Test Failed
Push — master ( fad8c1...3c40c1 )
by Stiofan
01:06
created
geodirectory_hooks_actions.php 1 patch
Indentation   +1212 added lines, -1212 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,45 +511,45 @@  discard block
 block discarded – undo
511 511
  */
512 512
 function geodir_detail_page_google_analytics()
513 513
 {
514
-    if ( ! get_option( 'geodir_ga_stats' ) ) {
514
+	if ( ! get_option( 'geodir_ga_stats' ) ) {
515 515
 		return;
516 516
 	}
517 517
 	global $post,$preview;
518
-    if($preview){return '';}
519
-    $package_info = array();
520
-    $package_info = geodir_post_package_info($package_info, $post);
518
+	if($preview){return '';}
519
+	$package_info = array();
520
+	$package_info = geodir_post_package_info($package_info, $post);
521 521
 
522
-    $id = trim(get_option('geodir_ga_account_id'));
522
+	$id = trim(get_option('geodir_ga_account_id'));
523 523
 
524
-    if (!$id) {
525
-        return; //if no Google Analytics ID then bail.
526
-    }
524
+	if (!$id) {
525
+		return; //if no Google Analytics ID then bail.
526
+	}
527 527
 
528
-    ob_start(); // Start buffering;
529
-    /**
530
-     * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
531
-     *
532
-     * @since 1.0.0
533
-     */
534
-    do_action('geodir_before_google_analytics');
528
+	ob_start(); // Start buffering;
529
+	/**
530
+	 * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
531
+	 *
532
+	 * @since 1.0.0
533
+	 */
534
+	do_action('geodir_before_google_analytics');
535 535
     
536
-    $refresh_time = get_option('geodir_ga_refresh_time', 5);
537
-    /**
538
-     * Filter the time interval to check & refresh new users results.
539
-     *
540
-     * @since 1.5.9
541
-     *
542
-     * @param int $refresh_time Time interval to check & refresh new users results.
543
-     */
544
-    $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
545
-    $refresh_time = absint($refresh_time * 1000);
536
+	$refresh_time = get_option('geodir_ga_refresh_time', 5);
537
+	/**
538
+	 * Filter the time interval to check & refresh new users results.
539
+	 *
540
+	 * @since 1.5.9
541
+	 *
542
+	 * @param int $refresh_time Time interval to check & refresh new users results.
543
+	 */
544
+	$refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time);
545
+	$refresh_time = absint($refresh_time * 1000);
546 546
     
547
-    $hide_refresh = get_option('geodir_ga_auto_refresh');
547
+	$hide_refresh = get_option('geodir_ga_auto_refresh');
548 548
     
549
-    $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
550
-    if (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' )) ) {
551
-        $page_url = urlencode($_SERVER['REQUEST_URI']);
552
-        ?>
549
+	$auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0;
550
+	if (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' )) ) {
551
+		$page_url = urlencode($_SERVER['REQUEST_URI']);
552
+		?>
553 553
         <script type="text/javascript">
554 554
             var gd_gaTimeOut;
555 555
             var gd_gaTime = parseInt('<?php echo $refresh_time;?>');
@@ -801,15 +801,15 @@  discard block
 block discarded – undo
801 801
                     var labels = results[1].rows.map(function(row) { return +row[0]; });
802 802
 
803 803
                     <?php
804
-                    // Here we list the shorthand days of the week so it can be used in translation.
805
-                    __("Mon",'geodirectory');
806
-                    __("Tue",'geodirectory');
807
-                    __("Wed",'geodirectory');
808
-                    __("Thu",'geodirectory');
809
-                    __("Fri",'geodirectory');
810
-                    __("Sat",'geodirectory');
811
-                    __("Sun",'geodirectory');
812
-                    ?>
804
+					// Here we list the shorthand days of the week so it can be used in translation.
805
+					__("Mon",'geodirectory');
806
+					__("Tue",'geodirectory');
807
+					__("Wed",'geodirectory');
808
+					__("Thu",'geodirectory');
809
+					__("Fri",'geodirectory');
810
+					__("Sat",'geodirectory');
811
+					__("Sun",'geodirectory');
812
+					?>
813 813
 
814 814
                     labels = [
815 815
                         "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
@@ -1058,24 +1058,24 @@  discard block
 block discarded – undo
1058 1058
         </span>
1059 1059
 
1060 1060
     <?php
1061
-    }
1062
-    /**
1063
-     * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1064
-     *
1065
-     * @since 1.0.0
1066
-     */
1067
-    do_action('geodir_after_google_analytics');
1068
-    $content_html = ob_get_clean();
1069
-    if (trim($content_html) != '')
1070
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1071
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1072
-        /**
1073
-         * Filter the geodir_edit_post_link() function content.
1074
-         *
1075
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
1076
-         */
1077
-        echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1078
-    }
1061
+	}
1062
+	/**
1063
+	 * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1064
+	 *
1065
+	 * @since 1.0.0
1066
+	 */
1067
+	do_action('geodir_after_google_analytics');
1068
+	$content_html = ob_get_clean();
1069
+	if (trim($content_html) != '')
1070
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1071
+	if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1072
+		/**
1073
+		 * Filter the geodir_edit_post_link() function content.
1074
+		 *
1075
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
1076
+		 */
1077
+		echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1078
+	}
1079 1079
 }
1080 1080
 
1081 1081
 /**
@@ -1092,94 +1092,94 @@  discard block
 block discarded – undo
1092 1092
  */
1093 1093
 function geodir_detail_page_review_rating()
1094 1094
 {
1095
-    global $post, $preview, $post_images;
1095
+	global $post, $preview, $post_images;
1096 1096
     
1097
-    if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
1098
-        return;
1099
-    }
1100
-    ob_start(); // Start  buffering;
1101
-    /**
1102
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1103
-     *
1104
-     * This is called outside the check for an actual rating and the check for preview page.
1105
-     *
1106
-     * @since 1.0.0
1107
-     */
1108
-    do_action('geodir_before_detail_page_review_rating');
1109
-
1110
-    $comment_count = geodir_get_review_count_total($post->ID);
1111
-    $post_avgratings = geodir_get_post_rating($post->ID);
1112
-
1113
-    if ($post_avgratings != 0 && !$preview) {
1114
-        /**
1115
-         * This is called before the rating html in the function geodir_detail_page_review_rating().
1116
-         *
1117
-         * This is called inside the check for an actual rating and the check for preview page.
1118
-         *
1119
-         * @since 1.0.0
1120
-         * @param float $post_avgratings Average rating for the current post.
1121
-         * @param int $post->ID Current post ID.
1122
-         */
1123
-        do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1124
-
1125
-        $html = '<p style=" float:left;">';
1126
-        $html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1127
-        $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1128
-        $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1097
+	if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) {
1098
+		return;
1099
+	}
1100
+	ob_start(); // Start  buffering;
1101
+	/**
1102
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1103
+	 *
1104
+	 * This is called outside the check for an actual rating and the check for preview page.
1105
+	 *
1106
+	 * @since 1.0.0
1107
+	 */
1108
+	do_action('geodir_before_detail_page_review_rating');
1109
+
1110
+	$comment_count = geodir_get_review_count_total($post->ID);
1111
+	$post_avgratings = geodir_get_post_rating($post->ID);
1112
+
1113
+	if ($post_avgratings != 0 && !$preview) {
1114
+		/**
1115
+		 * This is called before the rating html in the function geodir_detail_page_review_rating().
1116
+		 *
1117
+		 * This is called inside the check for an actual rating and the check for preview page.
1118
+		 *
1119
+		 * @since 1.0.0
1120
+		 * @param float $post_avgratings Average rating for the current post.
1121
+		 * @param int $post->ID Current post ID.
1122
+		 */
1123
+		do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1124
+
1125
+		$html = '<p style=" float:left;">';
1126
+		$html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1127
+		$html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1128
+		$post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1129 1129
        
1130 1130
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1131 1131
 	   
1132 1132
 	   $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 />';
1133 1133
 
1134
-        $html .= '<span class="item">';
1135
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1134
+		$html .= '<span class="item">';
1135
+		$html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1136 1136
 
1137
-        if ($post_images) {
1138
-            foreach ($post_images as $img) {
1139
-                $post_img = $img->src;
1140
-                break;
1141
-            }
1142
-        }
1143
-
1144
-        if (isset($post_img) && $post_img) {
1145
-            $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1146
-        }
1147
-
1148
-        $html .= '</span>';
1149
-
1150
-        echo $html .= '</div>';
1151
-        /**
1152
-         * This is called after the rating html in the function geodir_detail_page_review_rating().
1153
-         *
1154
-         * This is called inside the check for an actual rating and the check for preview page.
1155
-         *
1156
-         * @since 1.0.0
1157
-         * @param float $post_avgratings Average rating for the current post.
1158
-         * @param int $post->ID Current post ID.
1159
-         */
1160
-        do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1161
-    }
1162
-    /**
1163
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1164
-     *
1165
-     * This is called outside the check for an actual rating and the check for preview page.
1166
-     *
1167
-     * @since 1.0.0
1168
-     */
1169
-    do_action('geodir_after_detail_page_review_rating');
1170
-    $content_html = ob_get_clean();
1171
-    if (trim($content_html) != '') {
1172
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1173
-    }
1174
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1175
-        /**
1176
-         * Filter the geodir_detail_page_review_rating() function content.
1177
-         *
1178
-         * @since 1.0.0
1179
-         * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1180
-         */
1181
-        echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1182
-    }
1137
+		if ($post_images) {
1138
+			foreach ($post_images as $img) {
1139
+				$post_img = $img->src;
1140
+				break;
1141
+			}
1142
+		}
1143
+
1144
+		if (isset($post_img) && $post_img) {
1145
+			$html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />';
1146
+		}
1147
+
1148
+		$html .= '</span>';
1149
+
1150
+		echo $html .= '</div>';
1151
+		/**
1152
+		 * This is called after the rating html in the function geodir_detail_page_review_rating().
1153
+		 *
1154
+		 * This is called inside the check for an actual rating and the check for preview page.
1155
+		 *
1156
+		 * @since 1.0.0
1157
+		 * @param float $post_avgratings Average rating for the current post.
1158
+		 * @param int $post->ID Current post ID.
1159
+		 */
1160
+		do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1161
+	}
1162
+	/**
1163
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1164
+	 *
1165
+	 * This is called outside the check for an actual rating and the check for preview page.
1166
+	 *
1167
+	 * @since 1.0.0
1168
+	 */
1169
+	do_action('geodir_after_detail_page_review_rating');
1170
+	$content_html = ob_get_clean();
1171
+	if (trim($content_html) != '') {
1172
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1173
+	}
1174
+	if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1175
+		/**
1176
+		 * Filter the geodir_detail_page_review_rating() function content.
1177
+		 *
1178
+		 * @since 1.0.0
1179
+		 * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1180
+		 */
1181
+		echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1182
+	}
1183 1183
 }
1184 1184
 
1185 1185
 /**
@@ -1191,35 +1191,35 @@  discard block
 block discarded – undo
1191 1191
  */
1192 1192
 function geodir_detail_page_more_info()
1193 1193
 {
1194
-    ob_start(); // Start  buffering;
1195
-    /**
1196
-     * This is called before the info section html.
1197
-     *
1198
-     * @since 1.0.0
1199
-     */
1200
-    do_action('geodir_before_detail_page_more_info');
1201
-    if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1202
-        echo $geodir_post_detail_fields;
1203
-    }
1204
-    /**
1205
-     * This is called after the info section html.
1206
-     *
1207
-     * @since 1.0.0
1208
-     */
1209
-    do_action('geodir_after_detail_page_more_info');
1210
-
1211
-    $content_html = ob_get_clean();
1212
-    if (trim($content_html) != '')
1213
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1214
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1215
-        /**
1216
-         * Filter the output html for function geodir_detail_page_more_info().
1217
-         *
1218
-         * @since 1.0.0
1219
-         * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1220
-         */
1221
-        echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1222
-    }
1194
+	ob_start(); // Start  buffering;
1195
+	/**
1196
+	 * This is called before the info section html.
1197
+	 *
1198
+	 * @since 1.0.0
1199
+	 */
1200
+	do_action('geodir_before_detail_page_more_info');
1201
+	if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) {
1202
+		echo $geodir_post_detail_fields;
1203
+	}
1204
+	/**
1205
+	 * This is called after the info section html.
1206
+	 *
1207
+	 * @since 1.0.0
1208
+	 */
1209
+	do_action('geodir_after_detail_page_more_info');
1210
+
1211
+	$content_html = ob_get_clean();
1212
+	if (trim($content_html) != '')
1213
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1214
+	if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1215
+		/**
1216
+		 * Filter the output html for function geodir_detail_page_more_info().
1217
+		 *
1218
+		 * @since 1.0.0
1219
+		 * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1220
+		 */
1221
+		echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1222
+	}
1223 1223
 }
1224 1224
 
1225 1225
 
@@ -1233,15 +1233,15 @@  discard block
 block discarded – undo
1233 1233
  */
1234 1234
 function geodir_localize_all_js_msg()
1235 1235
 {// 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
1236
-    if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1237
-        $ajax_url = admin_url('admin-ajax.php');
1238
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1239
-        $ajax_url = admin_url('admin-ajax.php');
1240
-    } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1241
-        $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1242
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1243
-        $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1244
-    }
1236
+	if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1237
+		$ajax_url = admin_url('admin-ajax.php');
1238
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1239
+		$ajax_url = admin_url('admin-ajax.php');
1240
+	} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1241
+		$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1242
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1243
+		$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1244
+	}
1245 1245
 	
1246 1246
 	/**
1247 1247
 	 * Filter the allowed image type extensions for post images.
@@ -1251,62 +1251,62 @@  discard block
 block discarded – undo
1251 1251
 	 */
1252 1252
 	$allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
1253 1253
 	
1254
-    $default_marker_icon = get_option('geodir_default_marker_icon');
1255
-    $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1256
-    $default_marker_width = $default_marker_size['w'];
1257
-    $default_marker_height = $default_marker_size['h'];
1254
+	$default_marker_icon = get_option('geodir_default_marker_icon');
1255
+	$default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34));
1256
+	$default_marker_width = $default_marker_size['w'];
1257
+	$default_marker_height = $default_marker_size['h'];
1258 1258
     
1259
-    $arr_alert_msg = array(
1260
-        'geodir_plugin_url' => geodir_plugin_url(),
1261
-        'geodir_admin_ajax_url' => $ajax_url,
1262
-        'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1263
-        'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1264
-        'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1265
-        'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1266
-        //start not show alert msg
1267
-        'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1268
-        'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1269
-        'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1270
-        'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1271
-        'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1272
-        // end not show alert msg
1273
-        'my_place_listing_del' => __('Are you sure you wish to delete this listing?', 'geodirectory'),
1274
-        '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'),
1275
-        //start not show alert msg
1276
-        'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1277
-        'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1278
-        'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1279
-        'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1280
-        'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1281
-        'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1282
-        'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1283
-        'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1284
-        'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1285
-        'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1286
-        'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1287
-        'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1288
-        'geodir_default_marker_icon' => $default_marker_icon,
1289
-        'geodir_default_marker_w' => $default_marker_width,
1290
-        'geodir_default_marker_h' => $default_marker_height,
1291
-        'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1292
-        'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1293
-        'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1294
-        'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1295
-        'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1296
-        'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1297
-        'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1298
-        'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1299
-        'err_empty_review' => __('Please type a review.', 'geodirectory'),
1300
-        'err_empty_reply' => __('Please type a reply.', 'geodirectory'),
1301
-        /* on/off dragging for phone devices */
1302
-        'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1303
-        'geodir_is_mobile' => wp_is_mobile() ? true : false,
1304
-        'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1305
-        'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1306
-        'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1307
-        'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1308
-        'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1309
-        'geodir_action_remove' => __('Remove', 'geodirectory'),
1259
+	$arr_alert_msg = array(
1260
+		'geodir_plugin_url' => geodir_plugin_url(),
1261
+		'geodir_admin_ajax_url' => $ajax_url,
1262
+		'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1263
+		'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1264
+		'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1265
+		'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1266
+		//start not show alert msg
1267
+		'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1268
+		'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1269
+		'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1270
+		'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1271
+		'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1272
+		// end not show alert msg
1273
+		'my_place_listing_del' => __('Are you sure you wish to delete this listing?', 'geodirectory'),
1274
+		'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'),
1275
+		//start not show alert msg
1276
+		'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1277
+		'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1278
+		'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1279
+		'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1280
+		'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1281
+		'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1282
+		'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1283
+		'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1284
+		'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1285
+		'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1286
+		'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1287
+		'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1288
+		'geodir_default_marker_icon' => $default_marker_icon,
1289
+		'geodir_default_marker_w' => $default_marker_width,
1290
+		'geodir_default_marker_h' => $default_marker_height,
1291
+		'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1292
+		'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1293
+		'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1294
+		'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1295
+		'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1296
+		'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1297
+		'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1298
+		'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1299
+		'err_empty_review' => __('Please type a review.', 'geodirectory'),
1300
+		'err_empty_reply' => __('Please type a reply.', 'geodirectory'),
1301
+		/* on/off dragging for phone devices */
1302
+		'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1303
+		'geodir_is_mobile' => wp_is_mobile() ? true : false,
1304
+		'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1305
+		'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1306
+		'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1307
+		'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1308
+		'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1309
+		'geodir_action_remove' => __('Remove', 'geodirectory'),
1310 1310
 		'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
1311 1311
 		'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
1312 1312
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
@@ -1314,41 +1314,41 @@  discard block
 block discarded – undo
1314 1314
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1315 1315
 		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1316 1316
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1317
-        'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1318
-        'geodir_map_name' => geodir_map_name(),
1319
-        'osmStart' => __('Start', 'geodirectory'),
1320
-        'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1321
-        'osmEnd' => __('Enter Your Location', 'geodirectory'),
1322
-        'ga_delete_check' => __('Do you wish to Deauthorize and break Analytics?', 'geodirectory'),
1323
-        'geoMyLocation' => __('My Location', 'geodirectory'),
1324
-        'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')),
1325
-        'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')),
1326
-        'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')),
1327
-        'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')),
1328
-        'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')),
1317
+		'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false,
1318
+		'geodir_map_name' => geodir_map_name(),
1319
+		'osmStart' => __('Start', 'geodirectory'),
1320
+		'osmVia' => __('Via {viaNumber}', 'geodirectory'),
1321
+		'osmEnd' => __('Enter Your Location', 'geodirectory'),
1322
+		'ga_delete_check' => __('Do you wish to Deauthorize and break Analytics?', 'geodirectory'),
1323
+		'geoMyLocation' => __('My Location', 'geodirectory'),
1324
+		'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')),
1325
+		'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')),
1326
+		'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')),
1327
+		'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')),
1328
+		'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')),
1329 1329
 		'mapLanguage' => geodir_get_map_default_language()
1330
-    );
1331
-
1332
-    /**
1333
-     * Filters the translated JS strings from function geodir_localize_all_js_msg().
1334
-     *
1335
-     * With this filter you can add, remove or change translated JS strings.
1336
-     * You should add your own translations to this if you are building an addon rather than adding another script block.
1337
-     *
1338
-     * @since 1.0.0
1339
-     */
1340
-    $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1341
-
1342
-    foreach ($arr_alert_msg as $key => $value) {
1343
-        if (!is_scalar($value))
1344
-            continue;
1345
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1346
-    }
1330
+	);
1331
+
1332
+	/**
1333
+	 * Filters the translated JS strings from function geodir_localize_all_js_msg().
1334
+	 *
1335
+	 * With this filter you can add, remove or change translated JS strings.
1336
+	 * You should add your own translations to this if you are building an addon rather than adding another script block.
1337
+	 *
1338
+	 * @since 1.0.0
1339
+	 */
1340
+	$arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1347 1341
 
1348
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1349
-    echo '<script>';
1350
-    echo $script;
1351
-    echo '</script>';
1342
+	foreach ($arr_alert_msg as $key => $value) {
1343
+		if (!is_scalar($value))
1344
+			continue;
1345
+		$arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1346
+	}
1347
+
1348
+	$script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1349
+	echo '<script>';
1350
+	echo $script;
1351
+	echo '</script>';
1352 1352
 }
1353 1353
 
1354 1354
 add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31);
@@ -1364,11 +1364,11 @@  discard block
 block discarded – undo
1364 1364
  */
1365 1365
 function geodir_admin_bar_site_menu($wp_admin_bar)
1366 1366
 {
1367
-    if (get_option("geodir_installed")) {
1368
-        if (current_user_can('manage_options')) {
1369
-            $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1370
-        }
1371
-    }
1367
+	if (get_option("geodir_installed")) {
1368
+		if (current_user_can('manage_options')) {
1369
+			$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1370
+		}
1371
+	}
1372 1372
 }
1373 1373
 
1374 1374
 add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/
@@ -1394,25 +1394,25 @@  discard block
 block discarded – undo
1394 1394
  */
1395 1395
 function geodir_store_sidebars()
1396 1396
 {
1397
-    global $geodir_sidebars;
1398
-    global $sidebars_widgets;
1399
-
1400
-    if (!is_array($sidebars_widgets))
1401
-        $sidebars_widgets = wp_get_sidebars_widgets();
1402
-    $geodir_old_sidebars = array();
1403
-
1404
-    if (is_array($geodir_sidebars)) {
1405
-        foreach ($geodir_sidebars as $val) {
1406
-            if (is_array($sidebars_widgets)) {
1407
-                if (array_key_exists($val, $sidebars_widgets))
1408
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1409
-                else
1410
-                    $geodir_old_sidebars[$val] = array();
1411
-            }
1412
-        }
1413
-    }
1414
-    update_option('geodir_sidebars', $geodir_old_sidebars);
1415
-    geodir_option_version_backup('geodir_sidebars');
1397
+	global $geodir_sidebars;
1398
+	global $sidebars_widgets;
1399
+
1400
+	if (!is_array($sidebars_widgets))
1401
+		$sidebars_widgets = wp_get_sidebars_widgets();
1402
+	$geodir_old_sidebars = array();
1403
+
1404
+	if (is_array($geodir_sidebars)) {
1405
+		foreach ($geodir_sidebars as $val) {
1406
+			if (is_array($sidebars_widgets)) {
1407
+				if (array_key_exists($val, $sidebars_widgets))
1408
+					$geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1409
+				else
1410
+					$geodir_old_sidebars[$val] = array();
1411
+			}
1412
+		}
1413
+	}
1414
+	update_option('geodir_sidebars', $geodir_old_sidebars);
1415
+	geodir_option_version_backup('geodir_sidebars');
1416 1416
 
1417 1417
 }
1418 1418
 
@@ -1426,28 +1426,28 @@  discard block
 block discarded – undo
1426 1426
  */
1427 1427
 function geodir_restore_sidebars()
1428 1428
 {
1429
-    global $sidebars_widgets;
1430
-
1431
-    if (!is_array($sidebars_widgets))
1432
-        $sidebars_widgets = wp_get_sidebars_widgets();
1433
-
1434
-    if (is_array($sidebars_widgets)) {
1435
-        $geodir_old_sidebars = get_option('geodir_sidebars');
1436
-        if (is_array($geodir_old_sidebars)) {
1437
-            foreach ($geodir_old_sidebars as $key => $val) {
1438
-                if(0 === strpos($key, 'geodir_'))// if gd widget
1439
-                {
1440
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1441
-                }
1429
+	global $sidebars_widgets;
1442 1430
 
1431
+	if (!is_array($sidebars_widgets))
1432
+		$sidebars_widgets = wp_get_sidebars_widgets();
1443 1433
 
1444
-            }
1445
-        }
1434
+	if (is_array($sidebars_widgets)) {
1435
+		$geodir_old_sidebars = get_option('geodir_sidebars');
1436
+		if (is_array($geodir_old_sidebars)) {
1437
+			foreach ($geodir_old_sidebars as $key => $val) {
1438
+				if(0 === strpos($key, 'geodir_'))// if gd widget
1439
+				{
1440
+					$sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1441
+				}
1446 1442
 
1447
-    }
1448 1443
 
1449
-    update_option('sidebars_widgets', $sidebars_widgets);
1450
-    update_option('geodir_sidebars', '');
1444
+			}
1445
+		}
1446
+
1447
+	}
1448
+
1449
+	update_option('sidebars_widgets', $sidebars_widgets);
1450
+	update_option('geodir_sidebars', '');
1451 1451
 }
1452 1452
 
1453 1453
 add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview');
@@ -1460,9 +1460,9 @@  discard block
 block discarded – undo
1460 1460
  */
1461 1461
 function geodir_after_listing_post_gridview()
1462 1462
 {
1463
-    global $gridview_columns;
1463
+	global $gridview_columns;
1464 1464
 
1465
-    $gridview_columns = '';
1465
+	$gridview_columns = '';
1466 1466
 
1467 1467
 }
1468 1468
 
@@ -1490,11 +1490,11 @@  discard block
 block discarded – undo
1490 1490
  */
1491 1491
 function so_handle_038($url, $original_url, $_context)
1492 1492
 {
1493
-    if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1494
-        $url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1495
-    }
1493
+	if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1494
+		$url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1495
+	}
1496 1496
 
1497
-    return $url;
1497
+	return $url;
1498 1498
 }
1499 1499
 
1500 1500
 
@@ -1510,34 +1510,34 @@  discard block
 block discarded – undo
1510 1510
 function geodir_after_main_form_fields() {
1511 1511
 	global $gd_session;
1512 1512
 	
1513
-    if (get_option('geodir_accept_term_condition')) {
1514
-        global $post;
1515
-        $term_condition = '';
1516
-        if (isset($_REQUEST['backandedit'])) {
1517
-            $post = (object)$gd_session->get('listing');
1518
-            $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1519
-        }
1520
-
1521
-        ?>
1513
+	if (get_option('geodir_accept_term_condition')) {
1514
+		global $post;
1515
+		$term_condition = '';
1516
+		if (isset($_REQUEST['backandedit'])) {
1517
+			$post = (object)$gd_session->get('listing');
1518
+			$term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1519
+		}
1520
+
1521
+		?>
1522 1522
         <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix">
1523 1523
             <label>&nbsp;</label>
1524 1524
 
1525 1525
             <div class="geodir_taxonomy_field" style="float:left; width:70%;">
1526 1526
 				<span style="display:block"> 
1527 1527
 				<input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') {
1528
-                    echo 'checked="checked"';
1529
-                } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1528
+					echo 'checked="checked"';
1529
+				} ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1530 1530
                        class="geodir_textfield" value="1"
1531 1531
                        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>
1532 1532
 				</span>
1533 1533
             </div>
1534 1534
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
1535
-                    _e($required_msg, 'geodirectory');
1536
-                } ?></span>
1535
+					_e($required_msg, 'geodirectory');
1536
+				} ?></span>
1537 1537
         </div>
1538 1538
     <?php
1539 1539
 
1540
-    }
1540
+	}
1541 1541
 }
1542 1542
 
1543 1543
 
@@ -1562,42 +1562,42 @@  discard block
 block discarded – undo
1562 1562
  */
1563 1563
 function geodir_detail_page_tab_is_display($is_display, $tab)
1564 1564
 {
1565
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1565
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1566 1566
 
1567
-    if ($tab == 'post_profile') {
1568
-        /** This action is documented in geodirectory_template_actions.php */
1569
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1567
+	if ($tab == 'post_profile') {
1568
+		/** This action is documented in geodirectory_template_actions.php */
1569
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', '');
1570 1570
         
1571
-        if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1572
-            $is_display = false;
1573
-        }
1574
-    }
1571
+		if (!($desc_limit === '' || (int)$desc_limit > 0)) {
1572
+			$is_display = false;
1573
+		}
1574
+	}
1575 1575
     
1576
-    if ($tab == 'post_info')
1577
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1576
+	if ($tab == 'post_info')
1577
+		$is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1578 1578
     
1579
-    if ($tab == 'post_images')
1580
-        $is_display = (!empty($post_images)) ? true : false;
1579
+	if ($tab == 'post_images')
1580
+		$is_display = (!empty($post_images)) ? true : false;
1581 1581
 
1582
-    if ($tab == 'post_video')
1583
-        $is_display = (!empty($video)) ? true : false;
1582
+	if ($tab == 'post_video')
1583
+		$is_display = (!empty($video)) ? true : false;
1584 1584
 
1585
-    if ($tab == 'special_offers')
1586
-        $is_display = (!empty($special_offers)) ? true : false;
1585
+	if ($tab == 'special_offers')
1586
+		$is_display = (!empty($special_offers)) ? true : false;
1587 1587
 
1588
-    if ($tab == 'reviews')
1589
-        $is_display = (geodir_is_page('detail')) ? true : false;
1588
+	if ($tab == 'reviews')
1589
+		$is_display = (geodir_is_page('detail')) ? true : false;
1590 1590
 
1591
-    if ($tab == 'related_listing') {
1592
-       $message = __('No listings found which match your selection.', 'geodirectory');
1591
+	if ($tab == 'related_listing') {
1592
+	   $message = __('No listings found which match your selection.', 'geodirectory');
1593 1593
        
1594
-       /** This action is documented in geodirectory-functions/template_functions.php */
1595
-       $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1594
+	   /** This action is documented in geodirectory-functions/template_functions.php */
1595
+	   $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1596 1596
        
1597
-       $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1598
-    }
1597
+	   $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1598
+	}
1599 1599
 
1600
-    return $is_display;
1600
+	return $is_display;
1601 1601
 }
1602 1602
 
1603 1603
 
@@ -1613,69 +1613,69 @@  discard block
 block discarded – undo
1613 1613
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1614 1614
  */
1615 1615
 function geodir_changes_in_custom_fields_table() {
1616
-    global $wpdb, $plugin_prefix;
1616
+	global $wpdb, $plugin_prefix;
1617 1617
 	
1618 1618
 	// Remove unused virtual page
1619 1619
 	$listings_page_id = (int)get_option('geodir_listing_page');
1620 1620
 	if ($listings_page_id) {
1621 1621
 		$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')));
1622
-        delete_option('geodir_listing_page');
1622
+		delete_option('geodir_listing_page');
1623 1623
 	}
1624 1624
 
1625
-    if (!get_option('geodir_changes_in_custom_fields_table')) {
1626
-        $wpdb->query(
1627
-            $wpdb->prepare(
1628
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1629
-                array('1', '1', 'admin')
1630
-            )
1631
-        );
1625
+	if (!get_option('geodir_changes_in_custom_fields_table')) {
1626
+		$wpdb->query(
1627
+			$wpdb->prepare(
1628
+				"UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1629
+				array('1', '1', 'admin')
1630
+			)
1631
+		);
1632 1632
 
1633 1633
 
1634
-        /* --- terms meta value set --- */
1634
+		/* --- terms meta value set --- */
1635 1635
 
1636
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1636
+		update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1637 1637
 
1638
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1638
+		$options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1639 1639
 
1640
-        if (!empty($options_data)) {
1640
+		if (!empty($options_data)) {
1641 1641
 
1642
-            foreach ($options_data as $optobj) {
1642
+			foreach ($options_data as $optobj) {
1643 1643
 
1644
-                $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1644
+				$option_val = str_replace('tax_meta_', '', $optobj->option_name);
1645 1645
 
1646
-                $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)));
1646
+				$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)));
1647 1647
 
1648
-                if (!empty($taxonomies_data)) {
1648
+				if (!empty($taxonomies_data)) {
1649 1649
 
1650
-                    foreach ($taxonomies_data as $taxobj) {
1650
+					foreach ($taxonomies_data as $taxobj) {
1651 1651
 
1652
-                        $taxObject = get_taxonomy($taxobj->taxonomy);
1653
-                        $post_type = $taxObject->object_type[0];
1652
+						$taxObject = get_taxonomy($taxobj->taxonomy);
1653
+						$post_type = $taxObject->object_type[0];
1654 1654
 
1655
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1655
+						$opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1656 1656
 
1657
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1657
+						$duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1658 1658
 
1659
-                        if ($duplicate_data) {
1659
+						if ($duplicate_data) {
1660 1660
 
1661
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1661
+							$wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1662 1662
 
1663
-                        } else {
1663
+						} else {
1664 1664
 
1665
-                            $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)));
1665
+							$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)));
1666 1666
 
1667
-                        }
1667
+						}
1668 1668
 
1669
-                    }
1669
+					}
1670 1670
 
1671
-                }
1671
+				}
1672 1672
 
1673
-            }
1674
-        }
1673
+			}
1674
+		}
1675 1675
 
1676
-        update_option('geodir_changes_in_custom_fields_table', '1');
1676
+		update_option('geodir_changes_in_custom_fields_table', '1');
1677 1677
 
1678
-    }
1678
+	}
1679 1679
 
1680 1680
 }
1681 1681
 
@@ -1694,24 +1694,24 @@  discard block
 block discarded – undo
1694 1694
 function geodir_location_slug_check($slug)
1695 1695
 {
1696 1696
 
1697
-    global $wpdb, $table_prefix;
1697
+	global $wpdb, $table_prefix;
1698 1698
 
1699
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1699
+	$slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1700 1700
 
1701
-    if ($slug_exists) {
1701
+	if ($slug_exists) {
1702 1702
 
1703
-        $suffix = 1;
1704
-        do {
1705
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1706
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1707
-            $suffix++;
1708
-        } while ($location_slug_check && $suffix < 100);
1703
+		$suffix = 1;
1704
+		do {
1705
+			$alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1706
+			$location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1707
+			$suffix++;
1708
+		} while ($location_slug_check && $suffix < 100);
1709 1709
 
1710
-        $slug = $alt_location_name;
1710
+		$slug = $alt_location_name;
1711 1711
 
1712
-    }
1712
+	}
1713 1713
 
1714
-    return $slug;
1714
+	return $slug;
1715 1715
 
1716 1716
 }
1717 1717
 
@@ -1736,42 +1736,42 @@  discard block
 block discarded – undo
1736 1736
 function geodir_update_term_slug($term_id, $tt_id, $taxonomy)
1737 1737
 {
1738 1738
 
1739
-    global $wpdb, $plugin_prefix, $table_prefix;
1739
+	global $wpdb, $plugin_prefix, $table_prefix;
1740 1740
 
1741
-    $tern_data = get_term_by('id', $term_id, $taxonomy);
1741
+	$tern_data = get_term_by('id', $term_id, $taxonomy);
1742 1742
 
1743
-    $slug = $tern_data->slug;
1743
+	$slug = $tern_data->slug;
1744 1744
 
1745
-    /**
1746
-     * Filter if a term slug exists.
1747
-     *
1748
-     * @since 1.0.0
1749
-     * @package GeoDirectory
1750
-     * @param bool $bool Default: false.
1751
-     * @param string $slug The term slug.
1752
-     * @param int $term_id The term ID.
1753
-     */
1754
-    $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1745
+	/**
1746
+	 * Filter if a term slug exists.
1747
+	 *
1748
+	 * @since 1.0.0
1749
+	 * @package GeoDirectory
1750
+	 * @param bool $bool Default: false.
1751
+	 * @param string $slug The term slug.
1752
+	 * @param int $term_id The term ID.
1753
+	 */
1754
+	$slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1755 1755
 
1756
-    if ($slug_exists) {
1756
+	if ($slug_exists) {
1757 1757
 
1758
-        $suffix = 1;
1759
-        do {
1760
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1758
+		$suffix = 1;
1759
+		do {
1760
+			$new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1761 1761
 
1762
-            /** This action is documented in geodirectory_hooks_actions.php */
1763
-            $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1762
+			/** This action is documented in geodirectory_hooks_actions.php */
1763
+			$term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1764 1764
 
1765
-            $suffix++;
1766
-        } while ($term_slug_check && $suffix < 100);
1765
+			$suffix++;
1766
+		} while ($term_slug_check && $suffix < 100);
1767 1767
 
1768
-        $slug = $new_slug;
1768
+		$slug = $new_slug;
1769 1769
 
1770
-        //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1770
+		//wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1771 1771
 
1772
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1772
+		$wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1773 1773
 
1774
-    }
1774
+	}
1775 1775
 	
1776 1776
 	// Update tag in detail table.
1777 1777
 	$taxonomy_obj = get_taxonomy($taxonomy);
@@ -1812,21 +1812,21 @@  discard block
 block discarded – undo
1812 1812
 function geodir_term_slug_is_exists($slug_exists, $slug, $term_id)
1813 1813
 {
1814 1814
 
1815
-    global $wpdb, $table_prefix;
1815
+	global $wpdb, $table_prefix;
1816 1816
 
1817
-    $default_location = geodir_get_default_location();
1817
+	$default_location = geodir_get_default_location();
1818 1818
 
1819
-    $country_slug = $default_location->country_slug;
1820
-    $region_slug = $default_location->region_slug;
1821
-    $city_slug = $default_location->city_slug;
1819
+	$country_slug = $default_location->country_slug;
1820
+	$region_slug = $default_location->region_slug;
1821
+	$city_slug = $default_location->city_slug;
1822 1822
 
1823
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1824
-        return $slug_exists = true;
1823
+	if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1824
+		return $slug_exists = true;
1825 1825
 
1826
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1827
-        return $slug_exists = true;
1826
+	if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1827
+		return $slug_exists = true;
1828 1828
 
1829
-    return $slug_exists;
1829
+	return $slug_exists;
1830 1830
 }
1831 1831
 
1832 1832
 
@@ -1846,75 +1846,75 @@  discard block
 block discarded – undo
1846 1846
  */
1847 1847
 function geodir_custom_page_title($title = '', $sep = '')
1848 1848
 {
1849
-    global $wp;
1850
-    if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
1851
-        return $title;
1852
-    }
1849
+	global $wp;
1850
+	if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
1851
+		return $title;
1852
+	}
1853 1853
 
1854
-    if ($sep == '') {
1855
-        /**
1856
-         * Filter the page title separator.
1857
-         *
1858
-         * @since 1.0.0
1859
-         * @package GeoDirectory
1860
-         * @param string $sep The separator, default: `|`.
1861
-         */
1862
-        $sep = apply_filters('geodir_page_title_separator', '|');
1863
-    }
1854
+	if ($sep == '') {
1855
+		/**
1856
+		 * Filter the page title separator.
1857
+		 *
1858
+		 * @since 1.0.0
1859
+		 * @package GeoDirectory
1860
+		 * @param string $sep The separator, default: `|`.
1861
+		 */
1862
+		$sep = apply_filters('geodir_page_title_separator', '|');
1863
+	}
1864 1864
 
1865 1865
 
1866
-    $gd_page = '';
1867
-    if(geodir_is_page('home')){
1868
-        $gd_page = 'home';
1869
-        $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1870
-    }
1871
-    elseif(geodir_is_page('detail')){
1872
-        $gd_page = 'detail';
1873
-        $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1874
-    }
1875
-    elseif(geodir_is_page('pt')){
1876
-        $gd_page = 'pt';
1877
-        $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1878
-    }
1879
-    elseif(geodir_is_page('listing')){
1880
-        $gd_page = 'listing';
1881
-        $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1882
-    }
1883
-    elseif(geodir_is_page('location')){
1884
-        $gd_page = 'location';
1885
-        $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1886
-    }
1887
-    elseif(geodir_is_page('search')){
1888
-        $gd_page = 'search';
1889
-        $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1890
-    }
1891
-    elseif(geodir_is_page('add-listing')){
1892
-        $gd_page = 'add-listing';
1893
-        $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1894
-    }
1895
-    elseif(geodir_is_page('author')){
1896
-        $gd_page = 'author';
1897
-        $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1898
-    }
1899
-    elseif(geodir_is_page('login')){
1900
-        $gd_page = 'login';
1901
-        $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1902
-    }
1903
-    elseif(geodir_is_page('listing-success')){
1904
-        $gd_page = 'listing-success';
1905
-        $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1906
-    }
1866
+	$gd_page = '';
1867
+	if(geodir_is_page('home')){
1868
+		$gd_page = 'home';
1869
+		$title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1870
+	}
1871
+	elseif(geodir_is_page('detail')){
1872
+		$gd_page = 'detail';
1873
+		$title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1874
+	}
1875
+	elseif(geodir_is_page('pt')){
1876
+		$gd_page = 'pt';
1877
+		$title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1878
+	}
1879
+	elseif(geodir_is_page('listing')){
1880
+		$gd_page = 'listing';
1881
+		$title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1882
+	}
1883
+	elseif(geodir_is_page('location')){
1884
+		$gd_page = 'location';
1885
+		$title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1886
+	}
1887
+	elseif(geodir_is_page('search')){
1888
+		$gd_page = 'search';
1889
+		$title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1890
+	}
1891
+	elseif(geodir_is_page('add-listing')){
1892
+		$gd_page = 'add-listing';
1893
+		$title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1894
+	}
1895
+	elseif(geodir_is_page('author')){
1896
+		$gd_page = 'author';
1897
+		$title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1898
+	}
1899
+	elseif(geodir_is_page('login')){
1900
+		$gd_page = 'login';
1901
+		$title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1902
+	}
1903
+	elseif(geodir_is_page('listing-success')){
1904
+		$gd_page = 'listing-success';
1905
+		$title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1906
+	}
1907 1907
 
1908 1908
 
1909
-    /**
1910
-     * Filter page meta title to replace variables.
1911
-     *
1912
-     * @since 1.5.4
1913
-     * @param string $title The page title including variables.
1914
-     * @param string $gd_page The GeoDirectory page type if any.
1915
-     * @param string $sep The title separator symbol.
1916
-     */
1917
-    return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1909
+	/**
1910
+	 * Filter page meta title to replace variables.
1911
+	 *
1912
+	 * @since 1.5.4
1913
+	 * @param string $title The page title including variables.
1914
+	 * @param string $gd_page The GeoDirectory page type if any.
1915
+	 * @param string $sep The title separator symbol.
1916
+	 */
1917
+	return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1918 1918
 
1919 1919
 }
1920 1920
 
@@ -1930,36 +1930,36 @@  discard block
 block discarded – undo
1930 1930
 function geodir_set_post_attachment()
1931 1931
 {
1932 1932
 
1933
-    if (!get_option('geodir_set_post_attachments')) {
1933
+	if (!get_option('geodir_set_post_attachments')) {
1934 1934
 
1935
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1936
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1935
+		require_once(ABSPATH . 'wp-admin/includes/image.php');
1936
+		require_once(ABSPATH . 'wp-admin/includes/file.php');
1937 1937
 
1938
-        $all_postypes = geodir_get_posttypes();
1938
+		$all_postypes = geodir_get_posttypes();
1939 1939
 
1940
-        foreach($all_postypes as $post_type){
1941
-            $args = array(
1942
-                'posts_per_page' => -1,
1943
-                'post_type' => $post_type,
1944
-                'post_status' => 'publish');
1940
+		foreach($all_postypes as $post_type){
1941
+			$args = array(
1942
+				'posts_per_page' => -1,
1943
+				'post_type' => $post_type,
1944
+				'post_status' => 'publish');
1945 1945
 
1946
-            $posts_array = get_posts($args);
1946
+			$posts_array = get_posts($args);
1947 1947
 
1948
-            if (!empty($posts_array)) {
1948
+			if (!empty($posts_array)) {
1949 1949
 
1950
-                foreach ($posts_array as $post) {
1950
+				foreach ($posts_array as $post) {
1951 1951
 
1952
-                    geodir_set_wp_featured_image($post->ID);
1952
+					geodir_set_wp_featured_image($post->ID);
1953 1953
 
1954
-                }
1954
+				}
1955 1955
 
1956
-            }
1957
-        }
1956
+			}
1957
+		}
1958 1958
 
1959 1959
 
1960
-        update_option('geodir_set_post_attachments', '1');
1960
+		update_option('geodir_set_post_attachments', '1');
1961 1961
 
1962
-    }
1962
+	}
1963 1963
 
1964 1964
 }
1965 1965
 
@@ -1976,19 +1976,19 @@  discard block
 block discarded – undo
1976 1976
 function geodir_remove_url_seperator()
1977 1977
 {
1978 1978
 
1979
-    if (!get_option('geodir_remove_url_seperator')) {
1979
+	if (!get_option('geodir_remove_url_seperator')) {
1980 1980
 
1981
-        if (get_option('geodir_listingurl_separator'))
1982
-            delete_option('geodir_listingurl_separator');
1981
+		if (get_option('geodir_listingurl_separator'))
1982
+			delete_option('geodir_listingurl_separator');
1983 1983
 
1984
-        if (get_option('geodir_detailurl_separator'))
1985
-            delete_option('geodir_detailurl_separator');
1984
+		if (get_option('geodir_detailurl_separator'))
1985
+			delete_option('geodir_detailurl_separator');
1986 1986
 
1987
-        flush_rewrite_rules(false);
1987
+		flush_rewrite_rules(false);
1988 1988
 
1989
-        update_option('geodir_remove_url_seperator', '1');
1989
+		update_option('geodir_remove_url_seperator', '1');
1990 1990
 
1991
-    }
1991
+	}
1992 1992
 
1993 1993
 }
1994 1994
 
@@ -2004,19 +2004,19 @@  discard block
 block discarded – undo
2004 2004
  */
2005 2005
 function geodir_remove_url_seperator_form_permalink_settings($permalink_arr)
2006 2006
 {
2007
-    foreach ($permalink_arr as $key => $value) {
2007
+	foreach ($permalink_arr as $key => $value) {
2008 2008
 
2009
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2010
-            unset($permalink_arr[$key]);
2009
+		if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2010
+			unset($permalink_arr[$key]);
2011 2011
 
2012
-    }
2012
+	}
2013 2013
 
2014
-    return $permalink_arr;
2014
+	return $permalink_arr;
2015 2015
 
2016 2016
 }
2017 2017
 
2018 2018
 if (!is_admin()) {
2019
-    add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2019
+	add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2020 2020
 }
2021 2021
 /**
2022 2022
  * Set status from draft to publish.
@@ -2029,16 +2029,16 @@  discard block
 block discarded – undo
2029 2029
  */
2030 2030
 function geodir_set_status_draft_to_publish_for_own_post($post)
2031 2031
 {
2032
-    $user_id = get_current_user_id();
2032
+	$user_id = get_current_user_id();
2033 2033
 
2034
-    if(!$user_id){return $post;}
2034
+	if(!$user_id){return $post;}
2035 2035
 
2036
-    $gd_post_types = geodir_get_posttypes();
2036
+	$gd_post_types = geodir_get_posttypes();
2037 2037
 
2038
-    if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2039
-        $post[0]->post_status = 'publish';
2040
-    }
2041
-    return $post;
2038
+	if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) {
2039
+		$post[0]->post_status = 'publish';
2040
+	}
2041
+	return $post;
2042 2042
 }
2043 2043
 
2044 2044
 
@@ -2130,33 +2130,33 @@  discard block
 block discarded – undo
2130 2130
  */
2131 2131
 function geodir_detail_page_tab_headings_change($tabs_arr)
2132 2132
 {
2133
-    global $wpdb;
2133
+	global $wpdb;
2134 2134
 
2135
-    $post_type = geodir_get_current_posttype();
2135
+	$post_type = geodir_get_current_posttype();
2136 2136
 
2137
-    $all_postypes = geodir_get_posttypes();
2137
+	$all_postypes = geodir_get_posttypes();
2138 2138
 
2139
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2139
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2140 2140
 
2141
-        if (array_key_exists('post_video', $tabs_arr)) {
2141
+		if (array_key_exists('post_video', $tabs_arr)) {
2142 2142
 
2143
-            $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)));
2143
+			$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)));
2144 2144
 
2145
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2146
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2147
-        }
2145
+			if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2146
+				$tabs_arr['post_video']['heading_text'] = $field_title;
2147
+		}
2148 2148
 
2149
-        if (array_key_exists('special_offers', $tabs_arr)) {
2149
+		if (array_key_exists('special_offers', $tabs_arr)) {
2150 2150
 
2151
-            $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)));
2151
+			$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)));
2152 2152
 
2153
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2154
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2155
-        }
2153
+			if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2154
+				$tabs_arr['special_offers']['heading_text'] = $field_title;
2155
+		}
2156 2156
 
2157
-    }
2157
+	}
2158 2158
 
2159
-    return $tabs_arr;
2159
+	return $tabs_arr;
2160 2160
 
2161 2161
 }
2162 2162
 
@@ -2169,10 +2169,10 @@  discard block
 block discarded – undo
2169 2169
  */
2170 2170
 function geodir_remove_template_redirect_actions()
2171 2171
 {
2172
-    if (geodir_is_page('login')){
2173
-        remove_all_actions('template_redirect');
2174
-        remove_action('init', 'avia_modify_front', 10);
2175
-    }
2172
+	if (geodir_is_page('login')){
2173
+		remove_all_actions('template_redirect');
2174
+		remove_action('init', 'avia_modify_front', 10);
2175
+	}
2176 2176
 }
2177 2177
 
2178 2178
 
@@ -2194,51 +2194,51 @@  discard block
 block discarded – undo
2194 2194
 function geodirectory_before_featured_image_delete($attachment_id)
2195 2195
 {
2196 2196
 
2197
-    global $wpdb, $plugin_prefix;
2197
+	global $wpdb, $plugin_prefix;
2198 2198
 
2199
-    $post_id = get_post_field('post_parent', $attachment_id);
2199
+	$post_id = get_post_field('post_parent', $attachment_id);
2200 2200
 
2201
-    $attachment_url = wp_get_attachment_url($attachment_id);
2201
+	$attachment_url = wp_get_attachment_url($attachment_id);
2202 2202
 
2203
-    if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2203
+	if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2204 2204
 
2205
-        $post_type = get_post_type($post_id);
2205
+		$post_type = get_post_type($post_id);
2206 2206
 
2207
-        $all_postypes = geodir_get_posttypes();
2207
+		$all_postypes = geodir_get_posttypes();
2208 2208
 
2209
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2210
-            return false;
2209
+		if (!in_array($post_type, $all_postypes) || !is_admin())
2210
+			return false;
2211 2211
 
2212
-        $uploads = wp_upload_dir();
2212
+		$uploads = wp_upload_dir();
2213 2213
 
2214
-        $split_img_path = explode($uploads['baseurl'], $attachment_url);
2214
+		$split_img_path = explode($uploads['baseurl'], $attachment_url);
2215 2215
 
2216
-        $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2216
+		$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2217 2217
 
2218
-        $wpdb->query(
2219
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2220
-                array($post_id, $split_img_file_path)
2221
-            )
2222
-        );
2218
+		$wpdb->query(
2219
+			$wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2220
+				array($post_id, $split_img_file_path)
2221
+			)
2222
+		);
2223 2223
 
2224
-        $attachment_data = $wpdb->get_row(
2225
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2226
-                array($post_id)
2227
-            )
2228
-        );
2224
+		$attachment_data = $wpdb->get_row(
2225
+			$wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2226
+				array($post_id)
2227
+			)
2228
+		);
2229 2229
 
2230
-        if (!empty($attachment_data)) {
2231
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2232
-        }
2230
+		if (!empty($attachment_data)) {
2231
+			$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2232
+		}
2233 2233
 
2234 2234
 
2235
-        $table_name = $plugin_prefix . $post_type . '_detail';
2235
+		$table_name = $plugin_prefix . $post_type . '_detail';
2236 2236
 
2237
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2237
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2238 2238
 
2239
-        geodir_set_wp_featured_image($post_id);
2239
+		geodir_set_wp_featured_image($post_id);
2240 2240
 
2241
-    }
2241
+	}
2242 2242
 
2243 2243
 }
2244 2244
 
@@ -2256,79 +2256,79 @@  discard block
 block discarded – undo
2256 2256
 function geodir_temp_set_post_attachment()
2257 2257
 {
2258 2258
 
2259
-    global $wpdb, $plugin_prefix;
2259
+	global $wpdb, $plugin_prefix;
2260 2260
 
2261
-    $all_postypes = geodir_get_posttypes();
2261
+	$all_postypes = geodir_get_posttypes();
2262 2262
 
2263
-    foreach ($all_postypes as $posttype) {
2263
+	foreach ($all_postypes as $posttype) {
2264 2264
 
2265
-        $tablename = $plugin_prefix . $posttype . '_detail';
2265
+		$tablename = $plugin_prefix . $posttype . '_detail';
2266 2266
 
2267
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2267
+		$get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2268 2268
 
2269
-        if (!empty($get_post_data)) {
2269
+		if (!empty($get_post_data)) {
2270 2270
 
2271
-            foreach ($get_post_data as $data) {
2271
+			foreach ($get_post_data as $data) {
2272 2272
 
2273
-                $post_id = $data->post_id;
2273
+				$post_id = $data->post_id;
2274 2274
 
2275
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2275
+				$attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2276 2276
 
2277
-                if (!empty($attachment_data)) {
2277
+				if (!empty($attachment_data)) {
2278 2278
 
2279
-                    foreach ($attachment_data as $attach) {
2279
+					foreach ($attachment_data as $attach) {
2280 2280
 
2281
-                        $file_info = pathinfo($attach->file);
2281
+						$file_info = pathinfo($attach->file);
2282 2282
 
2283
-                        $sub_dir = '';
2284
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2285
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2283
+						$sub_dir = '';
2284
+						if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2285
+							$sub_dir = stripslashes_deep($file_info['dirname']);
2286 2286
 
2287
-                        $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2288
-                        $uploads_path = $uploads['basedir'];
2287
+						$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2288
+						$uploads_path = $uploads['basedir'];
2289 2289
 
2290
-                        $file_name = $file_info['basename'];
2290
+						$file_name = $file_info['basename'];
2291 2291
 
2292
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2292
+						$img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2293 2293
 
2294
-                        if (!file_exists($img_arr['path'])) {
2294
+						if (!file_exists($img_arr['path'])) {
2295 2295
 
2296
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2296
+							$wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2297 2297
 
2298
-                        }
2298
+						}
2299 2299
 
2300
-                    }
2300
+					}
2301 2301
 
2302
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2302
+					$attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2303 2303
 
2304
-                    if (!empty($attachment_data)) {
2304
+					if (!empty($attachment_data)) {
2305 2305
 
2306
-                        if ($attachment_data->ID)
2307
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2306
+						if ($attachment_data->ID)
2307
+							$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2308 2308
 
2309
-                    } else {
2309
+					} else {
2310 2310
 
2311
-                        if (has_post_thumbnail($post_id)) {
2311
+						if (has_post_thumbnail($post_id)) {
2312 2312
 
2313
-                            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2313
+							$post_thumbnail_id = get_post_thumbnail_id($post_id);
2314 2314
 
2315
-                            wp_delete_attachment($post_thumbnail_id);
2315
+							wp_delete_attachment($post_thumbnail_id);
2316 2316
 
2317
-                        }
2317
+						}
2318 2318
 
2319
-                    }
2319
+					}
2320 2320
 
2321
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2321
+					$wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2322 2322
 
2323
-                    geodir_set_wp_featured_image($post_id);
2323
+					geodir_set_wp_featured_image($post_id);
2324 2324
 
2325
-                }
2325
+				}
2326 2326
 
2327
-            }
2327
+			}
2328 2328
 
2329
-        }
2329
+		}
2330 2330
 
2331
-    }
2331
+	}
2332 2332
 
2333 2333
 }
2334 2334
 
@@ -2346,9 +2346,9 @@  discard block
 block discarded – undo
2346 2346
 function geodir_default_rating_star_icon()
2347 2347
 {
2348 2348
 
2349
-    if (!get_option('geodir_default_rating_star_icon')) {
2350
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2351
-    }
2349
+	if (!get_option('geodir_default_rating_star_icon')) {
2350
+		update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2351
+	}
2352 2352
 
2353 2353
 }
2354 2354
 
@@ -2366,25 +2366,25 @@  discard block
 block discarded – undo
2366 2366
  */
2367 2367
 function geodir_user_post_listing_count($user_id = 0)
2368 2368
 {
2369
-    global $wpdb, $plugin_prefix, $current_user;
2370
-    if(!$user_id){
2371
-        $user_id = $current_user->ID;
2372
-    }
2369
+	global $wpdb, $plugin_prefix, $current_user;
2370
+	if(!$user_id){
2371
+		$user_id = $current_user->ID;
2372
+	}
2373 2373
 
2374
-    $all_posts = get_option('geodir_listing_link_user_dashboard');
2374
+	$all_posts = get_option('geodir_listing_link_user_dashboard');
2375 2375
 
2376
-    $user_listing = array();
2377
-    if ($user_id && is_array($all_posts) && !empty($all_posts)) {
2378
-        foreach ($all_posts as $ptype) {
2379
-            $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' )");
2376
+	$user_listing = array();
2377
+	if ($user_id && is_array($all_posts) && !empty($all_posts)) {
2378
+		foreach ($all_posts as $ptype) {
2379
+			$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' )");
2380 2380
 
2381
-            if ($total_posts > 0) {
2382
-                $user_listing[$ptype] = $total_posts;
2383
-            }
2384
-        }
2385
-    }
2381
+			if ($total_posts > 0) {
2382
+				$user_listing[$ptype] = $total_posts;
2383
+			}
2384
+		}
2385
+	}
2386 2386
 
2387
-    return $user_listing;
2387
+	return $user_listing;
2388 2388
 }
2389 2389
 
2390 2390
 
@@ -2404,189 +2404,189 @@  discard block
 block discarded – undo
2404 2404
  */
2405 2405
 function geodir_detail_page_custom_field_tab($tabs_arr)
2406 2406
 {
2407
-    global $post;
2408
-
2409
-    $post_type = geodir_get_current_posttype();
2410
-    $all_postypes = geodir_get_posttypes();
2411
-
2412
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2413
-        $package_info = array();
2414
-        $package_info = geodir_post_package_info($package_info, $post);
2415
-        $post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2416
-        $fields_location = 'owntab';
2417
-
2418
-        $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2419
-        //remove video and special offers if it is already set to show
2420
-        if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2421
-            $unset_video = true;
2422
-        }
2423
-
2424
-        if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2425
-            $unset_special_offers = true;
2426
-        }
2427
-        if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2428
-            foreach($custom_fields as $key => $custom_field){
2429
-                if($custom_field['name']=='geodir_video' && isset($unset_video)){
2430
-                    unset($custom_fields[$key]);
2431
-                }
2432
-                if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2433
-                    unset($custom_fields[$key]);
2434
-                }
2435
-            }
2436
-        }
2437
-
2438
-
2439
-        if (!empty($custom_fields)) {
2440
-            $parse_custom_fields = array();
2441
-            foreach ($custom_fields as $field) {
2442
-                $field = stripslashes_deep($field); // strip slashes
2443
-                $type = $field;
2444
-                $field_name = $field['htmlvar_name'];
2445
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2446
-                    $post->{$field_name} = $_REQUEST[$field_name];
2447
-                }
2407
+	global $post;
2448 2408
 
2449
-                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'))) {
2450
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2451
-                        continue;
2452
-                    }
2409
+	$post_type = geodir_get_current_posttype();
2410
+	$all_postypes = geodir_get_posttypes();
2453 2411
 
2454
-                    $parse_custom_fields[] = $field;
2455
-                }
2456
-            }
2457
-            $custom_fields = $parse_custom_fields;
2458
-        }
2459
-        //print_r($custom_fields);
2460
-        if (!empty($custom_fields)) {
2412
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2413
+		$package_info = array();
2414
+		$package_info = geodir_post_package_info($package_info, $post);
2415
+		$post_package_id = !empty($package_info->pid) ? $package_info->pid : '';
2416
+		$fields_location = 'owntab';
2461 2417
 
2462
-            global $field_set_start;
2418
+		$custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location);
2419
+		//remove video and special offers if it is already set to show
2420
+		if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){
2421
+			$unset_video = true;
2422
+		}
2463 2423
 
2464
-            $post = stripslashes_deep($post); // strip slashes
2465
-            
2466
-            $field_set_start = 0;
2467
-            $fieldset_count = 0;
2468
-            $fieldset = '';
2469
-            $total_fields = count($custom_fields);
2470
-            $count_field = 0;
2471
-            $fieldset_arr = array();
2472
-            $i = 0;
2473
-            $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2474
-
2475
-            foreach ($custom_fields as $field) {
2476
-                $count_field++;
2477
-                $field_name = $field['htmlvar_name'];
2478
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2479
-                    $post->{$field_name} = $_REQUEST[$field_name];
2480
-                }
2424
+		if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){
2425
+			$unset_special_offers = true;
2426
+		}
2427
+		if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){
2428
+			foreach($custom_fields as $key => $custom_field){
2429
+				if($custom_field['name']=='geodir_video' && isset($unset_video)){
2430
+					unset($custom_fields[$key]);
2431
+				}
2432
+				if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){
2433
+					unset($custom_fields[$key]);
2434
+				}
2435
+			}
2436
+		}
2481 2437
 
2482
-                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'))) {
2483
-                    $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2484
-                    $site_title = trim($field['site_title']);
2485
-                    $type = $field;
2486
-                    $variables_array = array();
2487 2438
 
2488
-                    if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2489
-                        continue;
2490
-                    }
2439
+		if (!empty($custom_fields)) {
2440
+			$parse_custom_fields = array();
2441
+			foreach ($custom_fields as $field) {
2442
+				$field = stripslashes_deep($field); // strip slashes
2443
+				$type = $field;
2444
+				$field_name = $field['htmlvar_name'];
2445
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2446
+					$post->{$field_name} = $_REQUEST[$field_name];
2447
+				}
2491 2448
 
2492
-                    if ($type['type'] != 'fieldset') {
2493
-                        $i++;
2494
-                        $variables_array['post_id'] = $post->ID;
2495
-                        $variables_array['label'] = __($type['site_title'], 'geodirectory');
2496
-                        $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2497
-
2498
-                    }else{
2499
-                        $i = 0;
2500
-                        $fieldset_count++;
2501
-                        $field_set_start = 1;
2502
-                        $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2503
-                        $fieldset_arr[$fieldset_count]['label'] = $label;
2504
-                    }
2449
+				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'))) {
2450
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2451
+						continue;
2452
+					}
2505 2453
 
2454
+					$parse_custom_fields[] = $field;
2455
+				}
2456
+			}
2457
+			$custom_fields = $parse_custom_fields;
2458
+		}
2459
+		//print_r($custom_fields);
2460
+		if (!empty($custom_fields)) {
2506 2461
 
2507
-                    if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2508
-                    $type = stripslashes_deep($type); // strip slashes
2509
-                    if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2510
-                    $html = '';
2511
-                    $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2512
-                    if($html_var=='post'){$html_var='post_address';}
2513
-                    $field_icon = geodir_field_icon_proccess($type);
2514
-                    $filed_type = $type['type'];
2515
-
2516
-                    /**
2517
-                     * Filter the output for custom fields.
2518
-                     *
2519
-                     * Here we can remove or add new functions depending on the field type.
2520
-                     *
2521
-                     * @param string $html The html to be filtered (blank).
2522
-                     * @param string $fields_location The location the field is to be show.
2523
-                     * @param array $type The array of field values.
2524
-                     */
2525
-                    $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2526
-
2527
-
2528
-                    /**
2529
-                     * Filter custom field output in tab.
2530
-                     *
2531
-                     * @since 1.5.6
2532
-                     *
2533
-                     * @param string $html_var The HTML variable name for the field.
2534
-                     * @param string $html Custom field unfiltered HTML.
2535
-                     * @param array $variables_array Custom field variables array.
2536
-                     */
2537
-                    $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2538
-
2539
-                    $fieldset_html = '';
2540
-                    if ($field_set_start == 1) {
2541
-                        $add_html = false;
2542
-                        if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2543
-                            if ($fieldset != '') {
2544
-                                $add_html = true;
2545
-                                $label = $fieldset_arr[$fieldset_count - 1]['label'];
2546
-                                $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2547
-                            }
2548
-                            $fieldset_html = $fieldset;
2549
-                            $fieldset = '';
2550
-                        } else {
2551
-                            $fieldset .= $html;
2552
-                            if ($total_fields == $count_field && $fieldset != '') {
2553
-                                $add_html = true;
2554
-                                $label = $fieldset_arr[$fieldset_count]['label'];
2555
-                                $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2556
-                                $fieldset_html = $fieldset;
2557
-                            }
2558
-                        }
2462
+			global $field_set_start;
2559 2463
 
2560
-                        if ($add_html) {
2561
-                            $tabs_arr[$htmlvar_name] = array(
2562
-                                'heading_text' => __($label, 'geodirectory'),
2563
-                                'is_active_tab' => false,
2564
-                                /**
2565
-                                 * Filter if a custom field should be displayed on the details page tab.
2566
-                                 *
2567
-                                 * @since 1.0.0
2568
-                                 * @param string $htmlvar_name The field HTML var name.
2569
-                                 */
2570
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2571
-                                'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2572
-                            );
2573
-                        }
2574
-                    } else {
2575
-                        if ($html != '') {
2576
-                            $tabs_arr[$html_var] = array(
2577
-                                'heading_text' => __($label, 'geodirectory'),
2578
-                                'is_active_tab' => false,
2579
-                                /** This action is documented in geodirectory_hooks_actions.php */
2580
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2581
-                                'tab_content' => $html
2582
-                            );
2583
-                        }
2584
-                    }
2585
-                }
2586
-            }
2587
-        }
2588
-    }
2589
-    return $tabs_arr;
2464
+			$post = stripslashes_deep($post); // strip slashes
2465
+            
2466
+			$field_set_start = 0;
2467
+			$fieldset_count = 0;
2468
+			$fieldset = '';
2469
+			$total_fields = count($custom_fields);
2470
+			$count_field = 0;
2471
+			$fieldset_arr = array();
2472
+			$i = 0;
2473
+			$geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2474
+
2475
+			foreach ($custom_fields as $field) {
2476
+				$count_field++;
2477
+				$field_name = $field['htmlvar_name'];
2478
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) {
2479
+					$post->{$field_name} = $_REQUEST[$field_name];
2480
+				}
2481
+
2482
+				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'))) {
2483
+					$label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2484
+					$site_title = trim($field['site_title']);
2485
+					$type = $field;
2486
+					$variables_array = array();
2487
+
2488
+					if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) {
2489
+						continue;
2490
+					}
2491
+
2492
+					if ($type['type'] != 'fieldset') {
2493
+						$i++;
2494
+						$variables_array['post_id'] = $post->ID;
2495
+						$variables_array['label'] = __($type['site_title'], 'geodirectory');
2496
+						$variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : '';
2497
+
2498
+					}else{
2499
+						$i = 0;
2500
+						$fieldset_count++;
2501
+						$field_set_start = 1;
2502
+						$fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2503
+						$fieldset_arr[$fieldset_count]['label'] = $label;
2504
+					}
2505
+
2506
+
2507
+					if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
2508
+					$type = stripslashes_deep($type); // strip slashes
2509
+					if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
2510
+					$html = '';
2511
+					$html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : '';
2512
+					if($html_var=='post'){$html_var='post_address';}
2513
+					$field_icon = geodir_field_icon_proccess($type);
2514
+					$filed_type = $type['type'];
2515
+
2516
+					/**
2517
+					 * Filter the output for custom fields.
2518
+					 *
2519
+					 * Here we can remove or add new functions depending on the field type.
2520
+					 *
2521
+					 * @param string $html The html to be filtered (blank).
2522
+					 * @param string $fields_location The location the field is to be show.
2523
+					 * @param array $type The array of field values.
2524
+					 */
2525
+					$html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
2526
+
2527
+
2528
+					/**
2529
+					 * Filter custom field output in tab.
2530
+					 *
2531
+					 * @since 1.5.6
2532
+					 *
2533
+					 * @param string $html_var The HTML variable name for the field.
2534
+					 * @param string $html Custom field unfiltered HTML.
2535
+					 * @param array $variables_array Custom field variables array.
2536
+					 */
2537
+					$html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2538
+
2539
+					$fieldset_html = '';
2540
+					if ($field_set_start == 1) {
2541
+						$add_html = false;
2542
+						if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2543
+							if ($fieldset != '') {
2544
+								$add_html = true;
2545
+								$label = $fieldset_arr[$fieldset_count - 1]['label'];
2546
+								$htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2547
+							}
2548
+							$fieldset_html = $fieldset;
2549
+							$fieldset = '';
2550
+						} else {
2551
+							$fieldset .= $html;
2552
+							if ($total_fields == $count_field && $fieldset != '') {
2553
+								$add_html = true;
2554
+								$label = $fieldset_arr[$fieldset_count]['label'];
2555
+								$htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2556
+								$fieldset_html = $fieldset;
2557
+							}
2558
+						}
2559
+
2560
+						if ($add_html) {
2561
+							$tabs_arr[$htmlvar_name] = array(
2562
+								'heading_text' => __($label, 'geodirectory'),
2563
+								'is_active_tab' => false,
2564
+								/**
2565
+								 * Filter if a custom field should be displayed on the details page tab.
2566
+								 *
2567
+								 * @since 1.0.0
2568
+								 * @param string $htmlvar_name The field HTML var name.
2569
+								 */
2570
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2571
+								'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>'
2572
+							);
2573
+						}
2574
+					} else {
2575
+						if ($html != '') {
2576
+							$tabs_arr[$html_var] = array(
2577
+								'heading_text' => __($label, 'geodirectory'),
2578
+								'is_active_tab' => false,
2579
+								/** This action is documented in geodirectory_hooks_actions.php */
2580
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2581
+								'tab_content' => $html
2582
+							);
2583
+						}
2584
+					}
2585
+				}
2586
+			}
2587
+		}
2588
+	}
2589
+	return $tabs_arr;
2590 2590
 }
2591 2591
 
2592 2592
 /* display add listing page for wpml */
@@ -2610,41 +2610,41 @@  discard block
 block discarded – undo
2610 2610
  */
2611 2611
 function geodir_add_post_status_author_page()
2612 2612
 {
2613
-    global $wpdb, $post;
2614
-
2615
-    $html = '';
2616
-    if (get_current_user_id()) {
2617
-
2618
-        $is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2619
-        if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2620
-
2621
-            // 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.
2622
-            $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2623
-            $status = "<strong>(";
2624
-            $status_icon = '<i class="fa fa-play"></i>';
2625
-            if ($real_status == 'publish') {
2626
-                $status .= __('Published', 'geodirectory');
2627
-            }elseif ($real_status == 'pending') {
2628
-                $status .= __('Awaiting Review', 'geodirectory');
2629
-            } else {
2630
-                $status .= __('Not published', 'geodirectory');
2631
-                $status_icon = '<i class="fa fa-pause"></i>';
2632
-            }
2633
-            $status .= ")</strong>";
2613
+	global $wpdb, $post;
2614
+
2615
+	$html = '';
2616
+	if (get_current_user_id()) {
2617
+
2618
+		$is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author'));
2619
+		if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
2620
+
2621
+			// 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.
2622
+			$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
2623
+			$status = "<strong>(";
2624
+			$status_icon = '<i class="fa fa-play"></i>';
2625
+			if ($real_status == 'publish') {
2626
+				$status .= __('Published', 'geodirectory');
2627
+			}elseif ($real_status == 'pending') {
2628
+				$status .= __('Awaiting Review', 'geodirectory');
2629
+			} else {
2630
+				$status .= __('Not published', 'geodirectory');
2631
+				$status_icon = '<i class="fa fa-pause"></i>';
2632
+			}
2633
+			$status .= ")</strong>";
2634 2634
 
2635
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2636
-        }
2637
-    }
2635
+			$html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
2636
+		}
2637
+	}
2638 2638
 
2639
-    if ($html != '') {
2640
-        /**
2641
-         * Filter the post status text on the author page.
2642
-         *
2643
-         * @since 1.0.0
2644
-         * @param string $html The HTML of the status.
2645
-         */
2646
-        echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2647
-    }
2639
+	if ($html != '') {
2640
+		/**
2641
+		 * Filter the post status text on the author page.
2642
+		 *
2643
+		 * @since 1.0.0
2644
+		 * @param string $html The HTML of the status.
2645
+		 */
2646
+		echo apply_filters('geodir_filter_status_text_on_author_page', $html);
2647
+	}
2648 2648
 
2649 2649
 
2650 2650
 }
@@ -2658,9 +2658,9 @@  discard block
 block discarded – undo
2658 2658
  * @package GeoDirectory
2659 2659
  */
2660 2660
 function geodir_init_no_rating() {
2661
-    if (geodir_rating_disabled_post_types()) {
2662
-        add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2663
-    }
2661
+	if (geodir_rating_disabled_post_types()) {
2662
+		add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
2663
+	}
2664 2664
 }
2665 2665
 
2666 2666
 /**
@@ -2674,22 +2674,22 @@  discard block
 block discarded – undo
2674 2674
  * @return array Modified sort options array.
2675 2675
  */
2676 2676
 function geodir_no_rating_get_sort_options($options, $post_type = '') {
2677
-    if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) {
2678
-        $new_options = array();
2677
+	if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) {
2678
+		$new_options = array();
2679 2679
         
2680
-        if (!empty($options)) {
2681
-            foreach ($options as $option) {
2682
-                if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2683
-                    continue;
2684
-                }
2685
-                $new_options[] = $option;
2686
-            }
2680
+		if (!empty($options)) {
2681
+			foreach ($options as $option) {
2682
+				if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2683
+					continue;
2684
+				}
2685
+				$new_options[] = $option;
2686
+			}
2687 2687
 
2688
-            $options = $new_options;
2689
-        }
2690
-    }
2688
+			$options = $new_options;
2689
+		}
2690
+	}
2691 2691
 
2692
-    return $options;
2692
+	return $options;
2693 2693
 }
2694 2694
 
2695 2695
 /**
@@ -2701,9 +2701,9 @@  discard block
 block discarded – undo
2701 2701
  * @return array Modified class array.
2702 2702
  */
2703 2703
 function geodir_body_class_active_map($classes = array()) {
2704
-    $classes[] = 'gd-map-' . geodir_map_name();
2704
+	$classes[] = 'gd-map-' . geodir_map_name();
2705 2705
 
2706
-    return $classes;
2706
+	return $classes;
2707 2707
 }
2708 2708
 add_filter('body_class', 'geodir_body_class_active_map', 100);
2709 2709
 
@@ -2716,9 +2716,9 @@  discard block
 block discarded – undo
2716 2716
  * @return string Modified class string.
2717 2717
  */
2718 2718
 function geodir_admin_body_class_active_map($class = '') {    
2719
-    $class .= ' gd-map-' . geodir_map_name();
2719
+	$class .= ' gd-map-' . geodir_map_name();
2720 2720
 
2721
-    return $class;
2721
+	return $class;
2722 2722
 }
2723 2723
 add_filter('admin_body_class', 'geodir_admin_body_class_active_map', 100);
2724 2724
 
@@ -2736,36 +2736,36 @@  discard block
 block discarded – undo
2736 2736
  * @return array Translation texts.
2737 2737
  */
2738 2738
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
2739
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2740
-
2741
-    $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_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2742
-
2743
-    /**
2744
-     * Filters the geodirectory option names that requires to add for translation.
2745
-     *
2746
-     * @since 1.5.7
2747
-     * @package GeoDirectory
2748
-     *
2749
-     * @param  array $gd_options Array of option names.
2750
-     */
2751
-    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2752
-    $gd_options = array_unique($gd_options);
2753
-
2754
-    if (!empty($gd_options)) {
2755
-        foreach ($gd_options as $gd_option) {
2756
-            if ($gd_option != '' && $option_value = get_option($gd_option)) {
2757
-                $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2739
+	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
2740
+
2741
+	$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_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin');
2742
+
2743
+	/**
2744
+	 * Filters the geodirectory option names that requires to add for translation.
2745
+	 *
2746
+	 * @since 1.5.7
2747
+	 * @package GeoDirectory
2748
+	 *
2749
+	 * @param  array $gd_options Array of option names.
2750
+	 */
2751
+	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
2752
+	$gd_options = array_unique($gd_options);
2753
+
2754
+	if (!empty($gd_options)) {
2755
+		foreach ($gd_options as $gd_option) {
2756
+			if ($gd_option != '' && $option_value = get_option($gd_option)) {
2757
+				$option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
2758 2758
                 
2759
-                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2760
-                    $translation_texts[] = stripslashes_deep($option_value);
2761
-                }
2762
-            }
2763
-        }
2764
-    }
2759
+				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
2760
+					$translation_texts[] = stripslashes_deep($option_value);
2761
+				}
2762
+			}
2763
+		}
2764
+	}
2765 2765
 
2766
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2766
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
2767 2767
 
2768
-    return $translation_texts;
2768
+	return $translation_texts;
2769 2769
 }
2770 2770
 
2771 2771
 add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
@@ -2779,15 +2779,15 @@  discard block
 block discarded – undo
2779 2779
 
2780 2780
 add_filter('get_comments_link', 'gd_get_comments_link', 10, 2);
2781 2781
 function gd_get_comments_link($comments_link, $post_id) {
2782
-    $post_type = get_post_type($post_id);
2782
+	$post_type = get_post_type($post_id);
2783 2783
 
2784
-    $all_postypes = geodir_get_posttypes();
2785
-    if (in_array($post_type, $all_postypes)) {
2786
-        $comments_link = str_replace('#comments', '#reviews', $comments_link);
2787
-        $comments_link = str_replace('#respond', '#reviews', $comments_link);
2788
-    }
2784
+	$all_postypes = geodir_get_posttypes();
2785
+	if (in_array($post_type, $all_postypes)) {
2786
+		$comments_link = str_replace('#comments', '#reviews', $comments_link);
2787
+		$comments_link = str_replace('#respond', '#reviews', $comments_link);
2788
+	}
2789 2789
 
2790
-    return $comments_link;
2790
+	return $comments_link;
2791 2791
 }
2792 2792
 
2793 2793
 
@@ -2805,11 +2805,11 @@  discard block
 block discarded – undo
2805 2805
 function geodir_add_nav_menu_class( $args )
2806 2806
 {
2807 2807
 
2808
-        if(isset($args['menu_class'])){
2809
-            $args['menu_class'] = $args['menu_class']." gd-menu-z";
2810
-        }
2808
+		if(isset($args['menu_class'])){
2809
+			$args['menu_class'] = $args['menu_class']." gd-menu-z";
2810
+		}
2811 2811
     
2812
-    return $args;
2812
+	return $args;
2813 2813
 }
2814 2814
 
2815 2815
 add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' );
@@ -2826,15 +2826,15 @@  discard block
 block discarded – undo
2826 2826
  * @return string Filtered locale ID.
2827 2827
  */
2828 2828
 function geodir_wpml_filter_locale($locale) {
2829
-    global $sitepress;
2829
+	global $sitepress;
2830 2830
     
2831
-    $post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : '');
2831
+	$post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : '');
2832 2832
     
2833
-    if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
2834
-        $locale = $sitepress->get_locale($current_lang);
2835
-    }
2833
+	if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) {
2834
+		$locale = $sitepress->get_locale($current_lang);
2835
+	}
2836 2836
     
2837
-    return $locale;
2837
+	return $locale;
2838 2838
 }
2839 2839
 
2840 2840
 /**
@@ -2844,20 +2844,20 @@  discard block
 block discarded – undo
2844 2844
  * @package GeoDirectory
2845 2845
  */
2846 2846
 function geodir_wpml_set_filter() {
2847
-    if (geodir_is_wpml()) {
2848
-        global $sitepress;
2847
+	if (geodir_is_wpml()) {
2848
+		global $sitepress;
2849 2849
         
2850
-        if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2851
-            add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
2852
-        }
2850
+		if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2851
+			add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1);
2852
+		}
2853 2853
         
2854
-        add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2855
-        add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 );
2854
+		add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2);
2855
+		add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 );
2856 2856
 		add_action( 'geodir_after_search_form', 'geodir_wpml_add_language_input_field' );
2857
-        if (is_admin()) {
2858
-            add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 );
2859
-        }
2860
-    }
2857
+		if (is_admin()) {
2858
+			add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 );
2859
+		}
2860
+	}
2861 2861
 }
2862 2862
 add_filter('plugins_loaded', 'geodir_wpml_set_filter');
2863 2863
 
@@ -2870,38 +2870,38 @@  discard block
 block discarded – undo
2870 2870
  * @return array Filtered languages.
2871 2871
  */
2872 2872
 function geodir_wpml_filter_ls_languages($languages) {    
2873
-    if (geodir_is_geodir_page()) {        
2874
-        $keep_vars = array();
2873
+	if (geodir_is_geodir_page()) {        
2874
+		$keep_vars = array();
2875 2875
         
2876
-        if (geodir_is_page('add-listing')) {
2877
-            $keep_vars = array('listing_type', 'package_id');
2878
-        } else if (geodir_is_page('search')) {
2879
-            $keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
2880
-        } else if (geodir_is_page('author')) {
2881
-            $keep_vars = array('geodir_dashbord', 'stype', 'list');
2882
-        } else if (geodir_is_page('login')) {
2883
-            $keep_vars = array('forgot', 'signup');
2884
-        }        
2876
+		if (geodir_is_page('add-listing')) {
2877
+			$keep_vars = array('listing_type', 'package_id');
2878
+		} else if (geodir_is_page('search')) {
2879
+			$keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon');
2880
+		} else if (geodir_is_page('author')) {
2881
+			$keep_vars = array('geodir_dashbord', 'stype', 'list');
2882
+		} else if (geodir_is_page('login')) {
2883
+			$keep_vars = array('forgot', 'signup');
2884
+		}        
2885 2885
         
2886
-        if (!empty($keep_vars)) {
2887
-            foreach ( $languages as $code => $url) {
2888
-                $filter_url = $url['url'];
2886
+		if (!empty($keep_vars)) {
2887
+			foreach ( $languages as $code => $url) {
2888
+				$filter_url = $url['url'];
2889 2889
                 
2890
-                foreach ($keep_vars as $var) {
2891
-                    if (isset($_GET[$var]) && !is_array($_GET[$var])) {
2892
-                        $filter_url = remove_query_arg(array($var), $filter_url);
2893
-                        $filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url);
2894
-                    }
2895
-                }
2890
+				foreach ($keep_vars as $var) {
2891
+					if (isset($_GET[$var]) && !is_array($_GET[$var])) {
2892
+						$filter_url = remove_query_arg(array($var), $filter_url);
2893
+						$filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url);
2894
+					}
2895
+				}
2896 2896
                 
2897
-                if ($filter_url != $url['url']) {
2898
-                    $languages[$code]['url'] = $filter_url;
2899
-                }
2900
-            }
2901
-        }
2902
-    }
2897
+				if ($filter_url != $url['url']) {
2898
+					$languages[$code]['url'] = $filter_url;
2899
+				}
2900
+			}
2901
+		}
2902
+	}
2903 2903
 
2904
-    return $languages;
2904
+	return $languages;
2905 2905
 }
2906 2906
 add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 );
2907 2907
 
@@ -2912,18 +2912,18 @@  discard block
 block discarded – undo
2912 2912
  *
2913 2913
  */
2914 2914
 function geodir_remove_yoast_seo_metas(){
2915
-    if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
2916
-        $wpseo = WPSEO_Frontend::get_instance();
2915
+	if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) {
2916
+		$wpseo = WPSEO_Frontend::get_instance();
2917 2917
         
2918
-        remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 );
2919
-        remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 );
2920
-        remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 );
2921
-        remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 );
2922
-        remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 );
2923
-        remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 );
2918
+		remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 );
2919
+		remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 );
2920
+		remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 );
2921
+		remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 );
2922
+		remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 );
2923
+		remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 );
2924 2924
         
2925
-        remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 );
2926
-    }
2925
+		remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 );
2926
+	}
2927 2927
 }
2928 2928
 
2929 2929
 /**
@@ -2937,20 +2937,20 @@  discard block
 block discarded – undo
2937 2937
  *
2938 2938
  */
2939 2939
  function geodir_wpml_ajax_set_guest_lang() {    
2940
-    if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
2941
-        if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
2942
-            global $sitepress;
2940
+	if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) {
2941
+		if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) {
2942
+			global $sitepress;
2943 2943
             
2944
-            $referer = wp_get_referer();
2944
+			$referer = wp_get_referer();
2945 2945
             
2946
-            $current_lang = $sitepress->get_current_language();
2947
-            $referrer_lang = $sitepress->get_language_from_url( $referer );
2946
+			$current_lang = $sitepress->get_current_language();
2947
+			$referrer_lang = $sitepress->get_language_from_url( $referer );
2948 2948
             
2949
-            if ( $referrer_lang && $current_lang != $referrer_lang ) {
2950
-                $_GET['lang'] = $referrer_lang;
2951
-            }
2952
-        }
2953
-    }
2949
+			if ( $referrer_lang && $current_lang != $referrer_lang ) {
2950
+				$_GET['lang'] = $referrer_lang;
2951
+			}
2952
+		}
2953
+	}
2954 2954
 }
2955 2955
 add_action( 'plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1 );
2956 2956
 
@@ -2962,36 +2962,36 @@  discard block
 block discarded – undo
2962 2962
  * @param object $wp The WordPress object.
2963 2963
  */
2964 2964
 function geodir_check_redirect($wp) {
2965
-    if (is_404() || (!empty($wp->query_vars['error']) && $wp->query_vars['error'] == '404')) {
2966
-        $current_url = geodir_curPageURL();
2967
-        $search = 'czech-republic';
2968
-        $replace = 'czechia';        
2965
+	if (is_404() || (!empty($wp->query_vars['error']) && $wp->query_vars['error'] == '404')) {
2966
+		$current_url = geodir_curPageURL();
2967
+		$search = 'czech-republic';
2968
+		$replace = 'czechia';        
2969 2969
         
2970
-        $has_slash = substr($current_url, -1);
2971
-        if ($has_slash != "/") {
2972
-            $current_url .= '/';
2973
-        }
2970
+		$has_slash = substr($current_url, -1);
2971
+		if ($has_slash != "/") {
2972
+			$current_url .= '/';
2973
+		}
2974 2974
         
2975
-        $redirect = false;
2976
-        if (strpos($current_url, '/' . $search . '/') !== false) {
2977
-            $redirect = true;
2978
-            $current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
2979
-        }
2975
+		$redirect = false;
2976
+		if (strpos($current_url, '/' . $search . '/') !== false) {
2977
+			$redirect = true;
2978
+			$current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1);
2979
+		}
2980 2980
         
2981
-        if ($has_slash != "/") {
2982
-            $current_url = trim($current_url, '/');
2983
-        }
2981
+		if ($has_slash != "/") {
2982
+			$current_url = trim($current_url, '/');
2983
+		}
2984 2984
         
2985
-        if (strpos($current_url, 'gd_country=' . $search) !== false) {
2986
-            $redirect = true;
2987
-            $current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
2988
-        }
2989
-
2990
-        if ($redirect) {
2991
-            wp_redirect($current_url);
2992
-            exit;
2993
-        }
2994
-    }
2985
+		if (strpos($current_url, 'gd_country=' . $search) !== false) {
2986
+			$redirect = true;
2987
+			$current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url);
2988
+		}
2989
+
2990
+		if ($redirect) {
2991
+			wp_redirect($current_url);
2992
+			exit;
2993
+		}
2994
+	}
2995 2995
 }
2996 2996
 add_action('parse_request', 'geodir_check_redirect', 101, 1);
2997 2997
 
@@ -3011,50 +3011,50 @@  discard block
 block discarded – undo
3011 3011
  * @param string $original_slug The original post slug.
3012 3012
  */
3013 3013
 function geodir_check_post_to_term_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
3014
-    global $wpdb, $sitepress;
3014
+	global $wpdb, $sitepress;
3015 3015
     
3016
-    if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
3017
-        $wpml_post_join = "";
3018
-        $wpml_post_where = "";
3019
-        $wpml_term_join = "";
3020
-        $wpml_term_where = "";
3016
+	if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) {
3017
+		$wpml_post_join = "";
3018
+		$wpml_post_where = "";
3019
+		$wpml_term_join = "";
3020
+		$wpml_term_where = "";
3021 3021
         
3022
-        if (geodir_wpml_is_post_type_translated($post_type)) {
3023
-            $post_language = $post_ID ? $sitepress->post_translations()->get_element_lang_code($post_ID) : $sitepress->get_current_language();
3024
-            $post_language = $post_language ? $post_language : $sitepress->post_translations()->get_save_post_lang($post_ID, $sitepress);
3025
-            if (!$post_language) {
3026
-                $post_language = $sitepress->get_current_language();
3027
-            }
3022
+		if (geodir_wpml_is_post_type_translated($post_type)) {
3023
+			$post_language = $post_ID ? $sitepress->post_translations()->get_element_lang_code($post_ID) : $sitepress->get_current_language();
3024
+			$post_language = $post_language ? $post_language : $sitepress->post_translations()->get_save_post_lang($post_ID, $sitepress);
3025
+			if (!$post_language) {
3026
+				$post_language = $sitepress->get_current_language();
3027
+			}
3028 3028
             
3029
-            $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)";
3030
-            $wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'";
3029
+			$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)";
3030
+			$wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'";
3031 3031
             
3032
-            $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)";
3033
-            $wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'";
3034
-        }
3032
+			$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)";
3033
+			$wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'";
3034
+		}
3035 3035
 
3036
-        $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 ) );
3036
+		$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 ) );
3037 3037
 
3038
-        if ( $term_slug_check ) {
3039
-            $suffix = 1;
3038
+		if ( $term_slug_check ) {
3039
+			$suffix = 1;
3040 3040
             
3041
-            do {
3042
-                $alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3041
+			do {
3042
+				$alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3043 3043
                 
3044
-                $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 ) );
3044
+				$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 ) );
3045 3045
                 
3046
-                $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 ) );
3046
+				$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 ) );
3047 3047
                 
3048
-                $term_slug_check = $term_check || $post_check;
3048
+				$term_slug_check = $term_check || $post_check;
3049 3049
                 
3050
-                $suffix++;
3051
-            } while ( $term_slug_check );
3050
+				$suffix++;
3051
+			} while ( $term_slug_check );
3052 3052
             
3053
-            $slug = $alt_slug;
3054
-        }
3055
-    }
3053
+			$slug = $alt_slug;
3054
+		}
3055
+	}
3056 3056
     
3057
-    return $slug;
3057
+	return $slug;
3058 3058
 }
3059 3059
 add_filter( 'wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6 );
3060 3060
 
@@ -3074,48 +3074,48 @@  discard block
 block discarded – undo
3074 3074
  * @return bool true when exists. false when not exists.
3075 3075
  */
3076 3076
 function geodir_check_term_to_post_slug( $slug_exists, $slug, $term_id ) {
3077
-    global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress;
3077
+	global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress;
3078 3078
     
3079
-    if ( $slug_exists ) {
3080
-        return $slug_exists;
3081
-    }
3079
+	if ( $slug_exists ) {
3080
+		return $slug_exists;
3081
+	}
3082 3082
     
3083
-    if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
3084
-        $taxonomy = $gd_term_taxonomy[$term_id];
3085
-    } else {
3086
-        $taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) );
3087
-        $gd_term_taxonomy[$term_id] = $taxonomy;
3088
-    }
3083
+	if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) {
3084
+		$taxonomy = $gd_term_taxonomy[$term_id];
3085
+	} else {
3086
+		$taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) );
3087
+		$gd_term_taxonomy[$term_id] = $taxonomy;
3088
+	}
3089 3089
     
3090
-    if ( empty($taxonomy) ) {
3091
-        return $slug_exists;
3092
-    }
3090
+	if ( empty($taxonomy) ) {
3091
+		return $slug_exists;
3092
+	}
3093 3093
     
3094
-    if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
3095
-        $post_type = $gd_term_post_type[$term_id];
3096
-    } else {
3097
-        $taxonomy_obj = get_taxonomy( $taxonomy );
3098
-        $post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL;
3099
-    }
3094
+	if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) {
3095
+		$post_type = $gd_term_post_type[$term_id];
3096
+	} else {
3097
+		$taxonomy_obj = get_taxonomy( $taxonomy );
3098
+		$post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL;
3099
+	}
3100 3100
     
3101
-    $wpml_post_join = "";
3102
-    $wpml_post_where = "";
3101
+	$wpml_post_join = "";
3102
+	$wpml_post_where = "";
3103 3103
     
3104
-    if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
3105
-        $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language();
3106
-        if (!$term_language) {
3107
-            $term_language = $sitepress->get_current_language();
3108
-        }
3104
+	if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) {
3105
+		$term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language();
3106
+		if (!$term_language) {
3107
+			$term_language = $sitepress->get_current_language();
3108
+		}
3109 3109
         
3110
-        $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)";
3111
-        $wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'";
3112
-    }
3110
+		$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)";
3111
+		$wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'";
3112
+	}
3113 3113
     
3114
-    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 ) ) ) {
3115
-        $slug_exists = true;
3116
-    }
3114
+	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 ) ) ) {
3115
+		$slug_exists = true;
3116
+	}
3117 3117
 
3118
-    return $slug_exists;
3118
+	return $slug_exists;
3119 3119
 }
3120 3120
 add_filter( 'geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3 );
3121 3121
 
Please login to merge, or discard this patch.
geodirectory_template_tags.php 1 patch
Indentation   +344 added lines, -344 removed lines patch added patch discarded remove patch
@@ -36,175 +36,175 @@  discard block
 block discarded – undo
36 36
  */
37 37
 function geodir_templates_scripts()
38 38
 {
39
-    $is_detail_page = false;
40
-    $geodir_map_name = geodir_map_name();
39
+	$is_detail_page = false;
40
+	$geodir_map_name = geodir_map_name();
41 41
 
42
-    if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
43
-        $is_detail_page = true;
44
-    }
45
-
46
-    wp_enqueue_script('jquery');
47
-
48
-    wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
49
-    wp_enqueue_script('geodirectory-script');
50
-
51
-    $geodir_vars_data = array(
52
-        'siteurl' => get_option('siteurl'),
53
-        'geodir_plugin_url' => geodir_plugin_url(),
54
-        'geodir_lazy_load' => get_option('geodir_lazy_load',1),
55
-        'geodir_ajax_url' => geodir_get_ajax_url(),
56
-        'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
57
-        'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
58
-    );
59
-
60
-    /**
61
-     * Filter the `geodir_var` data array that outputs the  wp_localize_script() translations and variables.
62
-     *
63
-     * This is used by addons to add JS translatable variables.
64
-     *
65
-     * @since 1.4.4
66
-     * @param array $geodir_vars_data {
67
-     *    geodir var data used by addons to add JS translatable variables.
68
-     *
69
-     *    @type string $siteurl Site url.
70
-     *    @type string $geodir_plugin_url Geodirectory core plugin url.
71
-     *    @type string $geodir_ajax_url Geodirectory plugin ajax url.
72
-     *    @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?.
73
-     *    @type int $is_rtl Checks if current locale is RTL.
74
-     *
75
-     * }
76
-     */
77
-    $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
78
-
79
-    wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
80
-
81
-    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
82
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
83
-
84
-    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
85
-    wp_enqueue_script('geodirectory-lightbox-jquery');
42
+	if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
43
+		$is_detail_page = true;
44
+	}
86 45
 
87
-    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
88
-    if ($is_detail_page) {
89
-        wp_enqueue_script('geodirectory-jquery-simplemodal');
90
-    }
46
+	wp_enqueue_script('jquery');
47
+
48
+	wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
49
+	wp_enqueue_script('geodirectory-script');
50
+
51
+	$geodir_vars_data = array(
52
+		'siteurl' => get_option('siteurl'),
53
+		'geodir_plugin_url' => geodir_plugin_url(),
54
+		'geodir_lazy_load' => get_option('geodir_lazy_load',1),
55
+		'geodir_ajax_url' => geodir_get_ajax_url(),
56
+		'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
57
+		'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
58
+	);
59
+
60
+	/**
61
+	 * Filter the `geodir_var` data array that outputs the  wp_localize_script() translations and variables.
62
+	 *
63
+	 * This is used by addons to add JS translatable variables.
64
+	 *
65
+	 * @since 1.4.4
66
+	 * @param array $geodir_vars_data {
67
+	 *    geodir var data used by addons to add JS translatable variables.
68
+	 *
69
+	 *    @type string $siteurl Site url.
70
+	 *    @type string $geodir_plugin_url Geodirectory core plugin url.
71
+	 *    @type string $geodir_ajax_url Geodirectory plugin ajax url.
72
+	 *    @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?.
73
+	 *    @type int $is_rtl Checks if current locale is RTL.
74
+	 *
75
+	 * }
76
+	 */
77
+	$geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
78
+
79
+	wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
80
+
81
+	wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
82
+	if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
83
+
84
+	wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
85
+	wp_enqueue_script('geodirectory-lightbox-jquery');
86
+
87
+	wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
88
+	if ($is_detail_page) {
89
+		wp_enqueue_script('geodirectory-jquery-simplemodal');
90
+	}
91 91
 
92
-    if (in_array($geodir_map_name, array('auto', 'google'))) {
93
-        $map_lang = "&language=" . geodir_get_map_default_language();
94
-        $map_key = "&key=" . geodir_get_map_api_key();
95
-        /**
96
-         * Filter the variables that are added to the end of the google maps script call.
97
-         *
98
-         * This i used to change things like google maps language etc.
99
-         *
100
-         * @since 1.0.0
101
-         * @param string $var The string to filter, default is empty string.
102
-         */
103
-        $map_extra = apply_filters('geodir_googlemap_script_extra', '');
104
-        wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL);
92
+	if (in_array($geodir_map_name, array('auto', 'google'))) {
93
+		$map_lang = "&language=" . geodir_get_map_default_language();
94
+		$map_key = "&key=" . geodir_get_map_api_key();
95
+		/**
96
+		 * Filter the variables that are added to the end of the google maps script call.
97
+		 *
98
+		 * This i used to change things like google maps language etc.
99
+		 *
100
+		 * @since 1.0.0
101
+		 * @param string $var The string to filter, default is empty string.
102
+		 */
103
+		$map_extra = apply_filters('geodir_googlemap_script_extra', '');
104
+		wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL);
105 105
         
106
-        // Overlapping Marker Spiderfier
107
-        wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
108
-        wp_enqueue_script('geodirectory-g-overlappingmarker-script');
109
-    }
106
+		// Overlapping Marker Spiderfier
107
+		wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
108
+		wp_enqueue_script('geodirectory-g-overlappingmarker-script');
109
+	}
110 110
     
111
-    if ($geodir_map_name == 'osm') {
112
-        // Leaflet OpenStreetMap
113
-        wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
114
-        wp_enqueue_style('geodirectory-leaflet-style');
111
+	if ($geodir_map_name == 'osm') {
112
+		// Leaflet OpenStreetMap
113
+		wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
114
+		wp_enqueue_style('geodirectory-leaflet-style');
115 115
             
116
-        wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
117
-        wp_enqueue_script('geodirectory-leaflet-script');
116
+		wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
117
+		wp_enqueue_script('geodirectory-leaflet-script');
118 118
         
119
-        wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION);
120
-        wp_enqueue_script('geodirectory-leaflet-geo-script');
119
+		wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION);
120
+		wp_enqueue_script('geodirectory-leaflet-geo-script');
121 121
         
122
-        if ($is_detail_page) {
123
-            wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
124
-            wp_enqueue_style('geodirectory-leaflet-routing-style');
122
+		if ($is_detail_page) {
123
+			wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
124
+			wp_enqueue_style('geodirectory-leaflet-routing-style');
125 125
                 
126
-            wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION);
127
-            wp_enqueue_script('geodirectory-leaflet-routing-script');
128
-        }
126
+			wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION);
127
+			wp_enqueue_script('geodirectory-leaflet-routing-script');
128
+		}
129 129
         
130
-        // Overlapping Marker Spiderfier Leaflet
131
-        wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
132
-        wp_enqueue_script('geodirectory-o-overlappingmarker-script');
133
-    }
134
-    wp_enqueue_script( 'jquery-ui-autocomplete' );
130
+		// Overlapping Marker Spiderfier Leaflet
131
+		wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
132
+		wp_enqueue_script('geodirectory-o-overlappingmarker-script');
133
+	}
134
+	wp_enqueue_script( 'jquery-ui-autocomplete' );
135 135
     
136
-    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
137
-    wp_enqueue_script('geodirectory-goMap-script');
138
-
139
-    wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
140
-    wp_enqueue_script('chosen');
141
-
142
-    wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
143
-    wp_enqueue_script('geodirectory-choose-ajax');
144
-
145
-    wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
146
-
147
-    if (is_page() && geodir_is_page('add-listing')) {
148
-        // SCRIPT FOR UPLOAD
149
-        wp_enqueue_script('plupload-all');
150
-        wp_enqueue_script('jquery-ui-sortable');
151
-
152
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
153
-        wp_enqueue_script('geodirectory-plupload-script');
154
-        // SCRIPT FOR UPLOAD END
155
-
156
-        // check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
157
-        if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
158
-            $ajax_url = admin_url('admin-ajax.php');
159
-        } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
160
-            $ajax_url = admin_url('admin-ajax.php');
161
-        } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
162
-            $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
163
-        } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
164
-            $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
165
-        } else {
166
-            $ajax_url = admin_url('admin-ajax.php');
167
-        }
136
+	wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
137
+	wp_enqueue_script('geodirectory-goMap-script');
138
+
139
+	wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
140
+	wp_enqueue_script('chosen');
141
+
142
+	wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
143
+	wp_enqueue_script('geodirectory-choose-ajax');
144
+
145
+	wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
146
+
147
+	if (is_page() && geodir_is_page('add-listing')) {
148
+		// SCRIPT FOR UPLOAD
149
+		wp_enqueue_script('plupload-all');
150
+		wp_enqueue_script('jquery-ui-sortable');
151
+
152
+		wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
153
+		wp_enqueue_script('geodirectory-plupload-script');
154
+		// SCRIPT FOR UPLOAD END
155
+
156
+		// check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
157
+		if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
158
+			$ajax_url = admin_url('admin-ajax.php');
159
+		} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
160
+			$ajax_url = admin_url('admin-ajax.php');
161
+		} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
162
+			$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
163
+		} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
164
+			$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
165
+		} else {
166
+			$ajax_url = admin_url('admin-ajax.php');
167
+		}
168 168
 
169
-        // place js config array for plupload
170
-        $plupload_init = array(
171
-            'runtimes' => 'html5,silverlight,browserplus,gears,html4',
172
-            'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
173
-            'container' => 'plupload-upload-ui', // will be adjusted per uploader
174
-            'drop_element' => 'dropbox', // will be adjusted per uploader
175
-            'file_data_name' => 'async-upload', // will be adjusted per uploader
176
-            'multiple_queues' => true,
177
-            'max_file_size' => geodir_max_upload_size(),
178
-            'url' => $ajax_url,
179
-            'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
180
-            'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
181
-            'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
182
-            'multipart' => true,
183
-            'urlstream_upload' => true,
184
-            'multi_selection' => false, // will be added per uploader
185
-            // additional post data to send to our ajax hook
186
-            'multipart_params' => array(
187
-                '_ajax_nonce' => "", // will be added per uploader
188
-                'action' => 'plupload_action', // the ajax action name
189
-                'imgid' => 0 // will be added per uploader
190
-            )
191
-        );
192
-        $base_plupload_config = json_encode($plupload_init);
193
-
194
-        $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
195
-            'upload_img_size' => geodir_max_upload_size());
196
-
197
-        wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
198
-
199
-        wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
200
-    } // End if for add place page
201
-
202
-    wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
203
-    if ($is_detail_page) {
169
+		// place js config array for plupload
170
+		$plupload_init = array(
171
+			'runtimes' => 'html5,silverlight,browserplus,gears,html4',
172
+			'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
173
+			'container' => 'plupload-upload-ui', // will be adjusted per uploader
174
+			'drop_element' => 'dropbox', // will be adjusted per uploader
175
+			'file_data_name' => 'async-upload', // will be adjusted per uploader
176
+			'multiple_queues' => true,
177
+			'max_file_size' => geodir_max_upload_size(),
178
+			'url' => $ajax_url,
179
+			'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
180
+			'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
181
+			'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
182
+			'multipart' => true,
183
+			'urlstream_upload' => true,
184
+			'multi_selection' => false, // will be added per uploader
185
+			// additional post data to send to our ajax hook
186
+			'multipart_params' => array(
187
+				'_ajax_nonce' => "", // will be added per uploader
188
+				'action' => 'plupload_action', // the ajax action name
189
+				'imgid' => 0 // will be added per uploader
190
+			)
191
+		);
192
+		$base_plupload_config = json_encode($plupload_init);
193
+
194
+		$gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
195
+			'upload_img_size' => geodir_max_upload_size());
196
+
197
+		wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
198
+
199
+		wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
200
+	} // End if for add place page
201
+
202
+	wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
203
+	if ($is_detail_page) {
204 204
 		wp_enqueue_script('geodirectory-post-custom-js');
205 205
 	}
206 206
 
207
-    // font awesome rating script
207
+	// font awesome rating script
208 208
 	if (get_option('geodir_reviewrating_enable_font_awesome')) {
209 209
 		wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
210 210
 		wp_enqueue_script('geodir-barrating-js');
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
 		wp_enqueue_script('geodir-jRating-js');
214 214
 	}
215 215
 
216
-    wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
217
-    wp_enqueue_script('geodir-on-document-load');
216
+	wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
217
+	wp_enqueue_script('geodir-on-document-load');
218 218
 
219
-    wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
220
-    wp_enqueue_script('google-geometa');
219
+	wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
220
+	wp_enqueue_script('google-geometa');
221 221
 }
222 222
 
223 223
 /**
@@ -231,8 +231,8 @@  discard block
 block discarded – undo
231 231
  */
232 232
 function geodir_header_scripts()
233 233
 {
234
-    echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
235
-    echo stripslashes(get_option('geodir_header_scripts'));
234
+	echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
235
+	echo stripslashes(get_option('geodir_header_scripts'));
236 236
 }
237 237
 
238 238
 /**
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
  */
246 246
 function geodir_google_analytics_tracking_code()
247 247
 {
248
-    if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?>
248
+	if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?>
249 249
 
250 250
         <script>
251 251
             (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
         </script>
261 261
 
262 262
         <?php
263
-    }elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
264
-        echo stripslashes(get_option('geodir_ga_tracking_code'));
265
-    }
263
+	}elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
264
+		echo stripslashes(get_option('geodir_ga_tracking_code'));
265
+	}
266 266
 }
267 267
 
268 268
 /**
@@ -276,16 +276,16 @@  discard block
 block discarded – undo
276 276
 function geodir_footer_scripts()
277 277
 {
278 278
 
279
-    echo stripslashes(get_option('geodir_footer_scripts'));
279
+	echo stripslashes(get_option('geodir_footer_scripts'));
280 280
 
281
-    /*
281
+	/*
282 282
      * Apple suck and can't/won't fix bugs: https://bugs.webkit.org/show_bug.cgi?id=136041
283 283
      *
284 284
      * Flexbox wont wrap on ios for search form items
285 285
      */
286
-    if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) {
287
-        echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>";
288
-    }
286
+	if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) {
287
+		echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>";
288
+	}
289 289
 }
290 290
 
291 291
 
@@ -299,12 +299,12 @@  discard block
 block discarded – undo
299 299
  */
300 300
 function geodir_add_async_forscript($url)
301 301
 {
302
-    if (strpos($url, '#asyncload')===false)
303
-        return $url;
304
-    else if (is_admin())
305
-        return str_replace('#asyncload', '', $url);
306
-    else
307
-        return str_replace('#asyncload', '', $url)."' async='async";
302
+	if (strpos($url, '#asyncload')===false)
303
+		return $url;
304
+	else if (is_admin())
305
+		return str_replace('#asyncload', '', $url);
306
+	else
307
+		return str_replace('#asyncload', '', $url)."' async='async";
308 308
 }
309 309
 add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
310 310
 
@@ -317,17 +317,17 @@  discard block
 block discarded – undo
317 317
 function geodir_templates_styles()
318 318
 {
319 319
 
320
-    wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
321
-    wp_enqueue_style('geodir-core-scss');
322
-    wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
320
+	wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
321
+	wp_enqueue_style('geodir-core-scss');
322
+	wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
323 323
 
324
-    if(is_rtl()){
325
-    wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
326
-    wp_enqueue_style('geodirectory-frontend-rtl-style');
327
-    }
324
+	if(is_rtl()){
325
+	wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
326
+	wp_enqueue_style('geodirectory-frontend-rtl-style');
327
+	}
328 328
 
329
-    wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
330
-    wp_enqueue_style('font-awesome');
329
+	wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
330
+	wp_enqueue_style('font-awesome');
331 331
 
332 332
 
333 333
 }
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
  */
342 342
 function geodir_get_sidebar()
343 343
 {
344
-    get_sidebar('geodirectory');
344
+	get_sidebar('geodirectory');
345 345
 }
346 346
 
347 347
 /**
@@ -360,122 +360,122 @@  discard block
 block discarded – undo
360 360
  * @param bool $always_show Do you want to show the pagination always? Default: false.
361 361
  */
362 362
 function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) {
363
-    global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
363
+	global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
364 364
 
365
-    if (empty($prelabel)) {
366
-        $prelabel = '<strong>&lt;</strong>';
367
-    }
365
+	if (empty($prelabel)) {
366
+		$prelabel = '<strong>&lt;</strong>';
367
+	}
368 368
 
369
-    if (empty($nxtlabel)) {
370
-        $nxtlabel = '<strong>&gt;</strong>';
371
-    }
369
+	if (empty($nxtlabel)) {
370
+		$nxtlabel = '<strong>&gt;</strong>';
371
+	}
372 372
 
373
-    $half_pages_to_show = round($pages_to_show / 2);
373
+	$half_pages_to_show = round($pages_to_show / 2);
374 374
 
375
-    if (geodir_is_page('home')) // dont apply default  pagination for geodirectory home page.
376
-        return;
375
+	if (geodir_is_page('home')) // dont apply default  pagination for geodirectory home page.
376
+		return;
377 377
 
378
-    if (!is_single()) {
379
-        if (function_exists('geodir_location_geo_home_link')) {
380
-            remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
381
-        }
382
-        $numposts = $wp_query->found_posts;
378
+	if (!is_single()) {
379
+		if (function_exists('geodir_location_geo_home_link')) {
380
+			remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
381
+		}
382
+		$numposts = $wp_query->found_posts;
383 383
 
384
-        $max_page = ceil($numposts / $posts_per_page);
384
+		$max_page = ceil($numposts / $posts_per_page);
385 385
 
386
-        if (empty($paged)) {
387
-            $paged = 1;
388
-        }
386
+		if (empty($paged)) {
387
+			$paged = 1;
388
+		}
389 389
         
390
-        $post_type = geodir_get_current_posttype();
391
-        $listing_type_name = get_post_type_plural_label($post_type);
392
-        if (geodir_is_page('listing') || geodir_is_page('search')) {            
393
-            $term = array();
390
+		$post_type = geodir_get_current_posttype();
391
+		$listing_type_name = get_post_type_plural_label($post_type);
392
+		if (geodir_is_page('listing') || geodir_is_page('search')) {            
393
+			$term = array();
394 394
             
395
-            if (is_tax()) {
396
-                $term_id = get_queried_object_id();
397
-                $taxonomy = get_query_var('taxonomy');
395
+			if (is_tax()) {
396
+				$term_id = get_queried_object_id();
397
+				$taxonomy = get_query_var('taxonomy');
398 398
 
399
-                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
400
-                    $term = get_term($term_id, $post_type . 'category');
401
-                }
402
-            }
399
+				if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
400
+					$term = get_term($term_id, $post_type . 'category');
401
+				}
402
+			}
403 403
             
404
-            if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
405
-                $taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
404
+			if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
405
+				$taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
406 406
                 
407
-                if (!is_array($taxonomy_search)) {
408
-                    $term = get_term((int)$taxonomy_search, $post_type . 'category');
409
-                } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
410
-                    $term = get_term((int)$taxonomy_search[0], $post_type . 'category');
411
-                }
412
-            }
407
+				if (!is_array($taxonomy_search)) {
408
+					$term = get_term((int)$taxonomy_search, $post_type . 'category');
409
+				} else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
410
+					$term = get_term((int)$taxonomy_search[0], $post_type . 'category');
411
+				}
412
+			}
413 413
             
414
-            if (!empty($term) && !is_wp_error($term)) {
415
-                $listing_type_name = $term->name;
416
-            }
417
-        }
414
+			if (!empty($term) && !is_wp_error($term)) {
415
+				$listing_type_name = $term->name;
416
+			}
417
+		}
418 418
 
419
-        if ($max_page > 1 || $always_show) {            
420
-            // Extra pagination info
421
-            $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
422
-            $start_no = ( $paged - 1 ) * $posts_per_page + 1;
423
-            $end_no = min($paged * $posts_per_page, $numposts);
419
+		if ($max_page > 1 || $always_show) {            
420
+			// Extra pagination info
421
+			$geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
422
+			$start_no = ( $paged - 1 ) * $posts_per_page + 1;
423
+			$end_no = min($paged * $posts_per_page, $numposts);
424 424
 
425
-            if ($geodir_pagination_more_info != '') {
426
-                if ($listing_type_name) {
427
-                    $listing_type_name = __($listing_type_name, 'geodirectory');
428
-                    $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts);
429
-                } else {
430
-                    $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
431
-                }
432
-                $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
433
-                /**
434
-                 * Adds an extra pagination info above/under pagination.
435
-                 *
436
-                 * @since 1.5.9
437
-                 *
438
-                 * @param string $pagination_info Extra pagination info content.
439
-                 * @param string $listing_type_name Listing results type.
440
-                 * @param string $start_no First result number.
441
-                 * @param string $end_no Last result number.
442
-                 * @param string $numposts Total number of listings.
443
-                 * @param string $post_type The post type.
444
-                 */
445
-                $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
425
+			if ($geodir_pagination_more_info != '') {
426
+				if ($listing_type_name) {
427
+					$listing_type_name = __($listing_type_name, 'geodirectory');
428
+					$pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts);
429
+				} else {
430
+					$pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
431
+				}
432
+				$pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
433
+				/**
434
+				 * Adds an extra pagination info above/under pagination.
435
+				 *
436
+				 * @since 1.5.9
437
+				 *
438
+				 * @param string $pagination_info Extra pagination info content.
439
+				 * @param string $listing_type_name Listing results type.
440
+				 * @param string $start_no First result number.
441
+				 * @param string $end_no Last result number.
442
+				 * @param string $numposts Total number of listings.
443
+				 * @param string $post_type The post type.
444
+				 */
445
+				$pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
446 446
                 
447
-                if ($geodir_pagination_more_info == 'before') {
448
-                    $before = $before . $pagination_info;
449
-                } else if ($geodir_pagination_more_info == 'after') {
450
-                    $after = $pagination_info . $after;
451
-                }
452
-            }
447
+				if ($geodir_pagination_more_info == 'before') {
448
+					$before = $before . $pagination_info;
449
+				} else if ($geodir_pagination_more_info == 'after') {
450
+					$after = $pagination_info . $after;
451
+				}
452
+			}
453 453
             
454
-            echo "$before <div class='Navi gd-navi'>";
455
-            if ($paged >= ($pages_to_show - 1)) {
456
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
457
-            }
458
-            previous_posts_link($prelabel);
459
-            for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
460
-                if ($i >= 1 && $i <= $max_page) {
461
-                    if ($i == $paged) {
462
-                        echo "<strong class='on'>$i</strong>";
463
-                    } else {
464
-                        echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
465
-                    }
466
-                }
467
-            }
468
-            next_posts_link($nxtlabel, $max_page);
469
-            if (($paged + $half_pages_to_show) < ($max_page)) {
470
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
471
-            }
472
-            echo "</div> $after";
473
-        }
454
+			echo "$before <div class='Navi gd-navi'>";
455
+			if ($paged >= ($pages_to_show - 1)) {
456
+				echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
457
+			}
458
+			previous_posts_link($prelabel);
459
+			for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
460
+				if ($i >= 1 && $i <= $max_page) {
461
+					if ($i == $paged) {
462
+						echo "<strong class='on'>$i</strong>";
463
+					} else {
464
+						echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
465
+					}
466
+				}
467
+			}
468
+			next_posts_link($nxtlabel, $max_page);
469
+			if (($paged + $half_pages_to_show) < ($max_page)) {
470
+				echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
471
+			}
472
+			echo "</div> $after";
473
+		}
474 474
         
475
-        if (function_exists('geodir_location_geo_home_link')) {
476
-            add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
477
-        }
478
-    }
475
+		if (function_exists('geodir_location_geo_home_link')) {
476
+			add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
477
+		}
478
+	}
479 479
 }
480 480
 
481 481
 /**
@@ -486,20 +486,20 @@  discard block
 block discarded – undo
486 486
  */
487 487
 function geodir_listingsearch_scripts()
488 488
 {
489
-    if (get_option('gd_search_dist') != '') {
490
-        $dist = get_option('gd_search_dist');
491
-    } else {
492
-        $dist = 500;
493
-    }
494
-    $dist_dif = 1000;
495
-
496
-    if ($dist <= 5000) $dist_dif = 500;
497
-    if ($dist <= 1000) $dist_dif = 100;
498
-    if ($dist <= 500) $dist_dif = 50;
499
-    if ($dist <= 100) $dist_dif = 10;
500
-    if ($dist <= 50) $dist_dif = 5;
501
-
502
-    ?>
489
+	if (get_option('gd_search_dist') != '') {
490
+		$dist = get_option('gd_search_dist');
491
+	} else {
492
+		$dist = 500;
493
+	}
494
+	$dist_dif = 1000;
495
+
496
+	if ($dist <= 5000) $dist_dif = 500;
497
+	if ($dist <= 1000) $dist_dif = 100;
498
+	if ($dist <= 500) $dist_dif = 50;
499
+	if ($dist <= 100) $dist_dif = 10;
500
+	if ($dist <= 50) $dist_dif = 5;
501
+
502
+	?>
503 503
     <script type="text/javascript">
504 504
 
505 505
         jQuery(function ($) {
@@ -557,20 +557,20 @@  discard block
 block discarded – undo
557 557
  * @package GeoDirectory
558 558
  */
559 559
 function geodir_add_sharelocation_scripts() {
560
-    $default_search_for_text = SEARCH_FOR_TEXT;
561
-    if (get_option('geodir_search_field_default_text'))
562
-        $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
560
+	$default_search_for_text = SEARCH_FOR_TEXT;
561
+	if (get_option('geodir_search_field_default_text'))
562
+		$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
563 563
 
564
-    $default_near_text = NEAR_TEXT;
565
-    if (get_option('geodir_near_field_default_text'))
566
-        $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
564
+	$default_near_text = NEAR_TEXT;
565
+	if (get_option('geodir_near_field_default_text'))
566
+		$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
567 567
     
568
-    $search_location = geodir_get_default_location();
568
+	$search_location = geodir_get_default_location();
569 569
     
570
-    $default_search_for_text = addslashes(stripslashes($default_search_for_text));
571
-    $default_near_text = addslashes(stripslashes($default_near_text));
572
-    $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : '';
573
-    ?>
570
+	$default_search_for_text = addslashes(stripslashes($default_search_for_text));
571
+	$default_near_text = addslashes(stripslashes($default_near_text));
572
+	$city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : '';
573
+	?>
574 574
     <script type="text/javascript">
575 575
         var default_location = '<?php echo $city ;?>';
576 576
         var latlng;
@@ -651,14 +651,14 @@  discard block
 block discarded – undo
651 651
                     initialise2();
652 652
                 } else {
653 653
                     <?php
654
-                    $near_add = get_option('geodir_search_near_addition');
655
-                    /**
656
-                     * Adds any extra info to the near search box query when trying to geolocate it via google api.
657
-                     *
658
-                     * @since 1.0.0
659
-                     */
660
-                    $near_add2 = apply_filters('geodir_search_near_addition', '');
661
-                    ?>
654
+					$near_add = get_option('geodir_search_near_addition');
655
+					/**
656
+					 * Adds any extra info to the near search box query when trying to geolocate it via google api.
657
+					 *
658
+					 * @since 1.0.0
659
+					 */
660
+					$near_add2 = apply_filters('geodir_search_near_addition', '');
661
+					?>
662 662
                     if (window.gdMaps === 'google') {
663 663
                         Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>},
664 664
                             function (results, status) {
@@ -772,32 +772,32 @@  discard block
 block discarded – undo
772 772
  */
773 773
 function geodir_show_badges_on_image($which, $post, $link)
774 774
 {
775
-    $return = '';
776
-    switch ($which) {
777
-        case 'featured':
778
-            /**
779
-             * Filter the featured image badge html that appears in the listings pages over the thumbnail.
780
-             *
781
-             * @since 1.0.0
782
-             * @param object $post The post object.
783
-             * @param string $link The link to the post.
784
-             */
785
-            $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
786
-            break;
787
-        case 'new' :
788
-            /**
789
-             * Filter the new image badge html that appears in the listings pages over the thumbnail.
790
-             *
791
-             * @since 1.0.0
792
-             * @param object $post The post object.
793
-             * @param string $link The link to the post.
794
-             */
795
-            $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
796
-            break;
797
-
798
-    }
775
+	$return = '';
776
+	switch ($which) {
777
+		case 'featured':
778
+			/**
779
+			 * Filter the featured image badge html that appears in the listings pages over the thumbnail.
780
+			 *
781
+			 * @since 1.0.0
782
+			 * @param object $post The post object.
783
+			 * @param string $link The link to the post.
784
+			 */
785
+			$return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
786
+			break;
787
+		case 'new' :
788
+			/**
789
+			 * Filter the new image badge html that appears in the listings pages over the thumbnail.
790
+			 *
791
+			 * @since 1.0.0
792
+			 * @param object $post The post object.
793
+			 * @param string $link The link to the post.
794
+			 */
795
+			$return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
796
+			break;
797
+
798
+	}
799 799
     
800
-    return $return;
800
+	return $return;
801 801
 }
802 802
 
803 803
 /**
@@ -806,8 +806,8 @@  discard block
 block discarded – undo
806 806
  * @since 1.6.22
807 807
  */
808 808
 function geodir_fix_script_conflict() {
809
-    if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) {
810
-        wp_dequeue_script( 'flexslider' );
811
-    }
809
+	if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) {
810
+		wp_dequeue_script( 'flexslider' );
811
+	}
812 812
 }
813 813
 add_action( 'wp_enqueue_scripts', 'geodir_fix_script_conflict', 100 );
814 814
\ No newline at end of file
Please login to merge, or discard this patch.