Passed
Pull Request — master (#228)
by Viruthagiri
10:20
created
geodirectory-templates/listing-success.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Template for the success page after submitting a listing
4
- *
5
- * You can make most changes via hooks or see the link below for info on how to replace the template in your theme.
6
- *
7
- * @link http://docs.wpgeodirectory.com/customizing-geodirectory-templates/
8
- * @since 1.0.0
9
- * @package GeoDirectory
10
- */
3
+		 * Template for the success page after submitting a listing
4
+		 *
5
+		 * You can make most changes via hooks or see the link below for info on how to replace the template in your theme.
6
+		 *
7
+		 * @link http://docs.wpgeodirectory.com/customizing-geodirectory-templates/
8
+		 * @since 1.0.0
9
+		 * @package GeoDirectory
10
+		 */
11 11
 
12 12
 // call header
13 13
 get_header();
Please login to merge, or discard this patch.
geodirectory_template_tags.php 3 patches
Braces   +38 added lines, -20 removed lines patch added patch discarded remove patch
@@ -245,13 +245,14 @@  discard block
 block discarded – undo
245 245
  */
246 246
 function geodir_add_async_forscript($url)
247 247
 {
248
-    if (strpos($url, '#asyncload')===false)
249
-        return $url;
250
-    else if (is_admin())
251
-        return str_replace('#asyncload', '', $url);
252
-    else
253
-        return str_replace('#asyncload', '', $url)."' async='async";
254
-}
248
+    if (strpos($url, '#asyncload')===false) {
249
+            return $url;
250
+    } else if (is_admin()) {
251
+            return str_replace('#asyncload', '', $url);
252
+    } else {
253
+            return str_replace('#asyncload', '', $url)."' async='async";
254
+    }
255
+    }
255 256
 add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
256 257
 
257 258
 /**
@@ -298,7 +299,7 @@  discard block
 block discarded – undo
298 299
         wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
299 300
         wp_enqueue_style('geodir-chosen-style');
300 301
 
301
-    }else{
302
+    } else{
302 303
         wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
303 304
         wp_enqueue_style('geodir-core-scss');
304 305
 
@@ -359,8 +360,10 @@  discard block
 block discarded – undo
359 360
 
360 361
     $half_pages_to_show = round($pages_to_show / 2);
361 362
 
362
-    if (geodir_is_page('home') || (get_option('geodir_set_as_home') && is_home())) // dont apply default  pagination for geodirectory home page.
363
-        return;
363
+    if (geodir_is_page('home') || (get_option('geodir_set_as_home') && is_home())) {
364
+    	// dont apply default  pagination for geodirectory home page.
365
+        return;
366
+    }
364 367
 
365 368
     if (!is_single()) {
366 369
 		if (function_exists('geodir_location_geo_home_link')) {
@@ -433,11 +436,21 @@  discard block
 block discarded – undo
433 436
     }
434 437
     $dist_dif = 1000;
435 438
 
436
-    if ($dist <= 5000) $dist_dif = 500;
437
-    if ($dist <= 1000) $dist_dif = 100;
438
-    if ($dist <= 500) $dist_dif = 50;
439
-    if ($dist <= 100) $dist_dif = 10;
440
-    if ($dist <= 50) $dist_dif = 5;
439
+    if ($dist <= 5000) {
440
+    	$dist_dif = 500;
441
+    }
442
+    if ($dist <= 1000) {
443
+    	$dist_dif = 100;
444
+    }
445
+    if ($dist <= 500) {
446
+    	$dist_dif = 50;
447
+    }
448
+    if ($dist <= 100) {
449
+    	$dist_dif = 10;
450
+    }
451
+    if ($dist <= 50) {
452
+    	$dist_dif = 5;
453
+    }
441 454
 
442 455
     ?>
443 456
     <script type="text/javascript">
@@ -499,18 +512,23 @@  discard block
 block discarded – undo
499 512
 {
500 513
 
501 514
     $default_search_for_text = SEARCH_FOR_TEXT;
502
-    if (get_option('geodir_search_field_default_text'))
503
-        $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
515
+    if (get_option('geodir_search_field_default_text')) {
516
+            $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
517
+    }
504 518
 
505 519
     $default_near_text = NEAR_TEXT;
506
-    if (get_option('geodir_near_field_default_text'))
507
-        $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
520
+    if (get_option('geodir_near_field_default_text')) {
521
+            $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
522
+    }
508 523
 
509 524
     ?>
510 525
 
511 526
 
512 527
     <script type="text/javascript">
513
-        var default_location = '<?php if($search_location = geodir_get_default_location())  echo $search_location->city ;?>';
528
+        var default_location = '<?php if($search_location = geodir_get_default_location()) {
529
+	echo $search_location->city ;
530
+}
531
+?>';
514 532
         var latlng;
515 533
         var Sgeocoder;
516 534
         var address;
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 {
38 38
     $is_detail_page = false;
39 39
 
40
-    if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
40
+    if ((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview'))) {
41 41
         $is_detail_page = true;
42 42
     }
43 43
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         'siteurl' => get_option('siteurl'),
52 52
         'geodir_plugin_url' => geodir_plugin_url(),
53 53
         'geodir_ajax_url' => geodir_get_ajax_url(),
54
-        'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
54
+        'geodir_gd_modal' => (int) get_option('geodir_disable_gb_modal'),
55 55
         'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
56 56
     );
57 57
 
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
      *
73 73
      * }
74 74
      */
75
-    $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
75
+    $geodir_vars_data = apply_filters('geodir_vars_data', $geodir_vars_data);
76 76
 
77 77
     wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
78 78
 
79
-    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
80
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
79
+    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION, true);
80
+    if ($is_detail_page) {wp_enqueue_script('geodirectory-jquery-flexslider-js'); }
81 81
 
82
-    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
82
+    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION, true);
83 83
     wp_enqueue_script('geodirectory-lightbox-jquery');
84 84
 
85
-    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
85
+    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION, true);
86 86
     if ($is_detail_page) {
87 87
         wp_enqueue_script('geodirectory-jquery-simplemodal');
88 88
     }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     $map_extra = apply_filters('geodir_googlemap_script_extra', '');
100 100
     wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
101 101
     
102
-    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
102
+    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
103 103
     wp_enqueue_script('geodirectory-goMap-script');
104 104
 
105 105
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         wp_enqueue_script('plupload-all');
117 117
         wp_enqueue_script('jquery-ui-sortable');
118 118
 
119
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
119
+        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
120 120
         wp_enqueue_script('geodirectory-plupload-script');
121 121
         // SCRIPT FOR UPLOAD END
122 122
 
@@ -229,12 +229,12 @@  discard block
 block discarded – undo
229 229
  */
230 230
 function geodir_add_async_forscript($url)
231 231
 {
232
-    if (strpos($url, '#asyncload')===false)
232
+    if (strpos($url, '#asyncload') === false)
233 233
         return $url;
234 234
     else if (is_admin())
235 235
         return str_replace('#asyncload', '', $url);
236 236
     else
237
-        return str_replace('#asyncload', '', $url)."' async='async";
237
+        return str_replace('#asyncload', '', $url) . "' async='async";
238 238
 }
239 239
 add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
240 240
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 {
249 249
 
250 250
 
251
-    if(get_option('geodir_scss_core')) {
251
+    if (get_option('geodir_scss_core')) {
252 252
 
253 253
 
254 254
         wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
         wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
283 283
         wp_enqueue_style('geodir-chosen-style');
284 284
 
285
-    }else{
285
+    } else {
286 286
         wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
287 287
         wp_enqueue_style('geodir-core-scss');
288 288
 
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 
291 291
     }
292 292
 
293
-    if(is_rtl()){
293
+    if (is_rtl()) {
294 294
     wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
295 295
     wp_enqueue_style('geodirectory-frontend-rtl-style');
296 296
     }
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
                 $term_id = get_queried_object_id();
366 366
                 $taxonomy = get_query_var('taxonomy');
367 367
 
368
-                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
368
+                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category') {
369 369
                     $term = get_term($term_id, $post_type . 'category');
370 370
                 }
371 371
             }
@@ -374,9 +374,9 @@  discard block
 block discarded – undo
374 374
                 $taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
375 375
                 
376 376
                 if (!is_array($taxonomy_search)) {
377
-                    $term = get_term((int)$taxonomy_search, $post_type . 'category');
378
-                } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
379
-                    $term = get_term((int)$taxonomy_search[0], $post_type . 'category');
377
+                    $term = get_term((int) $taxonomy_search, $post_type . 'category');
378
+                } else if (is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
379
+                    $term = get_term((int) $taxonomy_search[0], $post_type . 'category');
380 380
                 }
381 381
             }
382 382
             
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
         if ($max_page > 1 || $always_show) {            
389 389
             // Extra pagination info
390 390
             $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
391
-            $start_no = ( $paged - 1 ) * $posts_per_page + 1;
391
+            $start_no = ($paged - 1) * $posts_per_page + 1;
392 392
             $end_no = min($paged * $posts_per_page, $numposts);
393 393
 
394 394
             if ($geodir_pagination_more_info != '') {
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
         jQuery(function ($) {
475 475
             $("#distance_slider").slider({
476 476
                 range: true,
477
-                values: [0, <?php echo ($_REQUEST['sdist']!='') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>],
477
+                values: [0, <?php echo ($_REQUEST['sdist'] != '') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>],
478 478
                 min: 0,
479 479
                 max: <?php echo $dist; ?>,
480 480
                 step: <?php echo $dist_dif; ?>,
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 
540 540
 
541 541
     <script type="text/javascript">
542
-        var default_location = '<?php if($search_location = geodir_get_default_location())  echo $search_location->city ;?>';
542
+        var default_location = '<?php if ($search_location = geodir_get_default_location())  echo $search_location->city; ?>';
543 543
         var latlng;
544 544
         var Sgeocoder;
545 545
         var address;
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 				var $form = jQuery(this).closest('form');
553 553
 				
554 554
 				if (jQuery("#sdist input[type='radio']:checked").length != 0) dist = jQuery("#sdist input[type='radio']:checked").val();
555
-				if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text;?>') jQuery('.search_text', $form).val(s);
555
+				if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text; ?>') jQuery('.search_text', $form).val(s);
556 556
 				
557 557
 				// Disable location based search for disabled location post type.
558 558
 				if (jQuery('.search_by_post', $form).val() != '' && typeof gd_cpt_no_location == 'function') {
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 					}
567 567
 				}
568 568
 				
569
-				if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text;?>')) {
569
+				if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text; ?>')) {
570 570
 					geodir_setsearch($form);
571 571
 				} else {
572 572
 					jQuery(".snear", $form).val('');
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 		});
587 587
         
588 588
 		function geodir_setsearch($form) {
589
-			if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text;?>')) jQuery(".snear", $form).val(default_location);
589
+			if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text; ?>')) jQuery(".snear", $form).val(default_location);
590 590
 			geocodeAddress($form);
591 591
 		}
592 592
 
@@ -599,8 +599,8 @@  discard block
 block discarded – undo
599 599
         function geocodeAddress($form) {
600 600
             Sgeocoder = new google.maps.Geocoder(); // Call the geocode function
601 601
 
602
-            if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != ''  ) || jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) {
603
-                if (jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) {
602
+            if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != ''  ) || jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) {
603
+                if (jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) {
604 604
                     jQuery(".snear", $form).val('');
605 605
                 }
606 606
                 jQuery($form).submit();
@@ -608,24 +608,24 @@  discard block
 block discarded – undo
608 608
 
609 609
                 var address = jQuery(".snear", $form).val();
610 610
 
611
-                if (jQuery('.snear', $form).val() == '<?php echo $default_near_text;?>') {
611
+                if (jQuery('.snear', $form).val() == '<?php echo $default_near_text; ?>') {
612 612
                     initialise2();
613 613
                 } else {
614 614
 
615 615
                     Sgeocoder.geocode({'address': address<?php
616
-                    if($near_add = get_option('geodir_search_near_addition')){echo '+", '.$near_add.'"';}
617
-                    if($near_add2 =
616
+                    if ($near_add = get_option('geodir_search_near_addition')) {echo '+", ' . $near_add . '"'; }
617
+                    if ($near_add2 =
618 618
                     /**
619 619
                      * Adds any extra info to the near search box query when trying to geolocate it via google api.
620 620
                      *
621 621
                      * @since 1.0.0
622 622
                      */
623
-                    apply_filters('geodir_search_near_addition','')){echo $near_add2;}//gt_advanced_near_search();?>},
623
+                    apply_filters('geodir_search_near_addition', '')) {echo $near_add2; }//gt_advanced_near_search();?>},
624 624
                         function (results, status) {
625 625
                             if (status == google.maps.GeocoderStatus.OK) {
626 626
                                 updateSearchPosition(results[0].geometry.location, $form);
627 627
                             } else {
628
-                                alert("<?php _e('Search was not successful for the following reason:','geodirectory');?>" + status);
628
+                                alert("<?php _e('Search was not successful for the following reason:', 'geodirectory'); ?>" + status);
629 629
                             }
630 630
                         });
631 631
                 }
@@ -656,19 +656,19 @@  discard block
 block discarded – undo
656 656
             var msg;
657 657
             switch (err.code) {
658 658
                 case err.UNKNOWN_ERROR:
659
-                    msg = "<?php _e('Unable to find your location','geodirectory');?>";
659
+                    msg = "<?php _e('Unable to find your location', 'geodirectory'); ?>";
660 660
                     break;
661 661
                 case err.PERMISSION_DENINED:
662
-                    msg = "<?php _e('Permission denied in finding your location','geodirectory');?>";
662
+                    msg = "<?php _e('Permission denied in finding your location', 'geodirectory'); ?>";
663 663
                     break;
664 664
                 case err.POSITION_UNAVAILABLE:
665
-                    msg = "<?php _e('Your location is currently unknown','geodirectory');?>";
665
+                    msg = "<?php _e('Your location is currently unknown', 'geodirectory'); ?>";
666 666
                     break;
667 667
                 case err.BREAK:
668
-                    msg = "<?php _e('Attempt to find location took too long','geodirectory');?>";
668
+                    msg = "<?php _e('Attempt to find location took too long', 'geodirectory'); ?>";
669 669
                     break;
670 670
                 default:
671
-                    msg = "<?php _e('Location detection not supported in browser','geodirectory');?>";
671
+                    msg = "<?php _e('Location detection not supported in browser', 'geodirectory'); ?>";
672 672
             }
673 673
             jQuery('#info').html(msg);
674 674
         }
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
              * @param object $post The post object.
710 710
              * @param string $link The link to the post.
711 711
              */
712
-            $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
712
+            $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>', $post, $link);
713 713
             break;
714 714
         case 'new' :
715 715
             /**
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
              * @param object $post The post object.
720 720
              * @param string $link The link to the post.
721 721
              */
722
-            $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
722
+            $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>', $post, $link);
723 723
             break;
724 724
 
725 725
     }
Please login to merge, or discard this patch.
Indentation   +336 added lines, -336 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Template tag functions.
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+	 * Template tag functions.
4
+	 *
5
+	 * @since 1.0.0
6
+	 * @package GeoDirectory
7
+	 */
8 8
 
9 9
 /**
10 10
  * Contains all map related templates used by the plugin.
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function geodir_core_dequeue_script()
24 24
 {
25
-    wp_dequeue_script('flexslider');
25
+	wp_dequeue_script('flexslider');
26 26
 }
27 27
 
28 28
 add_action('wp_print_scripts', 'geodir_core_dequeue_script', 100);
@@ -35,143 +35,143 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function geodir_templates_scripts()
37 37
 {
38
-    $is_detail_page = false;
39
-
40
-    if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
41
-        $is_detail_page = true;
42
-    }
43
-
44
-    wp_enqueue_script('jquery');
45
-
46
-    wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js#asyncload', array(), GEODIRECTORY_VERSION);
47
-    wp_enqueue_script('geodirectory-script');
48
-
49
-
50
-    $geodir_vars_data = array(
51
-        'siteurl' => get_option('siteurl'),
52
-        'geodir_plugin_url' => geodir_plugin_url(),
53
-        'geodir_ajax_url' => geodir_get_ajax_url(),
54
-        'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
55
-        'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
56
-    );
57
-
58
-    /**
59
-     * Filter the `geodir_var` data array that outputs the  wp_localize_script() translations and variables.
60
-     *
61
-     * This is used by addons to add JS translatable variables.
62
-     *
63
-     * @since 1.4.4
64
-     * @param array $geodir_vars_data {
65
-     *    geodir var data used by addons to add JS translatable variables.
66
-     *
67
-     *    @type string $siteurl Site url.
68
-     *    @type string $geodir_plugin_url Geodirectory core plugin url.
69
-     *    @type string $geodir_ajax_url Geodirectory plugin ajax url.
70
-     *    @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?.
71
-     *    @type int $is_rtl Checks if current locale is RTL.
72
-     *
73
-     * }
74
-     */
75
-    $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
76
-
77
-    wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
78
-
79
-    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
80
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
81
-
82
-    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
83
-    wp_enqueue_script('geodirectory-lightbox-jquery');
84
-
85
-    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
86
-    if ($is_detail_page) {
87
-        wp_enqueue_script('geodirectory-jquery-simplemodal');
88
-    }
89
-
90
-    $map_lang = "&language=" . geodir_get_map_default_language();
91
-    /**
92
-     * Filter the variables that are added to the end of the google maps script call.
93
-     *
94
-     * This i used to change things like google maps language etc.
95
-     *
96
-     * @since 1.0.0
97
-     * @param string $var The string to filter, default is empty string.
98
-     */
99
-    $map_extra = apply_filters('geodir_googlemap_script_extra', '');
100
-    wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
38
+	$is_detail_page = false;
39
+
40
+	if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
41
+		$is_detail_page = true;
42
+	}
43
+
44
+	wp_enqueue_script('jquery');
45
+
46
+	wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js#asyncload', array(), GEODIRECTORY_VERSION);
47
+	wp_enqueue_script('geodirectory-script');
48
+
49
+
50
+	$geodir_vars_data = array(
51
+		'siteurl' => get_option('siteurl'),
52
+		'geodir_plugin_url' => geodir_plugin_url(),
53
+		'geodir_ajax_url' => geodir_get_ajax_url(),
54
+		'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
55
+		'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
56
+	);
57
+
58
+	/**
59
+	 * Filter the `geodir_var` data array that outputs the  wp_localize_script() translations and variables.
60
+	 *
61
+	 * This is used by addons to add JS translatable variables.
62
+	 *
63
+	 * @since 1.4.4
64
+	 * @param array $geodir_vars_data {
65
+	 *    geodir var data used by addons to add JS translatable variables.
66
+	 *
67
+	 *    @type string $siteurl Site url.
68
+	 *    @type string $geodir_plugin_url Geodirectory core plugin url.
69
+	 *    @type string $geodir_ajax_url Geodirectory plugin ajax url.
70
+	 *    @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?.
71
+	 *    @type int $is_rtl Checks if current locale is RTL.
72
+	 *
73
+	 * }
74
+	 */
75
+	$geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
76
+
77
+	wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
78
+
79
+	wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
80
+	if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
81
+
82
+	wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
83
+	wp_enqueue_script('geodirectory-lightbox-jquery');
84
+
85
+	wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
86
+	if ($is_detail_page) {
87
+		wp_enqueue_script('geodirectory-jquery-simplemodal');
88
+	}
89
+
90
+	$map_lang = "&language=" . geodir_get_map_default_language();
91
+	/**
92
+	 * Filter the variables that are added to the end of the google maps script call.
93
+	 *
94
+	 * This i used to change things like google maps language etc.
95
+	 *
96
+	 * @since 1.0.0
97
+	 * @param string $var The string to filter, default is empty string.
98
+	 */
99
+	$map_extra = apply_filters('geodir_googlemap_script_extra', '');
100
+	wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
101 101
     
102
-    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
103
-    wp_enqueue_script('geodirectory-goMap-script');
104
-
105
-
106
-    wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
107
-    wp_enqueue_script('chosen');
108
-
109
-    wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
110
-    wp_enqueue_script('geodirectory-choose-ajax');
111
-
112
-    wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js#asyncload', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
113
-
114
-    if (is_page() && geodir_is_page('add-listing')) {
115
-        // SCRIPT FOR UPLOAD
116
-        wp_enqueue_script('plupload-all');
117
-        wp_enqueue_script('jquery-ui-sortable');
118
-
119
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
120
-        wp_enqueue_script('geodirectory-plupload-script');
121
-        // SCRIPT FOR UPLOAD END
122
-
123
-        // 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
124
-        if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
125
-            $ajax_url = admin_url('admin-ajax.php');
126
-        } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
127
-            $ajax_url = admin_url('admin-ajax.php');
128
-        } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
129
-            $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
130
-        } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
131
-            $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
132
-        } else {
133
-            $ajax_url = admin_url('admin-ajax.php');
134
-        }
102
+	wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
103
+	wp_enqueue_script('geodirectory-goMap-script');
104
+
105
+
106
+	wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
107
+	wp_enqueue_script('chosen');
108
+
109
+	wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
110
+	wp_enqueue_script('geodirectory-choose-ajax');
111
+
112
+	wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js#asyncload', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
113
+
114
+	if (is_page() && geodir_is_page('add-listing')) {
115
+		// SCRIPT FOR UPLOAD
116
+		wp_enqueue_script('plupload-all');
117
+		wp_enqueue_script('jquery-ui-sortable');
118
+
119
+		wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
120
+		wp_enqueue_script('geodirectory-plupload-script');
121
+		// SCRIPT FOR UPLOAD END
122
+
123
+		// 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
124
+		if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
125
+			$ajax_url = admin_url('admin-ajax.php');
126
+		} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
127
+			$ajax_url = admin_url('admin-ajax.php');
128
+		} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
129
+			$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
130
+		} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
131
+			$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
132
+		} else {
133
+			$ajax_url = admin_url('admin-ajax.php');
134
+		}
135 135
 
136
-        // place js config array for plupload
137
-        $plupload_init = array(
138
-            'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4',
139
-            'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
140
-            'container' => 'plupload-upload-ui', // will be adjusted per uploader
141
-            'drop_element' => 'dropbox', // will be adjusted per uploader
142
-            'file_data_name' => 'async-upload', // will be adjusted per uploader
143
-            'multiple_queues' => true,
144
-            'max_file_size' => geodir_max_upload_size(),
145
-            'url' => $ajax_url,
146
-            'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
147
-            'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
148
-            'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
149
-            'multipart' => true,
150
-            'urlstream_upload' => true,
151
-            'multi_selection' => false, // will be added per uploader
152
-            // additional post data to send to our ajax hook
153
-            'multipart_params' => array(
154
-                '_ajax_nonce' => "", // will be added per uploader
155
-                'action' => 'plupload_action', // the ajax action name
156
-                'imgid' => 0 // will be added per uploader
157
-            )
158
-        );
159
-        $base_plupload_config = json_encode($plupload_init);
160
-
161
-        $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
162
-            'upload_img_size' => geodir_max_upload_size());
163
-
164
-        wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
165
-
166
-        wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
167
-    } // End if for add place page
168
-
169
-    wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
170
-    if ($is_detail_page) {
136
+		// place js config array for plupload
137
+		$plupload_init = array(
138
+			'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4',
139
+			'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
140
+			'container' => 'plupload-upload-ui', // will be adjusted per uploader
141
+			'drop_element' => 'dropbox', // will be adjusted per uploader
142
+			'file_data_name' => 'async-upload', // will be adjusted per uploader
143
+			'multiple_queues' => true,
144
+			'max_file_size' => geodir_max_upload_size(),
145
+			'url' => $ajax_url,
146
+			'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
147
+			'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
148
+			'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
149
+			'multipart' => true,
150
+			'urlstream_upload' => true,
151
+			'multi_selection' => false, // will be added per uploader
152
+			// additional post data to send to our ajax hook
153
+			'multipart_params' => array(
154
+				'_ajax_nonce' => "", // will be added per uploader
155
+				'action' => 'plupload_action', // the ajax action name
156
+				'imgid' => 0 // will be added per uploader
157
+			)
158
+		);
159
+		$base_plupload_config = json_encode($plupload_init);
160
+
161
+		$gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
162
+			'upload_img_size' => geodir_max_upload_size());
163
+
164
+		wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
165
+
166
+		wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
167
+	} // End if for add place page
168
+
169
+	wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
170
+	if ($is_detail_page) {
171 171
 		wp_enqueue_script('geodirectory-post-custom-js');
172 172
 	}
173 173
 
174
-    // font awesome rating script
174
+	// font awesome rating script
175 175
 	if (get_option('geodir_reviewrating_enable_font_awesome')) {
176 176
 		wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
177 177
 		wp_enqueue_script('geodir-barrating-js');
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
 		wp_enqueue_script('geodir-jRating-js');
181 181
 	}
182 182
 
183
-    wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js#asyncload', array(), GEODIRECTORY_VERSION, true);
184
-    wp_enqueue_script('geodir-on-document-load');
183
+	wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js#asyncload', array(), GEODIRECTORY_VERSION, true);
184
+	wp_enqueue_script('geodir-on-document-load');
185 185
 
186
-    wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
187
-    wp_enqueue_script('google-geometa');
186
+	wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
187
+	wp_enqueue_script('google-geometa');
188 188
 }
189 189
 
190 190
 /**
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
  */
199 199
 function geodir_header_scripts()
200 200
 {
201
-    echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
202
-    echo stripslashes(get_option('geodir_header_scripts'));
201
+	echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
202
+	echo stripslashes(get_option('geodir_header_scripts'));
203 203
 }
204 204
 
205 205
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 function geodir_footer_scripts()
216 216
 {	
217 217
 	echo stripslashes(get_option('geodir_ga_tracking_code'));
218
-    echo stripslashes(get_option('geodir_footer_scripts'));
218
+	echo stripslashes(get_option('geodir_footer_scripts'));
219 219
 }
220 220
 
221 221
 
@@ -229,12 +229,12 @@  discard block
 block discarded – undo
229 229
  */
230 230
 function geodir_add_async_forscript($url)
231 231
 {
232
-    if (strpos($url, '#asyncload')===false)
233
-        return $url;
234
-    else if (is_admin())
235
-        return str_replace('#asyncload', '', $url);
236
-    else
237
-        return str_replace('#asyncload', '', $url)."' async='async";
232
+	if (strpos($url, '#asyncload')===false)
233
+		return $url;
234
+	else if (is_admin())
235
+		return str_replace('#asyncload', '', $url);
236
+	else
237
+		return str_replace('#asyncload', '', $url)."' async='async";
238 238
 }
239 239
 add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
240 240
 
@@ -248,55 +248,55 @@  discard block
 block discarded – undo
248 248
 {
249 249
 
250 250
 
251
-    if(get_option('geodir_scss_core')) {
251
+	if(get_option('geodir_scss_core')) {
252 252
 
253 253
 
254
-        wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
255
-        wp_enqueue_style('geodirectory-frontend-style');
254
+		wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
255
+		wp_enqueue_style('geodirectory-frontend-style');
256 256
 
257
-        wp_register_style('geodirectory-media-style', geodir_plugin_url() . '/geodirectory-assets/css/media.css', array(), GEODIRECTORY_VERSION);
258
-        wp_enqueue_style('geodirectory-media-style');
257
+		wp_register_style('geodirectory-media-style', geodir_plugin_url() . '/geodirectory-assets/css/media.css', array(), GEODIRECTORY_VERSION);
258
+		wp_enqueue_style('geodirectory-media-style');
259 259
 
260 260
 
261
-        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
262
-        wp_enqueue_style('geodirectory-jquery-ui-css');
261
+		wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
262
+		wp_enqueue_style('geodirectory-jquery-ui-css');
263 263
 
264
-        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
265
-        wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
264
+		wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
265
+		wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
266 266
 
267
-        wp_register_style('geodirectory-flexslider-css', geodir_plugin_url() . '/geodirectory-assets/css/flexslider.css', array(), GEODIRECTORY_VERSION);
268
-        wp_enqueue_style('geodirectory-flexslider-css');
267
+		wp_register_style('geodirectory-flexslider-css', geodir_plugin_url() . '/geodirectory-assets/css/flexslider.css', array(), GEODIRECTORY_VERSION);
268
+		wp_enqueue_style('geodirectory-flexslider-css');
269 269
 
270
-        wp_register_style('geodirectory-thic-box-css', geodir_plugin_url() . '/geodirectory-assets/css/thic-box.css', array(), GEODIRECTORY_VERSION);
271
-        wp_enqueue_style('geodirectory-thic-box-css');
270
+		wp_register_style('geodirectory-thic-box-css', geodir_plugin_url() . '/geodirectory-assets/css/thic-box.css', array(), GEODIRECTORY_VERSION);
271
+		wp_enqueue_style('geodirectory-thic-box-css');
272 272
 
273
-        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
274
-        wp_enqueue_style('geodirectory-pluplodar-css');
273
+		wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
274
+		wp_enqueue_style('geodirectory-pluplodar-css');
275 275
 
276
-        wp_register_style('geodirectory-lightbox-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.lightbox-0.5.css', array(), GEODIRECTORY_VERSION);
277
-        wp_enqueue_style('geodirectory-lightbox-css');
276
+		wp_register_style('geodirectory-lightbox-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.lightbox-0.5.css', array(), GEODIRECTORY_VERSION);
277
+		wp_enqueue_style('geodirectory-lightbox-css');
278 278
 
279
-        wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
280
-        wp_enqueue_style('geodir-rating-style');
279
+		wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
280
+		wp_enqueue_style('geodir-rating-style');
281 281
 
282
-        wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
283
-        wp_enqueue_style('geodir-chosen-style');
282
+		wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
283
+		wp_enqueue_style('geodir-chosen-style');
284 284
 
285
-    }else{
286
-        wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
287
-        wp_enqueue_style('geodir-core-scss');
285
+	}else{
286
+		wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
287
+		wp_enqueue_style('geodir-core-scss');
288 288
 
289
-        wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
289
+		wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
290 290
 
291
-    }
291
+	}
292 292
 
293
-    if(is_rtl()){
294
-    wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
295
-    wp_enqueue_style('geodirectory-frontend-rtl-style');
296
-    }
293
+	if(is_rtl()){
294
+	wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
295
+	wp_enqueue_style('geodirectory-frontend-rtl-style');
296
+	}
297 297
 
298
-    wp_register_style('geodirectory-font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
299
-    wp_enqueue_style('geodirectory-font-awesome');
298
+	wp_register_style('geodirectory-font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
299
+	wp_enqueue_style('geodirectory-font-awesome');
300 300
 
301 301
 
302 302
 }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
  */
311 311
 function geodir_get_sidebar()
312 312
 {
313
-    get_sidebar('geodirectory');
313
+	get_sidebar('geodirectory');
314 314
 }
315 315
 
316 316
 /**
@@ -329,122 +329,122 @@  discard block
 block discarded – undo
329 329
  * @param bool $always_show Do you want to show the pagination always? Default: false.
330 330
  */
331 331
 function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) {
332
-    global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
332
+	global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
333 333
 
334
-    if (empty($prelabel)) {
335
-        $prelabel = '<strong>&laquo;</strong>';
336
-    }
334
+	if (empty($prelabel)) {
335
+		$prelabel = '<strong>&laquo;</strong>';
336
+	}
337 337
 
338
-    if (empty($nxtlabel)) {
339
-        $nxtlabel = '<strong>&raquo;</strong>';
340
-    }
338
+	if (empty($nxtlabel)) {
339
+		$nxtlabel = '<strong>&raquo;</strong>';
340
+	}
341 341
 
342
-    $half_pages_to_show = round($pages_to_show / 2);
342
+	$half_pages_to_show = round($pages_to_show / 2);
343 343
 
344
-    if (geodir_is_page('home') || (get_option('geodir_set_as_home') && is_home())) // dont apply default  pagination for geodirectory home page.
345
-        return;
344
+	if (geodir_is_page('home') || (get_option('geodir_set_as_home') && is_home())) // dont apply default  pagination for geodirectory home page.
345
+		return;
346 346
 
347
-    if (!is_single()) {
348
-        if (function_exists('geodir_location_geo_home_link')) {
349
-            remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
350
-        }
351
-        $numposts = $wp_query->found_posts;
347
+	if (!is_single()) {
348
+		if (function_exists('geodir_location_geo_home_link')) {
349
+			remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
350
+		}
351
+		$numposts = $wp_query->found_posts;
352 352
 
353
-        $max_page = ceil($numposts / $posts_per_page);
353
+		$max_page = ceil($numposts / $posts_per_page);
354 354
 
355
-        if (empty($paged)) {
356
-            $paged = 1;
357
-        }
355
+		if (empty($paged)) {
356
+			$paged = 1;
357
+		}
358 358
         
359
-        $post_type = geodir_get_current_posttype();
360
-        $listing_type_name = get_post_type_plural_label($post_type);
361
-        if (geodir_is_page('listing') || geodir_is_page('search')) {            
362
-            $term = array();
359
+		$post_type = geodir_get_current_posttype();
360
+		$listing_type_name = get_post_type_plural_label($post_type);
361
+		if (geodir_is_page('listing') || geodir_is_page('search')) {            
362
+			$term = array();
363 363
             
364
-            if (is_tax()) {
365
-                $term_id = get_queried_object_id();
366
-                $taxonomy = get_query_var('taxonomy');
364
+			if (is_tax()) {
365
+				$term_id = get_queried_object_id();
366
+				$taxonomy = get_query_var('taxonomy');
367 367
 
368
-                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
369
-                    $term = get_term($term_id, $post_type . 'category');
370
-                }
371
-            }
368
+				if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
369
+					$term = get_term($term_id, $post_type . 'category');
370
+				}
371
+			}
372 372
             
373
-            if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
374
-                $taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
373
+			if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
374
+				$taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
375 375
                 
376
-                if (!is_array($taxonomy_search)) {
377
-                    $term = get_term((int)$taxonomy_search, $post_type . 'category');
378
-                } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
379
-                    $term = get_term((int)$taxonomy_search[0], $post_type . 'category');
380
-                }
381
-            }
376
+				if (!is_array($taxonomy_search)) {
377
+					$term = get_term((int)$taxonomy_search, $post_type . 'category');
378
+				} else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
379
+					$term = get_term((int)$taxonomy_search[0], $post_type . 'category');
380
+				}
381
+			}
382 382
             
383
-            if (!empty($term) && !is_wp_error($term)) {
384
-                $listing_type_name = $term->name;
385
-            }
386
-        }
383
+			if (!empty($term) && !is_wp_error($term)) {
384
+				$listing_type_name = $term->name;
385
+			}
386
+		}
387 387
 
388
-        if ($max_page > 1 || $always_show) {            
389
-            // Extra pagination info
390
-            $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
391
-            $start_no = ( $paged - 1 ) * $posts_per_page + 1;
392
-            $end_no = min($paged * $posts_per_page, $numposts);
388
+		if ($max_page > 1 || $always_show) {            
389
+			// Extra pagination info
390
+			$geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
391
+			$start_no = ( $paged - 1 ) * $posts_per_page + 1;
392
+			$end_no = min($paged * $posts_per_page, $numposts);
393 393
 
394
-            if ($geodir_pagination_more_info != '') {
395
-                if ($listing_type_name) {
396
-                    $listing_type_name = __($listing_type_name, 'geodirectory');
397
-                    $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts);
398
-                } else {
399
-                    $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
400
-                }
401
-                $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
402
-                /**
403
-                 * Adds an extra pagination info above/under pagination.
404
-                 *
405
-                 * @since 1.5.9
406
-                 *
407
-                 * @param string $pagination_info Extra pagination info content.
408
-                 * @param string $listing_type_name Listing results type.
409
-                 * @param string $start_no First result number.
410
-                 * @param string $end_no Last result number.
411
-                 * @param string $numposts Total number of listings.
412
-                 * @param string $post_type The post type.
413
-                 */
414
-                $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
394
+			if ($geodir_pagination_more_info != '') {
395
+				if ($listing_type_name) {
396
+					$listing_type_name = __($listing_type_name, 'geodirectory');
397
+					$pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts);
398
+				} else {
399
+					$pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
400
+				}
401
+				$pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
402
+				/**
403
+				 * Adds an extra pagination info above/under pagination.
404
+				 *
405
+				 * @since 1.5.9
406
+				 *
407
+				 * @param string $pagination_info Extra pagination info content.
408
+				 * @param string $listing_type_name Listing results type.
409
+				 * @param string $start_no First result number.
410
+				 * @param string $end_no Last result number.
411
+				 * @param string $numposts Total number of listings.
412
+				 * @param string $post_type The post type.
413
+				 */
414
+				$pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
415 415
                 
416
-                if ($geodir_pagination_more_info == 'before') {
417
-                    $before = $before . $pagination_info;
418
-                } else if ($geodir_pagination_more_info == 'after') {
419
-                    $after = $pagination_info . $after;
420
-                }
421
-            }
416
+				if ($geodir_pagination_more_info == 'before') {
417
+					$before = $before . $pagination_info;
418
+				} else if ($geodir_pagination_more_info == 'after') {
419
+					$after = $pagination_info . $after;
420
+				}
421
+			}
422 422
             
423
-            echo "$before <div class='Navi'>";
424
-            if ($paged >= ($pages_to_show - 1)) {
425
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
426
-            }
427
-            previous_posts_link($prelabel);
428
-            for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
429
-                if ($i >= 1 && $i <= $max_page) {
430
-                    if ($i == $paged) {
431
-                        echo "<strong class='on'>$i</strong>";
432
-                    } else {
433
-                        echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
434
-                    }
435
-                }
436
-            }
437
-            next_posts_link($nxtlabel, $max_page);
438
-            if (($paged + $half_pages_to_show) < ($max_page)) {
439
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
440
-            }
441
-            echo "</div> $after";
442
-        }
423
+			echo "$before <div class='Navi'>";
424
+			if ($paged >= ($pages_to_show - 1)) {
425
+				echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
426
+			}
427
+			previous_posts_link($prelabel);
428
+			for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
429
+				if ($i >= 1 && $i <= $max_page) {
430
+					if ($i == $paged) {
431
+						echo "<strong class='on'>$i</strong>";
432
+					} else {
433
+						echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
434
+					}
435
+				}
436
+			}
437
+			next_posts_link($nxtlabel, $max_page);
438
+			if (($paged + $half_pages_to_show) < ($max_page)) {
439
+				echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
440
+			}
441
+			echo "</div> $after";
442
+		}
443 443
         
444
-        if (function_exists('geodir_location_geo_home_link')) {
445
-            add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
446
-        }
447
-    }
444
+		if (function_exists('geodir_location_geo_home_link')) {
445
+			add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
446
+		}
447
+	}
448 448
 }
449 449
 
450 450
 /**
@@ -455,20 +455,20 @@  discard block
 block discarded – undo
455 455
  */
456 456
 function geodir_listingsearch_scripts()
457 457
 {
458
-    if (get_option('gd_search_dist') != '') {
459
-        $dist = get_option('gd_search_dist');
460
-    } else {
461
-        $dist = 500;
462
-    }
463
-    $dist_dif = 1000;
464
-
465
-    if ($dist <= 5000) $dist_dif = 500;
466
-    if ($dist <= 1000) $dist_dif = 100;
467
-    if ($dist <= 500) $dist_dif = 50;
468
-    if ($dist <= 100) $dist_dif = 10;
469
-    if ($dist <= 50) $dist_dif = 5;
470
-
471
-    ?>
458
+	if (get_option('gd_search_dist') != '') {
459
+		$dist = get_option('gd_search_dist');
460
+	} else {
461
+		$dist = 500;
462
+	}
463
+	$dist_dif = 1000;
464
+
465
+	if ($dist <= 5000) $dist_dif = 500;
466
+	if ($dist <= 1000) $dist_dif = 100;
467
+	if ($dist <= 500) $dist_dif = 50;
468
+	if ($dist <= 100) $dist_dif = 10;
469
+	if ($dist <= 50) $dist_dif = 5;
470
+
471
+	?>
472 472
     <script type="text/javascript">
473 473
 
474 474
         jQuery(function ($) {
@@ -527,15 +527,15 @@  discard block
 block discarded – undo
527 527
 function geodir_add_sharelocation_scripts()
528 528
 {
529 529
 
530
-    $default_search_for_text = SEARCH_FOR_TEXT;
531
-    if (get_option('geodir_search_field_default_text'))
532
-        $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
530
+	$default_search_for_text = SEARCH_FOR_TEXT;
531
+	if (get_option('geodir_search_field_default_text'))
532
+		$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
533 533
 
534
-    $default_near_text = NEAR_TEXT;
535
-    if (get_option('geodir_near_field_default_text'))
536
-        $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
534
+	$default_near_text = NEAR_TEXT;
535
+	if (get_option('geodir_near_field_default_text'))
536
+		$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
537 537
 
538
-    ?>
538
+	?>
539 539
 
540 540
 
541 541
     <script type="text/javascript">
@@ -613,14 +613,14 @@  discard block
 block discarded – undo
613 613
                 } else {
614 614
 
615 615
                     Sgeocoder.geocode({'address': address<?php
616
-                    if($near_add = get_option('geodir_search_near_addition')){echo '+", '.$near_add.'"';}
617
-                    if($near_add2 =
618
-                    /**
619
-                     * Adds any extra info to the near search box query when trying to geolocate it via google api.
620
-                     *
621
-                     * @since 1.0.0
622
-                     */
623
-                    apply_filters('geodir_search_near_addition','')){echo $near_add2;}//gt_advanced_near_search();?>},
616
+					if($near_add = get_option('geodir_search_near_addition')){echo '+", '.$near_add.'"';}
617
+					if($near_add2 =
618
+					/**
619
+					 * Adds any extra info to the near search box query when trying to geolocate it via google api.
620
+					 *
621
+					 * @since 1.0.0
622
+					 */
623
+					apply_filters('geodir_search_near_addition','')){echo $near_add2;}//gt_advanced_near_search();?>},
624 624
                         function (results, status) {
625 625
                             if (status == google.maps.GeocoderStatus.OK) {
626 626
                                 updateSearchPosition(results[0].geometry.location, $form);
@@ -699,30 +699,30 @@  discard block
 block discarded – undo
699 699
  */
700 700
 function geodir_show_badges_on_image($which, $post, $link)
701 701
 {
702
-    $return = '';
703
-    switch ($which) {
704
-        case 'featured':
705
-            /**
706
-             * Filter the featured image badge html that appears in the listings pages over the thumbnail.
707
-             *
708
-             * @since 1.0.0
709
-             * @param object $post The post object.
710
-             * @param string $link The link to the post.
711
-             */
712
-            $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
713
-            break;
714
-        case 'new' :
715
-            /**
716
-             * Filter the new image badge html that appears in the listings pages over the thumbnail.
717
-             *
718
-             * @since 1.0.0
719
-             * @param object $post The post object.
720
-             * @param string $link The link to the post.
721
-             */
722
-            $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
723
-            break;
724
-
725
-    }
702
+	$return = '';
703
+	switch ($which) {
704
+		case 'featured':
705
+			/**
706
+			 * Filter the featured image badge html that appears in the listings pages over the thumbnail.
707
+			 *
708
+			 * @since 1.0.0
709
+			 * @param object $post The post object.
710
+			 * @param string $link The link to the post.
711
+			 */
712
+			$return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
713
+			break;
714
+		case 'new' :
715
+			/**
716
+			 * Filter the new image badge html that appears in the listings pages over the thumbnail.
717
+			 *
718
+			 * @since 1.0.0
719
+			 * @param object $post The post object.
720
+			 * @param string $link The link to the post.
721
+			 */
722
+			$return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
723
+			break;
724
+
725
+	}
726 726
     
727
-    return $return;
727
+	return $return;
728 728
 }
Please login to merge, or discard this patch.
geodirectory-widgets/geodirectory_bestof_widget.php 3 patches
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -118,10 +118,11 @@  discard block
 block discarded – undo
118 118
         $instance['listing_width'] = strip_tags($new_instance['listing_width']);
119 119
         $instance['list_sort'] = strip_tags($new_instance['list_sort']);
120 120
         $instance['character_count'] = $new_instance['character_count'];
121
-        if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '')
122
-            $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
123
-        else
124
-            $instance['add_location_filter'] = '0';
121
+        if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') {
122
+                    $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
123
+        } else {
124
+                    $instance['add_location_filter'] = '0';
125
+        }
125 126
 
126 127
         return $instance;
127 128
     }
@@ -279,7 +280,10 @@  discard block
 block discarded – undo
279 280
             <label for="<?php echo $this->get_field_id('add_location_filter'); ?>">
280 281
                 <?php _e('Enable Location Filter:', 'geodirectory');?>
281 282
                 <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>"
282
-                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?>
283
+                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) {
284
+	echo 'checked="checked"';
285
+}
286
+?>
283 287
                        value="1"/>
284 288
             </label>
285 289
         </p>
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         }
203 203
 
204 204
 
205
-        echo $before_title . __($title,'geodirectory') . $after_title;
205
+        echo $before_title . __($title, 'geodirectory') . $after_title;
206 206
 
207 207
         //term navigation - start
208 208
         echo '<div class="geodir-tabs gd-bestof-tabs" id="gd-bestof-tabs" style="position:relative;">';
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
      */
379 379
     public function form($instance)
380 380
     {
381
-        $instance = wp_parse_args((array)$instance,
381
+        $instance = wp_parse_args((array) $instance,
382 382
             array(
383 383
                 'title' => '',
384 384
                 'post_type' => '',
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 
404 404
         ?>
405 405
         <p>
406
-            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
406
+            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?>
407 407
 
408 408
                 <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
409 409
                        name="<?php echo $this->get_field_name('title'); ?>" type="text"
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 
414 414
         <p>
415 415
             <label
416
-                for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?>
416
+                for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?>
417 417
 
418 418
                 <?php $postypes = geodir_get_posttypes();
419 419
                 /**
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
         <p>
446 446
 
447 447
             <label
448
-                for="<?php echo $this->get_field_id('post_limit'); ?>"><?php _e('Number of posts:', 'geodirectory');?>
448
+                for="<?php echo $this->get_field_id('post_limit'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?>
449 449
 
450 450
                 <input class="widefat" id="<?php echo $this->get_field_id('post_limit'); ?>"
451 451
                        name="<?php echo $this->get_field_name('post_limit'); ?>" type="text"
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
         <p>
457 457
 
458 458
             <label
459
-                for="<?php echo $this->get_field_id('categ_limit'); ?>"><?php _e('Number of categories:', 'geodirectory');?>
459
+                for="<?php echo $this->get_field_id('categ_limit'); ?>"><?php _e('Number of categories:', 'geodirectory'); ?>
460 460
 
461 461
                 <input class="widefat" id="<?php echo $this->get_field_id('categ_limit'); ?>"
462 462
                        name="<?php echo $this->get_field_name('categ_limit'); ?>" type="text"
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 
467 467
         <p>
468 468
             <label
469
-                for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?>
469
+                for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?>
470 470
                 <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>"
471 471
                        name="<?php echo $this->get_field_name('character_count'); ?>" type="text"
472 472
                        value="<?php echo esc_attr($character_count); ?>"/>
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
         </p>
475 475
         <p>
476 476
             <label
477
-                for="<?php echo $this->get_field_id('tab_layout'); ?>"><?php _e('Tab Layout:', 'geodirectory');?>
477
+                for="<?php echo $this->get_field_id('tab_layout'); ?>"><?php _e('Tab Layout:', 'geodirectory'); ?>
478 478
 
479 479
                 <select class="widefat" id="<?php echo $this->get_field_id('tab_layout'); ?>"
480 480
                         name="<?php echo $this->get_field_name('tab_layout'); ?>">
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 
496 496
         <p>
497 497
             <label
498
-                for="<?php echo $this->get_field_id('excerpt_type'); ?>"><?php _e('Excerpt Type:', 'geodirectory');?>
498
+                for="<?php echo $this->get_field_id('excerpt_type'); ?>"><?php _e('Excerpt Type:', 'geodirectory'); ?>
499 499
 
500 500
                 <select class="widefat" id="<?php echo $this->get_field_id('excerpt_type'); ?>"
501 501
                         name="<?php echo $this->get_field_name('excerpt_type'); ?>">
@@ -512,9 +512,9 @@  discard block
 block discarded – undo
512 512
 
513 513
         <p>
514 514
             <label for="<?php echo $this->get_field_id('add_location_filter'); ?>">
515
-                <?php _e('Enable Location Filter:', 'geodirectory');?>
515
+                <?php _e('Enable Location Filter:', 'geodirectory'); ?>
516 516
                 <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>"
517
-                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?>
517
+                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?>
518 518
                        value="1"/>
519 519
             </label>
520 520
         </p>
Please login to merge, or discard this patch.
Indentation   +523 added lines, -523 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * GeoDirectory Best of widget
4
- *
5
- * @since 1.3.9
6
- *
7
- * @package GeoDirectory
8
- */
3
+	 * GeoDirectory Best of widget
4
+	 *
5
+	 * @since 1.3.9
6
+	 *
7
+	 * @package GeoDirectory
8
+	 */
9 9
 
10 10
 /**
11 11
  * GeoDirectory Best of widget widget class.
@@ -14,280 +14,280 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class geodir_bestof_widget extends WP_Widget
16 16
 {
17
-    /**
18
-     * Register the best of widget with WordPress.
19
-     *
20
-     * @since 1.3.9
21
-     * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
22
-     */
23
-    public function __construct()
24
-    {
25
-        $widget_ops = array('classname' => 'geodir_bestof_widget', 'description' => __('GD > Best of widget', 'geodirectory'));
26
-        parent::__construct(
27
-            'bestof_widget', // Base ID
28
-            __('GD > Best of widget', 'geodirectory'), // Name
29
-            $widget_ops// Args
30
-        );
31
-    }
32
-
33
-    /**
34
-     * Front-end display content for best of widget.
35
-     *
36
-     * @since 1.3.9
37
-     * @since 1.5.1 Added filter to view all link.
38
-     * @since 1.5.1 Declare function public.
39
-     *
40
-     * @param array $args Widget arguments.
41
-     * @param array $instance Saved values from database.
42
-     */
43
-    public function widget($args, $instance)
44
-    {
45
-        extract($args);
46
-        /**
47
-         * Filter the best of widget tab layout.
48
-         *
49
-         * @since 1.3.9
50
-         *
51
-         * @param string $instance ['tab_layout'] Best of widget tab layout name.
52
-         */
53
-        $tab_layout = empty($instance['tab_layout']) ? 'bestof-tabs-on-top' : apply_filters('bestof_widget_tab_layout', $instance['tab_layout']);
54
-        echo '<div class="bestof-widget-tab-layout ' . $tab_layout . '">';
55
-        echo $before_widget;
56
-        $loc_terms = geodir_get_current_location_terms();
57
-        if (!empty($loc_terms)) {
58
-            $cur_location = ' : ' . geodir_ucwords(str_replace('-', ' ', end($loc_terms)));
59
-        } else {
60
-            $cur_location = '';
61
-        }
62
-
63
-        /**
64
-         * Filter the current location name.
65
-         *
66
-         * @since 1.3.9
67
-         *
68
-         * @param string $cur_location Current location name.
69
-         */
70
-        $cur_location = apply_filters('bestof_widget_cur_location', $cur_location);
71
-
72
-        /**
73
-         * Filter the widget title.
74
-         *
75
-         * @since 1.3.9
76
-         *
77
-         * @param string $instance ['title'] The widget title.
78
-         */
79
-        $title = empty($instance['title']) ? wp_sprintf(__('Best of %s', 'geodirectory'), get_bloginfo('name') . $cur_location) : apply_filters('bestof_widget_title', __($instance['title'], 'geodirectory'));
80
-
81
-        /**
82
-         * Filter the post type.
83
-         *
84
-         * @since 1.3.9
85
-         *
86
-         * @param string $instance ['post_type'] The post type.
87
-         */
88
-        $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('bestof_widget_post_type', $instance['post_type']);
89
-
90
-        /**
91
-         * Filter the excerpt type.
92
-         *
93
-         * @since 1.5.4
94
-         *
95
-         * @param string $instance ['excerpt_type'] The excerpt type.
96
-         */
97
-        $excerpt_type = empty($instance['excerpt_type']) ? 'show-desc' : apply_filters('bestof_widget_excerpt_type', $instance['excerpt_type']);
98
-
99
-
100
-        /**
101
-         * Filter the listing limit.
102
-         *
103
-         * @since 1.3.9
104
-         *
105
-         * @param int $instance ['post_limit'] No. of posts to display.
106
-         */
107
-        $post_limit = empty($instance['post_limit']) ? '5' : apply_filters('bestof_widget_post_limit', $instance['post_limit']);
108
-
109
-        /**
110
-         * Filter the category limit.
111
-         *
112
-         * @since 1.3.9
113
-         *
114
-         * @param int $instance ['categ_limit'] No. of categories to display.
115
-         */
116
-        $categ_limit = empty($instance['categ_limit']) ? '3' : apply_filters('bestof_widget_categ_limit', $instance['categ_limit']);
117
-        $use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
118
-
119
-        /**
120
-         * Filter the use of location filter.
121
-         *
122
-         * @since 1.3.9
123
-         *
124
-         * @param int|bool $instance ['add_location_filter'] Filter listings using current location.
125
-         */
126
-        $add_location_filter = empty($instance['add_location_filter']) ? '1' : apply_filters('bestof_widget_location_filter', $instance['add_location_filter']);
127
-
128
-        // set post type to current viewing post type
129
-        if ($use_viewing_post_type) {
130
-            $current_post_type = geodir_get_current_posttype();
131
-            if ($current_post_type != '' && $current_post_type != $post_type) {
132
-                $post_type = $current_post_type;
133
-            }
134
-        }
135
-
136
-        if (isset($instance['character_count'])) {
137
-            /**
138
-             * Filter the widget's excerpt character count.
139
-             *
140
-             * @since 1.3.9
141
-             *
142
-             * @param int $instance ['character_count'] Excerpt character count.
143
-             */
144
-            $character_count = apply_filters('bestof_widget_list_character_count', $instance['character_count']);
145
-        } else {
146
-            $character_count = '';
147
-        }
148
-
149
-        $category_taxonomy = geodir_get_taxonomies($post_type);
150
-
151
-        $term_args = array(
152
-            'hide_empty' => true,
153
-            'parent' => 0
154
-        );
155
-
156
-        if (is_tax()) {
157
-            $taxonomy = get_query_var('taxonomy');
158
-            $cur_term = get_query_var('term');
159
-            $term_data = get_term_by('name', $cur_term, $taxonomy);
160
-            $term_args['parent'] = $term_data->term_id;
161
-        }
162
-
163
-        $terms = get_terms($category_taxonomy[0], $term_args);
164
-
165
-        $term_reviews = geodir_count_reviews_by_terms();
166
-        $a_terms = array();
167
-        foreach ($terms as $term) {
168
-
169
-
170
-            if ($term->count > 0) {
171
-                if (isset($term_reviews[$term->term_id])) {
172
-                    $term->review_count = $term_reviews[$term->term_id];
173
-                } else {
174
-                    $term->review_count = '0';
175
-                }
176
-
177
-                $a_terms[] = $term;
178
-            }
179
-
180
-        }
181
-
182
-
183
-        $terms = geodir_sort_terms($a_terms, 'review_count');
184
-
185
-        $query_args = array(
186
-            'posts_per_page' => $post_limit,
187
-            'is_geodir_loop' => true,
188
-            'post_type' => $post_type,
189
-            'gd_location' => $add_location_filter ? true : false,
190
-            'order_by' => 'high_review'
191
-        );
192
-        if ($character_count >= 0) {
193
-            $query_args['excerpt_length'] = $character_count;
194
-        }
195
-
196
-        $layout = array();
197
-        if ($tab_layout == 'bestof-tabs-as-dropdown') {
198
-            $layout[] = $tab_layout;
199
-        } else {
200
-            $layout[] = 'bestof-tabs-as-dropdown';
201
-            $layout[] = $tab_layout;
202
-        }
203
-
204
-
205
-        echo $before_title . __($title,'geodirectory') . $after_title;
206
-
207
-        //term navigation - start
208
-        echo '<div class="geodir-tabs gd-bestof-tabs" id="gd-bestof-tabs" style="position:relative;">';
209
-
210
-        $final_html = '';
211
-        foreach ($layout as $tab_layout) {
212
-            $nav_html = '';
213
-            $is_dropdown = ($tab_layout == 'bestof-tabs-as-dropdown') ? true : false;
214
-
215
-            if ($is_dropdown) {
216
-                $nav_html .= '<select id="geodir_bestof_tab_dd" class="chosen_select" name="geodir_bestof_tab_dd" data-placeholder="' . esc_attr(__('Select Category', 'geodirectory')) . '">';
217
-            } else {
218
-                $nav_html .= '<dl class="geodir-tab-head geodir-bestof-cat-list">';
219
-                $nav_html .= '<dt></dt>';
220
-            }
221
-
222
-
223
-            $term_icon = geodir_get_term_icon();
224
-            $cat_count = 0;
225
-            if (!empty($terms)) {
226
-                foreach ($terms as $cat) {
227
-                    $cat_count++;
228
-                    if ($cat_count > $categ_limit) {
229
-                        break;
230
-                    }
231
-                    if ($is_dropdown) {
232
-                        $selected = ($cat_count == 1) ? 'selected="selected"' : '';
233
-                        $nav_html .= '<option ' . $selected . ' value="' . $cat->term_id . '">' . geodir_ucwords($cat->name) . '</option>';
234
-                    } else {
235
-                        if ($cat_count == 1) {
236
-                            $nav_html .= '<dd class="geodir-tab-active">';
237
-                        } else {
238
-                            $nav_html .= '<dd class="">';
239
-                        }
240
-                        $term_icon_url = !empty($term_icon) && isset($term_icon[$cat->term_id]) ? $term_icon[$cat->term_id] : '';
241
-                        $nav_html .= '<a data-termid="' . $cat->term_id . '" href="' . get_term_link($cat, $cat->taxonomy) . '">';
242
-                        $nav_html .= '<img alt="' . $cat->name . ' icon" class="bestof-cat-icon" src="' . $term_icon_url . '"/>';
243
-                        $nav_html .= '<span>';
244
-                        $nav_html .= geodir_ucwords($cat->name);
245
-                        $nav_html .= '<small>';
246
-                        if (isset($cat->review_count)) {
247
-                            $num_reviews = $cat->review_count;
248
-                            if ($num_reviews == 0) {
249
-                                $reviews = __('No Reviews', 'geodirectory');
250
-                            } elseif ($num_reviews > 1) {
251
-                                $reviews = $num_reviews . __(' Reviews', 'geodirectory');
252
-                            } else {
253
-                                $reviews = __('1 Review', 'geodirectory');
254
-                            }
255
-                            $nav_html .= $reviews;
256
-                        }
257
-                        $nav_html .= '</small>';
258
-                        $nav_html .= '</span>';
259
-                        $nav_html .= '</a>';
260
-                        $nav_html .= '</dd>';
261
-                    }
262
-                }
263
-            }
264
-
265
-            if ($is_dropdown) {
266
-                $nav_html .= '</select>';
267
-            } else {
268
-                $nav_html .= '</dl>';
269
-            }
270
-            $final_html .= $nav_html;
271
-        }
272
-        if ($terms) {
273
-            echo $final_html;
274
-        }
275
-        echo '</div>';
276
-        //term navigation - end
277
-
278
-        //first term listings by default - start
279
-        $first_term = '';
280
-        if ($terms) {
281
-            $first_term = $terms[0];
282
-            $tax_query = array(
283
-                'taxonomy' => $category_taxonomy[0],
284
-                'field' => 'id',
285
-                'terms' => $first_term->term_id
286
-            );
287
-            $query_args['tax_query'] = array($tax_query);
288
-        }
289
-
290
-        ?>
17
+	/**
18
+	 * Register the best of widget with WordPress.
19
+	 *
20
+	 * @since 1.3.9
21
+	 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
22
+	 */
23
+	public function __construct()
24
+	{
25
+		$widget_ops = array('classname' => 'geodir_bestof_widget', 'description' => __('GD > Best of widget', 'geodirectory'));
26
+		parent::__construct(
27
+			'bestof_widget', // Base ID
28
+			__('GD > Best of widget', 'geodirectory'), // Name
29
+			$widget_ops// Args
30
+		);
31
+	}
32
+
33
+	/**
34
+	 * Front-end display content for best of widget.
35
+	 *
36
+	 * @since 1.3.9
37
+	 * @since 1.5.1 Added filter to view all link.
38
+	 * @since 1.5.1 Declare function public.
39
+	 *
40
+	 * @param array $args Widget arguments.
41
+	 * @param array $instance Saved values from database.
42
+	 */
43
+	public function widget($args, $instance)
44
+	{
45
+		extract($args);
46
+		/**
47
+		 * Filter the best of widget tab layout.
48
+		 *
49
+		 * @since 1.3.9
50
+		 *
51
+		 * @param string $instance ['tab_layout'] Best of widget tab layout name.
52
+		 */
53
+		$tab_layout = empty($instance['tab_layout']) ? 'bestof-tabs-on-top' : apply_filters('bestof_widget_tab_layout', $instance['tab_layout']);
54
+		echo '<div class="bestof-widget-tab-layout ' . $tab_layout . '">';
55
+		echo $before_widget;
56
+		$loc_terms = geodir_get_current_location_terms();
57
+		if (!empty($loc_terms)) {
58
+			$cur_location = ' : ' . geodir_ucwords(str_replace('-', ' ', end($loc_terms)));
59
+		} else {
60
+			$cur_location = '';
61
+		}
62
+
63
+		/**
64
+		 * Filter the current location name.
65
+		 *
66
+		 * @since 1.3.9
67
+		 *
68
+		 * @param string $cur_location Current location name.
69
+		 */
70
+		$cur_location = apply_filters('bestof_widget_cur_location', $cur_location);
71
+
72
+		/**
73
+		 * Filter the widget title.
74
+		 *
75
+		 * @since 1.3.9
76
+		 *
77
+		 * @param string $instance ['title'] The widget title.
78
+		 */
79
+		$title = empty($instance['title']) ? wp_sprintf(__('Best of %s', 'geodirectory'), get_bloginfo('name') . $cur_location) : apply_filters('bestof_widget_title', __($instance['title'], 'geodirectory'));
80
+
81
+		/**
82
+		 * Filter the post type.
83
+		 *
84
+		 * @since 1.3.9
85
+		 *
86
+		 * @param string $instance ['post_type'] The post type.
87
+		 */
88
+		$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('bestof_widget_post_type', $instance['post_type']);
89
+
90
+		/**
91
+		 * Filter the excerpt type.
92
+		 *
93
+		 * @since 1.5.4
94
+		 *
95
+		 * @param string $instance ['excerpt_type'] The excerpt type.
96
+		 */
97
+		$excerpt_type = empty($instance['excerpt_type']) ? 'show-desc' : apply_filters('bestof_widget_excerpt_type', $instance['excerpt_type']);
98
+
99
+
100
+		/**
101
+		 * Filter the listing limit.
102
+		 *
103
+		 * @since 1.3.9
104
+		 *
105
+		 * @param int $instance ['post_limit'] No. of posts to display.
106
+		 */
107
+		$post_limit = empty($instance['post_limit']) ? '5' : apply_filters('bestof_widget_post_limit', $instance['post_limit']);
108
+
109
+		/**
110
+		 * Filter the category limit.
111
+		 *
112
+		 * @since 1.3.9
113
+		 *
114
+		 * @param int $instance ['categ_limit'] No. of categories to display.
115
+		 */
116
+		$categ_limit = empty($instance['categ_limit']) ? '3' : apply_filters('bestof_widget_categ_limit', $instance['categ_limit']);
117
+		$use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
118
+
119
+		/**
120
+		 * Filter the use of location filter.
121
+		 *
122
+		 * @since 1.3.9
123
+		 *
124
+		 * @param int|bool $instance ['add_location_filter'] Filter listings using current location.
125
+		 */
126
+		$add_location_filter = empty($instance['add_location_filter']) ? '1' : apply_filters('bestof_widget_location_filter', $instance['add_location_filter']);
127
+
128
+		// set post type to current viewing post type
129
+		if ($use_viewing_post_type) {
130
+			$current_post_type = geodir_get_current_posttype();
131
+			if ($current_post_type != '' && $current_post_type != $post_type) {
132
+				$post_type = $current_post_type;
133
+			}
134
+		}
135
+
136
+		if (isset($instance['character_count'])) {
137
+			/**
138
+			 * Filter the widget's excerpt character count.
139
+			 *
140
+			 * @since 1.3.9
141
+			 *
142
+			 * @param int $instance ['character_count'] Excerpt character count.
143
+			 */
144
+			$character_count = apply_filters('bestof_widget_list_character_count', $instance['character_count']);
145
+		} else {
146
+			$character_count = '';
147
+		}
148
+
149
+		$category_taxonomy = geodir_get_taxonomies($post_type);
150
+
151
+		$term_args = array(
152
+			'hide_empty' => true,
153
+			'parent' => 0
154
+		);
155
+
156
+		if (is_tax()) {
157
+			$taxonomy = get_query_var('taxonomy');
158
+			$cur_term = get_query_var('term');
159
+			$term_data = get_term_by('name', $cur_term, $taxonomy);
160
+			$term_args['parent'] = $term_data->term_id;
161
+		}
162
+
163
+		$terms = get_terms($category_taxonomy[0], $term_args);
164
+
165
+		$term_reviews = geodir_count_reviews_by_terms();
166
+		$a_terms = array();
167
+		foreach ($terms as $term) {
168
+
169
+
170
+			if ($term->count > 0) {
171
+				if (isset($term_reviews[$term->term_id])) {
172
+					$term->review_count = $term_reviews[$term->term_id];
173
+				} else {
174
+					$term->review_count = '0';
175
+				}
176
+
177
+				$a_terms[] = $term;
178
+			}
179
+
180
+		}
181
+
182
+
183
+		$terms = geodir_sort_terms($a_terms, 'review_count');
184
+
185
+		$query_args = array(
186
+			'posts_per_page' => $post_limit,
187
+			'is_geodir_loop' => true,
188
+			'post_type' => $post_type,
189
+			'gd_location' => $add_location_filter ? true : false,
190
+			'order_by' => 'high_review'
191
+		);
192
+		if ($character_count >= 0) {
193
+			$query_args['excerpt_length'] = $character_count;
194
+		}
195
+
196
+		$layout = array();
197
+		if ($tab_layout == 'bestof-tabs-as-dropdown') {
198
+			$layout[] = $tab_layout;
199
+		} else {
200
+			$layout[] = 'bestof-tabs-as-dropdown';
201
+			$layout[] = $tab_layout;
202
+		}
203
+
204
+
205
+		echo $before_title . __($title,'geodirectory') . $after_title;
206
+
207
+		//term navigation - start
208
+		echo '<div class="geodir-tabs gd-bestof-tabs" id="gd-bestof-tabs" style="position:relative;">';
209
+
210
+		$final_html = '';
211
+		foreach ($layout as $tab_layout) {
212
+			$nav_html = '';
213
+			$is_dropdown = ($tab_layout == 'bestof-tabs-as-dropdown') ? true : false;
214
+
215
+			if ($is_dropdown) {
216
+				$nav_html .= '<select id="geodir_bestof_tab_dd" class="chosen_select" name="geodir_bestof_tab_dd" data-placeholder="' . esc_attr(__('Select Category', 'geodirectory')) . '">';
217
+			} else {
218
+				$nav_html .= '<dl class="geodir-tab-head geodir-bestof-cat-list">';
219
+				$nav_html .= '<dt></dt>';
220
+			}
221
+
222
+
223
+			$term_icon = geodir_get_term_icon();
224
+			$cat_count = 0;
225
+			if (!empty($terms)) {
226
+				foreach ($terms as $cat) {
227
+					$cat_count++;
228
+					if ($cat_count > $categ_limit) {
229
+						break;
230
+					}
231
+					if ($is_dropdown) {
232
+						$selected = ($cat_count == 1) ? 'selected="selected"' : '';
233
+						$nav_html .= '<option ' . $selected . ' value="' . $cat->term_id . '">' . geodir_ucwords($cat->name) . '</option>';
234
+					} else {
235
+						if ($cat_count == 1) {
236
+							$nav_html .= '<dd class="geodir-tab-active">';
237
+						} else {
238
+							$nav_html .= '<dd class="">';
239
+						}
240
+						$term_icon_url = !empty($term_icon) && isset($term_icon[$cat->term_id]) ? $term_icon[$cat->term_id] : '';
241
+						$nav_html .= '<a data-termid="' . $cat->term_id . '" href="' . get_term_link($cat, $cat->taxonomy) . '">';
242
+						$nav_html .= '<img alt="' . $cat->name . ' icon" class="bestof-cat-icon" src="' . $term_icon_url . '"/>';
243
+						$nav_html .= '<span>';
244
+						$nav_html .= geodir_ucwords($cat->name);
245
+						$nav_html .= '<small>';
246
+						if (isset($cat->review_count)) {
247
+							$num_reviews = $cat->review_count;
248
+							if ($num_reviews == 0) {
249
+								$reviews = __('No Reviews', 'geodirectory');
250
+							} elseif ($num_reviews > 1) {
251
+								$reviews = $num_reviews . __(' Reviews', 'geodirectory');
252
+							} else {
253
+								$reviews = __('1 Review', 'geodirectory');
254
+							}
255
+							$nav_html .= $reviews;
256
+						}
257
+						$nav_html .= '</small>';
258
+						$nav_html .= '</span>';
259
+						$nav_html .= '</a>';
260
+						$nav_html .= '</dd>';
261
+					}
262
+				}
263
+			}
264
+
265
+			if ($is_dropdown) {
266
+				$nav_html .= '</select>';
267
+			} else {
268
+				$nav_html .= '</dl>';
269
+			}
270
+			$final_html .= $nav_html;
271
+		}
272
+		if ($terms) {
273
+			echo $final_html;
274
+		}
275
+		echo '</div>';
276
+		//term navigation - end
277
+
278
+		//first term listings by default - start
279
+		$first_term = '';
280
+		if ($terms) {
281
+			$first_term = $terms[0];
282
+			$tax_query = array(
283
+				'taxonomy' => $category_taxonomy[0],
284
+				'field' => 'id',
285
+				'terms' => $first_term->term_id
286
+			);
287
+			$query_args['tax_query'] = array($tax_query);
288
+		}
289
+
290
+		?>
291 291
         <input type="hidden" id="bestof_widget_post_type" name="bestof_widget_post_type"
292 292
                value="<?php echo $post_type; ?>">
293 293
         <input type="hidden" id="bestof_widget_excerpt_type" name="bestof_widget_excerpt_type"
@@ -298,110 +298,110 @@  discard block
 block discarded – undo
298 298
                value="<?php echo $category_taxonomy[0]; ?>">
299 299
         <input type="hidden" id="bestof_widget_location_filter" name="bestof_widget_location_filter"
300 300
                value="<?php if ($add_location_filter) {
301
-                   echo 1;
302
-               } else {
303
-                   echo 0;
304
-               } ?>">
301
+				   echo 1;
302
+			   } else {
303
+				   echo 0;
304
+			   } ?>">
305 305
         <input type="hidden" id="bestof_widget_char_count" name="bestof_widget_char_count"
306 306
                value="<?php echo $character_count; ?>">
307 307
         <div class="geo-bestof-contentwrap geodir-tabs-content" style="position: relative; z-index: 0;">
308 308
             <p id="geodir-bestof-loading" class="geodir-bestof-loading"><i class="fa fa-cog fa-spin"></i></p>
309 309
             <?php
310
-            echo '<div id="geodir-bestof-places">';
311
-            if ($terms) {
312
-                $view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($first_term, $first_term->taxonomy));
313
-                /**
314
-                 * Filter the page link to view all lisitngs.
315
-                 *
316
-                 * @since 1.5.1
317
-                 *
318
-                 * @param array $view_all_link View all listings page link.
319
-                 * @param array $post_type The Post type.
320
-                 * @param array $first_term The category term object.
321
-                 */
322
-                $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $first_term);
323
-
324
-                echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $first_term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>';
325
-            }
326
-            if ($excerpt_type == 'show-reviews') {
327
-                add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
328
-            }
329
-            geodir_bestof_places_by_term($query_args);
330
-            if ($excerpt_type == 'show-reviews') {
331
-                remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
332
-            }
333
-            echo "</div>";
334
-            ?>
310
+			echo '<div id="geodir-bestof-places">';
311
+			if ($terms) {
312
+				$view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($first_term, $first_term->taxonomy));
313
+				/**
314
+				 * Filter the page link to view all lisitngs.
315
+				 *
316
+				 * @since 1.5.1
317
+				 *
318
+				 * @param array $view_all_link View all listings page link.
319
+				 * @param array $post_type The Post type.
320
+				 * @param array $first_term The category term object.
321
+				 */
322
+				$view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $first_term);
323
+
324
+				echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $first_term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>';
325
+			}
326
+			if ($excerpt_type == 'show-reviews') {
327
+				add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
328
+			}
329
+			geodir_bestof_places_by_term($query_args);
330
+			if ($excerpt_type == 'show-reviews') {
331
+				remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
332
+			}
333
+			echo "</div>";
334
+			?>
335 335
         </div>
336 336
         <?php //first term listings by default - end
337
-        ?>
337
+		?>
338 338
         <?php echo $after_widget;
339
-        echo "</div>";
340
-    }
341
-
342
-    /**
343
-     * Sanitize best of widget form values as they are saved.
344
-     *
345
-     * @since 1.3.9
346
-     * @since 1.5.1 Declare function public.
347
-     *
348
-     * @param array $new_instance Values just sent to be saved.
349
-     * @param array $old_instance Previously saved values from database.
350
-     *
351
-     * @return array Updated safe values to be saved.
352
-     */
353
-    public function update($new_instance, $old_instance)
354
-    {
355
-        $instance = $old_instance;
356
-        $instance['title'] = strip_tags($new_instance['title']);
357
-        $instance['post_type'] = strip_tags($new_instance['post_type']);
358
-        $instance['post_limit'] = strip_tags($new_instance['post_limit']);
359
-        $instance['categ_limit'] = strip_tags($new_instance['categ_limit']);
360
-        $instance['character_count'] = $new_instance['character_count'];
361
-        $instance['tab_layout'] = $new_instance['tab_layout'];
362
-        $instance['excerpt_type'] = $new_instance['excerpt_type'];
363
-        if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '')
364
-            $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
365
-        else
366
-            $instance['add_location_filter'] = '0';
367
-        $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0;
368
-        return $instance;
369
-    }
370
-
371
-    /**
372
-     * Back-end best of widget settings form.
373
-     *
374
-     * @since 1.3.9
375
-     * @since 1.5.1 Declare function public.
376
-     *
377
-     * @param array $instance Previously saved values from database.
378
-     */
379
-    public function form($instance)
380
-    {
381
-        $instance = wp_parse_args((array)$instance,
382
-            array(
383
-                'title' => '',
384
-                'post_type' => '',
385
-                'post_limit' => '5',
386
-                'categ_limit' => '3',
387
-                'character_count' => '20',
388
-                'add_location_filter' => '1',
389
-                'tab_layout' => 'bestof-tabs-on-top',
390
-                'excerpt_type' => 'show-desc',
391
-                'use_viewing_post_type' => ''
392
-            )
393
-        );
394
-        $title = strip_tags($instance['title']);
395
-        $post_type = strip_tags($instance['post_type']);
396
-        $post_limit = strip_tags($instance['post_limit']);
397
-        $categ_limit = strip_tags($instance['categ_limit']);
398
-        $character_count = strip_tags($instance['character_count']);
399
-        $tab_layout = strip_tags($instance['tab_layout']);
400
-        $excerpt_type = strip_tags($instance['excerpt_type']);
401
-        $add_location_filter = strip_tags($instance['add_location_filter']);
402
-        $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false;
403
-
404
-        ?>
339
+		echo "</div>";
340
+	}
341
+
342
+	/**
343
+	 * Sanitize best of widget form values as they are saved.
344
+	 *
345
+	 * @since 1.3.9
346
+	 * @since 1.5.1 Declare function public.
347
+	 *
348
+	 * @param array $new_instance Values just sent to be saved.
349
+	 * @param array $old_instance Previously saved values from database.
350
+	 *
351
+	 * @return array Updated safe values to be saved.
352
+	 */
353
+	public function update($new_instance, $old_instance)
354
+	{
355
+		$instance = $old_instance;
356
+		$instance['title'] = strip_tags($new_instance['title']);
357
+		$instance['post_type'] = strip_tags($new_instance['post_type']);
358
+		$instance['post_limit'] = strip_tags($new_instance['post_limit']);
359
+		$instance['categ_limit'] = strip_tags($new_instance['categ_limit']);
360
+		$instance['character_count'] = $new_instance['character_count'];
361
+		$instance['tab_layout'] = $new_instance['tab_layout'];
362
+		$instance['excerpt_type'] = $new_instance['excerpt_type'];
363
+		if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '')
364
+			$instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
365
+		else
366
+			$instance['add_location_filter'] = '0';
367
+		$instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0;
368
+		return $instance;
369
+	}
370
+
371
+	/**
372
+	 * Back-end best of widget settings form.
373
+	 *
374
+	 * @since 1.3.9
375
+	 * @since 1.5.1 Declare function public.
376
+	 *
377
+	 * @param array $instance Previously saved values from database.
378
+	 */
379
+	public function form($instance)
380
+	{
381
+		$instance = wp_parse_args((array)$instance,
382
+			array(
383
+				'title' => '',
384
+				'post_type' => '',
385
+				'post_limit' => '5',
386
+				'categ_limit' => '3',
387
+				'character_count' => '20',
388
+				'add_location_filter' => '1',
389
+				'tab_layout' => 'bestof-tabs-on-top',
390
+				'excerpt_type' => 'show-desc',
391
+				'use_viewing_post_type' => ''
392
+			)
393
+		);
394
+		$title = strip_tags($instance['title']);
395
+		$post_type = strip_tags($instance['post_type']);
396
+		$post_limit = strip_tags($instance['post_limit']);
397
+		$categ_limit = strip_tags($instance['categ_limit']);
398
+		$character_count = strip_tags($instance['character_count']);
399
+		$tab_layout = strip_tags($instance['tab_layout']);
400
+		$excerpt_type = strip_tags($instance['excerpt_type']);
401
+		$add_location_filter = strip_tags($instance['add_location_filter']);
402
+		$use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false;
403
+
404
+		?>
405 405
         <p>
406 406
             <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
407 407
 
@@ -416,14 +416,14 @@  discard block
 block discarded – undo
416 416
                 for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?>
417 417
 
418 418
                 <?php $postypes = geodir_get_posttypes();
419
-                /**
420
-                 * Filter the post types to display in widget.
421
-                 *
422
-                 * @since 1.3.9
423
-                 *
424
-                 * @param array $postypes Post types array.
425
-                 */
426
-                $postypes = apply_filters('geodir_post_type_list_in_p_widget', $postypes); ?>
419
+				/**
420
+				 * Filter the post types to display in widget.
421
+				 *
422
+				 * @since 1.3.9
423
+				 *
424
+				 * @param array $postypes Post types array.
425
+				 */
426
+				$postypes = apply_filters('geodir_post_type_list_in_p_widget', $postypes); ?>
427 427
 
428 428
                 <select class="widefat" id="<?php echo $this->get_field_id('post_type'); ?>"
429 429
                         name="<?php echo $this->get_field_name('post_type'); ?>"
@@ -432,9 +432,9 @@  discard block
 block discarded – undo
432 432
                     <?php foreach ($postypes as $postypes_obj) { ?>
433 433
 
434 434
                         <option <?php if ($post_type == $postypes_obj) {
435
-                            echo 'selected="selected"';
436
-                        } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
437
-                            echo ucfirst($extvalue[1]); ?></option>
435
+							echo 'selected="selected"';
436
+						} ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
437
+							echo ucfirst($extvalue[1]); ?></option>
438 438
 
439 439
                     <?php } ?>
440 440
 
@@ -480,14 +480,14 @@  discard block
 block discarded – undo
480 480
                         name="<?php echo $this->get_field_name('tab_layout'); ?>">
481 481
 
482 482
                     <option <?php if ($tab_layout == 'bestof-tabs-on-top') {
483
-                        echo 'selected="selected"';
484
-                    } ?> value="bestof-tabs-on-top"><?php _e('Tabs on Top', 'geodirectory'); ?></option>
483
+						echo 'selected="selected"';
484
+					} ?> value="bestof-tabs-on-top"><?php _e('Tabs on Top', 'geodirectory'); ?></option>
485 485
                     <option <?php if ($tab_layout == 'bestof-tabs-on-left') {
486
-                        echo 'selected="selected"';
487
-                    } ?> value="bestof-tabs-on-left"><?php _e('Tabs on Left', 'geodirectory'); ?></option>
486
+						echo 'selected="selected"';
487
+					} ?> value="bestof-tabs-on-left"><?php _e('Tabs on Left', 'geodirectory'); ?></option>
488 488
                     <option <?php if ($tab_layout == 'bestof-tabs-as-dropdown') {
489
-                        echo 'selected="selected"';
490
-                    } ?>
489
+						echo 'selected="selected"';
490
+					} ?>
491 491
                         value="bestof-tabs-as-dropdown"><?php _e('Tabs as Dropdown', 'geodirectory'); ?></option>
492 492
                 </select>
493 493
             </label>
@@ -501,11 +501,11 @@  discard block
 block discarded – undo
501 501
                         name="<?php echo $this->get_field_name('excerpt_type'); ?>">
502 502
 
503 503
                     <option <?php if ($excerpt_type == 'show-desc') {
504
-                        echo 'selected="selected"';
505
-                    } ?> value="show-desc"><?php _e('Show Description', 'geodirectory'); ?></option>
504
+						echo 'selected="selected"';
505
+					} ?> value="show-desc"><?php _e('Show Description', 'geodirectory'); ?></option>
506 506
                     <option <?php if ($excerpt_type == 'show-reviews') {
507
-                        echo 'selected="selected"';
508
-                    } ?> value="show-reviews"><?php _e('Show Reviews if Available', 'geodirectory'); ?></option>
507
+						echo 'selected="selected"';
508
+					} ?> value="show-reviews"><?php _e('Show Reviews if Available', 'geodirectory'); ?></option>
509 509
                 </select>
510 510
             </label>
511 511
         </p>
@@ -524,12 +524,12 @@  discard block
 block discarded – undo
524 524
                 for="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"><?php _e('Use current viewing post type:', 'geodirectory'); ?>
525 525
                 <input type="checkbox" id="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"
526 526
                        name="<?php echo $this->get_field_name('use_viewing_post_type'); ?>" <?php if ($use_viewing_post_type) {
527
-                    echo 'checked="checked"';
528
-                } ?>  value="1"/>
527
+					echo 'checked="checked"';
528
+				} ?>  value="1"/>
529 529
             </label>
530 530
         </p>
531 531
     <?php
532
-    }
532
+	}
533 533
 } // class geodir_bestof_widget
534 534
 
535 535
 register_widget('geodir_bestof_widget');
@@ -549,68 +549,68 @@  discard block
 block discarded – undo
549 549
  */
550 550
 function geodir_bestof_places_by_term($query_args)
551 551
 {
552
-    global $gd_session;
553
-
554
-    /**
555
-     * This action called before querying widget listings.
556
-     *
557
-     * @since 1.0.0
558
-     */
559
-    do_action('geodir_bestof_get_widget_listings_before');
560
-
561
-    $widget_listings = geodir_get_widget_listings($query_args);
562
-
563
-    /**
564
-     * This action called after querying widget listings.
565
-     *
566
-     * @since 1.0.0
567
-     */
568
-    do_action('geodir_bestof_get_widget_listings_after');
569
-
570
-    $character_count = isset($query_args['excerpt_length']) ? $query_args['excerpt_length'] : '';
571
-
572
-    if (!isset($character_count)) {
573
-        /** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */
574
-        $character_count = $character_count == '' ? 50 : apply_filters('bestof_widget_character_count', $character_count);
575
-    }
576
-
577
-    /** This filter is documented in geodirectory-functions/general_functions.php */
578
-    $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
579
-
580
-    global $post, $map_jason, $map_canvas_arr, $gridview_columns_widget, $geodir_is_widget_listing;
581
-    $current_post = $post;
582
-    $current_map_jason = $map_jason;
583
-    $current_map_canvas_arr = $map_canvas_arr;
584
-    $current_grid_view = $gridview_columns_widget;
585
-    $gridview_columns_widget = null;
586
-
587
-    $gd_listing_view_set = $gd_session->get('gd_listing_view') ? true : false;
588
-    $gd_listing_view_old = $gd_listing_view_set ? $gd_session->get('gd_listing_view') : '';
589
-
590
-    $gd_session->set('gd_listing_view', '1');
591
-    $geodir_is_widget_listing = true;
592
-
593
-    /**
594
-     * Includes the template for the listing listview.
595
-     *
596
-     * @since 1.3.9
597
-     */
598
-    include($template);
599
-
600
-    $geodir_is_widget_listing = false;
601
-
602
-    $GLOBALS['post'] = $current_post;
603
-    if (!empty($current_post)) {
604
-        setup_postdata($current_post);
605
-    }
606
-    if ($gd_listing_view_set) { // Set back previous value
607
-        $gd_session->set('gd_listing_view', $gd_listing_view_old);
608
-    } else {
609
-        $gd_session->un_set('gd_listing_view');
610
-    }
611
-    $map_jason = $current_map_jason;
612
-    $map_canvas_arr = $current_map_canvas_arr;
613
-    $gridview_columns_widget = $current_grid_view;
552
+	global $gd_session;
553
+
554
+	/**
555
+	 * This action called before querying widget listings.
556
+	 *
557
+	 * @since 1.0.0
558
+	 */
559
+	do_action('geodir_bestof_get_widget_listings_before');
560
+
561
+	$widget_listings = geodir_get_widget_listings($query_args);
562
+
563
+	/**
564
+	 * This action called after querying widget listings.
565
+	 *
566
+	 * @since 1.0.0
567
+	 */
568
+	do_action('geodir_bestof_get_widget_listings_after');
569
+
570
+	$character_count = isset($query_args['excerpt_length']) ? $query_args['excerpt_length'] : '';
571
+
572
+	if (!isset($character_count)) {
573
+		/** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */
574
+		$character_count = $character_count == '' ? 50 : apply_filters('bestof_widget_character_count', $character_count);
575
+	}
576
+
577
+	/** This filter is documented in geodirectory-functions/general_functions.php */
578
+	$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
579
+
580
+	global $post, $map_jason, $map_canvas_arr, $gridview_columns_widget, $geodir_is_widget_listing;
581
+	$current_post = $post;
582
+	$current_map_jason = $map_jason;
583
+	$current_map_canvas_arr = $map_canvas_arr;
584
+	$current_grid_view = $gridview_columns_widget;
585
+	$gridview_columns_widget = null;
586
+
587
+	$gd_listing_view_set = $gd_session->get('gd_listing_view') ? true : false;
588
+	$gd_listing_view_old = $gd_listing_view_set ? $gd_session->get('gd_listing_view') : '';
589
+
590
+	$gd_session->set('gd_listing_view', '1');
591
+	$geodir_is_widget_listing = true;
592
+
593
+	/**
594
+	 * Includes the template for the listing listview.
595
+	 *
596
+	 * @since 1.3.9
597
+	 */
598
+	include($template);
599
+
600
+	$geodir_is_widget_listing = false;
601
+
602
+	$GLOBALS['post'] = $current_post;
603
+	if (!empty($current_post)) {
604
+		setup_postdata($current_post);
605
+	}
606
+	if ($gd_listing_view_set) { // Set back previous value
607
+		$gd_session->set('gd_listing_view', $gd_listing_view_old);
608
+	} else {
609
+		$gd_session->un_set('gd_listing_view');
610
+	}
611
+	$map_jason = $current_map_jason;
612
+	$map_canvas_arr = $current_map_canvas_arr;
613
+	$gridview_columns_widget = $current_grid_view;
614 614
 }
615 615
 
616 616
 //Ajax functions
@@ -627,51 +627,51 @@  discard block
 block discarded – undo
627 627
  */
628 628
 function geodir_bestof_callback()
629 629
 {
630
-    check_ajax_referer('geodir-bestof-nonce', 'geodir_bestof_nonce');
631
-    //set variables
632
-    $post_type = strip_tags(esc_sql($_POST['post_type']));
633
-    $post_limit = strip_tags(esc_sql($_POST['post_limit']));
634
-    $character_count = strip_tags(esc_sql($_POST['char_count']));
635
-    $taxonomy = strip_tags(esc_sql($_POST['taxonomy']));
636
-    $add_location_filter = strip_tags(esc_sql($_POST['add_location_filter']));
637
-    $term_id = strip_tags(esc_sql($_POST['term_id']));
638
-    $excerpt_type = strip_tags(esc_sql($_POST['excerpt_type']));
639
-
640
-    $query_args = array(
641
-        'posts_per_page' => $post_limit,
642
-        'is_geodir_loop' => true,
643
-        'post_type' => $post_type,
644
-        'gd_location' => $add_location_filter ? true : false,
645
-        'order_by' => 'high_review'
646
-    );
647
-
648
-    if ($character_count >= 0) {
649
-        $query_args['excerpt_length'] = $character_count;
650
-    }
651
-
652
-    $tax_query = array(
653
-        'taxonomy' => $taxonomy,
654
-        'field' => 'id',
655
-        'terms' => $term_id
656
-    );
657
-
658
-    $query_args['tax_query'] = array($tax_query);
659
-    if ($term_id && $taxonomy) {
660
-        $term = get_term_by('id', $term_id, $taxonomy);
661
-        $view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($term));
662
-        /** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */
663
-        $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $term);
664
-
665
-        echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>';
666
-    }
667
-    if ($excerpt_type == 'show-reviews') {
668
-        add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
669
-    }
670
-    geodir_bestof_places_by_term($query_args);
671
-    if ($excerpt_type == 'show-reviews') {
672
-        remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
673
-    }
674
-    wp_die();
630
+	check_ajax_referer('geodir-bestof-nonce', 'geodir_bestof_nonce');
631
+	//set variables
632
+	$post_type = strip_tags(esc_sql($_POST['post_type']));
633
+	$post_limit = strip_tags(esc_sql($_POST['post_limit']));
634
+	$character_count = strip_tags(esc_sql($_POST['char_count']));
635
+	$taxonomy = strip_tags(esc_sql($_POST['taxonomy']));
636
+	$add_location_filter = strip_tags(esc_sql($_POST['add_location_filter']));
637
+	$term_id = strip_tags(esc_sql($_POST['term_id']));
638
+	$excerpt_type = strip_tags(esc_sql($_POST['excerpt_type']));
639
+
640
+	$query_args = array(
641
+		'posts_per_page' => $post_limit,
642
+		'is_geodir_loop' => true,
643
+		'post_type' => $post_type,
644
+		'gd_location' => $add_location_filter ? true : false,
645
+		'order_by' => 'high_review'
646
+	);
647
+
648
+	if ($character_count >= 0) {
649
+		$query_args['excerpt_length'] = $character_count;
650
+	}
651
+
652
+	$tax_query = array(
653
+		'taxonomy' => $taxonomy,
654
+		'field' => 'id',
655
+		'terms' => $term_id
656
+	);
657
+
658
+	$query_args['tax_query'] = array($tax_query);
659
+	if ($term_id && $taxonomy) {
660
+		$term = get_term_by('id', $term_id, $taxonomy);
661
+		$view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($term));
662
+		/** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */
663
+		$view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $term);
664
+
665
+		echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>';
666
+	}
667
+	if ($excerpt_type == 'show-reviews') {
668
+		add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
669
+	}
670
+	geodir_bestof_places_by_term($query_args);
671
+	if ($excerpt_type == 'show-reviews') {
672
+		remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt');
673
+	}
674
+	wp_die();
675 675
 }
676 676
 
677 677
 //Javascript
@@ -684,8 +684,8 @@  discard block
 block discarded – undo
684 684
  */
685 685
 function geodir_bestof_js()
686 686
 {
687
-    $ajax_nonce = wp_create_nonce("geodir-bestof-nonce");
688
-    ?>
687
+	$ajax_nonce = wp_create_nonce("geodir-bestof-nonce");
688
+	?>
689 689
     <script type="text/javascript">
690 690
         jQuery(document).ready(function () {
691 691
             jQuery('.geodir-bestof-cat-list a, #geodir_bestof_tab_dd').on("click change", function (e) {
@@ -758,18 +758,18 @@  discard block
 block discarded – undo
758 758
 
759 759
 function best_of_show_review_in_excerpt($excerpt)
760 760
 {
761
-    global $wpdb, $post;
762
-    $review_table = GEODIR_REVIEW_TABLE;
763
-    $request = "SELECT comment_ID FROM $review_table WHERE post_id = $post->ID ORDER BY post_date DESC, id DESC LIMIT 1";
764
-    $comments = $wpdb->get_results($request);
765
-
766
-    if ($comments) {
767
-        foreach ($comments as $comment) {
768
-            // Set the extra comment info needed.
769
-            $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
770
-            $comment_content = $comment_extra->comment_content;
771
-            $excerpt = strip_tags($comment_content);
772
-        }
773
-    }
774
-    return $excerpt;
761
+	global $wpdb, $post;
762
+	$review_table = GEODIR_REVIEW_TABLE;
763
+	$request = "SELECT comment_ID FROM $review_table WHERE post_id = $post->ID ORDER BY post_date DESC, id DESC LIMIT 1";
764
+	$comments = $wpdb->get_results($request);
765
+
766
+	if ($comments) {
767
+		foreach ($comments as $comment) {
768
+			// Set the extra comment info needed.
769
+			$comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
770
+			$comment_content = $comment_extra->comment_content;
771
+			$excerpt = strip_tags($comment_content);
772
+		}
773
+	}
774
+	return $excerpt;
775 775
 }
776 776
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory_widgets.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
             public function form($instance)
302 302
             {
303 303
                 //widgetform in backend
304
-                $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
304
+                $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
305 305
                 $title = strip_tags($instance['title']);
306 306
 
307 307
                 ?>
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
                 ?>
374 374
 
375 375
                 <a href="http://twitter.com/share"
376
-                   class="twitter-share-button"><?php _e('Tweet', 'geodirectory');?></a>
376
+                   class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
377 377
 
378 378
                 <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
379 379
 
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
             public function form($instance)
444 444
             {
445 445
                 //widgetform in backend
446
-                $instance = wp_parse_args((array)$instance, array('title' => ''));
446
+                $instance = wp_parse_args((array) $instance, array('title' => ''));
447 447
                 $title = strip_tags($instance['title']);
448 448
                 ?>
449 449
                 <p>No settings for this widget</p>
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
                 echo 'http://feeds2.feedburner.com/' . $id;
520 520
             } else {
521 521
                 bloginfo('rss_url');
522
-            } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?>
522
+            } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title; ?>
523 523
 
524 524
                 <?php if ($text <> "") { ?>
525 525
 
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
             public function form($instance)
585 585
             {
586 586
                 //widgetform in backend
587
-                $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => ''));
587
+                $instance = wp_parse_args((array) $instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => ''));
588 588
 
589 589
                 $id = strip_tags($instance['id']);
590 590
 
@@ -596,19 +596,19 @@  discard block
 block discarded – undo
596 596
 
597 597
                 ?>
598 598
                 <p><label
599
-                        for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory');?>:
599
+                        for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory'); ?>:
600 600
                         <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
601 601
                                name="<?php echo $this->get_field_name('title'); ?>" type="text"
602 602
                                value="<?php echo esc_attr($title); ?>"/></label></p>
603 603
 
604 604
                 <p><label
605
-                        for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Feedburner ID (ex :- geotheme)', 'geodirectory');?>
605
+                        for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Feedburner ID (ex :- geotheme)', 'geodirectory'); ?>
606 606
                         : <input class="widefat" id="<?php echo $this->get_field_id('id'); ?>"
607 607
                                  name="<?php echo $this->get_field_name('id'); ?>" type="text"
608 608
                                  value="<?php echo esc_attr($id); ?>"/></label></p>
609 609
 
610 610
                 <p><label
611
-                        for="<?php echo $this->get_field_id('text'); ?>"><?php _e('Short Description', 'geodirectory');?>
611
+                        for="<?php echo $this->get_field_id('text'); ?>"><?php _e('Short Description', 'geodirectory'); ?>
612 612
                         <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('text'); ?>"
613 613
                                   name="<?php echo $this->get_field_name('text'); ?>"><?php echo esc_attr($text); ?></textarea></label>
614 614
                 </p>
@@ -704,12 +704,12 @@  discard block
 block discarded – undo
704 704
             public function form($instance)
705 705
             {
706 706
                 //widgetform in backend
707
-                $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
707
+                $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
708 708
 
709 709
                 $desc1 = ($instance['desc1']);
710 710
                 ?>
711 711
                 <p><label
712
-                        for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory');?>
712
+                        for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory'); ?>
713 713
                         <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('desc1'); ?>"
714 714
                                   name="<?php echo $this->get_field_name('desc1'); ?>"><?php echo esc_attr($desc1); ?></textarea></label>
715 715
                 </p>
@@ -819,14 +819,14 @@  discard block
 block discarded – undo
819 819
             {
820 820
 
821 821
                 //widgetform in backend
822
-                $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => ''));
822
+                $instance = wp_parse_args((array) $instance, array('title' => '', 'id' => '', 'number' => ''));
823 823
                 $id = strip_tags($instance['id']);
824 824
                 $number = strip_tags($instance['number']);
825 825
                 ?>
826 826
 
827 827
                 <p>
828 828
                     <label
829
-                        for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Flickr ID', 'geodirectory');?>
829
+                        for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Flickr ID', 'geodirectory'); ?>
830 830
                         (<a href="http://www.idgettr.com">idGettr</a>):
831 831
                         <input class="widefat" id="<?php echo $this->get_field_id('id'); ?>"
832 832
                                name="<?php echo $this->get_field_name('id'); ?>" type="text"
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
 
837 837
                 <p>
838 838
                     <label
839
-                        for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of photos:', 'geodirectory');?>
839
+                        for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of photos:', 'geodirectory'); ?>
840 840
                         <input class="widefat" id="<?php echo $this->get_field_id('number'); ?>"
841 841
                                name="<?php echo $this->get_field_name('number'); ?>" type="text"
842 842
                                value="<?php echo esc_attr($number); ?>"/>
@@ -932,12 +932,12 @@  discard block
 block discarded – undo
932 932
             public function form($instance)
933 933
             {
934 934
                 //widgetform in backend
935
-                $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => ''));
935
+                $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => ''));
936 936
 
937 937
                 $desc1 = ($instance['gd_tw_desc1']);
938 938
                 ?>
939 939
                 <p><label
940
-                        for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory');?>
940
+                        for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory'); ?>
941 941
                         <textarea class="widefat" rows="6" cols="20"
942 942
                                   id="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"
943 943
                                   name="<?php echo $this->get_field_name('gd_tw_desc1'); ?>"><?php echo esc_attr($desc1); ?></textarea></label>
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
                  * @param array $args The widget arguments.
994 994
                  * @param array $instance The widget instance.
995 995
                  */
996
-                $args = apply_filters('widget_geodir_advance_search_args',$args,$instance);
996
+                $args = apply_filters('widget_geodir_advance_search_args', $args, $instance);
997 997
 
998 998
                 // prints the widget
999 999
                 extract($args, EXTR_SKIP);
Please login to merge, or discard this patch.
Indentation   +893 added lines, -893 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * GeoDirectory Widgets
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+	 * GeoDirectory Widgets
4
+	 *
5
+	 * @since 1.0.0
6
+	 * @package GeoDirectory
7
+	 */
8 8
 
9 9
 /**
10 10
  * Registers GeoDirectory sidebar.
@@ -15,296 +15,296 @@  discard block
 block discarded – undo
15 15
  */
16 16
 function geodir_register_sidebar()
17 17
 {
18
-    global $geodir_sidebars;
19
-
20
-    if (function_exists('register_sidebar')) {
21
-        /*===========================*/
22
-        /* Home page sidebars start*/
23
-        /*===========================*/
24
-
25
-        /**
26
-         * Filter the `$before_widget` widget opening HTML tag.
27
-         *
28
-         * @since 1.0.0
29
-         * @param string $var The HTML string to filter. Default = '<section id="%1$s" class="widget geodir-widget %2$s">'.
30
-         * @see 'geodir_after_widget'
31
-         */
32
-        $before_widget = apply_filters('geodir_before_widget', '<section id="%1$s" class="widget geodir-widget %2$s">');
33
-        /**
34
-         * Filter the `$after_widget` widget closing HTML tag.
35
-         *
36
-         * @since 1.0.0
37
-         * @param string $var The HTML string to filter. Default = '</section>'.
38
-         * @see 'geodir_before_widget'
39
-         */
40
-        $after_widget = apply_filters('geodir_after_widget', '</section>');
41
-        /**
42
-         * Filter the `$before_title` widget title opening HTML tag.
43
-         *
44
-         * @since 1.0.0
45
-         * @param string $var The HTML string to filter. Default = '<h3 class="widget-title">'.
46
-         * @see 'geodir_after_title'
47
-         */
48
-        $before_title = apply_filters('geodir_before_title', '<h3 class="widget-title">');
49
-        /**
50
-         * Filter the `$after_title` widget title closing HTML tag.
51
-         *
52
-         * @since 1.0.0
53
-         * @param string $var The HTML string to filter. Default = '</h3>'.
54
-         * @see 'geodir_before_title'
55
-         */
56
-        $after_title = apply_filters('geodir_after_title', '</h3>');
57
-
58
-        if (get_option('geodir_show_home_top_section')) {
59
-            register_sidebars(1, array('id' => 'geodir_home_top', 'name' => __('GD Home Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
60
-
61
-            $geodir_sidebars[] = 'geodir_home_top';
62
-        }
63
-
64
-        if (get_option('geodir_show_home_contant_section')) {
65
-            register_sidebars(1, array('id' => 'geodir_home_content', 'name' => __('GD Home Content Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
18
+	global $geodir_sidebars;
19
+
20
+	if (function_exists('register_sidebar')) {
21
+		/*===========================*/
22
+		/* Home page sidebars start*/
23
+		/*===========================*/
24
+
25
+		/**
26
+		 * Filter the `$before_widget` widget opening HTML tag.
27
+		 *
28
+		 * @since 1.0.0
29
+		 * @param string $var The HTML string to filter. Default = '<section id="%1$s" class="widget geodir-widget %2$s">'.
30
+		 * @see 'geodir_after_widget'
31
+		 */
32
+		$before_widget = apply_filters('geodir_before_widget', '<section id="%1$s" class="widget geodir-widget %2$s">');
33
+		/**
34
+		 * Filter the `$after_widget` widget closing HTML tag.
35
+		 *
36
+		 * @since 1.0.0
37
+		 * @param string $var The HTML string to filter. Default = '</section>'.
38
+		 * @see 'geodir_before_widget'
39
+		 */
40
+		$after_widget = apply_filters('geodir_after_widget', '</section>');
41
+		/**
42
+		 * Filter the `$before_title` widget title opening HTML tag.
43
+		 *
44
+		 * @since 1.0.0
45
+		 * @param string $var The HTML string to filter. Default = '<h3 class="widget-title">'.
46
+		 * @see 'geodir_after_title'
47
+		 */
48
+		$before_title = apply_filters('geodir_before_title', '<h3 class="widget-title">');
49
+		/**
50
+		 * Filter the `$after_title` widget title closing HTML tag.
51
+		 *
52
+		 * @since 1.0.0
53
+		 * @param string $var The HTML string to filter. Default = '</h3>'.
54
+		 * @see 'geodir_before_title'
55
+		 */
56
+		$after_title = apply_filters('geodir_after_title', '</h3>');
57
+
58
+		if (get_option('geodir_show_home_top_section')) {
59
+			register_sidebars(1, array('id' => 'geodir_home_top', 'name' => __('GD Home Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
66 60
 
67
-            $geodir_sidebars[] = 'geodir_home_content';
68
-        }
61
+			$geodir_sidebars[] = 'geodir_home_top';
62
+		}
69 63
 
70
-        if (get_option('geodir_show_home_right_section')) {
71
-            register_sidebars(1, array('id' => 'geodir_home_right', 'name' => __('GD Home Right Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
64
+		if (get_option('geodir_show_home_contant_section')) {
65
+			register_sidebars(1, array('id' => 'geodir_home_content', 'name' => __('GD Home Content Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
72 66
 
73
-            $geodir_sidebars[] = 'geodir_home_right';
74
-        }
67
+			$geodir_sidebars[] = 'geodir_home_content';
68
+		}
75 69
 
76
-        if (get_option('geodir_show_home_left_section')) {
77
-            register_sidebars(1, array('id' => 'geodir_home_left', 'name' => __('GD Home Left Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
70
+		if (get_option('geodir_show_home_right_section')) {
71
+			register_sidebars(1, array('id' => 'geodir_home_right', 'name' => __('GD Home Right Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
78 72
 
79
-            $geodir_sidebars[] = 'geodir_home_left';
80
-        }
73
+			$geodir_sidebars[] = 'geodir_home_right';
74
+		}
81 75
 
82
-        if (get_option('geodir_show_home_bottom_section')) {
83
-            register_sidebars(1, array('id' => 'geodir_home_bottom', 'name' => __('GD Home Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
76
+		if (get_option('geodir_show_home_left_section')) {
77
+			register_sidebars(1, array('id' => 'geodir_home_left', 'name' => __('GD Home Left Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
84 78
 
85
-            $geodir_sidebars[] = 'geodir_home_bottom';
86
-        }
79
+			$geodir_sidebars[] = 'geodir_home_left';
80
+		}
87 81
 
88
-        /*===========================*/
89
-        /* Home page sidebars end*/
90
-        /*===========================*/
82
+		if (get_option('geodir_show_home_bottom_section')) {
83
+			register_sidebars(1, array('id' => 'geodir_home_bottom', 'name' => __('GD Home Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
91 84
 
92
-        /*===========================*/
93
-        /* Listing page sidebars start*/
94
-        /*===========================*/
85
+			$geodir_sidebars[] = 'geodir_home_bottom';
86
+		}
95 87
 
96
-        if (get_option('geodir_show_listing_top_section')) {
97
-            register_sidebars(1, array('id' => 'geodir_listing_top', 'name' => __('GD Listing Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
88
+		/*===========================*/
89
+		/* Home page sidebars end*/
90
+		/*===========================*/
98 91
 
99
-            $geodir_sidebars[] = 'geodir_listing_top';
100
-        }
92
+		/*===========================*/
93
+		/* Listing page sidebars start*/
94
+		/*===========================*/
101 95
 
102
-        if (get_option('geodir_show_listing_left_section')) {
103
-            register_sidebars(1, array('id' => 'geodir_listing_left_sidebar', 'name' => __('GD Listing Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
96
+		if (get_option('geodir_show_listing_top_section')) {
97
+			register_sidebars(1, array('id' => 'geodir_listing_top', 'name' => __('GD Listing Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
104 98
 
105
-            $geodir_sidebars[] = 'geodir_listing_left_sidebar';
106
-        }
99
+			$geodir_sidebars[] = 'geodir_listing_top';
100
+		}
107 101
 
108
-        if (get_option('geodir_show_listing_right_section')) {
109
-            register_sidebars(1, array('id' => 'geodir_listing_right_sidebar', 'name' => __('GD Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
102
+		if (get_option('geodir_show_listing_left_section')) {
103
+			register_sidebars(1, array('id' => 'geodir_listing_left_sidebar', 'name' => __('GD Listing Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
110 104
 
111
-            $geodir_sidebars[] = 'geodir_listing_right_sidebar';
112
-        }
105
+			$geodir_sidebars[] = 'geodir_listing_left_sidebar';
106
+		}
113 107
 
114
-        if (get_option('geodir_show_listing_bottom_section')) {
115
-            register_sidebars(1, array('id' => 'geodir_listing_bottom', 'name' => __('GD Listing Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
108
+		if (get_option('geodir_show_listing_right_section')) {
109
+			register_sidebars(1, array('id' => 'geodir_listing_right_sidebar', 'name' => __('GD Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
116 110
 
117
-            $geodir_sidebars[] = 'geodir_listing_bottom';
118
-        }
111
+			$geodir_sidebars[] = 'geodir_listing_right_sidebar';
112
+		}
119 113
 
120
-        /*===========================*/
121
-        /* Listing page sidebars start*/
122
-        /*===========================*/
114
+		if (get_option('geodir_show_listing_bottom_section')) {
115
+			register_sidebars(1, array('id' => 'geodir_listing_bottom', 'name' => __('GD Listing Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
123 116
 
124
-        /*===========================*/
125
-        /* Search page sidebars start*/
126
-        /*===========================*/
117
+			$geodir_sidebars[] = 'geodir_listing_bottom';
118
+		}
127 119
 
128
-        if (get_option('geodir_show_search_top_section')) {
129
-            register_sidebars(1, array('id' => 'geodir_search_top', 'name' => __('GD Search Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
120
+		/*===========================*/
121
+		/* Listing page sidebars start*/
122
+		/*===========================*/
130 123
 
131
-            $geodir_sidebars[] = 'geodir_search_top';
132
-        }
124
+		/*===========================*/
125
+		/* Search page sidebars start*/
126
+		/*===========================*/
133 127
 
134
-        if (get_option('geodir_show_search_left_section')) {
135
-            register_sidebars(1, array('id' => 'geodir_search_left_sidebar', 'name' => __('GD Search Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
128
+		if (get_option('geodir_show_search_top_section')) {
129
+			register_sidebars(1, array('id' => 'geodir_search_top', 'name' => __('GD Search Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
136 130
 
137
-            $geodir_sidebars[] = 'geodir_search_left_sidebar';
138
-        }
131
+			$geodir_sidebars[] = 'geodir_search_top';
132
+		}
139 133
 
140
-        if (get_option('geodir_show_search_right_section')) {
141
-            register_sidebars(1, array('id' => 'geodir_search_right_sidebar', 'name' => __('GD Search Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
134
+		if (get_option('geodir_show_search_left_section')) {
135
+			register_sidebars(1, array('id' => 'geodir_search_left_sidebar', 'name' => __('GD Search Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
142 136
 
143
-            $geodir_sidebars[] = 'geodir_search_right_sidebar';
144
-        }
137
+			$geodir_sidebars[] = 'geodir_search_left_sidebar';
138
+		}
145 139
 
146
-        if (get_option('geodir_show_search_bottom_section')) {
147
-            register_sidebars(1, array('id' => 'geodir_search_bottom', 'name' => __('GD Search Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
140
+		if (get_option('geodir_show_search_right_section')) {
141
+			register_sidebars(1, array('id' => 'geodir_search_right_sidebar', 'name' => __('GD Search Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
148 142
 
149
-            $geodir_sidebars[] = 'geodir_search_bottom';
150
-        }
143
+			$geodir_sidebars[] = 'geodir_search_right_sidebar';
144
+		}
151 145
 
152
-        /*===========================*/
153
-        /* Search page sidebars end*/
154
-        /*===========================*/
146
+		if (get_option('geodir_show_search_bottom_section')) {
147
+			register_sidebars(1, array('id' => 'geodir_search_bottom', 'name' => __('GD Search Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
155 148
 
156
-        /*==================================*/
157
-        /* Detail/Single page sidebars start*/
158
-        /*==================================*/
159
-        if (get_option('geodir_show_detail_top_section')) {
160
-            register_sidebars(1, array('id' => 'geodir_detail_top', 'name' => __('GD Detail Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
149
+			$geodir_sidebars[] = 'geodir_search_bottom';
150
+		}
161 151
 
162
-            $geodir_sidebars[] = 'geodir_detail_top';
163
-        }
152
+		/*===========================*/
153
+		/* Search page sidebars end*/
154
+		/*===========================*/
164 155
 
165
-        register_sidebars(1, array('id' => 'geodir_detail_sidebar', 'name' => __('GD Detail Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
156
+		/*==================================*/
157
+		/* Detail/Single page sidebars start*/
158
+		/*==================================*/
159
+		if (get_option('geodir_show_detail_top_section')) {
160
+			register_sidebars(1, array('id' => 'geodir_detail_top', 'name' => __('GD Detail Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
166 161
 
167
-        $geodir_sidebars[] = 'geodir_detail_sidebar';
162
+			$geodir_sidebars[] = 'geodir_detail_top';
163
+		}
168 164
 
169
-        if (get_option('geodir_show_detail_bottom_section')) {
170
-            register_sidebars(1, array('id' => 'geodir_detail_bottom', 'name' => __('GD Detail Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
165
+		register_sidebars(1, array('id' => 'geodir_detail_sidebar', 'name' => __('GD Detail Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
171 166
 
172
-            $geodir_sidebars[] = 'geodir_detail_bottom';
173
-        }
167
+		$geodir_sidebars[] = 'geodir_detail_sidebar';
174 168
 
175
-        /*==================================*/
176
-        /* Detail/Single page sidebars end*/
177
-        /*==================================*/
169
+		if (get_option('geodir_show_detail_bottom_section')) {
170
+			register_sidebars(1, array('id' => 'geodir_detail_bottom', 'name' => __('GD Detail Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
178 171
 
179
-        /*==================================*/
180
-        /* Author page sidebars start       */
181
-        /*==================================*/
172
+			$geodir_sidebars[] = 'geodir_detail_bottom';
173
+		}
182 174
 
183
-        if (get_option('geodir_show_author_top_section')) {
184
-            register_sidebars(1, array('id' => 'geodir_author_top', 'name' => __('GD Author Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
175
+		/*==================================*/
176
+		/* Detail/Single page sidebars end*/
177
+		/*==================================*/
185 178
 
186
-            $geodir_sidebars[] = 'geodir_author_top';
187
-        }
179
+		/*==================================*/
180
+		/* Author page sidebars start       */
181
+		/*==================================*/
188 182
 
189
-        if (get_option('geodir_show_author_left_section')) {
190
-            register_sidebars(1, array('id' => 'geodir_author_left_sidebar', 'name' => __('GD Author Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
183
+		if (get_option('geodir_show_author_top_section')) {
184
+			register_sidebars(1, array('id' => 'geodir_author_top', 'name' => __('GD Author Top Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
191 185
 
192
-            $geodir_sidebars[] = 'geodir_author_left_sidebar';
193
-        }
186
+			$geodir_sidebars[] = 'geodir_author_top';
187
+		}
194 188
 
195
-        if (get_option('geodir_show_author_right_section')) {
196
-            register_sidebars(1, array('id' => 'geodir_author_right_sidebar', 'name' => __('GD Author Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
189
+		if (get_option('geodir_show_author_left_section')) {
190
+			register_sidebars(1, array('id' => 'geodir_author_left_sidebar', 'name' => __('GD Author Left Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
197 191
 
198
-            $geodir_sidebars[] = 'geodir_author_right_sidebar';
199
-        }
192
+			$geodir_sidebars[] = 'geodir_author_left_sidebar';
193
+		}
200 194
 
201
-        if (get_option('geodir_show_author_bottom_section')) {
202
-            register_sidebars(1, array('id' => 'geodir_author_bottom', 'name' => __('GD Author Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
195
+		if (get_option('geodir_show_author_right_section')) {
196
+			register_sidebars(1, array('id' => 'geodir_author_right_sidebar', 'name' => __('GD Author Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
203 197
 
204
-            $geodir_sidebars[] = 'geodir_author_bottom';
205
-        }
198
+			$geodir_sidebars[] = 'geodir_author_right_sidebar';
199
+		}
206 200
 
207
-        /*==================================*/
208
-        /* Author page sidebars end         */
209
-        /*==================================*/
201
+		if (get_option('geodir_show_author_bottom_section')) {
202
+			register_sidebars(1, array('id' => 'geodir_author_bottom', 'name' => __('GD Author Bottom Section', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
210 203
 
211
-        /*==================================*/
212
-        /* Add listing page sidebars start       */
213
-        /*==================================*/
204
+			$geodir_sidebars[] = 'geodir_author_bottom';
205
+		}
214 206
 
215
-        register_sidebars(1, array('id' => 'geodir_add_listing_sidebar', 'name' => __('GD Add Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
207
+		/*==================================*/
208
+		/* Author page sidebars end         */
209
+		/*==================================*/
216 210
 
217
-        $geodir_sidebars[] = 'geodir_add_listing_sidebar';
211
+		/*==================================*/
212
+		/* Add listing page sidebars start       */
213
+		/*==================================*/
218 214
 
219
-        /*==================================*/
220
-        /* Add listing page sidebars end         */
221
-        /*==================================*/
215
+		register_sidebars(1, array('id' => 'geodir_add_listing_sidebar', 'name' => __('GD Add Listing Right Sidebar', 'geodirectory'), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
222 216
 
223
-    }
217
+		$geodir_sidebars[] = 'geodir_add_listing_sidebar';
218
+
219
+		/*==================================*/
220
+		/* Add listing page sidebars end         */
221
+		/*==================================*/
222
+
223
+	}
224 224
 }
225 225
 
226 226
 
227 227
 if (!function_exists('register_geodir_widgets')) {
228
-    /**
229
-     * Registers all Widgets.
230
-     *
231
-     * @since 1.0.0
232
-     * @package GeoDirectory
233
-     */
234
-    function register_geodir_widgets()
235
-    {
236
-        /**
237
-         * Login Widget.
238
-         *
239
-         * @since 1.0.0
240
-         */
241
-        class geodir_loginwidget extends WP_Widget
242
-        {
243
-            /**
244
-             * Register the login widget with WordPress.
245
-             *
246
-             * @since 1.0.0
247
-             * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
248
-             */
249
-            public function __construct() {
250
-                $widget_ops = array('classname' => 'geodir_loginbox', 'description' => __('Geodirectory Loginbox Widget', 'geodirectory'));
251
-                parent::__construct(
252
-                    'geodir_loginbox', // Base ID
253
-                    __('GD > Loginbox', 'geodirectory'), // Name
254
-                    $widget_ops// Args
255
-                );
256
-            }
257
-
258
-            /**
259
-             * Front-end display content for login widget.
260
-             *
261
-             * @since 1.0.0
262
-             * @since 1.5.1 Declare function public.
263
-             *
264
-             * @param array $args     Widget arguments.
265
-             * @param array $instance Saved values from database.
266
-             */
267
-            public function widget($args, $instance)
268
-            {
269
-                geodir_loginwidget_output($args, $instance);
270
-            }
271
-
272
-            /**
273
-             * Sanitize login widget form values as they are saved.
274
-             *
275
-             * @since 1.0.0
276
-             * @since 1.5.1 Declare function public.
277
-             *
278
-             * @param array $new_instance Values just sent to be saved.
279
-             * @param array $old_instance Previously saved values from database.
280
-             *
281
-             * @return array Updated safe values to be saved.
282
-             */
283
-            public function update($new_instance, $old_instance)
284
-            {
285
-                //save the widget
286
-                $instance = $old_instance;
287
-                $instance['title'] = strip_tags($new_instance['title']);
288
-
289
-                return $instance;
290
-            }
291
-
292
-            /**
293
-             * Back-end login widget settings form.
294
-             *
295
-             * @since 1.0.0
296
-             * @since 1.5.1 Declare function public.
297
-             *
298
-             * @param array $instance Previously saved values from database.
299
-             * @return string|void
300
-             */
301
-            public function form($instance)
302
-            {
303
-                //widgetform in backend
304
-                $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
305
-                $title = strip_tags($instance['title']);
306
-
307
-                ?>
228
+	/**
229
+	 * Registers all Widgets.
230
+	 *
231
+	 * @since 1.0.0
232
+	 * @package GeoDirectory
233
+	 */
234
+	function register_geodir_widgets()
235
+	{
236
+		/**
237
+		 * Login Widget.
238
+		 *
239
+		 * @since 1.0.0
240
+		 */
241
+		class geodir_loginwidget extends WP_Widget
242
+		{
243
+			/**
244
+			 * Register the login widget with WordPress.
245
+			 *
246
+			 * @since 1.0.0
247
+			 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
248
+			 */
249
+			public function __construct() {
250
+				$widget_ops = array('classname' => 'geodir_loginbox', 'description' => __('Geodirectory Loginbox Widget', 'geodirectory'));
251
+				parent::__construct(
252
+					'geodir_loginbox', // Base ID
253
+					__('GD > Loginbox', 'geodirectory'), // Name
254
+					$widget_ops// Args
255
+				);
256
+			}
257
+
258
+			/**
259
+			 * Front-end display content for login widget.
260
+			 *
261
+			 * @since 1.0.0
262
+			 * @since 1.5.1 Declare function public.
263
+			 *
264
+			 * @param array $args     Widget arguments.
265
+			 * @param array $instance Saved values from database.
266
+			 */
267
+			public function widget($args, $instance)
268
+			{
269
+				geodir_loginwidget_output($args, $instance);
270
+			}
271
+
272
+			/**
273
+			 * Sanitize login widget form values as they are saved.
274
+			 *
275
+			 * @since 1.0.0
276
+			 * @since 1.5.1 Declare function public.
277
+			 *
278
+			 * @param array $new_instance Values just sent to be saved.
279
+			 * @param array $old_instance Previously saved values from database.
280
+			 *
281
+			 * @return array Updated safe values to be saved.
282
+			 */
283
+			public function update($new_instance, $old_instance)
284
+			{
285
+				//save the widget
286
+				$instance = $old_instance;
287
+				$instance['title'] = strip_tags($new_instance['title']);
288
+
289
+				return $instance;
290
+			}
291
+
292
+			/**
293
+			 * Back-end login widget settings form.
294
+			 *
295
+			 * @since 1.0.0
296
+			 * @since 1.5.1 Declare function public.
297
+			 *
298
+			 * @param array $instance Previously saved values from database.
299
+			 * @return string|void
300
+			 */
301
+			public function form($instance)
302
+			{
303
+				//widgetform in backend
304
+				$instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
305
+				$title = strip_tags($instance['title']);
306
+
307
+				?>
308 308
                 <p><label
309 309
                         for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title', 'geodirectory'); ?>
310 310
                         : <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
@@ -313,64 +313,64 @@  discard block
 block discarded – undo
313 313
 
314 314
 
315 315
             <?php
316
-            }
317
-        }
318
-
319
-        register_widget('geodir_loginwidget');
320
-
321
-
322
-        /**
323
-         * GeoDirectory Social Like Widget.
324
-         *
325
-         * @since 1.0.0
326
-         */
327
-        class geodir_social_like_widget extends WP_Widget
328
-        {
329
-
330
-            /**
331
-             * Register the social like widget with WordPress.
332
-             *
333
-             * @since 1.0.0
334
-             * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
335
-             */
336
-            public function __construct() {
337
-                $widget_ops = array('classname' => 'geodir_social_like_widget', 'description' => __('GD > Twitter,Facebook and Google+ buttons', 'geodirectory'));
338
-                parent::__construct(
339
-                    'social_like_widget', // Base ID
340
-                    __('GD > Social Like', 'geodirectory'), // Name
341
-                    $widget_ops// Args
342
-                );
343
-            }
344
-
345
-            /**
346
-             * Front-end display content for social like widget.
347
-             *
348
-             * @since 1.0.0
349
-             * @since 1.5.1 Declare function public.
350
-             *
351
-             * @param array $args     Widget arguments.
352
-             * @param array $instance Saved values from database.
353
-             */
354
-            public function widget($args, $instance)
355
-            {
356
-                // prints the widget
357
-                extract($args, EXTR_SKIP);
358
-
359
-                /**
360
-                 * Filter the widget title text.
361
-                 *
362
-                 * @since 1.0.0
363
-                 * @global object $current_user Current user object.
364
-                 * @param string $title The widget title text.
365
-                 */
366
-                $title = empty($instance['title']) ? '&nbsp;' : apply_filters('widget_title', $instance['title']);
367
-
368
-                global $current_user, $post;
369
-                echo $before_widget;
370
-                ?>
316
+			}
317
+		}
318
+
319
+		register_widget('geodir_loginwidget');
320
+
321
+
322
+		/**
323
+		 * GeoDirectory Social Like Widget.
324
+		 *
325
+		 * @since 1.0.0
326
+		 */
327
+		class geodir_social_like_widget extends WP_Widget
328
+		{
329
+
330
+			/**
331
+			 * Register the social like widget with WordPress.
332
+			 *
333
+			 * @since 1.0.0
334
+			 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
335
+			 */
336
+			public function __construct() {
337
+				$widget_ops = array('classname' => 'geodir_social_like_widget', 'description' => __('GD > Twitter,Facebook and Google+ buttons', 'geodirectory'));
338
+				parent::__construct(
339
+					'social_like_widget', // Base ID
340
+					__('GD > Social Like', 'geodirectory'), // Name
341
+					$widget_ops// Args
342
+				);
343
+			}
344
+
345
+			/**
346
+			 * Front-end display content for social like widget.
347
+			 *
348
+			 * @since 1.0.0
349
+			 * @since 1.5.1 Declare function public.
350
+			 *
351
+			 * @param array $args     Widget arguments.
352
+			 * @param array $instance Saved values from database.
353
+			 */
354
+			public function widget($args, $instance)
355
+			{
356
+				// prints the widget
357
+				extract($args, EXTR_SKIP);
358
+
359
+				/**
360
+				 * Filter the widget title text.
361
+				 *
362
+				 * @since 1.0.0
363
+				 * @global object $current_user Current user object.
364
+				 * @param string $title The widget title text.
365
+				 */
366
+				$title = empty($instance['title']) ? '&nbsp;' : apply_filters('widget_title', $instance['title']);
367
+
368
+				global $current_user, $post;
369
+				echo $before_widget;
370
+				?>
371 371
 
372 372
                 <?php //if ( get_option('gd_tweet_button') ) {
373
-                ?>
373
+				?>
374 374
 
375 375
                 <a href="http://twitter.com/share"
376 376
                    class="twitter-share-button"><?php _e('Tweet', 'geodirectory');?></a>
@@ -378,23 +378,23 @@  discard block
 block discarded – undo
378 378
                 <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
379 379
 
380 380
                 <?php //}
381
-                ?>
381
+				?>
382 382
 
383 383
                 <?php // if ( get_option('gd_facebook_button') ) {
384
-                ?>
384
+				?>
385 385
 
386 386
                 <iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
387
-                    echo 'allowtransparency="true"';
388
-                }?> class="facebook"
387
+					echo 'allowtransparency="true"';
388
+				}?> class="facebook"
389 389
                     src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(geodir_curPageURL()); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
390 390
                     style="border:none; overflow:hidden; width:100px; height:20px"></iframe>
391 391
 
392 392
 
393 393
                 <?php //}
394
-                ?>
394
+				?>
395 395
 
396 396
                 <?php //if ( get_option('gd_google_button') ) {
397
-                ?>
397
+				?>
398 398
                 <script>
399 399
                     window.___gcfg = {
400 400
                         parsetags: 'explicit'
@@ -408,118 +408,118 @@  discard block
 block discarded – undo
408 408
                         "count": "true"
409 409
                     });</script>
410 410
                 <?php //}
411
-                echo $after_widget;
412
-
413
-            }
414
-
415
-            /**
416
-             * Sanitize social like widget form values as they are saved.
417
-             *
418
-             * @since 1.0.0
419
-             * @since 1.5.1 Declare function public.
420
-             *
421
-             * @param array $new_instance Values just sent to be saved.
422
-             * @param array $old_instance Previously saved values from database.
423
-             *
424
-             * @return array Updated safe values to be saved.
425
-             */
426
-            public function update($new_instance, $old_instance)
427
-            {
428
-                //save the widget
429
-                $instance = $old_instance;
430
-                $instance['title'] = strip_tags($new_instance['title']);
431
-                return $instance;
432
-            }
433
-
434
-            /**
435
-             * Back-end social like widget settings form.
436
-             *
437
-             * @since 1.0.0
438
-             * @since 1.5.1 Declare function public.
439
-             *
440
-             * @param array $instance Previously saved values from database.
441
-             * @return string|void
442
-             */
443
-            public function form($instance)
444
-            {
445
-                //widgetform in backend
446
-                $instance = wp_parse_args((array)$instance, array('title' => ''));
447
-                $title = strip_tags($instance['title']);
448
-                ?>
411
+				echo $after_widget;
412
+
413
+			}
414
+
415
+			/**
416
+			 * Sanitize social like widget form values as they are saved.
417
+			 *
418
+			 * @since 1.0.0
419
+			 * @since 1.5.1 Declare function public.
420
+			 *
421
+			 * @param array $new_instance Values just sent to be saved.
422
+			 * @param array $old_instance Previously saved values from database.
423
+			 *
424
+			 * @return array Updated safe values to be saved.
425
+			 */
426
+			public function update($new_instance, $old_instance)
427
+			{
428
+				//save the widget
429
+				$instance = $old_instance;
430
+				$instance['title'] = strip_tags($new_instance['title']);
431
+				return $instance;
432
+			}
433
+
434
+			/**
435
+			 * Back-end social like widget settings form.
436
+			 *
437
+			 * @since 1.0.0
438
+			 * @since 1.5.1 Declare function public.
439
+			 *
440
+			 * @param array $instance Previously saved values from database.
441
+			 * @return string|void
442
+			 */
443
+			public function form($instance)
444
+			{
445
+				//widgetform in backend
446
+				$instance = wp_parse_args((array)$instance, array('title' => ''));
447
+				$title = strip_tags($instance['title']);
448
+				?>
449 449
                 <p>No settings for this widget</p>
450 450
 
451 451
 
452 452
             <?php
453
-            }
454
-        }
455
-
456
-        register_widget('geodir_social_like_widget');
457
-
458
-
459
-        /**
460
-         * GeoDirectory Feedburner Subscribe widget.
461
-         *
462
-         * @since 1.0.0
463
-         */
464
-        class geodirsubscribeWidget extends WP_Widget
465
-        {
466
-
467
-            /**
468
-             * Register the feedburner subscribe widget with WordPress.
469
-             *
470
-             * @since 1.0.0
471
-             * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
472
-             */
473
-            public function __construct() {
474
-                $widget_ops = array('classname' => 'geodir-subscribe', 'description' => __('GD > Google Feedburner Subscribe', 'geodirectory'));
475
-                parent::__construct(
476
-                    'widget_subscribeWidget', // Base ID
477
-                    __('GD > Subscribe', 'geodirectory'), // Name
478
-                    $widget_ops// Args
479
-                );
480
-            }
481
-
482
-            /**
483
-             * Front-end display content for feedburner subscribe widget.
484
-             *
485
-             * @since 1.0.0
486
-             * @since 1.5.1 Declare function public.
487
-             *
488
-             * @param array $args     Widget arguments.
489
-             * @param array $instance Saved values from database.
490
-             */
491
-            public function widget($args, $instance)
492
-            {
493
-                // prints the widget
494
-                extract($args, EXTR_SKIP);
495
-
496
-                /**
497
-                 * Filter the widget instance id.
498
-                 *
499
-                 * @since 1.0.0
500
-                 * @param string $id The widget instance id.
501
-                 */
502
-                $id = empty($instance['id']) ? '' : apply_filters('widget_id', $instance['id']);
503
-
504
-                /** This filter is documented in geodirectory_widgets.php */
505
-                $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
506
-
507
-                /**
508
-                 * Filter the widget text.
509
-                 *
510
-                 * @since 1.0.0
511
-                 * @param string $text The widget text.
512
-                 */
513
-                $text = empty($instance['text']) ? '' : apply_filters('widget_text', $instance['text']);
514
-
515
-                echo $before_widget;
516
-                ?>
453
+			}
454
+		}
455
+
456
+		register_widget('geodir_social_like_widget');
457
+
458
+
459
+		/**
460
+		 * GeoDirectory Feedburner Subscribe widget.
461
+		 *
462
+		 * @since 1.0.0
463
+		 */
464
+		class geodirsubscribeWidget extends WP_Widget
465
+		{
466
+
467
+			/**
468
+			 * Register the feedburner subscribe widget with WordPress.
469
+			 *
470
+			 * @since 1.0.0
471
+			 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
472
+			 */
473
+			public function __construct() {
474
+				$widget_ops = array('classname' => 'geodir-subscribe', 'description' => __('GD > Google Feedburner Subscribe', 'geodirectory'));
475
+				parent::__construct(
476
+					'widget_subscribeWidget', // Base ID
477
+					__('GD > Subscribe', 'geodirectory'), // Name
478
+					$widget_ops// Args
479
+				);
480
+			}
481
+
482
+			/**
483
+			 * Front-end display content for feedburner subscribe widget.
484
+			 *
485
+			 * @since 1.0.0
486
+			 * @since 1.5.1 Declare function public.
487
+			 *
488
+			 * @param array $args     Widget arguments.
489
+			 * @param array $instance Saved values from database.
490
+			 */
491
+			public function widget($args, $instance)
492
+			{
493
+				// prints the widget
494
+				extract($args, EXTR_SKIP);
495
+
496
+				/**
497
+				 * Filter the widget instance id.
498
+				 *
499
+				 * @since 1.0.0
500
+				 * @param string $id The widget instance id.
501
+				 */
502
+				$id = empty($instance['id']) ? '' : apply_filters('widget_id', $instance['id']);
503
+
504
+				/** This filter is documented in geodirectory_widgets.php */
505
+				$title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
506
+
507
+				/**
508
+				 * Filter the widget text.
509
+				 *
510
+				 * @since 1.0.0
511
+				 * @param string $text The widget text.
512
+				 */
513
+				$text = empty($instance['text']) ? '' : apply_filters('widget_text', $instance['text']);
514
+
515
+				echo $before_widget;
516
+				?>
517 517
 
518 518
                 <?php echo $before_title . $title; ?>  <a href="<?php if ($id) {
519
-                echo 'http://feeds2.feedburner.com/' . $id;
520
-            } else {
521
-                bloginfo('rss_url');
522
-            } ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?>
519
+				echo 'http://feeds2.feedburner.com/' . $id;
520
+			} else {
521
+				bloginfo('rss_url');
522
+			} ?>"><i class="fa fa-rss-square"></i> </a><?php echo $after_title;?>
523 523
 
524 524
                 <?php if ($text <> "") { ?>
525 525
 
@@ -544,57 +544,57 @@  discard block
 block discarded – undo
544 544
                 </form>
545 545
 
546 546
                 <?php
547
-                echo $after_widget;
547
+				echo $after_widget;
548 548
 
549
-            }
549
+			}
550 550
 
551
-            /**
552
-             * Sanitize feedburner subscribe widget form values as they are saved.
553
-             *
554
-             * @since 1.0.0
555
-             * @since 1.5.1 Declare function public.
556
-             *
557
-             * @param array $new_instance Values just sent to be saved.
558
-             * @param array $old_instance Previously saved values from database.
559
-             *
560
-             * @return array Updated safe values to be saved.
561
-             */
562
-            public function update($new_instance, $old_instance)
563
-            {
551
+			/**
552
+			 * Sanitize feedburner subscribe widget form values as they are saved.
553
+			 *
554
+			 * @since 1.0.0
555
+			 * @since 1.5.1 Declare function public.
556
+			 *
557
+			 * @param array $new_instance Values just sent to be saved.
558
+			 * @param array $old_instance Previously saved values from database.
559
+			 *
560
+			 * @return array Updated safe values to be saved.
561
+			 */
562
+			public function update($new_instance, $old_instance)
563
+			{
564 564
 
565
-                //save the widget
566
-                $instance = $old_instance;
567
-                $instance['id'] = strip_tags($new_instance['id']);
568
-                $instance['title'] = ($new_instance['title']);
569
-                $instance['text'] = ($new_instance['text']);
565
+				//save the widget
566
+				$instance = $old_instance;
567
+				$instance['id'] = strip_tags($new_instance['id']);
568
+				$instance['title'] = ($new_instance['title']);
569
+				$instance['text'] = ($new_instance['text']);
570 570
 
571 571
 
572
-                return $instance;
573
-            }
572
+				return $instance;
573
+			}
574 574
 
575
-            /**
576
-             * Back-end feedburner subscribe widget settings form.
577
-             *
578
-             * @since 1.0.0
579
-             * @since 1.5.1 Declare function public.
580
-             *
581
-             * @param array $instance Previously saved values from database.
582
-             * @return string|void
583
-             */
584
-            public function form($instance)
585
-            {
586
-                //widgetform in backend
587
-                $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => ''));
575
+			/**
576
+			 * Back-end feedburner subscribe widget settings form.
577
+			 *
578
+			 * @since 1.0.0
579
+			 * @since 1.5.1 Declare function public.
580
+			 *
581
+			 * @param array $instance Previously saved values from database.
582
+			 * @return string|void
583
+			 */
584
+			public function form($instance)
585
+			{
586
+				//widgetform in backend
587
+				$instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'advt1' => '', 'text' => '', 'twitter' => '', 'facebook' => '', 'digg' => '', 'myspace' => ''));
588 588
 
589
-                $id = strip_tags($instance['id']);
589
+				$id = strip_tags($instance['id']);
590 590
 
591
-                $title = strip_tags($instance['title']);
591
+				$title = strip_tags($instance['title']);
592 592
 
593
-                $text = strip_tags($instance['text']);
593
+				$text = strip_tags($instance['text']);
594 594
 
595 595
 
596 596
 
597
-                ?>
597
+				?>
598 598
                 <p><label
599 599
                         for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'geodirectory');?>:
600 600
                         <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
@@ -613,101 +613,101 @@  discard block
 block discarded – undo
613 613
                                   name="<?php echo $this->get_field_name('text'); ?>"><?php echo esc_attr($text); ?></textarea></label>
614 614
                 </p>
615 615
             <?php
616
-            }
617
-        }
618
-
619
-        register_widget('geodirsubscribeWidget');
620
-
621
-        /**
622
-         * GeoDirectory advertise widget.
623
-         *
624
-         * @since 1.0.0
625
-         */
626
-        class geodiradvtwidget extends WP_Widget
627
-        {
628
-
629
-            /**
630
-             * Register the advertise widget with WordPress.
631
-             *
632
-             * @since 1.0.0
633
-             * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
634
-             */
635
-            public function __construct() {
636
-                $widget_ops = array('classname' => 'GeoDirectory Advertise', 'description' => __('GD > common advertise widget in sidebar, bottom section', 'geodirectory'));
637
-                parent::__construct(
638
-                    'advtwidget', // Base ID
639
-                    __('GD > Advertise', 'geodirectory'), // Name
640
-                    $widget_ops// Args
641
-                );
642
-            }
643
-
644
-
645
-            /**
646
-             * Front-end display content for advertise widget.
647
-             *
648
-             * @since 1.0.0
649
-             * @since 1.5.1 Declare function public.
650
-             *
651
-             * @param array $args     Widget arguments.
652
-             * @param array $instance Saved values from database.
653
-             */
654
-            public function widget($args, $instance)
655
-            {
656
-
657
-                // prints the widget
658
-
659
-                extract($args, EXTR_SKIP);
660
-
661
-                /**
662
-                 * Filter the description text.
663
-                 *
664
-                 * @since 1.0.0
665
-                 * @param string $desc1 The widget description text.
666
-                 */
667
-                $desc1 = empty($instance['desc1']) ? '&nbsp;' : apply_filters('widget_desc1', $instance['desc1']);
668
-                echo $before_widget;
669
-                ?>
616
+			}
617
+		}
618
+
619
+		register_widget('geodirsubscribeWidget');
620
+
621
+		/**
622
+		 * GeoDirectory advertise widget.
623
+		 *
624
+		 * @since 1.0.0
625
+		 */
626
+		class geodiradvtwidget extends WP_Widget
627
+		{
628
+
629
+			/**
630
+			 * Register the advertise widget with WordPress.
631
+			 *
632
+			 * @since 1.0.0
633
+			 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
634
+			 */
635
+			public function __construct() {
636
+				$widget_ops = array('classname' => 'GeoDirectory Advertise', 'description' => __('GD > common advertise widget in sidebar, bottom section', 'geodirectory'));
637
+				parent::__construct(
638
+					'advtwidget', // Base ID
639
+					__('GD > Advertise', 'geodirectory'), // Name
640
+					$widget_ops// Args
641
+				);
642
+			}
643
+
644
+
645
+			/**
646
+			 * Front-end display content for advertise widget.
647
+			 *
648
+			 * @since 1.0.0
649
+			 * @since 1.5.1 Declare function public.
650
+			 *
651
+			 * @param array $args     Widget arguments.
652
+			 * @param array $instance Saved values from database.
653
+			 */
654
+			public function widget($args, $instance)
655
+			{
656
+
657
+				// prints the widget
658
+
659
+				extract($args, EXTR_SKIP);
660
+
661
+				/**
662
+				 * Filter the description text.
663
+				 *
664
+				 * @since 1.0.0
665
+				 * @param string $desc1 The widget description text.
666
+				 */
667
+				$desc1 = empty($instance['desc1']) ? '&nbsp;' : apply_filters('widget_desc1', $instance['desc1']);
668
+				echo $before_widget;
669
+				?>
670 670
                 <?php if ($desc1 <> "") { ?>
671 671
                 <?php echo $desc1; ?>
672 672
             <?php }
673
-                echo $after_widget;
674
-            }
675
-
676
-            /**
677
-             * Sanitize advertise widget form values as they are saved.
678
-             *
679
-             * @since 1.0.0
680
-             * @since 1.5.1 Declare function public.
681
-             *
682
-             * @param array $new_instance Values just sent to be saved.
683
-             * @param array $old_instance Previously saved values from database.
684
-             *
685
-             * @return array Updated safe values to be saved.
686
-             */
687
-            public function update($new_instance, $old_instance)
688
-            {
689
-                //save the widget
690
-                $instance = $old_instance;
691
-                $instance['desc1'] = ($new_instance['desc1']);
692
-                return $instance;
693
-            }
694
-
695
-            /**
696
-             * Back-end advertise widget settings form.
697
-             *
698
-             * @since 1.0.0
699
-             * @since 1.5.1 Declare function public.
700
-             *
701
-             * @param array $instance Previously saved values from database.
702
-             * @return string|void
703
-             */
704
-            public function form($instance)
705
-            {
706
-                //widgetform in backend
707
-                $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
708
-
709
-                $desc1 = ($instance['desc1']);
710
-                ?>
673
+				echo $after_widget;
674
+			}
675
+
676
+			/**
677
+			 * Sanitize advertise widget form values as they are saved.
678
+			 *
679
+			 * @since 1.0.0
680
+			 * @since 1.5.1 Declare function public.
681
+			 *
682
+			 * @param array $new_instance Values just sent to be saved.
683
+			 * @param array $old_instance Previously saved values from database.
684
+			 *
685
+			 * @return array Updated safe values to be saved.
686
+			 */
687
+			public function update($new_instance, $old_instance)
688
+			{
689
+				//save the widget
690
+				$instance = $old_instance;
691
+				$instance['desc1'] = ($new_instance['desc1']);
692
+				return $instance;
693
+			}
694
+
695
+			/**
696
+			 * Back-end advertise widget settings form.
697
+			 *
698
+			 * @since 1.0.0
699
+			 * @since 1.5.1 Declare function public.
700
+			 *
701
+			 * @param array $instance Previously saved values from database.
702
+			 * @return string|void
703
+			 */
704
+			public function form($instance)
705
+			{
706
+				//widgetform in backend
707
+				$instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'desc1' => ''));
708
+
709
+				$desc1 = ($instance['desc1']);
710
+				?>
711 711
                 <p><label
712 712
                         for="<?php echo $this->get_field_id('desc1'); ?>"><?php _e('Your Advt code (ex.google adsense, etc.)', 'geodirectory');?>
713 713
                         <textarea class="widefat" rows="6" cols="20" id="<?php echo $this->get_field_id('desc1'); ?>"
@@ -715,65 +715,65 @@  discard block
 block discarded – undo
715 715
                 </p>
716 716
 
717 717
             <?php
718
-            }
719
-        }
720
-
721
-        register_widget('geodiradvtwidget');
722
-
723
-        /**
724
-         * GeoDirectory Flickr widget.
725
-         *
726
-         * @since 1.0.0
727
-         */
728
-        class GeodirFlickrWidget extends WP_Widget
729
-        {
730
-
731
-            /**
732
-             * Register the flickr widget with WordPress.
733
-             *
734
-             * @since 1.0.0
735
-             * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
736
-             */
737
-            public function __construct() {
738
-                $widget_ops = array('classname' => 'Geo Dir Flickr Photos ', 'description' => __('GD > Flickr Photos', 'geodirectory'));
739
-                parent::__construct(
740
-                    'widget_flickrwidget', // Base ID
741
-                    __('GD > Flickr Photos', 'geodirectory'), // Name
742
-                    $widget_ops// Args
743
-                );
744
-            }
745
-
746
-            /**
747
-             * Front-end display content for flickr widget.
748
-             *
749
-             * @since 1.0.0
750
-             * @since 1.5.1 Declare function public.
751
-             *
752
-             * @param array $args     Widget arguments.
753
-             * @param array $instance Saved values from database.
754
-             */
755
-            public function widget($args, $instance)
756
-            {
757
-
758
-                // prints the widget
759
-                extract($args, EXTR_SKIP);
760
-
761
-                echo $before_widget;
762
-
763
-                /** This filter is documented in geodirectory_widgets.php */
764
-                $id = empty($instance['id']) ? '&nbsp;' : apply_filters('widget_id', $instance['id']);
765
-
766
-                /**
767
-                 * Filter the widget number.
768
-                 *
769
-                 * This is used in the flicker widget to show how many images to show.
770
-                 *
771
-                 * @since 1.0.0
772
-                 * @param string $number The image count.
773
-                 */
774
-                $number = empty($instance['number']) ? '&nbsp;' : apply_filters('widget_number', $instance['number']);
775
-                echo $before_title . __('Photo Gallery', 'geodirectory') . $after_title;
776
-                ?>
718
+			}
719
+		}
720
+
721
+		register_widget('geodiradvtwidget');
722
+
723
+		/**
724
+		 * GeoDirectory Flickr widget.
725
+		 *
726
+		 * @since 1.0.0
727
+		 */
728
+		class GeodirFlickrWidget extends WP_Widget
729
+		{
730
+
731
+			/**
732
+			 * Register the flickr widget with WordPress.
733
+			 *
734
+			 * @since 1.0.0
735
+			 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
736
+			 */
737
+			public function __construct() {
738
+				$widget_ops = array('classname' => 'Geo Dir Flickr Photos ', 'description' => __('GD > Flickr Photos', 'geodirectory'));
739
+				parent::__construct(
740
+					'widget_flickrwidget', // Base ID
741
+					__('GD > Flickr Photos', 'geodirectory'), // Name
742
+					$widget_ops// Args
743
+				);
744
+			}
745
+
746
+			/**
747
+			 * Front-end display content for flickr widget.
748
+			 *
749
+			 * @since 1.0.0
750
+			 * @since 1.5.1 Declare function public.
751
+			 *
752
+			 * @param array $args     Widget arguments.
753
+			 * @param array $instance Saved values from database.
754
+			 */
755
+			public function widget($args, $instance)
756
+			{
757
+
758
+				// prints the widget
759
+				extract($args, EXTR_SKIP);
760
+
761
+				echo $before_widget;
762
+
763
+				/** This filter is documented in geodirectory_widgets.php */
764
+				$id = empty($instance['id']) ? '&nbsp;' : apply_filters('widget_id', $instance['id']);
765
+
766
+				/**
767
+				 * Filter the widget number.
768
+				 *
769
+				 * This is used in the flicker widget to show how many images to show.
770
+				 *
771
+				 * @since 1.0.0
772
+				 * @param string $number The image count.
773
+				 */
774
+				$number = empty($instance['number']) ? '&nbsp;' : apply_filters('widget_number', $instance['number']);
775
+				echo $before_title . __('Photo Gallery', 'geodirectory') . $after_title;
776
+				?>
777 777
 
778 778
                 <div class="geodir-flickr clearfix">
779 779
 
@@ -784,45 +784,45 @@  discard block
 block discarded – undo
784 784
 
785 785
 
786 786
                 <?php echo $after_widget;
787
-            }
788
-
789
-            /**
790
-             * Sanitize flickr widget form values as they are saved.
791
-             *
792
-             * @since 1.0.0
793
-             * @since 1.5.1 Declare function public.
794
-             *
795
-             * @param array $new_instance Values just sent to be saved.
796
-             * @param array $old_instance Previously saved values from database.
797
-             *
798
-             * @return array Updated safe values to be saved.
799
-             */
800
-            public function update($new_instance, $old_instance)
801
-            {
802
-                //save the widget
803
-                $instance = $old_instance;
804
-                $instance['id'] = strip_tags($new_instance['id']);
805
-                $instance['number'] = strip_tags($new_instance['number']);
806
-                return $instance;
807
-            }
808
-
809
-            /**
810
-             * Back-end flickr widget settings form.
811
-             *
812
-             * @since 1.0.0
813
-             * @since 1.5.1 Declare function public.
814
-             *
815
-             * @param array $instance Previously saved values from database.
816
-             * @return string|void
817
-             */
818
-            public function form($instance)
819
-            {
820
-
821
-                //widgetform in backend
822
-                $instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => ''));
823
-                $id = strip_tags($instance['id']);
824
-                $number = strip_tags($instance['number']);
825
-                ?>
787
+			}
788
+
789
+			/**
790
+			 * Sanitize flickr widget form values as they are saved.
791
+			 *
792
+			 * @since 1.0.0
793
+			 * @since 1.5.1 Declare function public.
794
+			 *
795
+			 * @param array $new_instance Values just sent to be saved.
796
+			 * @param array $old_instance Previously saved values from database.
797
+			 *
798
+			 * @return array Updated safe values to be saved.
799
+			 */
800
+			public function update($new_instance, $old_instance)
801
+			{
802
+				//save the widget
803
+				$instance = $old_instance;
804
+				$instance['id'] = strip_tags($new_instance['id']);
805
+				$instance['number'] = strip_tags($new_instance['number']);
806
+				return $instance;
807
+			}
808
+
809
+			/**
810
+			 * Back-end flickr widget settings form.
811
+			 *
812
+			 * @since 1.0.0
813
+			 * @since 1.5.1 Declare function public.
814
+			 *
815
+			 * @param array $instance Previously saved values from database.
816
+			 * @return string|void
817
+			 */
818
+			public function form($instance)
819
+			{
820
+
821
+				//widgetform in backend
822
+				$instance = wp_parse_args((array)$instance, array('title' => '', 'id' => '', 'number' => ''));
823
+				$id = strip_tags($instance['id']);
824
+				$number = strip_tags($instance['number']);
825
+				?>
826 826
 
827 827
                 <p>
828 828
                     <label
@@ -843,99 +843,99 @@  discard block
 block discarded – undo
843 843
                     </label>
844 844
                 </p>
845 845
             <?php
846
-            }
847
-        }
848
-
849
-        register_widget('GeodirFlickrWidget');
850
-
851
-        /**
852
-         * GeoDirectory Twitter widget.
853
-         *
854
-         * @since 1.0.0
855
-         */
856
-        class geodir_twitter extends WP_Widget
857
-        {
858
-            /**
859
-             * Register the Twitter widget with WordPress.
860
-             *
861
-             * @since 1.0.0
862
-             * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
863
-             */
864
-            public function __construct() {
865
-                $widget_ops = array('classname' => 'Twitter', 'description' => __('GD > Twitter Feed', 'geodirectory'));
866
-                parent::__construct(
867
-                    'widget_Twidget', // Base ID
868
-                    __('GD > Twitter', 'geodirectory'), // Name
869
-                    $widget_ops// Args
870
-                );
871
-            }
872
-
873
-
874
-            /**
875
-             * Front-end display content for Twitter widget.
876
-             *
877
-             * @since 1.0.0
878
-             * @since 1.5.1 Declare function public.
879
-             *
880
-             * @param array $args     Widget arguments.
881
-             * @param array $instance Saved values from database.
882
-             */
883
-            public function widget($args, $instance)
884
-            {
885
-
886
-                // prints the widget
887
-
888
-                extract($args, EXTR_SKIP);
889
-
890
-                /**
891
-                 * Filter the twitter widget description text.
892
-                 *
893
-                 * @since 1.0.0
894
-                 * @param string $desc1 The widget description text.
895
-                 */
896
-                $desc1 = empty($instance['gd_tw_desc1']) ? '&nbsp;' : apply_filters('gd_tw_widget_desc1', $instance['gd_tw_desc1']);
897
-                echo $before_widget;
898
-                if ($desc1 <> "") {
899
-                    echo $desc1;
900
-                }
901
-                echo $after_widget;
902
-            }
903
-
904
-            /**
905
-             * Sanitize twitter widget form values as they are saved.
906
-             *
907
-             * @since 1.0.0
908
-             * @since 1.5.1 Declare function public.
909
-             *
910
-             * @param array $new_instance Values just sent to be saved.
911
-             * @param array $old_instance Previously saved values from database.
912
-             *
913
-             * @return array Updated safe values to be saved.
914
-             */
915
-            public function update($new_instance, $old_instance)
916
-            {
917
-                //save the widget
918
-                $instance = $old_instance;
919
-                $instance['gd_tw_desc1'] = ($new_instance['gd_tw_desc1']);
920
-                return $instance;
921
-            }
922
-
923
-            /**
924
-             * Back-end twitter widget settings form.
925
-             *
926
-             * @since 1.0.0
927
-             * @since 1.5.1 Declare function public.
928
-             *
929
-             * @param array $instance Previously saved values from database.
930
-             * @return string|void
931
-             */
932
-            public function form($instance)
933
-            {
934
-                //widgetform in backend
935
-                $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => ''));
936
-
937
-                $desc1 = ($instance['gd_tw_desc1']);
938
-                ?>
846
+			}
847
+		}
848
+
849
+		register_widget('GeodirFlickrWidget');
850
+
851
+		/**
852
+		 * GeoDirectory Twitter widget.
853
+		 *
854
+		 * @since 1.0.0
855
+		 */
856
+		class geodir_twitter extends WP_Widget
857
+		{
858
+			/**
859
+			 * Register the Twitter widget with WordPress.
860
+			 *
861
+			 * @since 1.0.0
862
+			 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
863
+			 */
864
+			public function __construct() {
865
+				$widget_ops = array('classname' => 'Twitter', 'description' => __('GD > Twitter Feed', 'geodirectory'));
866
+				parent::__construct(
867
+					'widget_Twidget', // Base ID
868
+					__('GD > Twitter', 'geodirectory'), // Name
869
+					$widget_ops// Args
870
+				);
871
+			}
872
+
873
+
874
+			/**
875
+			 * Front-end display content for Twitter widget.
876
+			 *
877
+			 * @since 1.0.0
878
+			 * @since 1.5.1 Declare function public.
879
+			 *
880
+			 * @param array $args     Widget arguments.
881
+			 * @param array $instance Saved values from database.
882
+			 */
883
+			public function widget($args, $instance)
884
+			{
885
+
886
+				// prints the widget
887
+
888
+				extract($args, EXTR_SKIP);
889
+
890
+				/**
891
+				 * Filter the twitter widget description text.
892
+				 *
893
+				 * @since 1.0.0
894
+				 * @param string $desc1 The widget description text.
895
+				 */
896
+				$desc1 = empty($instance['gd_tw_desc1']) ? '&nbsp;' : apply_filters('gd_tw_widget_desc1', $instance['gd_tw_desc1']);
897
+				echo $before_widget;
898
+				if ($desc1 <> "") {
899
+					echo $desc1;
900
+				}
901
+				echo $after_widget;
902
+			}
903
+
904
+			/**
905
+			 * Sanitize twitter widget form values as they are saved.
906
+			 *
907
+			 * @since 1.0.0
908
+			 * @since 1.5.1 Declare function public.
909
+			 *
910
+			 * @param array $new_instance Values just sent to be saved.
911
+			 * @param array $old_instance Previously saved values from database.
912
+			 *
913
+			 * @return array Updated safe values to be saved.
914
+			 */
915
+			public function update($new_instance, $old_instance)
916
+			{
917
+				//save the widget
918
+				$instance = $old_instance;
919
+				$instance['gd_tw_desc1'] = ($new_instance['gd_tw_desc1']);
920
+				return $instance;
921
+			}
922
+
923
+			/**
924
+			 * Back-end twitter widget settings form.
925
+			 *
926
+			 * @since 1.0.0
927
+			 * @since 1.5.1 Declare function public.
928
+			 *
929
+			 * @param array $instance Previously saved values from database.
930
+			 * @return string|void
931
+			 */
932
+			public function form($instance)
933
+			{
934
+				//widgetform in backend
935
+				$instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'gd_tw_desc1' => ''));
936
+
937
+				$desc1 = ($instance['gd_tw_desc1']);
938
+				?>
939 939
                 <p><label
940 940
                         for="<?php echo $this->get_field_id('gd_tw_desc1'); ?>"><?php _e('Your twitter code', 'geodirectory');?>
941 941
                         <textarea class="widefat" rows="6" cols="20"
@@ -944,169 +944,169 @@  discard block
 block discarded – undo
944 944
                 </p>
945 945
 
946 946
             <?php
947
-            }
948
-        }
949
-
950
-        register_widget('geodir_twitter');
951
-
952
-        /**
953
-         * GeoDirectory Advanced Search widget.
954
-         *
955
-         * @since 1.0.0
956
-         */
957
-        class geodir_advance_search_widget extends WP_Widget
958
-        {
959
-            /**
960
-             * Register the advanced search widget with WordPress.
961
-             *
962
-             * @since 1.0.0
963
-             * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
964
-             */
965
-            public function __construct() {
966
-                $widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'));
967
-                parent::__construct(
968
-                    'geodir_advance_search', // Base ID
969
-                    __('GD > Search', 'geodirectory'), // Name
970
-                    $widget_ops// Args
971
-                );
972
-            }
973
-
974
-
975
-            /**
976
-             * Front-end display content for advanced search widget.
977
-             *
978
-             * @since 1.0.0
979
-             * @since 1.5.1 Declare function public.
980
-             *
981
-             * @param array $args     Widget arguments.
982
-             * @param array $instance Saved values from database.
983
-             */
984
-            public function widget($args, $instance)
985
-            {
986
-                /**
987
-                 * Filter the search widget arguments.
988
-                 *
989
-                 * @since 1.5.7
990
-                 * @param array $args The widget arguments.
991
-                 * @param array $instance The widget instance.
992
-                 */
993
-                $args = apply_filters('widget_geodir_advance_search_args',$args,$instance);
994
-
995
-                // prints the widget
996
-                extract($args, EXTR_SKIP);
997
-
998
-                echo $before_widget;
999
-
1000
-                /** This filter is documented in geodirectory_widgets.php */
1001
-                $title = empty($instance['title']) ? __('Search', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
1002
-
1003
-                geodir_get_template_part('listing', 'filter-form');
1004
-
1005
-                echo $after_widget;
1006
-            }
1007
-
1008
-            /**
1009
-             * Sanitize advanced search widget form values as they are saved.
1010
-             *
1011
-             * @since 1.0.0
1012
-             * @since 1.5.1 Declare function public.
1013
-             *
1014
-             * @param array $new_instance Values just sent to be saved.
1015
-             * @param array $old_instance Previously saved values from database.
1016
-             *
1017
-             * @return array Updated safe values to be saved.
1018
-             */
1019
-            public function update($new_instance, $old_instance)
1020
-            {
1021
-                //save the widget
1022
-                //Nothing to save
1023
-                return isset($instance) ? $instance : '';
1024
-            }
1025
-
1026
-            /**
1027
-             * Back-end advanced search widget settings form.
1028
-             *
1029
-             * @since 1.0.0
1030
-             * @since 1.5.1 Declare function public.
1031
-             *
1032
-             * @param array $instance Previously saved values from database.
1033
-             * @return string|void
1034
-             */
1035
-            public function form($instance)
1036
-            {
1037
-                //widgetform in backend
1038
-                echo __("This is a search widget to show advance search for gedodirectory listings.", 'geodirectory');
1039
-            }
1040
-        }
1041
-
1042
-        register_widget('geodir_advance_search_widget');
1043
-
1044
-
1045
-        /**
1046
-         * Contains all functions for popular widget.
1047
-         *
1048
-         * @since 1.0.0
1049
-         * @package GeoDirectory
1050
-         */
1051
-        include_once('geodirectory-widgets/geodirectory_popular_widget.php');
1052
-        /**
1053
-         * Contains all functions for listing slider widget.
1054
-         *
1055
-         * @since 1.0.0
1056
-         * @package GeoDirectory
1057
-         */
1058
-        include_once('geodirectory-widgets/geodirectory_listing_slider_widget.php');
1059
-        /**
1060
-         * Contains all functions for home map widget.
1061
-         *
1062
-         * @since 1.0.0
1063
-         * @package GeoDirectory
1064
-         */
1065
-        include_once('geodirectory-widgets/home_map_widget.php');
1066
-        /**
1067
-         * Contains all functions for listing map widget.
1068
-         *
1069
-         * @since 1.0.0
1070
-         * @package GeoDirectory
1071
-         */
1072
-        include_once('geodirectory-widgets/listing_map_widget.php');
1073
-        /**
1074
-         * Contains all functions for reviews widget.
1075
-         *
1076
-         * @since 1.0.0
1077
-         * @package GeoDirectory
1078
-         */
1079
-        include_once('geodirectory-widgets/geodirectory_reviews_widget.php');
1080
-        /**
1081
-         * Contains all functions for related listing widget.
1082
-         *
1083
-         * @since 1.0.0
1084
-         * @package GeoDirectory
1085
-         */
1086
-        include_once('geodirectory-widgets/geodirectory_related_listing_widget.php');
1087
-        /**
1088
-         * Contains all functions for bestof widget.
1089
-         *
1090
-         * @since 1.0.0
1091
-         * @package GeoDirectory
1092
-         */
1093
-        include_once('geodirectory-widgets/geodirectory_bestof_widget.php');
947
+			}
948
+		}
949
+
950
+		register_widget('geodir_twitter');
951
+
952
+		/**
953
+		 * GeoDirectory Advanced Search widget.
954
+		 *
955
+		 * @since 1.0.0
956
+		 */
957
+		class geodir_advance_search_widget extends WP_Widget
958
+		{
959
+			/**
960
+			 * Register the advanced search widget with WordPress.
961
+			 *
962
+			 * @since 1.0.0
963
+			 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
964
+			 */
965
+			public function __construct() {
966
+				$widget_ops = array('classname' => 'geodir_advance_search_widget', 'description' => __('GD > Search', 'geodirectory'));
967
+				parent::__construct(
968
+					'geodir_advance_search', // Base ID
969
+					__('GD > Search', 'geodirectory'), // Name
970
+					$widget_ops// Args
971
+				);
972
+			}
973
+
974
+
975
+			/**
976
+			 * Front-end display content for advanced search widget.
977
+			 *
978
+			 * @since 1.0.0
979
+			 * @since 1.5.1 Declare function public.
980
+			 *
981
+			 * @param array $args     Widget arguments.
982
+			 * @param array $instance Saved values from database.
983
+			 */
984
+			public function widget($args, $instance)
985
+			{
986
+				/**
987
+				 * Filter the search widget arguments.
988
+				 *
989
+				 * @since 1.5.7
990
+				 * @param array $args The widget arguments.
991
+				 * @param array $instance The widget instance.
992
+				 */
993
+				$args = apply_filters('widget_geodir_advance_search_args',$args,$instance);
994
+
995
+				// prints the widget
996
+				extract($args, EXTR_SKIP);
997
+
998
+				echo $before_widget;
999
+
1000
+				/** This filter is documented in geodirectory_widgets.php */
1001
+				$title = empty($instance['title']) ? __('Search', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
1002
+
1003
+				geodir_get_template_part('listing', 'filter-form');
1004
+
1005
+				echo $after_widget;
1006
+			}
1007
+
1008
+			/**
1009
+			 * Sanitize advanced search widget form values as they are saved.
1010
+			 *
1011
+			 * @since 1.0.0
1012
+			 * @since 1.5.1 Declare function public.
1013
+			 *
1014
+			 * @param array $new_instance Values just sent to be saved.
1015
+			 * @param array $old_instance Previously saved values from database.
1016
+			 *
1017
+			 * @return array Updated safe values to be saved.
1018
+			 */
1019
+			public function update($new_instance, $old_instance)
1020
+			{
1021
+				//save the widget
1022
+				//Nothing to save
1023
+				return isset($instance) ? $instance : '';
1024
+			}
1025
+
1026
+			/**
1027
+			 * Back-end advanced search widget settings form.
1028
+			 *
1029
+			 * @since 1.0.0
1030
+			 * @since 1.5.1 Declare function public.
1031
+			 *
1032
+			 * @param array $instance Previously saved values from database.
1033
+			 * @return string|void
1034
+			 */
1035
+			public function form($instance)
1036
+			{
1037
+				//widgetform in backend
1038
+				echo __("This is a search widget to show advance search for gedodirectory listings.", 'geodirectory');
1039
+			}
1040
+		}
1041
+
1042
+		register_widget('geodir_advance_search_widget');
1043
+
1044
+
1045
+		/**
1046
+		 * Contains all functions for popular widget.
1047
+		 *
1048
+		 * @since 1.0.0
1049
+		 * @package GeoDirectory
1050
+		 */
1051
+		include_once('geodirectory-widgets/geodirectory_popular_widget.php');
1052
+		/**
1053
+		 * Contains all functions for listing slider widget.
1054
+		 *
1055
+		 * @since 1.0.0
1056
+		 * @package GeoDirectory
1057
+		 */
1058
+		include_once('geodirectory-widgets/geodirectory_listing_slider_widget.php');
1059
+		/**
1060
+		 * Contains all functions for home map widget.
1061
+		 *
1062
+		 * @since 1.0.0
1063
+		 * @package GeoDirectory
1064
+		 */
1065
+		include_once('geodirectory-widgets/home_map_widget.php');
1066
+		/**
1067
+		 * Contains all functions for listing map widget.
1068
+		 *
1069
+		 * @since 1.0.0
1070
+		 * @package GeoDirectory
1071
+		 */
1072
+		include_once('geodirectory-widgets/listing_map_widget.php');
1073
+		/**
1074
+		 * Contains all functions for reviews widget.
1075
+		 *
1076
+		 * @since 1.0.0
1077
+		 * @package GeoDirectory
1078
+		 */
1079
+		include_once('geodirectory-widgets/geodirectory_reviews_widget.php');
1080
+		/**
1081
+		 * Contains all functions for related listing widget.
1082
+		 *
1083
+		 * @since 1.0.0
1084
+		 * @package GeoDirectory
1085
+		 */
1086
+		include_once('geodirectory-widgets/geodirectory_related_listing_widget.php');
1087
+		/**
1088
+		 * Contains all functions for bestof widget.
1089
+		 *
1090
+		 * @since 1.0.0
1091
+		 * @package GeoDirectory
1092
+		 */
1093
+		include_once('geodirectory-widgets/geodirectory_bestof_widget.php');
1094
+		/**
1095
+		 * Contains all functions for cpt categories widget.
1096
+		 *
1097
+		 * @since 1.5.4
1098
+		 * @package GeoDirectory
1099
+		 */
1100
+		include_once('geodirectory-widgets/geodirectory_cpt_categories_widget.php');
1094 1101
 		/**
1095
-         * Contains all functions for cpt categories widget.
1096
-         *
1097
-         * @since 1.5.4
1098
-         * @package GeoDirectory
1099
-         */
1100
-        include_once('geodirectory-widgets/geodirectory_cpt_categories_widget.php');
1101
-        /**
1102
-         * Contains all functions for features widget.
1103
-         *
1104
-         * @since 1.5.6
1105
-         * @package GeoDirectory
1106
-         * @todo make the image field recurring
1107
-         */
1108
-        include_once('geodirectory-widgets/geodirectory_features_widget.php');
1109
-    }
1102
+		 * Contains all functions for features widget.
1103
+		 *
1104
+		 * @since 1.5.6
1105
+		 * @package GeoDirectory
1106
+		 * @todo make the image field recurring
1107
+		 */
1108
+		include_once('geodirectory-widgets/geodirectory_features_widget.php');
1109
+	}
1110 1110
 
1111 1111
 }
1112 1112
 
Please login to merge, or discard this patch.
geodirectory_template_actions.php 3 patches
Braces   +31 added lines, -24 removed lines patch added patch discarded remove patch
@@ -714,8 +714,9 @@  discard block
 block discarded – undo
714 714
 
715 715
                         if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
716 716
                             if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
717
-                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
718
-                                    $term_icon = $term_icon_url['src'];
717
+                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '') {
718
+                                                                    $term_icon = $term_icon_url['src'];
719
+                                }
719 720
                                 break;
720 721
                             }
721 722
                         }
@@ -1246,8 +1247,9 @@  discard block
 block discarded – undo
1246 1247
         echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1247 1248
     }
1248 1249
 
1249
-    if (isset($taxonomies[$post_type . '_tags']))
1250
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1250
+    if (isset($taxonomies[$post_type . '_tags'])) {
1251
+            echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1252
+    }
1251 1253
 
1252 1254
     ?>
1253 1255
     </p><?php
@@ -1598,23 +1600,21 @@  discard block
 block discarded – undo
1598 1600
     if(geodir_is_page('pt')){
1599 1601
         $gd_page = 'pt';
1600 1602
         $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1601
-    }
1602
-    elseif(geodir_is_page('listing')){
1603
+    } elseif(geodir_is_page('listing')){
1603 1604
         $gd_page = 'listing';
1604 1605
         global $wp_query;
1605 1606
         $current_term = $wp_query->get_queried_object();
1606 1607
         if (strpos($current_term->taxonomy,'_tags') !== false) {
1607 1608
             $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1608
-        }else{
1609
+        } else{
1609 1610
             $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1610 1611
         }
1611 1612
 
1612
-    }
1613
-    elseif(geodir_is_page('author')){
1613
+    } elseif(geodir_is_page('author')){
1614 1614
         $gd_page = 'author';
1615 1615
         if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1616 1616
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1617
-        }else{
1617
+        } else{
1618 1618
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1619 1619
         }
1620 1620
 
@@ -2025,8 +2025,9 @@  discard block
 block discarded – undo
2025 2025
  */
2026 2026
 function geodir_action_add_listing_page_title()
2027 2027
 {
2028
-    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2029
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2028
+    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '') {
2029
+            $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2030
+    }
2030 2031
     /** This action is documented in geodirectory_template_actions.php */
2031 2032
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2032 2033
     /** This action is documented in geodirectory_template_actions.php */
@@ -2038,7 +2039,7 @@  discard block
 block discarded – undo
2038 2039
         $gd_page = 'add-listing';
2039 2040
         if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2040 2041
             $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2041
-        }elseif(isset($listing_type)){
2042
+        } elseif(isset($listing_type)){
2042 2043
             $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2043 2044
         }
2044 2045
 
@@ -2321,8 +2322,9 @@  discard block
 block discarded – undo
2321 2322
         $totImg = 0;
2322 2323
         if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2323 2324
             $post = (object)$gd_session->get('listing');
2324
-            if (isset($post->post_images))
2325
-                $curImages = trim($post->post_images, ",");
2325
+            if (isset($post->post_images)) {
2326
+                            $curImages = trim($post->post_images, ",");
2327
+            }
2326 2328
 
2327 2329
 
2328 2330
             if ($curImages != '') {
@@ -2350,10 +2352,13 @@  discard block
 block discarded – undo
2350 2352
             $totImg = count((array)$thumb_img_arr);
2351 2353
         }
2352 2354
 
2353
-        if ($curImages != '')
2354
-            $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2355
-        else
2356
-            $svalue = '';
2355
+        if ($curImages != '') {
2356
+                    $svalue = $curImages;
2357
+        }
2358
+        // this will be initial value of the above form field. Image urls.
2359
+        else {
2360
+                    $svalue = '';
2361
+        }
2357 2362
 
2358 2363
         $image_limit = $package_info->image_limit;
2359 2364
         $show_image_input_box = ($image_limit != '0');
@@ -2563,8 +2568,9 @@  discard block
 block discarded – undo
2563 2568
     </script><?php
2564 2569
 
2565 2570
     global $errors;
2566
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2567
-        $errors->add('claim_login', LOGIN_CLAIM);
2571
+    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim') {
2572
+            $errors->add('claim_login', LOGIN_CLAIM);
2573
+    }
2568 2574
 
2569 2575
     if (!empty($errors)) {
2570 2576
         foreach ($errors as $errorsObj) {
@@ -2668,8 +2674,9 @@  discard block
 block discarded – undo
2668 2674
 
2669 2675
     if (!empty($term)) {
2670 2676
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
2671
-        if (!empty($current_term))
2672
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2677
+        if (!empty($current_term)) {
2678
+                    $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2679
+        }
2673 2680
     }
2674 2681
 
2675 2682
 
@@ -2687,7 +2694,7 @@  discard block
 block discarded – undo
2687 2694
         $gd_page = 'author';
2688 2695
         if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2689 2696
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2690
-        }else{
2697
+        } else{
2691 2698
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2692 2699
         }
2693 2700
 
Please login to merge, or discard this patch.
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
         }
677 677
     }
678 678
 
679
-    $post = (object)$_REQUEST;
679
+    $post = (object) $_REQUEST;
680 680
 
681 681
 
682 682
     if (isset($post->video)) {
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
                     $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1020 1020
 
1021 1021
                     if ($image && $width && $height) {
1022
-                        $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1022
+                        $image = (object) array('src' => $image, 'width' => $width, 'height' => $height);
1023 1023
                     }
1024 1024
 
1025 1025
                     if (isset($image->src)) {
@@ -1052,9 +1052,9 @@  discard block
 block discarded – undo
1052 1052
                 } else {
1053 1053
                     $spacer_height = ((400 - $image->height) / 2);
1054 1054
                 }
1055
-                $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1055
+                $caption = ''; //(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1056 1056
                 $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1057
-                $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1057
+                $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />' . $caption . '</li>';
1058 1058
                 $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1059 1059
                 $slides++;
1060 1060
             }
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
  */
1091 1091
 function geodir_action_details_taxonomies()
1092 1092
 {
1093
-    global $preview, $post;?>
1093
+    global $preview, $post; ?>
1094 1094
     <p class="geodir_post_taxomomies clearfix">
1095 1095
     <?php
1096 1096
     $taxonomies = array();
@@ -1168,12 +1168,12 @@  discard block
 block discarded – undo
1168 1168
                          * @param string $tag_link The tag link html.
1169 1169
                          * @param object $term The tag term object.
1170 1170
                          */
1171
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1171
+                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
1172 1172
                         $links[] = $tag_link;
1173 1173
                     } else {
1174 1174
                         $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1175 1175
                         /** This action is documented in geodirectory-template_actions.php */
1176
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1176
+                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
1177 1177
                         $links[] = $tag_link;
1178 1178
                     }
1179 1179
                     $terms[] = $term;
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
             if (!isset($listing_label)) {
1184 1184
                 $listing_label = '';
1185 1185
             }
1186
-            $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1186
+            $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object) $terms);
1187 1187
         endif;
1188 1188
 
1189 1189
     }
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
                          * @param string $term_link The link html to the category.
1220 1220
                          * @param object $term The category term object.
1221 1221
                          */
1222
-                        $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1222
+                        $term_link = apply_filters('geodir_details_taxonomies_cat_link', $term_link, $term);
1223 1223
                         $links[] = $term_link;
1224 1224
                         $terms[] = $term;
1225 1225
                     }
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
         if (!isset($listing_label)) {
1238 1238
             $listing_label = '';
1239 1239
         }
1240
-        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1240
+        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object) $terms);
1241 1241
 
1242 1242
     }
1243 1243
 
@@ -1250,7 +1250,7 @@  discard block
 block discarded – undo
1250 1250
      * @param string $listing_label The post type label.
1251 1251
      * @param string $listing_label The post type label with ucwords function.
1252 1252
      */
1253
-    $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1253
+    $taxonomies = apply_filters('geodir_details_taxonomies_output', $taxonomies, $post_type, $listing_label, geodir_ucwords($listing_label));
1254 1254
 
1255 1255
     if (isset($taxonomies[$post_taxonomy])) {
1256 1256
         echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
@@ -1278,11 +1278,11 @@  discard block
 block discarded – undo
1278 1278
  * @param object $post Optional. The post object or blank.
1279 1279
  * @package GeoDirectory
1280 1280
  */
1281
-function geodir_action_details_micordata($post='')
1281
+function geodir_action_details_micordata($post = '')
1282 1282
 {
1283 1283
 
1284 1284
     global $preview;
1285
-    if(empty($post)){global $post;}
1285
+    if (empty($post)) {global $post; }
1286 1286
     if ($preview || !geodir_is_page('detail')) {
1287 1287
         return;
1288 1288
     }
@@ -1303,7 +1303,7 @@  discard block
 block discarded – undo
1303 1303
                 "description" => $review->comment_content,
1304 1304
                 "reviewRating" => array(
1305 1305
                     "@type" => "Rating",
1306
-                    "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1306
+                    "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1307 1307
                     "ratingValue" => geodir_get_commentoverall($review->comment_ID),
1308 1308
                     "worstRating" => "1"
1309 1309
                 )
@@ -1331,13 +1331,13 @@  discard block
 block discarded – undo
1331 1331
     }
1332 1332
     //print_r($post);
1333 1333
     // external links
1334
-    $external_links =  array();
1334
+    $external_links = array();
1335 1335
     $external_links[] = $post->geodir_website;
1336 1336
     $external_links[] = $post->geodir_twitter;
1337 1337
     $external_links[] = $post->geodir_facebook;
1338 1338
     $external_links = array_filter($external_links);
1339 1339
 
1340
-    if(!empty($external_links)){
1340
+    if (!empty($external_links)) {
1341 1341
         $external_links = array_values($external_links);
1342 1342
     }
1343 1343
 
@@ -1347,16 +1347,16 @@  discard block
 block discarded – undo
1347 1347
 
1348 1348
     // schema type
1349 1349
     $schema_type = 'LocalBusiness';
1350
-    if(isset($post->default_category) && $post->default_category){
1350
+    if (isset($post->default_category) && $post->default_category) {
1351 1351
         $schema_type = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1352
-        if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1352
+        if (!$schema_type && $post->post_type == 'gd_event') {$schema_type = 'Event'; }
1353 1353
     }
1354 1354
 
1355 1355
     $schema = array();
1356 1356
     $schema['@context'] = "http://schema.org";
1357 1357
     $schema['@type'] = $schema_type;
1358 1358
     $schema['name'] = $post->post_name;
1359
-    $schema['description'] = wp_strip_all_tags( $post->post_content, true );
1359
+    $schema['description'] = wp_strip_all_tags($post->post_content, true);
1360 1360
     $schema['telephone'] = $post->geodir_contact;
1361 1361
     $schema['url'] = $c_url;
1362 1362
     $schema['sameAs'] = $external_links;
@@ -1370,7 +1370,7 @@  discard block
 block discarded – undo
1370 1370
         "postalCode" => $post->post_zip
1371 1371
     );
1372 1372
 
1373
-    if($post->post_latitude && $post->post_longitude) {
1373
+    if ($post->post_latitude && $post->post_longitude) {
1374 1374
         $schema['geo'] = array(
1375 1375
             "@type" => "GeoCoordinates",
1376 1376
             "latitude" => $post->post_latitude,
@@ -1378,7 +1378,7 @@  discard block
 block discarded – undo
1378 1378
         );
1379 1379
     }
1380 1380
 
1381
-    if($post_avgratings) {
1381
+    if ($post_avgratings) {
1382 1382
         $schema['aggregateRating'] = array(
1383 1383
             "@type" => "AggregateRating",
1384 1384
             "ratingValue" => $post_avgratings,
@@ -1397,7 +1397,7 @@  discard block
 block discarded – undo
1397 1397
      * @param array $schema The array of schema data to be filtered.
1398 1398
      * @param object $post The post object.
1399 1399
      */
1400
-    $schema = apply_filters('geodir_details_schema', $schema,$post);
1400
+    $schema = apply_filters('geodir_details_schema', $schema, $post);
1401 1401
 
1402 1402
 
1403 1403
     echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
@@ -1605,26 +1605,26 @@  discard block
 block discarded – undo
1605 1605
 
1606 1606
 
1607 1607
     $title = $list_title;
1608
-    if(geodir_is_page('pt')){
1608
+    if (geodir_is_page('pt')) {
1609 1609
         $gd_page = 'pt';
1610
-        $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1610
+        $title = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1611 1611
     }
1612
-    elseif(geodir_is_page('listing')){
1612
+    elseif (geodir_is_page('listing')) {
1613 1613
         $gd_page = 'listing';
1614 1614
         global $wp_query;
1615 1615
         $current_term = $wp_query->get_queried_object();
1616
-        if (strpos($current_term->taxonomy,'_tags') !== false) {
1616
+        if (strpos($current_term->taxonomy, '_tags') !== false) {
1617 1617
             $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1618
-        }else{
1618
+        } else {
1619 1619
             $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1620 1620
         }
1621 1621
 
1622 1622
     }
1623
-    elseif(geodir_is_page('author')){
1623
+    elseif (geodir_is_page('author')) {
1624 1624
         $gd_page = 'author';
1625
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1625
+        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1626 1626
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1627
-        }else{
1627
+        } else {
1628 1628
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1629 1629
         }
1630 1630
 
@@ -1638,7 +1638,7 @@  discard block
 block discarded – undo
1638 1638
      * @param string $title The page title including variables.
1639 1639
      * @param string $gd_page The GeoDirectory page type if any.
1640 1640
      */
1641
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1641
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1642 1642
 
1643 1643
     echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1644 1644
         /**
@@ -1683,7 +1683,7 @@  discard block
 block discarded – undo
1683 1683
         if ($cat_description) {
1684 1684
             ?>
1685 1685
 
1686
-            <div class="term_description"><?php echo $cat_description;?></div> <?php
1686
+            <div class="term_description"><?php echo $cat_description; ?></div> <?php
1687 1687
         }
1688 1688
 
1689 1689
     }
@@ -1968,7 +1968,7 @@  discard block
 block discarded – undo
1968 1968
      */
1969 1969
     do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
1970 1970
     $extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
1971
-    echo '<div class="clearfix '.$extra_class.'">';
1971
+    echo '<div class="clearfix ' . $extra_class . '">';
1972 1972
     /**
1973 1973
      * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
1974 1974
      *
@@ -2044,11 +2044,11 @@  discard block
 block discarded – undo
2044 2044
 
2045 2045
     $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2046 2046
 
2047
-    if(geodir_is_page('add-listing')){
2047
+    if (geodir_is_page('add-listing')) {
2048 2048
         $gd_page = 'add-listing';
2049
-        if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2049
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2050 2050
             $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2051
-        }elseif(isset($listing_type)){
2051
+        }elseif (isset($listing_type)) {
2052 2052
             $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2053 2053
         }
2054 2054
 
@@ -2062,7 +2062,7 @@  discard block
 block discarded – undo
2062 2062
      * @param string $title The page title including variables.
2063 2063
      * @param string $gd_page The GeoDirectory page type if any.
2064 2064
      */
2065
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2065
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2066 2066
 
2067 2067
     echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2068 2068
     echo $title;
@@ -2078,7 +2078,7 @@  discard block
 block discarded – undo
2078 2078
  */
2079 2079
 function geodir_action_add_listing_page_mandatory()
2080 2080
 {?>
2081
-    <p class="geodir-note "><span class="geodir-required">*</span>&nbsp;<?php echo INDICATES_MANDATORY_FIELDS_TEXT;?></p>
2081
+    <p class="geodir-note "><span class="geodir-required">*</span>&nbsp;<?php echo INDICATES_MANDATORY_FIELDS_TEXT; ?></p>
2082 2082
 <?php
2083 2083
 }
2084 2084
 
@@ -2113,7 +2113,7 @@  discard block
 block discarded – undo
2113 2113
 
2114 2114
     if (isset($_REQUEST['backandedit'])) {
2115 2115
         global $post;
2116
-        $post = (object)$gd_session->get('listing');
2116
+        $post = (object) $gd_session->get('listing');
2117 2117
         $listing_type = $post->listing_type;
2118 2118
         $title = $post->post_title;
2119 2119
         $desc = $post->post_desc;
@@ -2145,15 +2145,15 @@  discard block
 block discarded – undo
2145 2145
         $user_login = true;
2146 2146
     }
2147 2147
     ?>
2148
-    <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data">
2149
-        <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/>
2150
-        <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/>
2148
+    <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id()); ?>" method="post" enctype="multipart/form-data">
2149
+        <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type); ?>"/>
2150
+        <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type); ?>"/>
2151 2151
         <?php if ($page_id) { ?>
2152
-        <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id;?>"/>
2152
+        <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id; ?>"/>
2153 2153
         <?php } if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { ?>
2154
-            <input type="hidden" name="pid" value="<?php echo sanitize_text_field($_REQUEST['pid']);?>"/>
2154
+            <input type="hidden" name="pid" value="<?php echo sanitize_text_field($_REQUEST['pid']); ?>"/>
2155 2155
         <?php } if (isset($_REQUEST['backandedit'])) { ?>
2156
-            <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/>
2156
+            <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']); ?>"/>
2157 2157
         <?php
2158 2158
         } 
2159 2159
         /**
@@ -2165,7 +2165,7 @@  discard block
 block discarded – undo
2165 2165
          */
2166 2166
         do_action('geodir_before_detail_fields');
2167 2167
         ?>
2168
-        <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5>
2168
+        <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT; ?></h5>
2169 2169
         <?php
2170 2170
         /**
2171 2171
          * Called at the top of the add listing page form for frontend.
@@ -2177,10 +2177,10 @@  discard block
 block discarded – undo
2177 2177
         do_action('geodir_before_main_form_fields');
2178 2178
         ?>
2179 2179
         <div id="geodir_post_title_row" class="required_field geodir_form_row clearfix gd-fieldset-details">
2180
-            <label><?php echo PLACE_TITLE_TEXT;?><span>*</span> </label>
2180
+            <label><?php echo PLACE_TITLE_TEXT; ?><span>*</span> </label>
2181 2181
             <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield"
2182 2182
                    value="<?php echo esc_attr(stripslashes($title)); ?>"/>
2183
-            <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span>
2183
+            <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
2184 2184
         </div>
2185 2185
         <?php
2186 2186
         $show_editor = get_option('geodir_tiny_editor_on_add_listing');
@@ -2215,7 +2215,7 @@  discard block
 block discarded – undo
2215 2215
         $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2216 2216
         
2217 2217
         $desc_class = '';
2218
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2218
+        if ($desc_limit === '' || (int) $desc_limit > 0) {
2219 2219
             /**
2220 2220
              * Called on the add listing page form for frontend just before the description field.
2221 2221
              *
@@ -2228,8 +2228,8 @@  discard block
 block discarded – undo
2228 2228
             $desc_class = ' hidden';
2229 2229
         }
2230 2230
         ?>
2231
-        <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>">
2232
-            <label><?php echo PLACE_DESC_TEXT;?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2231
+        <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class; ?>">
2232
+            <label><?php echo PLACE_DESC_TEXT; ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2233 2233
             <?php
2234 2234
             if (!empty($show_editor) && in_array($listing_type, $show_editor)) {
2235 2235
                 $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
@@ -2238,16 +2238,16 @@  discard block
 block discarded – undo
2238 2238
                     <?php wp_editor($desc, "post_desc", $editor_settings); ?>
2239 2239
                 </div>
2240 2240
             <?php if ($desc_limit != '') { ?>
2241
-                <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit;?>");</script>
2241
+                <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit; ?>");</script>
2242 2242
             <?php } } else { ?>
2243 2243
                 <textarea field_type="textarea" name="post_desc" id="post_desc" class="geodir_textarea" maxlength="<?php echo $desc_limit; ?>"><?php echo $desc; ?></textarea>
2244 2244
             <?php } if ($desc_limit_msg != '') { ?>
2245 2245
                 <span class="geodir_message_note"><?php echo $desc_limit_msg; ?></span>
2246 2246
             <?php } ?>
2247
-            <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span>
2247
+            <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory'); ?></span>
2248 2248
         </div>
2249 2249
         <?php
2250
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2250
+        if ($desc_limit === '' || (int) $desc_limit > 0) {
2251 2251
             /**
2252 2252
              * Called on the add listing page form for frontend just after the description field.
2253 2253
              *
@@ -2286,7 +2286,7 @@  discard block
 block discarded – undo
2286 2286
         $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2287 2287
         
2288 2288
         $tags_class = '';
2289
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2289
+        if ($kw_tags_count === '' || (int) $kw_tags_count > 0) {
2290 2290
             /**
2291 2291
              * Called on the add listing page form for frontend just before the tags field.
2292 2292
              *
@@ -2297,14 +2297,14 @@  discard block
 block discarded – undo
2297 2297
             $tags_class = ' hidden';
2298 2298
         }
2299 2299
         ?>
2300
-        <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>">
2300
+        <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class; ?>">
2301 2301
             <label><?php echo TAGKW_TEXT; ?></label>
2302 2302
             <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield"
2303
-                   maxlength="<?php echo $kw_tags_count;?>"/>
2304
-            <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span>
2303
+                   maxlength="<?php echo $kw_tags_count; ?>"/>
2304
+            <span class="geodir_message_note"><?php echo $kw_tags_msg; ?></span>
2305 2305
         </div>
2306 2306
         <?php
2307
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2307
+        if ($kw_tags_count === '' || (int) $kw_tags_count > 0) {
2308 2308
             /**
2309 2309
              * Called on the add listing page form for frontend just after the tags field.
2310 2310
              *
@@ -2330,7 +2330,7 @@  discard block
 block discarded – undo
2330 2330
         $thumb_img_arr = array();
2331 2331
         $totImg = 0;
2332 2332
         if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2333
-            $post = (object)$gd_session->get('listing');
2333
+            $post = (object) $gd_session->get('listing');
2334 2334
             if (isset($post->post_images))
2335 2335
                 $curImages = trim($post->post_images, ",");
2336 2336
 
@@ -2343,7 +2343,7 @@  discard block
 block discarded – undo
2343 2343
             $listing_type = $post->listing_type;
2344 2344
 
2345 2345
         } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2346
-            $post = geodir_get_post_info((int)$_REQUEST['pid']);
2346
+            $post = geodir_get_post_info((int) $_REQUEST['pid']);
2347 2347
             $listing_type = $post->post_type;
2348 2348
             $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2349 2349
 
@@ -2357,7 +2357,7 @@  discard block
 block discarded – undo
2357 2357
                 //$curImages = $img->src.",";
2358 2358
             }
2359 2359
 
2360
-            $totImg = count((array)$thumb_img_arr);
2360
+            $totImg = count((array) $thumb_img_arr);
2361 2361
         }
2362 2362
 
2363 2363
         if ($curImages != '')
@@ -2378,7 +2378,7 @@  discard block
 block discarded – undo
2378 2378
         if ($show_image_input_box) {
2379 2379
             ?>
2380 2380
 
2381
-            <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?>
2381
+            <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT; ?>
2382 2382
                 <?php if ($image_limit == 1) {
2383 2383
                     echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2384 2384
                 } ?>
@@ -2401,7 +2401,7 @@  discard block
 block discarded – undo
2401 2401
                 <div
2402 2402
                     class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
2403 2403
                     id="<?php echo $id; ?>plupload-upload-ui">
2404
-                    <h4><?php _e('Drop files to upload', 'geodirectory');?></h4><br/>
2404
+                    <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4><br/>
2405 2405
                     <input id="<?php echo $id; ?>plupload-browse-button" type="button"
2406 2406
                            value="<?php esc_attr_e('Select Files', 'geodirectory'); ?>" class="geodir_button"/>
2407 2407
                     <span class="ajaxnonceplu"
@@ -2418,7 +2418,7 @@  discard block
 block discarded – undo
2418 2418
                      id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;">
2419 2419
                 </div>
2420 2420
                 <span
2421
-                    id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory');?></span>
2421
+                    id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory'); ?></span>
2422 2422
                 <span id="<?php echo $id; ?>upload-error" style="display:none"></span>
2423 2423
             </div>
2424 2424
 
@@ -2430,7 +2430,7 @@  discard block
 block discarded – undo
2430 2430
          *
2431 2431
          * @since 1.0.0
2432 2432
          */
2433
-        do_action('geodir_after_main_form_fields');?>
2433
+        do_action('geodir_after_main_form_fields'); ?>
2434 2434
 
2435 2435
 
2436 2436
         <!-- add captcha code -->
@@ -2441,7 +2441,7 @@  discard block
 block discarded – undo
2441 2441
         </script>
2442 2442
         <noscript>
2443 2443
             <div>
2444
-                <label><?php _e('Type 64 into this box', 'geodirectory');?></label>
2444
+                <label><?php _e('Type 64 into this box', 'geodirectory'); ?></label>
2445 2445
                 <input type="text" id="geodir_spamblocker_top_form" name="geodir_spamblocker" value="" maxlength="10"/>
2446 2446
             </div>
2447 2447
         </noscript>
@@ -2451,10 +2451,10 @@  discard block
 block discarded – undo
2451 2451
         <!-- end captcha code -->
2452 2452
 
2453 2453
         <div id="geodir-add-listing-submit" class="geodir_form_row clear_both" style="padding:2px;text-align:center;">
2454
-            <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON;?>"
2455
-                   class="geodir_button" <?php echo $submit_button;?>/>
2454
+            <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON; ?>"
2455
+                   class="geodir_button" <?php echo $submit_button; ?>/>
2456 2456
             <span class="geodir_message_note"
2457
-                  style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory');?></span>
2457
+                  style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory'); ?></span>
2458 2458
         </div>
2459 2459
 
2460 2460
     </form>
@@ -2516,7 +2516,7 @@  discard block
 block discarded – undo
2516 2516
         class="<?php
2517 2517
         /** This action is documented in geodirectory_template_actions.php */
2518 2518
         echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2519
-        <?php dynamic_sidebar('Reg/Login Top Section');?>
2519
+        <?php dynamic_sidebar('Reg/Login Top Section'); ?>
2520 2520
     </div><!-- clearfix ends here-->
2521 2521
 <?php
2522 2522
 }
@@ -2538,7 +2538,7 @@  discard block
 block discarded – undo
2538 2538
 
2539 2539
     ?>
2540 2540
     <script type="text/javascript">
2541
-        <?php if ( $user_login ) { ?>
2541
+        <?php if ($user_login) { ?>
2542 2542
         setTimeout(function () {
2543 2543
             try {
2544 2544
                 d = document.getElementById('user_pass');
@@ -2555,7 +2555,7 @@  discard block
 block discarded – undo
2555 2555
         <?php } ?>
2556 2556
     </script>
2557 2557
     <script type="text/javascript">
2558
-        <?php if ( $user_login ) { ?>
2558
+        <?php if ($user_login) { ?>
2559 2559
         setTimeout(function () {
2560 2560
             try {
2561 2561
                 d = document.getElementById('user_pass');
@@ -2693,11 +2693,11 @@  discard block
 block discarded – undo
2693 2693
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2694 2694
 
2695 2695
     $title = $list_title;
2696
-    if(geodir_is_page('author')){
2696
+    if (geodir_is_page('author')) {
2697 2697
         $gd_page = 'author';
2698
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2698
+        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2699 2699
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2700
-        }else{
2700
+        } else {
2701 2701
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2702 2702
         }
2703 2703
 
@@ -2711,7 +2711,7 @@  discard block
 block discarded – undo
2711 2711
      * @param string $title The page title including variables.
2712 2712
      * @param string $gd_page The GeoDirectory page type if any.
2713 2713
      */
2714
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2714
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2715 2715
 
2716 2716
     echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2717 2717
         /**
@@ -2925,7 +2925,7 @@  discard block
 block discarded – undo
2925 2925
     $post_type_info = get_post_type_object($gd_post_type);
2926 2926
 
2927 2927
     $pt_name = '';
2928
-    if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
2928
+    if (isset($post_type_info->labels->name)) {$pt_name = $post_type_info->labels->name; }
2929 2929
 
2930 2930
     if (is_search()) {
2931 2931
         $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
Please login to merge, or discard this patch.
Indentation   +1686 added lines, -1686 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Template functions that affect the output of most GeoDirectory pages
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+	 * Template functions that affect the output of most GeoDirectory pages
4
+	 *
5
+	 * @since 1.0.0
6
+	 * @package GeoDirectory
7
+	 */
8 8
 ###############################################
9 9
 ########### DYNAMIC CONTENT ###################
10 10
 ###############################################
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function gd_compat_styles()
19 19
 {
20
-    $tc = get_option('theme_compatibility_setting');
21
-    echo "<style id='gd-compat-styles' type='text/css'>";
22
-    echo $tc['geodir_theme_compat_css'];
23
-    echo "</style>";
20
+	$tc = get_option('theme_compatibility_setting');
21
+	echo "<style id='gd-compat-styles' type='text/css'>";
22
+	echo $tc['geodir_theme_compat_css'];
23
+	echo "</style>";
24 24
 }
25 25
 
26 26
 /**
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function gd_compat_script()
33 33
 {
34
-    $tc = get_option('theme_compatibility_setting');
35
-    echo "<script>";
36
-    echo $tc['geodir_theme_compat_js'];
37
-    echo " </script>";
34
+	$tc = get_option('theme_compatibility_setting');
35
+	echo "<script>";
36
+	echo $tc['geodir_theme_compat_js'];
37
+	echo " </script>";
38 38
 }
39 39
 
40 40
 /**
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
  */
48 48
 function geodir_top_content_add_dynamic()
49 49
 {
50
-    $tc = get_option('theme_compatibility_setting');
51
-    echo $tc['geodir_top_content_add'];
50
+	$tc = get_option('theme_compatibility_setting');
51
+	echo $tc['geodir_top_content_add'];
52 52
 }
53 53
 
54 54
 /**
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
  */
62 62
 function geodir_before_main_content_add_dynamic()
63 63
 {
64
-    $tc = get_option('theme_compatibility_setting');
65
-    echo $tc['geodir_before_main_content_add'];
64
+	$tc = get_option('theme_compatibility_setting');
65
+	echo $tc['geodir_before_main_content_add'];
66 66
 }
67 67
 
68 68
 /**
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
  */
76 76
 function geodir_full_page_class_dynamic()
77 77
 {
78
-    $tc = get_option('theme_compatibility_setting');
79
-    return $tc['geodir_full_page_class_filter'];
78
+	$tc = get_option('theme_compatibility_setting');
79
+	return $tc['geodir_full_page_class_filter'];
80 80
 }
81 81
 
82 82
 /**
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
  */
90 90
 function geodir_before_widget_dynamic()
91 91
 {
92
-    $tc = get_option('theme_compatibility_setting');
93
-    return $tc['geodir_before_widget_filter'];
92
+	$tc = get_option('theme_compatibility_setting');
93
+	return $tc['geodir_before_widget_filter'];
94 94
 }
95 95
 
96 96
 /**
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
  */
104 104
 function geodir_after_widget_dynamic()
105 105
 {
106
-    $tc = get_option('theme_compatibility_setting');
107
-    return $tc['geodir_after_widget_filter'];
106
+	$tc = get_option('theme_compatibility_setting');
107
+	return $tc['geodir_after_widget_filter'];
108 108
 }
109 109
 
110 110
 /**
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
  */
118 118
 function geodir_before_title_dynamic()
119 119
 {
120
-    $tc = get_option('theme_compatibility_setting');
121
-    return $tc['geodir_before_title_filter'];
120
+	$tc = get_option('theme_compatibility_setting');
121
+	return $tc['geodir_before_title_filter'];
122 122
 }
123 123
 
124 124
 /**
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
  */
132 132
 function geodir_after_title_dynamic()
133 133
 {
134
-    $tc = get_option('theme_compatibility_setting');
135
-    return $tc['geodir_after_title_filter'];
134
+	$tc = get_option('theme_compatibility_setting');
135
+	return $tc['geodir_after_title_filter'];
136 136
 }
137 137
 
138 138
 /**
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
  */
146 146
 function geodir_menu_li_class_dynamic()
147 147
 {
148
-    $tc = get_option('theme_compatibility_setting');
149
-    return $tc['geodir_menu_li_class_filter'];
148
+	$tc = get_option('theme_compatibility_setting');
149
+	return $tc['geodir_menu_li_class_filter'];
150 150
 }
151 151
 
152 152
 /**
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
  */
160 160
 function geodir_sub_menu_ul_class_dynamic()
161 161
 {
162
-    $tc = get_option('theme_compatibility_setting');
163
-    return $tc['geodir_sub_menu_ul_class_filter'];
162
+	$tc = get_option('theme_compatibility_setting');
163
+	return $tc['geodir_sub_menu_ul_class_filter'];
164 164
 }
165 165
 
166 166
 /**
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
  */
174 174
 function geodir_sub_menu_li_class_dynamic()
175 175
 {
176
-    $tc = get_option('theme_compatibility_setting');
177
-    return $tc['geodir_sub_menu_li_class_filter'];
176
+	$tc = get_option('theme_compatibility_setting');
177
+	return $tc['geodir_sub_menu_li_class_filter'];
178 178
 }
179 179
 
180 180
 /**
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
  */
188 188
 function geodir_menu_a_class_dynamic()
189 189
 {
190
-    $tc = get_option('theme_compatibility_setting');
191
-    return $tc['geodir_menu_a_class_filter'];
190
+	$tc = get_option('theme_compatibility_setting');
191
+	return $tc['geodir_menu_a_class_filter'];
192 192
 }
193 193
 
194 194
 /**
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
  */
202 202
 function geodir_sub_menu_a_class_dynamic()
203 203
 {
204
-    $tc = get_option('theme_compatibility_setting');
205
-    return $tc['geodir_sub_menu_a_class_filter'];
204
+	$tc = get_option('theme_compatibility_setting');
205
+	return $tc['geodir_sub_menu_a_class_filter'];
206 206
 }
207 207
 
208 208
 /**
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
  */
216 216
 function geodir_location_switcher_menu_li_class_dynamic()
217 217
 {
218
-    $tc = get_option('theme_compatibility_setting');
219
-    return $tc['geodir_location_switcher_menu_li_class_filter'];
218
+	$tc = get_option('theme_compatibility_setting');
219
+	return $tc['geodir_location_switcher_menu_li_class_filter'];
220 220
 }
221 221
 
222 222
 /**
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
  */
230 230
 function geodir_location_switcher_menu_a_class_dynamic()
231 231
 {
232
-    $tc = get_option('theme_compatibility_setting');
233
-    return $tc['geodir_location_switcher_menu_a_class_filter'];
232
+	$tc = get_option('theme_compatibility_setting');
233
+	return $tc['geodir_location_switcher_menu_a_class_filter'];
234 234
 }
235 235
 
236 236
 /**
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
  */
244 244
 function geodir_location_switcher_menu_sub_ul_class_dynamic()
245 245
 {
246
-    $tc = get_option('theme_compatibility_setting');
247
-    return $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
246
+	$tc = get_option('theme_compatibility_setting');
247
+	return $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
248 248
 }
249 249
 
250 250
 /**
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
  */
258 258
 function geodir_location_switcher_menu_sub_li_class_dynamic()
259 259
 {
260
-    $tc = get_option('theme_compatibility_setting');
261
-    return $tc['geodir_location_switcher_menu_sub_li_class_filter'];
260
+	$tc = get_option('theme_compatibility_setting');
261
+	return $tc['geodir_location_switcher_menu_sub_li_class_filter'];
262 262
 }
263 263
 
264 264
 
@@ -275,106 +275,106 @@  discard block
 block discarded – undo
275 275
 function geodir_content_actions_dynamic()
276 276
 {
277 277
 
278
-    $tc = get_option('theme_compatibility_setting');
279
-    if (empty($tc)) {
280
-        return;
281
-    }
278
+	$tc = get_option('theme_compatibility_setting');
279
+	if (empty($tc)) {
280
+		return;
281
+	}
282 282
 
283
-    //php
284
-    if (!empty($tc['geodir_theme_compat_code'])) {
285
-        include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
286
-    }
283
+	//php
284
+	if (!empty($tc['geodir_theme_compat_code'])) {
285
+		include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
286
+	}
287 287
 
288
-    //geodir_full_page_class
289
-    if (!empty($tc['geodir_full_page_class_filter'])) {
290
-        add_filter('geodir_full_page_class', 'geodir_full_page_class_dynamic', 10);
291
-    }
288
+	//geodir_full_page_class
289
+	if (!empty($tc['geodir_full_page_class_filter'])) {
290
+		add_filter('geodir_full_page_class', 'geodir_full_page_class_dynamic', 10);
291
+	}
292 292
 
293
-    //widget before filter
294
-    if (!empty($tc['geodir_before_widget_filter'])) {
295
-        add_filter('geodir_before_widget', 'geodir_before_widget_dynamic', 10);
296
-    }
293
+	//widget before filter
294
+	if (!empty($tc['geodir_before_widget_filter'])) {
295
+		add_filter('geodir_before_widget', 'geodir_before_widget_dynamic', 10);
296
+	}
297 297
 
298
-    //widget after filter
299
-    if (!empty($tc['geodir_after_widget_filter'])) {
300
-        add_filter('geodir_after_widget', 'geodir_after_widget_dynamic', 10);
301
-    }
298
+	//widget after filter
299
+	if (!empty($tc['geodir_after_widget_filter'])) {
300
+		add_filter('geodir_after_widget', 'geodir_after_widget_dynamic', 10);
301
+	}
302 302
 
303
-    //widget before title filter
304
-    if (!empty($tc['geodir_before_title_filter'])) {
305
-        add_filter('geodir_before_title', 'geodir_before_title_dynamic', 10);
306
-    }
303
+	//widget before title filter
304
+	if (!empty($tc['geodir_before_title_filter'])) {
305
+		add_filter('geodir_before_title', 'geodir_before_title_dynamic', 10);
306
+	}
307 307
 
308
-    //widget before title filter
309
-    if (!empty($tc['geodir_after_title_filter'])) {
310
-        add_filter('geodir_after_title', 'geodir_after_title_dynamic', 10);
311
-    }
308
+	//widget before title filter
309
+	if (!empty($tc['geodir_after_title_filter'])) {
310
+		add_filter('geodir_after_title', 'geodir_after_title_dynamic', 10);
311
+	}
312 312
 
313
-    //menu li class
314
-    if (!empty($tc['geodir_menu_li_class_filter'])) {
315
-        add_filter('geodir_menu_li_class', 'geodir_menu_li_class_dynamic', 10);
316
-    }
313
+	//menu li class
314
+	if (!empty($tc['geodir_menu_li_class_filter'])) {
315
+		add_filter('geodir_menu_li_class', 'geodir_menu_li_class_dynamic', 10);
316
+	}
317 317
 
318
-    //menu ul class
319
-    if (!empty($tc['geodir_sub_menu_ul_class_filter'])) {
320
-        add_filter('geodir_sub_menu_ul_class', 'geodir_sub_menu_ul_class_dynamic', 10);
321
-    }
318
+	//menu ul class
319
+	if (!empty($tc['geodir_sub_menu_ul_class_filter'])) {
320
+		add_filter('geodir_sub_menu_ul_class', 'geodir_sub_menu_ul_class_dynamic', 10);
321
+	}
322 322
 
323
-    //menu sub li class
324
-    if (!empty($tc['geodir_sub_menu_li_class_filter'])) {
325
-        add_filter('geodir_sub_menu_li_class', 'geodir_sub_menu_li_class_dynamic', 10);
326
-    }
323
+	//menu sub li class
324
+	if (!empty($tc['geodir_sub_menu_li_class_filter'])) {
325
+		add_filter('geodir_sub_menu_li_class', 'geodir_sub_menu_li_class_dynamic', 10);
326
+	}
327 327
 
328
-    //menu a class
329
-    if (!empty($tc['geodir_menu_a_class_filter'])) {
330
-        add_filter('geodir_menu_a_class', 'geodir_menu_a_class_dynamic', 10);
331
-    }
328
+	//menu a class
329
+	if (!empty($tc['geodir_menu_a_class_filter'])) {
330
+		add_filter('geodir_menu_a_class', 'geodir_menu_a_class_dynamic', 10);
331
+	}
332 332
 
333
-    //menu sub a class
334
-    if (!empty($tc['geodir_sub_menu_a_class_filter'])) {
335
-        add_filter('geodir_sub_menu_a_class', 'geodir_sub_menu_a_class_dynamic', 10);
336
-    }
333
+	//menu sub a class
334
+	if (!empty($tc['geodir_sub_menu_a_class_filter'])) {
335
+		add_filter('geodir_sub_menu_a_class', 'geodir_sub_menu_a_class_dynamic', 10);
336
+	}
337 337
 
338
-    //location menu li class
339
-    if (!empty($tc['geodir_location_switcher_menu_li_class_filter'])) {
340
-        add_filter('geodir_location_switcher_menu_li_class', 'geodir_location_switcher_menu_li_class_dynamic', 10);
341
-    }
338
+	//location menu li class
339
+	if (!empty($tc['geodir_location_switcher_menu_li_class_filter'])) {
340
+		add_filter('geodir_location_switcher_menu_li_class', 'geodir_location_switcher_menu_li_class_dynamic', 10);
341
+	}
342 342
 
343
-    //location menu sub ul class
344
-    if (!empty($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
345
-        add_filter('geodir_location_switcher_menu_sub_ul_class', 'geodir_location_switcher_menu_sub_ul_class_dynamic', 10);
346
-    }
343
+	//location menu sub ul class
344
+	if (!empty($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
345
+		add_filter('geodir_location_switcher_menu_sub_ul_class', 'geodir_location_switcher_menu_sub_ul_class_dynamic', 10);
346
+	}
347 347
 
348
-    //location menu sub li class
349
-    if (!empty($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
350
-        add_filter('geodir_location_switcher_menu_sub_li_class', 'geodir_location_switcher_menu_sub_li_class_dynamic', 10);
351
-    }
348
+	//location menu sub li class
349
+	if (!empty($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
350
+		add_filter('geodir_location_switcher_menu_sub_li_class', 'geodir_location_switcher_menu_sub_li_class_dynamic', 10);
351
+	}
352 352
 
353
-    //location menu a class
354
-    if (!empty($tc['geodir_location_switcher_menu_a_class_filter'])) {
355
-        add_filter('geodir_location_switcher_menu_a_class', 'geodir_location_switcher_menu_a_class_dynamic', 10);
356
-    }
353
+	//location menu a class
354
+	if (!empty($tc['geodir_location_switcher_menu_a_class_filter'])) {
355
+		add_filter('geodir_location_switcher_menu_a_class', 'geodir_location_switcher_menu_a_class_dynamic', 10);
356
+	}
357 357
 
358
-    // compat styles
359
-    if (!empty($tc['geodir_theme_compat_css'])) {
360
-        add_action('wp_head', 'gd_compat_styles');
361
-    }
358
+	// compat styles
359
+	if (!empty($tc['geodir_theme_compat_css'])) {
360
+		add_action('wp_head', 'gd_compat_styles');
361
+	}
362 362
 
363
-    // compat js
364
-    if (!empty($tc['geodir_theme_compat_js'])) {
365
-        add_action('wp_footer', 'gd_compat_script');
366
-    }
363
+	// compat js
364
+	if (!empty($tc['geodir_theme_compat_js'])) {
365
+		add_action('wp_footer', 'gd_compat_script');
366
+	}
367 367
 
368 368
 
369
-    // geodir_top_content_add
370
-    if (!empty($tc['geodir_top_content_add'])) {
371
-        add_action('geodir_top_content', 'geodir_top_content_add_dynamic', 10, 1);
372
-    }
369
+	// geodir_top_content_add
370
+	if (!empty($tc['geodir_top_content_add'])) {
371
+		add_action('geodir_top_content', 'geodir_top_content_add_dynamic', 10, 1);
372
+	}
373 373
 
374
-    // geodir_before_main_content_add
375
-    if (!empty($tc['geodir_before_main_content_add'])) {
376
-        add_action('geodir_before_main_content', 'geodir_before_main_content_add_dynamic', 10, 1);
377
-    }
374
+	// geodir_before_main_content_add
375
+	if (!empty($tc['geodir_before_main_content_add'])) {
376
+		add_action('geodir_before_main_content', 'geodir_before_main_content_add_dynamic', 10, 1);
377
+	}
378 378
 
379 379
 
380 380
 }
@@ -397,23 +397,23 @@  discard block
 block discarded – undo
397 397
  */
398 398
 function geodir_action_wrapper_open($type = '', $id = '', $class = '')
399 399
 {
400
-    $tc = get_option('theme_compatibility_setting');
401
-    if (!empty($tc['geodir_wrapper_open_replace'])) {
402
-        $text = $tc['geodir_wrapper_open_replace'];
403
-    } else {
404
-        $text = '<div id="[id]" class="[class]">';
405
-    }
400
+	$tc = get_option('theme_compatibility_setting');
401
+	if (!empty($tc['geodir_wrapper_open_replace'])) {
402
+		$text = $tc['geodir_wrapper_open_replace'];
403
+	} else {
404
+		$text = '<div id="[id]" class="[class]">';
405
+	}
406 406
 
407
-    if (!empty($tc['geodir_wrapper_open_id'])) {
408
-        $id = $tc['geodir_wrapper_open_id'];
409
-    }
410
-    if (!empty($tc['geodir_wrapper_open_class'])) {
411
-        $class = $tc['geodir_wrapper_open_class'];
412
-    }
407
+	if (!empty($tc['geodir_wrapper_open_id'])) {
408
+		$id = $tc['geodir_wrapper_open_id'];
409
+	}
410
+	if (!empty($tc['geodir_wrapper_open_class'])) {
411
+		$class = $tc['geodir_wrapper_open_class'];
412
+	}
413 413
 
414
-    $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
414
+	$text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
415 415
 
416
-    echo $text;
416
+	echo $text;
417 417
 }
418 418
 
419 419
 // action for adding the wrapperdiv closing tag
@@ -428,14 +428,14 @@  discard block
 block discarded – undo
428 428
  */
429 429
 function geodir_action_wrapper_close($type = '')
430 430
 {
431
-    $tc = get_option('theme_compatibility_setting');
432
-    if (!empty($tc['geodir_wrapper_close_replace'])) {
433
-        $text = $tc['geodir_wrapper_close_replace'];
434
-    } else {
435
-        $text = '</div><!-- wrapper ends here-->';
436
-    }
431
+	$tc = get_option('theme_compatibility_setting');
432
+	if (!empty($tc['geodir_wrapper_close_replace'])) {
433
+		$text = $tc['geodir_wrapper_close_replace'];
434
+	} else {
435
+		$text = '</div><!-- wrapper ends here-->';
436
+	}
437 437
 
438
-    echo $text;
438
+	echo $text;
439 439
 }
440 440
 
441 441
 // action for adding the content div opening tag
@@ -451,35 +451,35 @@  discard block
 block discarded – undo
451 451
  */
452 452
 function geodir_action_wrapper_content_open($type = '', $id = '', $class = '')
453 453
 {
454
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
455
-        $width_css = 'style="width:' . $width . '%;"';
456
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
457
-        $width_css = 'style="width:' . $width . '%;"';
458
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
459
-        $width_css = 'style="width:' . $width . '%;"';
460
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
461
-        $width_css = 'style="width:' . $width . '%;"';
462
-    } else {
463
-        $width_css = '';
464
-    }
465
-
466
-    $tc = get_option('theme_compatibility_setting');
467
-    if (!empty($tc['geodir_wrapper_content_open_replace'])) {
468
-        $text = $tc['geodir_wrapper_content_open_replace'];
469
-    } else {
470
-        $text = '<div id="[id]" class="[class]" role="main" [width_css]>';
471
-    }
472
-
473
-    if (!empty($tc['geodir_wrapper_content_open_id'])) {
474
-        $id = $tc['geodir_wrapper_content_open_id'];
475
-    }
476
-    if (!empty($tc['geodir_wrapper_content_open_class'])) {
477
-        $class = $tc['geodir_wrapper_content_open_class'];
478
-    }
479
-
480
-    $text = str_replace(array("[id]", "[class]", "[width_css]"), array($id, $class, $width_css), $text);
481
-
482
-    echo $text;
454
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
455
+		$width_css = 'style="width:' . $width . '%;"';
456
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
457
+		$width_css = 'style="width:' . $width . '%;"';
458
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
459
+		$width_css = 'style="width:' . $width . '%;"';
460
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
461
+		$width_css = 'style="width:' . $width . '%;"';
462
+	} else {
463
+		$width_css = '';
464
+	}
465
+
466
+	$tc = get_option('theme_compatibility_setting');
467
+	if (!empty($tc['geodir_wrapper_content_open_replace'])) {
468
+		$text = $tc['geodir_wrapper_content_open_replace'];
469
+	} else {
470
+		$text = '<div id="[id]" class="[class]" role="main" [width_css]>';
471
+	}
472
+
473
+	if (!empty($tc['geodir_wrapper_content_open_id'])) {
474
+		$id = $tc['geodir_wrapper_content_open_id'];
475
+	}
476
+	if (!empty($tc['geodir_wrapper_content_open_class'])) {
477
+		$class = $tc['geodir_wrapper_content_open_class'];
478
+	}
479
+
480
+	$text = str_replace(array("[id]", "[class]", "[width_css]"), array($id, $class, $width_css), $text);
481
+
482
+	echo $text;
483 483
 }
484 484
 
485 485
 // action for adding the primary div closing tag
@@ -493,13 +493,13 @@  discard block
 block discarded – undo
493 493
  */
494 494
 function geodir_action_wrapper_content_close($type = '')
495 495
 {
496
-    $tc = get_option('theme_compatibility_setting');
497
-    if (!empty($tc['geodir_wrapper_content_close_replace'])) {
498
-        $text = $tc['geodir_wrapper_content_close_replace'];
499
-    } else {
500
-        $text = '</div><!-- content ends here-->';
501
-    }
502
-    echo $text;
496
+	$tc = get_option('theme_compatibility_setting');
497
+	if (!empty($tc['geodir_wrapper_content_close_replace'])) {
498
+		$text = $tc['geodir_wrapper_content_close_replace'];
499
+	} else {
500
+		$text = '</div><!-- content ends here-->';
501
+	}
502
+	echo $text;
503 503
 }
504 504
 
505 505
 // action for adding the <article> opening tag
@@ -517,24 +517,24 @@  discard block
 block discarded – undo
517 517
  */
518 518
 function geodir_action_article_open($type = '', $id = '', $class = '', $itemtype = '')
519 519
 {
520
-    $class = implode(" ", $class);
521
-    $tc = get_option('theme_compatibility_setting');
522
-    if (!empty($tc['geodir_article_open_replace'])) {
523
-        $text = $tc['geodir_article_open_replace'];
524
-    } else {
525
-        $text = '<article  id="[id]" class="[class]" >';
526
-    }
520
+	$class = implode(" ", $class);
521
+	$tc = get_option('theme_compatibility_setting');
522
+	if (!empty($tc['geodir_article_open_replace'])) {
523
+		$text = $tc['geodir_article_open_replace'];
524
+	} else {
525
+		$text = '<article  id="[id]" class="[class]" >';
526
+	}
527 527
 
528
-    if (!empty($tc['geodir_article_open_id'])) {
529
-        $id = $tc['geodir_article_open_id'];
530
-    }
531
-    if (!empty($tc['geodir_article_open_class'])) {
532
-        $class = $tc['geodir_article_open_class'];
533
-    }
528
+	if (!empty($tc['geodir_article_open_id'])) {
529
+		$id = $tc['geodir_article_open_id'];
530
+	}
531
+	if (!empty($tc['geodir_article_open_class'])) {
532
+		$class = $tc['geodir_article_open_class'];
533
+	}
534 534
 
535
-    $text = str_replace(array("[id]", "[class]", "[itemtype]"), array($id, $class, $itemtype), $text);
535
+	$text = str_replace(array("[id]", "[class]", "[itemtype]"), array($id, $class, $itemtype), $text);
536 536
 
537
-    echo $text;
537
+	echo $text;
538 538
 }
539 539
 
540 540
 // action for adding the primary div closing tag
@@ -548,13 +548,13 @@  discard block
 block discarded – undo
548 548
  */
549 549
 function geodir_action_article_close($type = '')
550 550
 {
551
-    $tc = get_option('theme_compatibility_setting');
552
-    if (!empty($tc['geodir_article_close_replace'])) {
553
-        $text = $tc['geodir_article_close_replace'];
554
-    } else {
555
-        $text = '</article><!-- article ends here-->';
556
-    }
557
-    echo $text;
551
+	$tc = get_option('theme_compatibility_setting');
552
+	if (!empty($tc['geodir_article_close_replace'])) {
553
+		$text = $tc['geodir_article_close_replace'];
554
+	} else {
555
+		$text = '</article><!-- article ends here-->';
556
+	}
557
+	echo $text;
558 558
 }
559 559
 
560 560
 // action for adding the sidebar opening tag
@@ -571,35 +571,35 @@  discard block
 block discarded – undo
571 571
  */
572 572
 function geodir_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')
573 573
 {
574
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
575
-        $width_css = 'style="width:' . $width . '%;"';
576
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
577
-        $width_css = 'style="width:' . $width . '%;"';
578
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
579
-        $width_css = 'style="width:' . $width . '%;"';
580
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
581
-        $width_css = 'style="width:' . $width . '%;"';
582
-    } else {
583
-        $width_css = '';
584
-    }
585
-
586
-    $tc = get_option('theme_compatibility_setting');
587
-    if (!empty($tc['geodir_sidebar_right_open_replace'])) {
588
-        $text = $tc['geodir_sidebar_right_open_replace'];
589
-    } else {
590
-        $text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
591
-    }
592
-
593
-    if (!empty($tc['geodir_sidebar_right_open_id'])) {
594
-        $id = $tc['geodir_sidebar_right_open_id'];
595
-    }
596
-    if (!empty($tc['geodir_sidebar_right_open_class'])) {
597
-        $class = $tc['geodir_sidebar_right_open_class'];
598
-    }
599
-
600
-    $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
601
-
602
-    echo $text;
574
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
575
+		$width_css = 'style="width:' . $width . '%;"';
576
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
577
+		$width_css = 'style="width:' . $width . '%;"';
578
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
579
+		$width_css = 'style="width:' . $width . '%;"';
580
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
581
+		$width_css = 'style="width:' . $width . '%;"';
582
+	} else {
583
+		$width_css = '';
584
+	}
585
+
586
+	$tc = get_option('theme_compatibility_setting');
587
+	if (!empty($tc['geodir_sidebar_right_open_replace'])) {
588
+		$text = $tc['geodir_sidebar_right_open_replace'];
589
+	} else {
590
+		$text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
591
+	}
592
+
593
+	if (!empty($tc['geodir_sidebar_right_open_id'])) {
594
+		$id = $tc['geodir_sidebar_right_open_id'];
595
+	}
596
+	if (!empty($tc['geodir_sidebar_right_open_class'])) {
597
+		$class = $tc['geodir_sidebar_right_open_class'];
598
+	}
599
+
600
+	$text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
601
+
602
+	echo $text;
603 603
 }
604 604
 
605 605
 // action for adding the primary div closing tag
@@ -613,13 +613,13 @@  discard block
 block discarded – undo
613 613
  */
614 614
 function geodir_action_sidebar_right_close($type = '')
615 615
 {
616
-    $tc = get_option('theme_compatibility_setting');
617
-    if (!empty($tc['geodir_sidebar_right_close_replace'])) {
618
-        $text = $tc['geodir_sidebar_right_close_replace'];
619
-    } else {
620
-        $text = '</aside><!-- sidebar ends here-->';
621
-    }
622
-    echo $text;
616
+	$tc = get_option('theme_compatibility_setting');
617
+	if (!empty($tc['geodir_sidebar_right_close_replace'])) {
618
+		$text = $tc['geodir_sidebar_right_close_replace'];
619
+	} else {
620
+		$text = '</aside><!-- sidebar ends here-->';
621
+	}
622
+	echo $text;
623 623
 }
624 624
 
625 625
 
@@ -640,121 +640,121 @@  discard block
 block discarded – undo
640 640
  */
641 641
 function geodir_action_geodir_set_preview_post()
642 642
 {
643
-    global $post, $preview, $gd_session;
644
-    $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
645
-    if (!$preview || $is_backend_preview) {
646
-        return;
647
-    }// bail if not previewing
648
-
649
-    $listing_type = isset($_REQUEST['listing_type']) ? sanitize_text_field($_REQUEST['listing_type']) : '';
650
-
651
-    $fields_info = geodir_get_custom_fields_type($listing_type);
652
-
653
-    foreach ($_REQUEST as $pkey => $pval) {
654
-        if ($pkey == 'geodir_video') {
655
-            $tags = '<iframe>';
656
-        } else if ($pkey == 'post_desc') {
657
-            $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
658
-        } else if (is_array($fields_info) && isset($fields_info[$pkey]) && ($fields_info[$pkey] == 'textarea' || $fields_info[$pkey] == 'html')) {
659
-            $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
660
-        } else if (is_array($_REQUEST[$pkey])) {
661
-            $tags = 'skip_field';
662
-        } else {
663
-            $tags = '';
664
-        }
665
-        /**
666
-         * Allows the filtering of the allowed HTML tags per field when submitting from frontend add listing page.
667
-         *
668
-         * @since 1.0.0
669
-         * @param string $tags The allowed HTML tags for the field. Can be many things, for example the description allows these tags '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'.
670
-         * @param string|array $pkey The field id/name. If array then value is set as "skip_field".
671
-         */
672
-        $tags = apply_filters('geodir_save_post_key', $tags, $pkey);
673
-
674
-        if ($tags != 'skip_field') {
675
-            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
676
-        }
677
-    }
678
-
679
-    $post = (object)$_REQUEST;
680
-
681
-
682
-    if (isset($post->video)) {
683
-        $post->video = stripslashes($post->video);
684
-    }
685
-
686
-    if (isset($post->Video2)) {
687
-        $post->Video2 = stripslashes($post->Video2);
688
-    }
689
-
690
-    $post_type = $post->listing_type;
691
-    $post_type_info = get_post_type_object($post_type);
692
-
693
-    $listing_label = $post_type_info->labels->singular_name;
694
-
695
-    $term_icon = '';
696
-
697
-    if (!empty($post->post_category)) {
698
-        foreach ($post->post_category as $post_taxonomy => $post_term) {
699
-
700
-            if ($post_term != '' && !is_array($post_term)) {
701
-                $post_term = explode(',', trim($post_term, ','));
702
-            }
643
+	global $post, $preview, $gd_session;
644
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
645
+	if (!$preview || $is_backend_preview) {
646
+		return;
647
+	}// bail if not previewing
648
+
649
+	$listing_type = isset($_REQUEST['listing_type']) ? sanitize_text_field($_REQUEST['listing_type']) : '';
650
+
651
+	$fields_info = geodir_get_custom_fields_type($listing_type);
652
+
653
+	foreach ($_REQUEST as $pkey => $pval) {
654
+		if ($pkey == 'geodir_video') {
655
+			$tags = '<iframe>';
656
+		} else if ($pkey == 'post_desc') {
657
+			$tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
658
+		} else if (is_array($fields_info) && isset($fields_info[$pkey]) && ($fields_info[$pkey] == 'textarea' || $fields_info[$pkey] == 'html')) {
659
+			$tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
660
+		} else if (is_array($_REQUEST[$pkey])) {
661
+			$tags = 'skip_field';
662
+		} else {
663
+			$tags = '';
664
+		}
665
+		/**
666
+		 * Allows the filtering of the allowed HTML tags per field when submitting from frontend add listing page.
667
+		 *
668
+		 * @since 1.0.0
669
+		 * @param string $tags The allowed HTML tags for the field. Can be many things, for example the description allows these tags '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'.
670
+		 * @param string|array $pkey The field id/name. If array then value is set as "skip_field".
671
+		 */
672
+		$tags = apply_filters('geodir_save_post_key', $tags, $pkey);
673
+
674
+		if ($tags != 'skip_field') {
675
+			$_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
676
+		}
677
+	}
678
+
679
+	$post = (object)$_REQUEST;
680
+
681
+
682
+	if (isset($post->video)) {
683
+		$post->video = stripslashes($post->video);
684
+	}
685
+
686
+	if (isset($post->Video2)) {
687
+		$post->Video2 = stripslashes($post->Video2);
688
+	}
689
+
690
+	$post_type = $post->listing_type;
691
+	$post_type_info = get_post_type_object($post_type);
692
+
693
+	$listing_label = $post_type_info->labels->singular_name;
694
+
695
+	$term_icon = '';
696
+
697
+	if (!empty($post->post_category)) {
698
+		foreach ($post->post_category as $post_taxonomy => $post_term) {
699
+
700
+			if ($post_term != '' && !is_array($post_term)) {
701
+				$post_term = explode(',', trim($post_term, ','));
702
+			}
703 703
 
704
-            if (is_array($post_term)) {
705
-                $post_term = array_unique($post_term);
706
-            }
704
+			if (is_array($post_term)) {
705
+				$post_term = array_unique($post_term);
706
+			}
707 707
 
708
-            if (!empty($post_term)) {
709
-                foreach ($post_term as $cat_id) {
710
-                    $cat_id = trim($cat_id);
711
-
712
-                    if ($cat_id != '') {
713
-                        $term_icon = get_option('geodir_default_marker_icon');
714
-
715
-                        if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
716
-                            if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
717
-                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
718
-                                    $term_icon = $term_icon_url['src'];
719
-                                break;
720
-                            }
721
-                        }
722
-                    }
723
-                }
724
-            }
725
-        }
726
-    }
708
+			if (!empty($post_term)) {
709
+				foreach ($post_term as $cat_id) {
710
+					$cat_id = trim($cat_id);
711
+
712
+					if ($cat_id != '') {
713
+						$term_icon = get_option('geodir_default_marker_icon');
714
+
715
+						if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
716
+							if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
717
+								if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
718
+									$term_icon = $term_icon_url['src'];
719
+								break;
720
+							}
721
+						}
722
+					}
723
+				}
724
+			}
725
+		}
726
+	}
727 727
 
728
-    $post_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
729
-    $post_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
728
+	$post_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
729
+	$post_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
730 730
 
731
-    $srcharr = array("'", "/", "-", '"', '\\');
732
-    $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
731
+	$srcharr = array("'", "/", "-", '"', '\\');
732
+	$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
733 733
 
734
-    $json_title = str_replace($srcharr, $replarr, $post->post_title);
734
+	$json_title = str_replace($srcharr, $replarr, $post->post_title);
735 735
 
736
-    $json = '{';
737
-    $json .= '"post_preview": "1",';
738
-    $json .= '"t": "' . $json_title . '",';
739
-    $json .= '"lt": "' . $post_latitude . '",';
740
-    $json .= '"ln": "' . $post_longitude . '",';
741
-    $json .= '"i":"' . $term_icon . '"';
742
-    $json .= '}';
736
+	$json = '{';
737
+	$json .= '"post_preview": "1",';
738
+	$json .= '"t": "' . $json_title . '",';
739
+	$json .= '"lt": "' . $post_latitude . '",';
740
+	$json .= '"ln": "' . $post_longitude . '",';
741
+	$json .= '"i":"' . $term_icon . '"';
742
+	$json .= '}';
743 743
 
744
-    $post->marker_json = $json;
744
+	$post->marker_json = $json;
745 745
 
746
-    $gd_session->set('listing', $_REQUEST);
746
+	$gd_session->set('listing', $_REQUEST);
747 747
 
748
-    // we need to define a few things to trick the setup_postdata
749
-    if (!isset($post->ID)) {
750
-        $post->ID = '';
751
-        $post->post_author = '';
752
-        $post->post_date = '';
753
-        $post->post_content = '';
754
-        $post->default_category = '';
755
-        $post->post_type = '';
756
-    }
757
-    setup_postdata($post);
748
+	// we need to define a few things to trick the setup_postdata
749
+	if (!isset($post->ID)) {
750
+		$post->ID = '';
751
+		$post->post_author = '';
752
+		$post->post_date = '';
753
+		$post->post_content = '';
754
+		$post->default_category = '';
755
+		$post->post_type = '';
756
+	}
757
+	setup_postdata($post);
758 758
 }
759 759
 
760 760
 /**
@@ -766,15 +766,15 @@  discard block
 block discarded – undo
766 766
  */
767 767
 function geodir_action_geodir_preview_code()
768 768
 {
769
-    global $preview;
769
+	global $preview;
770 770
 
771
-    $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
771
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
772 772
 
773
-    if (!$preview || $is_backend_preview) {
774
-        return;
775
-    }// bail if not previewing
773
+	if (!$preview || $is_backend_preview) {
774
+		return;
775
+	}// bail if not previewing
776 776
 
777
-    geodir_get_template_part('preview', 'buttons');
777
+	geodir_get_template_part('preview', 'buttons');
778 778
 }
779 779
 
780 780
 // action for adding the details page top widget area
@@ -790,20 +790,20 @@  discard block
 block discarded – undo
790 790
  */
791 791
 function geodir_action_geodir_sidebar_detail_top($class = '')
792 792
 {
793
-    if (get_option('geodir_show_detail_top_section')) { ?>
793
+	if (get_option('geodir_show_detail_top_section')) { ?>
794 794
         <div
795 795
             class="<?php
796
-            /**
797
-             * Filter the div class for the wrapper of the full width widget areas.
798
-             *
799
-             * Allows you to filter the class of the div for the HTML Container wrapper for the full width widget areas referred to as "Top Section" or "Bottom Section" in the widget areas.
800
-             *
801
-             * @since 1.0.0
802
-             * @param string $class The class of the div.
803
-             * @param string $type The page type the widget area is being used on. Values can be 'geodir_detail_top', 'geodir_detail_bottom', 'geodir_listing_top', 'geodir_listing_bottom', 'Reg/Login Top Section',
804
-             *               'geodir_author_top','geodir_author_bottom', 'geodir_search_top', 'geodir_search_bottom', 'geodir_home_top' or 'geodir_home_bottom'.
805
-             */
806
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_top'); ?> <?php echo $class; ?>">
796
+			/**
797
+			 * Filter the div class for the wrapper of the full width widget areas.
798
+			 *
799
+			 * Allows you to filter the class of the div for the HTML Container wrapper for the full width widget areas referred to as "Top Section" or "Bottom Section" in the widget areas.
800
+			 *
801
+			 * @since 1.0.0
802
+			 * @param string $class The class of the div.
803
+			 * @param string $type The page type the widget area is being used on. Values can be 'geodir_detail_top', 'geodir_detail_bottom', 'geodir_listing_top', 'geodir_listing_bottom', 'Reg/Login Top Section',
804
+			 *               'geodir_author_top','geodir_author_bottom', 'geodir_search_top', 'geodir_search_bottom', 'geodir_home_top' or 'geodir_home_bottom'.
805
+			 */
806
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_top'); ?> <?php echo $class; ?>">
807 807
             <?php dynamic_sidebar('geodir_detail_top'); ?>
808 808
         </div>
809 809
     <?php }
@@ -827,11 +827,11 @@  discard block
 block discarded – undo
827 827
  */
828 828
 function geodir_action_geodir_sidebar_detail_bottom_section($class = '')
829 829
 {
830
-    if (get_option('geodir_show_detail_bottom_section')) { ?>
830
+	if (get_option('geodir_show_detail_bottom_section')) { ?>
831 831
         <div
832 832
             class="<?php
833
-            /** This action is documented in geodirectory_template_actions.php */
834
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_bottom'); ?> <?php echo $class; ?>">
833
+			/** This action is documented in geodirectory_template_actions.php */
834
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_bottom'); ?> <?php echo $class; ?>">
835 835
             <?php dynamic_sidebar('geodir_detail_bottom'); ?>
836 836
         </div><!-- clearfix ends here-->
837 837
     <?php }
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
  */
846 846
 function geodir_details_sidebar_widget_area()
847 847
 {
848
-    dynamic_sidebar('geodir_detail_sidebar');
848
+	dynamic_sidebar('geodir_detail_sidebar');
849 849
 }
850 850
 
851 851
 /**
@@ -856,12 +856,12 @@  discard block
 block discarded – undo
856 856
  */
857 857
 function geodir_details_sidebar_place_details()
858 858
 {
859
-    /**
860
-     * Used to add items to the details page sidebar.
861
-     *
862
-     * @since 1.0.0
863
-     */
864
-    do_action('geodir_detail_page_sidebar');
859
+	/**
860
+	 * Used to add items to the details page sidebar.
861
+	 *
862
+	 * @since 1.0.0
863
+	 */
864
+	do_action('geodir_detail_page_sidebar');
865 865
 }
866 866
 
867 867
 add_action('geodir_detail_sidebar_inside', 'geodir_details_sidebar_place_details', 10);
@@ -876,68 +876,68 @@  discard block
 block discarded – undo
876 876
  */
877 877
 function geodir_action_details_sidebar()
878 878
 {
879
-    // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
880
-    if (get_option('geodir_detail_sidebar_left_section')) {
881
-        /**
882
-         * Called before the details page left sidebar is opened.
883
-         *
884
-         * This is used to add opening wrapper HTML to the details page left sidebar.
885
-         *
886
-         * @since 1.0.0
887
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
888
-         * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-left'.
889
-         * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-left geodir-details-sidebar-left'.
890
-         * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
891
-         */
892
-        do_action('geodir_sidebar_left_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-left geodir-details-sidebar-left', 'http://schema.org/WPSideBar');
893
-        ?>
879
+	// this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
880
+	if (get_option('geodir_detail_sidebar_left_section')) {
881
+		/**
882
+		 * Called before the details page left sidebar is opened.
883
+		 *
884
+		 * This is used to add opening wrapper HTML to the details page left sidebar.
885
+		 *
886
+		 * @since 1.0.0
887
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
888
+		 * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-left'.
889
+		 * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-left geodir-details-sidebar-left'.
890
+		 * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
891
+		 */
892
+		do_action('geodir_sidebar_left_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-left geodir-details-sidebar-left', 'http://schema.org/WPSideBar');
893
+		?>
894 894
         <div class="geodir-content-left geodir-sidebar-wrap"><?php
895
-        /**
896
-         * Called inside the HTML wrapper of the details sidebar for either the left and right sidebar.
897
-         *
898
-         * This is used to add all info to the details page sidebars.
899
-         *
900
-         * @since 1.0.0
901
-         */
902
-        do_action('geodir_detail_sidebar_inside');
903
-        ?></div><!-- end geodir-content-left --><?php
904
-        /**
905
-         * Called after the details page left sidebar.
906
-         *
907
-         * This is used to add closing wrapper HTML to the details page left sidebar.
908
-         *
909
-         * @since 1.0.0
910
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
911
-         */
912
-        do_action('geodir_sidebar_left_close', 'details-page');
913
-    } else {
914
-        /**
915
-         * Called before the details page right sidebar is opened.
916
-         *
917
-         * This is used to add opening wrapper HTML to the details page right sidebar.
918
-         *
919
-         * @since 1.0.0
920
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'add-listing-page', 'author-page', 'search-page' or 'home-page'.
921
-         * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-right'.
922
-         * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-right geodir-details-sidebar-right'.
923
-         * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
924
-         */
925
-        do_action('geodir_sidebar_right_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-right geodir-details-sidebar-right', 'http://schema.org/WPSideBar');
926
-        ?>
895
+		/**
896
+		 * Called inside the HTML wrapper of the details sidebar for either the left and right sidebar.
897
+		 *
898
+		 * This is used to add all info to the details page sidebars.
899
+		 *
900
+		 * @since 1.0.0
901
+		 */
902
+		do_action('geodir_detail_sidebar_inside');
903
+		?></div><!-- end geodir-content-left --><?php
904
+		/**
905
+		 * Called after the details page left sidebar.
906
+		 *
907
+		 * This is used to add closing wrapper HTML to the details page left sidebar.
908
+		 *
909
+		 * @since 1.0.0
910
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
911
+		 */
912
+		do_action('geodir_sidebar_left_close', 'details-page');
913
+	} else {
914
+		/**
915
+		 * Called before the details page right sidebar is opened.
916
+		 *
917
+		 * This is used to add opening wrapper HTML to the details page right sidebar.
918
+		 *
919
+		 * @since 1.0.0
920
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'add-listing-page', 'author-page', 'search-page' or 'home-page'.
921
+		 * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-right'.
922
+		 * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-right geodir-details-sidebar-right'.
923
+		 * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
924
+		 */
925
+		do_action('geodir_sidebar_right_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-right geodir-details-sidebar-right', 'http://schema.org/WPSideBar');
926
+		?>
927 927
         <div class="geodir-content-right geodir-sidebar-wrap"><?php
928
-        /** This action is documented in geodirectory_template_actions.php */
929
-        do_action('geodir_detail_sidebar_inside');
930
-        ?></div><!-- end geodir-content-right --><?php
931
-        /**
932
-         * Called after the details page right sidebar.
933
-         *
934
-         * This is used to add closing wrapper HTML to the details page right sidebar.
935
-         *
936
-         * @since 1.0.0
937
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
938
-         */
939
-        do_action('geodir_sidebar_right_close', 'details-page');
940
-    }
928
+		/** This action is documented in geodirectory_template_actions.php */
929
+		do_action('geodir_detail_sidebar_inside');
930
+		?></div><!-- end geodir-content-right --><?php
931
+		/**
932
+		 * Called after the details page right sidebar.
933
+		 *
934
+		 * This is used to add closing wrapper HTML to the details page right sidebar.
935
+		 *
936
+		 * @since 1.0.0
937
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
938
+		 */
939
+		do_action('geodir_sidebar_right_close', 'details-page');
940
+	}
941 941
 }
942 942
 
943 943
 add_action('geodir_page_title', 'geodir_action_page_title', 10);
@@ -951,21 +951,21 @@  discard block
 block discarded – undo
951 951
  */
952 952
 function geodir_action_page_title()
953 953
 {
954
-    /**
955
-     * Filter the page title HTML h1 class.
956
-     *
957
-     * @since 1.0.0
958
-     * @param string $class The class to use. Default is 'entry-title fn'.
959
-     */
960
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
961
-    /**
962
-     * Filter the page title HTML header wrapper class.
963
-     *
964
-     * @since 1.0.0
965
-     * @param string $class The class to use. Default is 'entry-header'.
966
-     */
967
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
968
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
954
+	/**
955
+	 * Filter the page title HTML h1 class.
956
+	 *
957
+	 * @since 1.0.0
958
+	 * @param string $class The class to use. Default is 'entry-title fn'.
959
+	 */
960
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
961
+	/**
962
+	 * Filter the page title HTML header wrapper class.
963
+	 *
964
+	 * @since 1.0.0
965
+	 * @param string $class The class to use. Default is 'entry-header'.
966
+	 */
967
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
968
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
969 969
 }
970 970
 
971 971
 
@@ -982,87 +982,87 @@  discard block
 block discarded – undo
982 982
  */
983 983
 function geodir_action_details_slider()
984 984
 {
985
-    global $preview, $post;
986
-
987
-    $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // preview from backend
988
-
989
-    if ($is_backend_preview && !empty($post) && !empty($post->ID) && !isset($post->post_images)) {
990
-        $preview_get_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
985
+	global $preview, $post;
991 986
 
992
-        $preview_post_images = array();
993
-        if ($preview_get_images) {
994
-            foreach ($preview_get_images as $row) {
995
-                $preview_post_images[] = $row->src;
996
-            }
997
-        }
998
-        if (!empty($preview_post_images)) {
999
-            $post->post_images = implode(',', $preview_post_images);
1000
-        }
1001
-    }
987
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // preview from backend
1002 988
 
1003
-    if ($preview) {
1004
-        $post_images = array();
1005
-        if (isset($post->post_images) && !empty($post->post_images)) {
1006
-            $post->post_images = trim($post->post_images, ",");
1007
-            $post_images = explode(",", $post->post_images);
1008
-        }
989
+	if ($is_backend_preview && !empty($post) && !empty($post->ID) && !isset($post->post_images)) {
990
+		$preview_get_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
1009 991
 
1010
-        $main_slides = '';
1011
-        $nav_slides = '';
1012
-        $slides = 0;
1013
-
1014
-        if (!empty($post_images)) {
1015
-            foreach ($post_images as $image) {
1016
-                if (!empty($image)) {
1017
-                    $sizes = getimagesize(trim($image));
1018
-                    $width = !empty($sizes) && isset($sizes[0]) ? $sizes[0] : 0;
1019
-                    $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1020
-
1021
-                    if ($image && $width && $height) {
1022
-                        $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1023
-                    }
1024
-
1025
-                    if (isset($image->src)) {
1026
-                        if ($image->height >= 400) {
1027
-                            $spacer_height = 0;
1028
-                        } else {
1029
-                            $spacer_height = ((400 - $image->height) / 2);
1030
-                        }
1031
-
1032
-                        $image_title = isset($image->title) ? $image->title : '';
1033
-
1034
-                        $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1035
-                        $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1036
-                        $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1037
-                        $slides++;
1038
-                    }
1039
-                }
1040
-            }// endfore
1041
-        } //end if
1042
-    } else {
1043
-        $main_slides = '';
1044
-        $nav_slides = '';
1045
-        $post_images = geodir_get_images($post->ID, 'thumbnail', false); // Hide default image on listing preview/detail page.
1046
-        $slides = 0;
1047
-
1048
-        if (!empty($post_images)) {
1049
-            foreach ($post_images as $image) {
1050
-                if ($image->height >= 400) {
1051
-                    $spacer_height = 0;
1052
-                } else {
1053
-                    $spacer_height = ((400 - $image->height) / 2);
1054
-                }
1055
-                $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1056
-                $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1057
-                $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1058
-                $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1059
-                $slides++;
1060
-            }
1061
-        }// endfore
1062
-    }
992
+		$preview_post_images = array();
993
+		if ($preview_get_images) {
994
+			foreach ($preview_get_images as $row) {
995
+				$preview_post_images[] = $row->src;
996
+			}
997
+		}
998
+		if (!empty($preview_post_images)) {
999
+			$post->post_images = implode(',', $preview_post_images);
1000
+		}
1001
+	}
1002
+
1003
+	if ($preview) {
1004
+		$post_images = array();
1005
+		if (isset($post->post_images) && !empty($post->post_images)) {
1006
+			$post->post_images = trim($post->post_images, ",");
1007
+			$post_images = explode(",", $post->post_images);
1008
+		}
1009
+
1010
+		$main_slides = '';
1011
+		$nav_slides = '';
1012
+		$slides = 0;
1013
+
1014
+		if (!empty($post_images)) {
1015
+			foreach ($post_images as $image) {
1016
+				if (!empty($image)) {
1017
+					$sizes = getimagesize(trim($image));
1018
+					$width = !empty($sizes) && isset($sizes[0]) ? $sizes[0] : 0;
1019
+					$height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1020
+
1021
+					if ($image && $width && $height) {
1022
+						$image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1023
+					}
1024
+
1025
+					if (isset($image->src)) {
1026
+						if ($image->height >= 400) {
1027
+							$spacer_height = 0;
1028
+						} else {
1029
+							$spacer_height = ((400 - $image->height) / 2);
1030
+						}
1031
+
1032
+						$image_title = isset($image->title) ? $image->title : '';
1033
+
1034
+						$main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1035
+						$main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1036
+						$nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1037
+						$slides++;
1038
+					}
1039
+				}
1040
+			}// endfore
1041
+		} //end if
1042
+	} else {
1043
+		$main_slides = '';
1044
+		$nav_slides = '';
1045
+		$post_images = geodir_get_images($post->ID, 'thumbnail', false); // Hide default image on listing preview/detail page.
1046
+		$slides = 0;
1047
+
1048
+		if (!empty($post_images)) {
1049
+			foreach ($post_images as $image) {
1050
+				if ($image->height >= 400) {
1051
+					$spacer_height = 0;
1052
+				} else {
1053
+					$spacer_height = ((400 - $image->height) / 2);
1054
+				}
1055
+				$caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1056
+				$main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1057
+				$main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1058
+				$nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1059
+				$slides++;
1060
+			}
1061
+		}// endfore
1062
+	}
1063 1063
 
1064
-    if (!empty($post_images)) {
1065
-        ?>
1064
+	if (!empty($post_images)) {
1065
+		?>
1066 1066
         <div class="geodir_flex-container">
1067 1067
             <div class="geodir_flex-loader"><i class="fa fa-refresh fa-spin"></i></div>
1068 1068
             <div id="geodir_slider" class="geodir_flexslider ">
@@ -1075,7 +1075,7 @@  discard block
 block discarded – undo
1075 1075
             <?php } ?>
1076 1076
         </div>
1077 1077
     <?php
1078
-    }
1078
+	}
1079 1079
 }
1080 1080
 
1081 1081
 add_action('geodir_details_taxonomies', 'geodir_action_details_taxonomies', 10);
@@ -1090,176 +1090,176 @@  discard block
 block discarded – undo
1090 1090
  */
1091 1091
 function geodir_action_details_taxonomies()
1092 1092
 {
1093
-    global $preview, $post;?>
1093
+	global $preview, $post;?>
1094 1094
     <p class="geodir_post_taxomomies clearfix">
1095 1095
     <?php
1096
-    $taxonomies = array();
1097
-
1098
-    $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
1099
-
1100
-    if ($preview && !$is_backend_preview) {
1101
-        $post_type = $post->listing_type;
1102
-        $post_taxonomy = $post_type . 'category';
1103
-        $post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1104
-    } else {
1105
-        $post_type = $post->post_type;
1106
-        $post_taxonomy = $post_type . 'category';
1107
-    }
1096
+	$taxonomies = array();
1097
+
1098
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
1099
+
1100
+	if ($preview && !$is_backend_preview) {
1101
+		$post_type = $post->listing_type;
1102
+		$post_taxonomy = $post_type . 'category';
1103
+		$post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1104
+	} else {
1105
+		$post_type = $post->post_type;
1106
+		$post_taxonomy = $post_type . 'category';
1107
+	}
1108 1108
 //{	
1109
-    $post_type_info = get_post_type_object($post_type);
1110
-    $listing_label = __($post_type_info->labels->singular_name, 'geodirectory');
1111
-
1112
-    if (!empty($post->post_tags)) {
1113
-
1114
-        if (taxonomy_exists($post_type . '_tags')):
1115
-            $links = array();
1116
-            $terms = array();
1117
-            // to limit post tags
1118
-            $post_tags = trim($post->post_tags, ",");
1119
-            $post_id = isset($post->ID) ? $post->ID : '';
1120
-            /**
1121
-             * Filter the post tags.
1122
-             *
1123
-             * Allows you to filter the post tags output on the details page of a post.
1124
-             *
1125
-             * @since 1.0.0
1126
-             * @param string $post_tags A comma seperated list of tags.
1127
-             * @param int $post_id The current post id.
1128
-             */
1129
-            $post_tags = apply_filters('geodir_action_details_post_tags', $post_tags, $post_id);
1130
-
1131
-            $post->post_tags = $post_tags;
1132
-            $post_tags = explode(",", trim($post->post_tags, ","));
1133
-
1134
-            foreach ($post_tags as $post_term) {
1135
-
1136
-                // fix slug creation order for tags & location
1137
-                $post_term = trim($post_term);
1138
-
1139
-                $priority_location = false;
1140
-                if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1141
-                    $term = get_term_by('name', $post_term, $post_type . '_tags');
1142
-                } else {
1143
-                    $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1144
-                    $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
1145
-                    $post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL;
1146
-                    $match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false;
1147
-                    $match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false;
1148
-                    $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1149
-                    if ($match_country || $match_region || $match_city) {
1150
-                        $priority_location = true;
1151
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1152
-                    } else {
1153
-                        $insert_term = wp_insert_term($post_term, $post_type . '_tags');
1154
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1155
-                    }
1156
-                }
1157
-
1158
-                if (!is_wp_error($term) && is_object($term)) {
1159
-
1160
-                    // fix tag link on detail page
1161
-                    if ($priority_location) {
1162
-
1163
-                        $tag_link = "<a href=''>$post_term</a>";
1164
-                        /**
1165
-                         * Filter the tag name on the details page.
1166
-                         *
1167
-                         * @since 1.5.6
1168
-                         * @param string $tag_link The tag link html.
1169
-                         * @param object $term The tag term object.
1170
-                         */
1171
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1172
-                        $links[] = $tag_link;
1173
-                    } else {
1174
-                        $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1175
-                        /** This action is documented in geodirectory-template_actions.php */
1176
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1177
-                        $links[] = $tag_link;
1178
-                    }
1179
-                    $terms[] = $term;
1180
-                }
1181
-                //
1182
-            }
1183
-            if (!isset($listing_label)) {
1184
-                $listing_label = '';
1185
-            }
1186
-            $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1187
-        endif;
1188
-
1189
-    }
1190
-
1191
-    if (!empty($post->{$post_taxonomy})) {
1192
-        $links = array();
1193
-        $terms = array();
1194
-        $termsOrdered = array();
1195
-        if (!is_array($post->{$post_taxonomy})) {
1196
-            $post_term = explode(",", trim($post->{$post_taxonomy}, ","));
1197
-        } else {
1198
-            $post_term = $post->{$post_taxonomy};
1109
+	$post_type_info = get_post_type_object($post_type);
1110
+	$listing_label = __($post_type_info->labels->singular_name, 'geodirectory');
1111
+
1112
+	if (!empty($post->post_tags)) {
1113
+
1114
+		if (taxonomy_exists($post_type . '_tags')):
1115
+			$links = array();
1116
+			$terms = array();
1117
+			// to limit post tags
1118
+			$post_tags = trim($post->post_tags, ",");
1119
+			$post_id = isset($post->ID) ? $post->ID : '';
1120
+			/**
1121
+			 * Filter the post tags.
1122
+			 *
1123
+			 * Allows you to filter the post tags output on the details page of a post.
1124
+			 *
1125
+			 * @since 1.0.0
1126
+			 * @param string $post_tags A comma seperated list of tags.
1127
+			 * @param int $post_id The current post id.
1128
+			 */
1129
+			$post_tags = apply_filters('geodir_action_details_post_tags', $post_tags, $post_id);
1130
+
1131
+			$post->post_tags = $post_tags;
1132
+			$post_tags = explode(",", trim($post->post_tags, ","));
1133
+
1134
+			foreach ($post_tags as $post_term) {
1135
+
1136
+				// fix slug creation order for tags & location
1137
+				$post_term = trim($post_term);
1138
+
1139
+				$priority_location = false;
1140
+				if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1141
+					$term = get_term_by('name', $post_term, $post_type . '_tags');
1142
+				} else {
1143
+					$post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1144
+					$post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
1145
+					$post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL;
1146
+					$match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false;
1147
+					$match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false;
1148
+					$match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1149
+					if ($match_country || $match_region || $match_city) {
1150
+						$priority_location = true;
1151
+						$term = get_term_by('name', $post_term, $post_type . '_tags');
1152
+					} else {
1153
+						$insert_term = wp_insert_term($post_term, $post_type . '_tags');
1154
+						$term = get_term_by('name', $post_term, $post_type . '_tags');
1155
+					}
1156
+				}
1157
+
1158
+				if (!is_wp_error($term) && is_object($term)) {
1159
+
1160
+					// fix tag link on detail page
1161
+					if ($priority_location) {
1162
+
1163
+						$tag_link = "<a href=''>$post_term</a>";
1164
+						/**
1165
+						 * Filter the tag name on the details page.
1166
+						 *
1167
+						 * @since 1.5.6
1168
+						 * @param string $tag_link The tag link html.
1169
+						 * @param object $term The tag term object.
1170
+						 */
1171
+						$tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1172
+						$links[] = $tag_link;
1173
+					} else {
1174
+						$tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1175
+						/** This action is documented in geodirectory-template_actions.php */
1176
+						$tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1177
+						$links[] = $tag_link;
1178
+					}
1179
+					$terms[] = $term;
1180
+				}
1181
+				//
1182
+			}
1183
+			if (!isset($listing_label)) {
1184
+				$listing_label = '';
1185
+			}
1186
+			$taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1187
+		endif;
1188
+
1189
+	}
1190
+
1191
+	if (!empty($post->{$post_taxonomy})) {
1192
+		$links = array();
1193
+		$terms = array();
1194
+		$termsOrdered = array();
1195
+		if (!is_array($post->{$post_taxonomy})) {
1196
+			$post_term = explode(",", trim($post->{$post_taxonomy}, ","));
1197
+		} else {
1198
+			$post_term = $post->{$post_taxonomy};
1199 1199
 			
1200 1200
 			if ($preview && !$is_backend_preview) {
1201 1201
 				$post_term = geodir_add_parent_terms($post_term, $post_taxonomy);
1202 1202
 			}
1203
-        }
1203
+		}
1204
+
1205
+		$post_term = array_unique($post_term);
1206
+		if (!empty($post_term)) {
1207
+			foreach ($post_term as $post_term) {
1208
+				$post_term = trim($post_term);
1209
+
1210
+				if ($post_term != ''):
1211
+					$term = get_term_by('id', $post_term, $post_taxonomy);
1212
+
1213
+					if (is_object($term)) {
1214
+						$term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1215
+						/**
1216
+						 * Filter the category name on the details page.
1217
+						 *
1218
+						 * @since 1.5.6
1219
+						 * @param string $term_link The link html to the category.
1220
+						 * @param object $term The category term object.
1221
+						 */
1222
+						$term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1223
+						$links[] = $term_link;
1224
+						$terms[] = $term;
1225
+					}
1226
+				endif;
1227
+			}
1228
+			// order alphabetically
1229
+			asort($links);
1230
+			foreach (array_keys($links) as $key) {
1231
+				$termsOrdered[$key] = $terms[$key];
1232
+			}
1233
+			$terms = $termsOrdered;
1204 1234
 
1205
-        $post_term = array_unique($post_term);
1206
-        if (!empty($post_term)) {
1207
-            foreach ($post_term as $post_term) {
1208
-                $post_term = trim($post_term);
1209
-
1210
-                if ($post_term != ''):
1211
-                    $term = get_term_by('id', $post_term, $post_taxonomy);
1212
-
1213
-                    if (is_object($term)) {
1214
-                        $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1215
-                        /**
1216
-                         * Filter the category name on the details page.
1217
-                         *
1218
-                         * @since 1.5.6
1219
-                         * @param string $term_link The link html to the category.
1220
-                         * @param object $term The category term object.
1221
-                         */
1222
-                        $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1223
-                        $links[] = $term_link;
1224
-                        $terms[] = $term;
1225
-                    }
1226
-                endif;
1227
-            }
1228
-            // order alphabetically
1229
-            asort($links);
1230
-            foreach (array_keys($links) as $key) {
1231
-                $termsOrdered[$key] = $terms[$key];
1232
-            }
1233
-            $terms = $termsOrdered;
1235
+		}
1234 1236
 
1235
-        }
1237
+		if (!isset($listing_label)) {
1238
+			$listing_label = '';
1239
+		}
1240
+		$taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1236 1241
 
1237
-        if (!isset($listing_label)) {
1238
-            $listing_label = '';
1239
-        }
1240
-        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1241
-
1242
-    }
1242
+	}
1243 1243
 
1244
-    /**
1245
-     * Filter the taxonomies array before output.
1246
-     *
1247
-     * @since 1.5.9
1248
-     * @param array $taxonomies The array of cats and tags.
1249
-     * @param string $post_type The post type being output.
1250
-     * @param string $listing_label The post type label.
1251
-     * @param string $listing_label The post type label with ucwords function.
1252
-     */
1253
-    $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1244
+	/**
1245
+	 * Filter the taxonomies array before output.
1246
+	 *
1247
+	 * @since 1.5.9
1248
+	 * @param array $taxonomies The array of cats and tags.
1249
+	 * @param string $post_type The post type being output.
1250
+	 * @param string $listing_label The post type label.
1251
+	 * @param string $listing_label The post type label with ucwords function.
1252
+	 */
1253
+	$taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1254 1254
 
1255
-    if (isset($taxonomies[$post_taxonomy])) {
1256
-        echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1257
-    }
1255
+	if (isset($taxonomies[$post_taxonomy])) {
1256
+		echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1257
+	}
1258 1258
 
1259
-    if (isset($taxonomies[$post_type . '_tags']))
1260
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1259
+	if (isset($taxonomies[$post_type . '_tags']))
1260
+		echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1261 1261
 
1262
-    ?>
1262
+	?>
1263 1263
     </p><?php
1264 1264
 }
1265 1265
 
@@ -1281,126 +1281,126 @@  discard block
 block discarded – undo
1281 1281
 function geodir_action_details_micordata($post='')
1282 1282
 {
1283 1283
 
1284
-    global $preview;
1285
-    if(empty($post)){global $post;}
1286
-    if ($preview || !geodir_is_page('detail')) {
1287
-        return;
1288
-    }
1289
-
1290
-    // url
1291
-    $c_url = geodir_curPageURL();
1292
-
1293
-    // post reviews
1294
-    $post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
1295
-    if (empty($post_reviews)) {
1296
-        $reviews = '';
1297
-    } else {
1298
-        foreach ($post_reviews as $review) {
1299
-            $reviews[] = array(
1300
-                "@type" => "Review",
1301
-                "author" => $review->comment_author,
1302
-                "datePublished" => $review->comment_date,
1303
-                "description" => $review->comment_content,
1304
-                "reviewRating" => array(
1305
-                    "@type" => "Rating",
1306
-                    "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1307
-                    "ratingValue" => geodir_get_commentoverall($review->comment_ID),
1308
-                    "worstRating" => "1"
1309
-                )
1310
-            );
1311
-        }
1312
-
1313
-    }
1314
-
1315
-    // post images
1316
-    $post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
1317
-    if (empty($post_images)) {
1318
-        $images = '';
1319
-    } else {
1320
-        $i_arr = array();
1321
-        foreach ($post_images as $img) {
1322
-            $i_arr[] = $img->src;
1323
-        }
1324
-
1325
-        if (count($i_arr) == 1) {
1326
-            $images = $i_arr[0];
1327
-        } else {
1328
-            $images = $i_arr;
1329
-        }
1330
-
1331
-    }
1332
-    //print_r($post);
1333
-    // external links
1334
-    $external_links =  array();
1335
-    $external_links[] = $post->geodir_website;
1336
-    $external_links[] = $post->geodir_twitter;
1337
-    $external_links[] = $post->geodir_facebook;
1338
-    $external_links = array_filter($external_links);
1339
-
1340
-    if(!empty($external_links)){
1341
-        $external_links = array_values($external_links);
1342
-    }
1343
-
1344
-    // reviews
1345
-    $comment_count = geodir_get_review_count_total($post->ID);
1346
-    $post_avgratings = geodir_get_post_rating($post->ID);
1347
-
1348
-    // schema type
1349
-    $schema_type = 'LocalBusiness';
1350
-    if(isset($post->default_category) && $post->default_category){
1351
-        $schema_type = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1352
-        if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1353
-    }
1354
-
1355
-    $schema = array();
1356
-    $schema['@context'] = "http://schema.org";
1357
-    $schema['@type'] = $schema_type;
1358
-    $schema['name'] = $post->post_name;
1359
-    $schema['description'] = wp_strip_all_tags( $post->post_content, true );
1360
-    $schema['telephone'] = $post->geodir_contact;
1361
-    $schema['url'] = $c_url;
1362
-    $schema['sameAs'] = $external_links;
1363
-    $schema['image'] = $images;
1364
-    $schema['address'] = array(
1365
-        "@type" => "PostalAddress",
1366
-        "streetAddress" => $post->post_address,
1367
-        "addressLocality" => $post->post_city,
1368
-        "addressRegion" => $post->post_region,
1369
-        "addressCountry" => $post->post_country,
1370
-        "postalCode" => $post->post_zip
1371
-    );
1372
-
1373
-    if($post->post_latitude && $post->post_longitude) {
1374
-        $schema['geo'] = array(
1375
-            "@type" => "GeoCoordinates",
1376
-            "latitude" => $post->post_latitude,
1377
-            "longitude" => $post->post_longitude
1378
-        );
1379
-    }
1380
-
1381
-    if($post_avgratings) {
1382
-        $schema['aggregateRating'] = array(
1383
-            "@type" => "AggregateRating",
1384
-            "ratingValue" => $post_avgratings,
1385
-            "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1386
-            "worstRating" => "1",
1387
-            "ratingCount" => $comment_count
1388
-        );
1389
-    }
1390
-    $schema['review'] = $reviews;
1391
-
1392
-    /**
1393
-     * Allow the schema JSON-LD info to be filtered.
1394
-     *
1395
-     * @since 1.5.4
1396
-     * @since 1.5.7 Added $post variable.
1397
-     * @param array $schema The array of schema data to be filtered.
1398
-     * @param object $post The post object.
1399
-     */
1400
-    $schema = apply_filters('geodir_details_schema', $schema,$post);
1401
-
1402
-
1403
-    echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1284
+	global $preview;
1285
+	if(empty($post)){global $post;}
1286
+	if ($preview || !geodir_is_page('detail')) {
1287
+		return;
1288
+	}
1289
+
1290
+	// url
1291
+	$c_url = geodir_curPageURL();
1292
+
1293
+	// post reviews
1294
+	$post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
1295
+	if (empty($post_reviews)) {
1296
+		$reviews = '';
1297
+	} else {
1298
+		foreach ($post_reviews as $review) {
1299
+			$reviews[] = array(
1300
+				"@type" => "Review",
1301
+				"author" => $review->comment_author,
1302
+				"datePublished" => $review->comment_date,
1303
+				"description" => $review->comment_content,
1304
+				"reviewRating" => array(
1305
+					"@type" => "Rating",
1306
+					"bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1307
+					"ratingValue" => geodir_get_commentoverall($review->comment_ID),
1308
+					"worstRating" => "1"
1309
+				)
1310
+			);
1311
+		}
1312
+
1313
+	}
1314
+
1315
+	// post images
1316
+	$post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
1317
+	if (empty($post_images)) {
1318
+		$images = '';
1319
+	} else {
1320
+		$i_arr = array();
1321
+		foreach ($post_images as $img) {
1322
+			$i_arr[] = $img->src;
1323
+		}
1324
+
1325
+		if (count($i_arr) == 1) {
1326
+			$images = $i_arr[0];
1327
+		} else {
1328
+			$images = $i_arr;
1329
+		}
1330
+
1331
+	}
1332
+	//print_r($post);
1333
+	// external links
1334
+	$external_links =  array();
1335
+	$external_links[] = $post->geodir_website;
1336
+	$external_links[] = $post->geodir_twitter;
1337
+	$external_links[] = $post->geodir_facebook;
1338
+	$external_links = array_filter($external_links);
1339
+
1340
+	if(!empty($external_links)){
1341
+		$external_links = array_values($external_links);
1342
+	}
1343
+
1344
+	// reviews
1345
+	$comment_count = geodir_get_review_count_total($post->ID);
1346
+	$post_avgratings = geodir_get_post_rating($post->ID);
1347
+
1348
+	// schema type
1349
+	$schema_type = 'LocalBusiness';
1350
+	if(isset($post->default_category) && $post->default_category){
1351
+		$schema_type = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1352
+		if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1353
+	}
1354
+
1355
+	$schema = array();
1356
+	$schema['@context'] = "http://schema.org";
1357
+	$schema['@type'] = $schema_type;
1358
+	$schema['name'] = $post->post_name;
1359
+	$schema['description'] = wp_strip_all_tags( $post->post_content, true );
1360
+	$schema['telephone'] = $post->geodir_contact;
1361
+	$schema['url'] = $c_url;
1362
+	$schema['sameAs'] = $external_links;
1363
+	$schema['image'] = $images;
1364
+	$schema['address'] = array(
1365
+		"@type" => "PostalAddress",
1366
+		"streetAddress" => $post->post_address,
1367
+		"addressLocality" => $post->post_city,
1368
+		"addressRegion" => $post->post_region,
1369
+		"addressCountry" => $post->post_country,
1370
+		"postalCode" => $post->post_zip
1371
+	);
1372
+
1373
+	if($post->post_latitude && $post->post_longitude) {
1374
+		$schema['geo'] = array(
1375
+			"@type" => "GeoCoordinates",
1376
+			"latitude" => $post->post_latitude,
1377
+			"longitude" => $post->post_longitude
1378
+		);
1379
+	}
1380
+
1381
+	if($post_avgratings) {
1382
+		$schema['aggregateRating'] = array(
1383
+			"@type" => "AggregateRating",
1384
+			"ratingValue" => $post_avgratings,
1385
+			"bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1386
+			"worstRating" => "1",
1387
+			"ratingCount" => $comment_count
1388
+		);
1389
+	}
1390
+	$schema['review'] = $reviews;
1391
+
1392
+	/**
1393
+	 * Allow the schema JSON-LD info to be filtered.
1394
+	 *
1395
+	 * @since 1.5.4
1396
+	 * @since 1.5.7 Added $post variable.
1397
+	 * @param array $schema The array of schema data to be filtered.
1398
+	 * @param object $post The post object.
1399
+	 */
1400
+	$schema = apply_filters('geodir_details_schema', $schema,$post);
1401
+
1402
+
1403
+	echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1404 1404
 
1405 1405
 }
1406 1406
 
@@ -1418,7 +1418,7 @@  discard block
 block discarded – undo
1418 1418
  */
1419 1419
 function geodir_action_details_next_prev()
1420 1420
 {
1421
-    ?>
1421
+	?>
1422 1422
     <div class="geodir-pos_navigation clearfix">
1423 1423
     <div
1424 1424
         class="geodir-post_left"><?php previous_post_link('%link', '' . __('Previous', 'geodirectory'), false) ?></div>
@@ -1436,15 +1436,15 @@  discard block
 block discarded – undo
1436 1436
  */
1437 1437
 function geodir_action_before_single_post()
1438 1438
 {
1439
-    global $post;
1440
-    /**
1441
-     * Called at the very start fo the details page output, before the title section.
1442
-     *
1443
-     * @since 1.0.0
1444
-     * @param object $post The current post object.
1445
-     * @global WP_Post|null $post The current post, if available.
1446
-     */
1447
-    do_action('geodir_before_single_post', $post); // extra action	
1439
+	global $post;
1440
+	/**
1441
+	 * Called at the very start fo the details page output, before the title section.
1442
+	 *
1443
+	 * @since 1.0.0
1444
+	 * @param object $post The current post object.
1445
+	 * @global WP_Post|null $post The current post, if available.
1446
+	 */
1447
+	do_action('geodir_before_single_post', $post); // extra action	
1448 1448
 }
1449 1449
 
1450 1450
 /**
@@ -1455,13 +1455,13 @@  discard block
 block discarded – undo
1455 1455
  */
1456 1456
 function geodir_action_after_single_post($post)
1457 1457
 {
1458
-    /**
1459
-     * Called on the details page after the details page tabs section and before the next/prev buttons.
1460
-     *
1461
-     * @since 1.0.0
1462
-     * @param object $post The current post object.
1463
-     */
1464
-    do_action('geodir_after_single_post', $post); // extra action	
1458
+	/**
1459
+	 * Called on the details page after the details page tabs section and before the next/prev buttons.
1460
+	 *
1461
+	 * @since 1.0.0
1462
+	 * @param object $post The current post object.
1463
+	 */
1464
+	do_action('geodir_after_single_post', $post); // extra action	
1465 1465
 }
1466 1466
 
1467 1467
 add_action('geodir_details_main_content', 'geodir_action_before_single_post', 10);
@@ -1487,167 +1487,167 @@  discard block
 block discarded – undo
1487 1487
  */
1488 1488
 function geodir_action_listings_title()
1489 1489
 {
1490
-    global $wp, $term;
1491
-
1492
-    $gd_post_type = geodir_get_current_posttype();
1493
-    $post_type_info = get_post_type_object($gd_post_type);
1494
-
1495
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
1496
-    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1497
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1498
-    }
1499
-
1500
-    $list_title = $add_string_in_title . __(ucfirst($post_type_info->labels->name), 'geodirectory');
1501
-    $single_name = $post_type_info->labels->singular_name;
1502
-
1503
-    $taxonomy = geodir_get_taxonomies($gd_post_type, true);
1490
+	global $wp, $term;
1504 1491
 
1505
-    $gd_country = get_query_var('gd_country');
1506
-    $gd_region = get_query_var('gd_region');
1507
-    $gd_city = get_query_var('gd_city');
1492
+	$gd_post_type = geodir_get_current_posttype();
1493
+	$post_type_info = get_post_type_object($gd_post_type);
1508 1494
 
1509
-    if (!empty($term)) {
1510
-        $location_name = '';
1511
-        if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
1512
-            if ($gd_country != '') {
1513
-                $location_name = geodir_sanitize_location_name('gd_country', $gd_country);
1514
-            }
1515
-
1516
-            if ($gd_region != '') {
1517
-                $location_name = geodir_sanitize_location_name('gd_region', $gd_region);
1518
-            }
1519
-
1520
-            if ($gd_city != '') {
1521
-                $location_name = geodir_sanitize_location_name('gd_city', $gd_city);
1522
-            }
1523
-        }
1524
-
1525
-        $current_term = get_term_by('slug', $term, $taxonomy[0]);
1526
-        if (!empty($current_term)) {
1527
-            $current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1528
-            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1529
-                $location_last_char = substr($location_name, -1);
1530
-                $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1531
-                $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1532
-            } else {
1533
-                $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1534
-            }
1535
-        } else {
1536
-            if (count($taxonomy) > 1) {
1537
-                $current_term = get_term_by('slug', $term, $taxonomy[1]);
1538
-
1539
-                if (!empty($current_term)) {
1540
-                    $current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1541
-                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1542
-                        $location_last_char = substr($location_name, -1);
1543
-                        $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1544
-                        $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1545
-                    } else {
1546
-                        $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1547
-                    }
1548
-                }
1549
-            }
1550
-        }
1495
+	$add_string_in_title = __('All', 'geodirectory') . ' ';
1496
+	if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1497
+		$add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1498
+	}
1551 1499
 
1552
-    } else {
1553
-        $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
1554
-        $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
1555
-        $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
1500
+	$list_title = $add_string_in_title . __(ucfirst($post_type_info->labels->name), 'geodirectory');
1501
+	$single_name = $post_type_info->labels->singular_name;
1556 1502
 
1557
-        $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
1503
+	$taxonomy = geodir_get_taxonomies($gd_post_type, true);
1558 1504
 
1559
-        if (function_exists('get_actual_location_name')) {
1560
-            $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
1561
-            $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
1562
-            $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
1563
-        }
1505
+	$gd_country = get_query_var('gd_country');
1506
+	$gd_region = get_query_var('gd_region');
1507
+	$gd_city = get_query_var('gd_city');
1564 1508
 
1565
-        if ($gd_city != '') {
1566
-            if ($gd_city_actual != '') {
1567
-                $gd_city = $gd_city_actual;
1568
-            } else {
1569
-                $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
1570
-                $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
1571
-                $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1572
-            }
1573
-
1574
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1575
-        } else if ($gd_region != '') {
1576
-            if ($gd_region_actual != '') {
1577
-                $gd_region = $gd_region_actual;
1578
-            } else {
1579
-                $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
1580
-                $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
1581
-                $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1582
-            }
1583
-
1584
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1585
-        } else if ($gd_country != '') {
1586
-            if ($gd_country_actual != '') {
1587
-                $gd_country = $gd_country_actual;
1588
-            } else {
1589
-                $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
1590
-                $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
1591
-                $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1592
-            }
1593
-
1594
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1595
-        }
1596
-    }
1597
-
1598
-    if (is_search()) {
1599
-        $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1600
-    }
1601
-    /** This action is documented in geodirectory_template_actions.php */
1602
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
1603
-    /** This action is documented in geodirectory_template_actions.php */
1604
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
1605
-
1606
-
1607
-    $title = $list_title;
1608
-    if(geodir_is_page('pt')){
1609
-        $gd_page = 'pt';
1610
-        $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1611
-    }
1612
-    elseif(geodir_is_page('listing')){
1613
-        $gd_page = 'listing';
1614
-        global $wp_query;
1615
-        $current_term = $wp_query->get_queried_object();
1616
-        if (strpos($current_term->taxonomy,'_tags') !== false) {
1617
-            $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1618
-        }else{
1619
-            $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1620
-        }
1509
+	if (!empty($term)) {
1510
+		$location_name = '';
1511
+		if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
1512
+			if ($gd_country != '') {
1513
+				$location_name = geodir_sanitize_location_name('gd_country', $gd_country);
1514
+			}
1621 1515
 
1622
-    }
1623
-    elseif(geodir_is_page('author')){
1624
-        $gd_page = 'author';
1625
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1626
-            $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1627
-        }else{
1628
-            $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1629
-        }
1516
+			if ($gd_region != '') {
1517
+				$location_name = geodir_sanitize_location_name('gd_region', $gd_region);
1518
+			}
1630 1519
 
1631
-    }
1520
+			if ($gd_city != '') {
1521
+				$location_name = geodir_sanitize_location_name('gd_city', $gd_city);
1522
+			}
1523
+		}
1524
+
1525
+		$current_term = get_term_by('slug', $term, $taxonomy[0]);
1526
+		if (!empty($current_term)) {
1527
+			$current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1528
+			if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1529
+				$location_last_char = substr($location_name, -1);
1530
+				$location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1531
+				$list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1532
+			} else {
1533
+				$list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1534
+			}
1535
+		} else {
1536
+			if (count($taxonomy) > 1) {
1537
+				$current_term = get_term_by('slug', $term, $taxonomy[1]);
1538
+
1539
+				if (!empty($current_term)) {
1540
+					$current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1541
+					if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1542
+						$location_last_char = substr($location_name, -1);
1543
+						$location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1544
+						$list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1545
+					} else {
1546
+						$list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1547
+					}
1548
+				}
1549
+			}
1550
+		}
1551
+
1552
+	} else {
1553
+		$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
1554
+		$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
1555
+		$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
1556
+
1557
+		$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
1558
+
1559
+		if (function_exists('get_actual_location_name')) {
1560
+			$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
1561
+			$gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
1562
+			$gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
1563
+		}
1564
+
1565
+		if ($gd_city != '') {
1566
+			if ($gd_city_actual != '') {
1567
+				$gd_city = $gd_city_actual;
1568
+			} else {
1569
+				$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
1570
+				$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
1571
+				$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1572
+			}
1632 1573
 
1574
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1575
+		} else if ($gd_region != '') {
1576
+			if ($gd_region_actual != '') {
1577
+				$gd_region = $gd_region_actual;
1578
+			} else {
1579
+				$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
1580
+				$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
1581
+				$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1582
+			}
1633 1583
 
1634
-    /**
1635
-     * Filter page title to replace variables.
1636
-     *
1637
-     * @since 1.5.4
1638
-     * @param string $title The page title including variables.
1639
-     * @param string $gd_page The GeoDirectory page type if any.
1640
-     */
1641
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1584
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1585
+		} else if ($gd_country != '') {
1586
+			if ($gd_country_actual != '') {
1587
+				$gd_country = $gd_country_actual;
1588
+			} else {
1589
+				$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
1590
+				$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
1591
+				$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1592
+			}
1642 1593
 
1643
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1644
-        /**
1645
-         * Filter the listing page title.
1646
-         *
1647
-         * @since 1.0.0
1648
-         * @param string $list_title The title for the category page.
1649
-         */
1650
-        apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1594
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1595
+		}
1596
+	}
1597
+
1598
+	if (is_search()) {
1599
+		$list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1600
+	}
1601
+	/** This action is documented in geodirectory_template_actions.php */
1602
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
1603
+	/** This action is documented in geodirectory_template_actions.php */
1604
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
1605
+
1606
+
1607
+	$title = $list_title;
1608
+	if(geodir_is_page('pt')){
1609
+		$gd_page = 'pt';
1610
+		$title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1611
+	}
1612
+	elseif(geodir_is_page('listing')){
1613
+		$gd_page = 'listing';
1614
+		global $wp_query;
1615
+		$current_term = $wp_query->get_queried_object();
1616
+		if (strpos($current_term->taxonomy,'_tags') !== false) {
1617
+			$title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1618
+		}else{
1619
+			$title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1620
+		}
1621
+
1622
+	}
1623
+	elseif(geodir_is_page('author')){
1624
+		$gd_page = 'author';
1625
+		if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1626
+			$title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1627
+		}else{
1628
+			$title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1629
+		}
1630
+
1631
+	}
1632
+
1633
+
1634
+	/**
1635
+	 * Filter page title to replace variables.
1636
+	 *
1637
+	 * @since 1.5.4
1638
+	 * @param string $title The page title including variables.
1639
+	 * @param string $gd_page The GeoDirectory page type if any.
1640
+	 */
1641
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1642
+
1643
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1644
+		/**
1645
+		 * Filter the listing page title.
1646
+		 *
1647
+		 * @since 1.0.0
1648
+		 * @param string $list_title The title for the category page.
1649
+		 */
1650
+		apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1651 1651
 }
1652 1652
 
1653 1653
 add_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
@@ -1660,33 +1660,33 @@  discard block
 block discarded – undo
1660 1660
  */
1661 1661
 function geodir_action_listings_description()
1662 1662
 {
1663
-    global $wp_query;
1664
-    $current_term = $wp_query->get_queried_object();
1665
-
1666
-    $gd_post_type = geodir_get_current_posttype();
1667
-    if (isset($current_term->term_id) && $current_term->term_id != '') {
1668
-
1669
-        $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1670
-        $saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1671
-        if ($term_desc && !$saved_data) {
1672
-            $saved_data = $term_desc;
1673
-        }
1674
-        /**
1675
-         * Apply the core filter `the_content` filter to the variable string.
1676
-         *
1677
-         * This is a WordPress core filter that does many things.
1678
-         *
1679
-         * @since 1.0.0
1680
-         * @param string $var The string to apply the filter to.
1681
-         */
1682
-        $cat_description = apply_filters('the_content', $saved_data);
1683
-        if ($cat_description) {
1684
-            ?>
1663
+	global $wp_query;
1664
+	$current_term = $wp_query->get_queried_object();
1665
+
1666
+	$gd_post_type = geodir_get_current_posttype();
1667
+	if (isset($current_term->term_id) && $current_term->term_id != '') {
1668
+
1669
+		$term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1670
+		$saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1671
+		if ($term_desc && !$saved_data) {
1672
+			$saved_data = $term_desc;
1673
+		}
1674
+		/**
1675
+		 * Apply the core filter `the_content` filter to the variable string.
1676
+		 *
1677
+		 * This is a WordPress core filter that does many things.
1678
+		 *
1679
+		 * @since 1.0.0
1680
+		 * @param string $var The string to apply the filter to.
1681
+		 */
1682
+		$cat_description = apply_filters('the_content', $saved_data);
1683
+		if ($cat_description) {
1684
+			?>
1685 1685
 
1686 1686
             <div class="term_description"><?php echo $cat_description;?></div> <?php
1687
-        }
1687
+		}
1688 1688
 
1689
-    }
1689
+	}
1690 1690
 }
1691 1691
 
1692 1692
 // action for adding the listings page top widget area
@@ -1705,11 +1705,11 @@  discard block
 block discarded – undo
1705 1705
  */
1706 1706
 function geodir_action_geodir_sidebar_listings_top()
1707 1707
 {
1708
-    if (get_option('geodir_show_listing_top_section')) { ?>
1708
+	if (get_option('geodir_show_listing_top_section')) { ?>
1709 1709
         <div
1710 1710
             class="<?php
1711
-            /** This action is documented in geodirectory_template_actions.php */
1712
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
1711
+			/** This action is documented in geodirectory_template_actions.php */
1712
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
1713 1713
             <?php dynamic_sidebar('geodir_listing_top'); ?>
1714 1714
         </div><!-- clearfix ends here-->
1715 1715
     <?php }
@@ -1732,35 +1732,35 @@  discard block
 block discarded – undo
1732 1732
  */
1733 1733
 function geodir_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')
1734 1734
 {
1735
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1736
-        $width_css = 'style="width:' . $width . '%;"';
1737
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1738
-        $width_css = 'style="width:' . $width . '%;"';
1739
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1740
-        $width_css = 'style="width:' . $width . '%;"';
1741
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1742
-        $width_css = 'style="width:' . $width . '%;"';
1743
-    } else {
1744
-        $width_css = '';
1745
-    }
1746
-
1747
-    $tc = get_option('theme_compatibility_setting');
1748
-    if (!empty($tc['geodir_sidebar_left_open_replace'])) {
1749
-        $text = $tc['geodir_sidebar_left_open_replace'];
1750
-    } else {
1751
-        $text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
1752
-    }
1753
-
1754
-    if (!empty($tc['geodir_sidebar_left_open_id'])) {
1755
-        $id = $tc['geodir_sidebar_left_open_id'];
1756
-    }
1757
-    if (!empty($tc['geodir_sidebar_left_open_class'])) {
1758
-        $class = $tc['geodir_sidebar_left_open_class'];
1759
-    }
1760
-
1761
-    $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
1762
-
1763
-    echo $text;
1735
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1736
+		$width_css = 'style="width:' . $width . '%;"';
1737
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1738
+		$width_css = 'style="width:' . $width . '%;"';
1739
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1740
+		$width_css = 'style="width:' . $width . '%;"';
1741
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1742
+		$width_css = 'style="width:' . $width . '%;"';
1743
+	} else {
1744
+		$width_css = '';
1745
+	}
1746
+
1747
+	$tc = get_option('theme_compatibility_setting');
1748
+	if (!empty($tc['geodir_sidebar_left_open_replace'])) {
1749
+		$text = $tc['geodir_sidebar_left_open_replace'];
1750
+	} else {
1751
+		$text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
1752
+	}
1753
+
1754
+	if (!empty($tc['geodir_sidebar_left_open_id'])) {
1755
+		$id = $tc['geodir_sidebar_left_open_id'];
1756
+	}
1757
+	if (!empty($tc['geodir_sidebar_left_open_class'])) {
1758
+		$class = $tc['geodir_sidebar_left_open_class'];
1759
+	}
1760
+
1761
+	$text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
1762
+
1763
+	echo $text;
1764 1764
 }
1765 1765
 
1766 1766
 // action for adding the primary div closing tag
@@ -1776,13 +1776,13 @@  discard block
 block discarded – undo
1776 1776
  */
1777 1777
 function geodir_action_sidebar_left_close($type = '')
1778 1778
 {
1779
-    $tc = get_option('theme_compatibility_setting');
1780
-    if (!empty($tc['geodir_sidebar_left_close_replace'])) {
1781
-        $text = $tc['geodir_sidebar_left_close_replace'];
1782
-    } else {
1783
-        $text = '</aside><!-- sidebar ends here-->';
1784
-    }
1785
-    echo $text;
1779
+	$tc = get_option('theme_compatibility_setting');
1780
+	if (!empty($tc['geodir_sidebar_left_close_replace'])) {
1781
+		$text = $tc['geodir_sidebar_left_close_replace'];
1782
+	} else {
1783
+		$text = '</aside><!-- sidebar ends here-->';
1784
+	}
1785
+	echo $text;
1786 1786
 }
1787 1787
 
1788 1788
 /**
@@ -1795,7 +1795,7 @@  discard block
 block discarded – undo
1795 1795
  */
1796 1796
 function geodir_listing_left_section()
1797 1797
 {
1798
-    if (get_option('geodir_show_listing_left_section')) { ?>
1798
+	if (get_option('geodir_show_listing_left_section')) { ?>
1799 1799
         <div class="geodir-content-left geodir-sidebar-wrap">
1800 1800
             <?php dynamic_sidebar('geodir_listing_left_sidebar'); ?>
1801 1801
         </div><!-- end geodir-content-left -->
@@ -1813,20 +1813,20 @@  discard block
 block discarded – undo
1813 1813
  */
1814 1814
 function geodir_action_listings_sidebar_left()
1815 1815
 {
1816
-    if (get_option('geodir_show_listing_left_section')) {
1817
-        /** This action is documented in geodirectory_template_actions.php */
1818
-        do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
1819
-        /**
1820
-         * Calls the listings page (category) left sidebar content.
1821
-         *
1822
-         * All the content for the listings page left sidebar is added via this hook.
1823
-         *
1824
-         * @since 1.0.0
1825
-         */
1826
-        do_action('geodir_listings_sidebar_left_inside');
1827
-        /** This action is documented in geodirectory_template_actions.php */
1828
-        do_action('geodir_sidebar_left_close', 'listings-page');
1829
-    }
1816
+	if (get_option('geodir_show_listing_left_section')) {
1817
+		/** This action is documented in geodirectory_template_actions.php */
1818
+		do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
1819
+		/**
1820
+		 * Calls the listings page (category) left sidebar content.
1821
+		 *
1822
+		 * All the content for the listings page left sidebar is added via this hook.
1823
+		 *
1824
+		 * @since 1.0.0
1825
+		 */
1826
+		do_action('geodir_listings_sidebar_left_inside');
1827
+		/** This action is documented in geodirectory_template_actions.php */
1828
+		do_action('geodir_sidebar_left_close', 'listings-page');
1829
+	}
1830 1830
 }
1831 1831
 
1832 1832
 /**
@@ -1839,7 +1839,7 @@  discard block
 block discarded – undo
1839 1839
  */
1840 1840
 function geodir_listing_right_section()
1841 1841
 {
1842
-    if (get_option('geodir_show_listing_right_section')) { ?>
1842
+	if (get_option('geodir_show_listing_right_section')) { ?>
1843 1843
         <div class="geodir-content-right geodir-sidebar-wrap">
1844 1844
             <?php dynamic_sidebar('geodir_listing_right_sidebar'); ?>
1845 1845
         </div><!-- end geodir-content-right -->
@@ -1857,20 +1857,20 @@  discard block
 block discarded – undo
1857 1857
  */
1858 1858
 function geodir_action_listings_sidebar_right()
1859 1859
 {
1860
-    if (get_option('geodir_show_listing_right_section')) {
1861
-        /** This action is documented in geodirectory_template_actions.php */
1862
-        do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
1863
-        /**
1864
-         * Calls the listings page (category) right sidebar content.
1865
-         *
1866
-         * All the content for the listings page right sidebar is added via this hook.
1867
-         *
1868
-         * @since 1.0.0
1869
-         */
1870
-        do_action('geodir_listings_sidebar_right_inside');
1871
-        /** This action is documented in geodirectory_template_actions.php */
1872
-        do_action('geodir_sidebar_right_close', 'listings-page');
1873
-    }
1860
+	if (get_option('geodir_show_listing_right_section')) {
1861
+		/** This action is documented in geodirectory_template_actions.php */
1862
+		do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
1863
+		/**
1864
+		 * Calls the listings page (category) right sidebar content.
1865
+		 *
1866
+		 * All the content for the listings page right sidebar is added via this hook.
1867
+		 *
1868
+		 * @since 1.0.0
1869
+		 */
1870
+		do_action('geodir_listings_sidebar_right_inside');
1871
+		/** This action is documented in geodirectory_template_actions.php */
1872
+		do_action('geodir_sidebar_right_close', 'listings-page');
1873
+	}
1874 1874
 }
1875 1875
 
1876 1876
 
@@ -1887,23 +1887,23 @@  discard block
 block discarded – undo
1887 1887
  */
1888 1888
 function geodir_action_main_content_open($type = '', $id = '', $class = '')
1889 1889
 {
1890
-    $tc = get_option('theme_compatibility_setting');
1891
-    if (!empty($tc['geodir_main_content_open_replace'])) {
1892
-        $text = $tc['geodir_main_content_open_replace'];
1893
-    } else {
1894
-        $text = '<main id="[id]" class="[class]" role="main">';
1895
-    }
1890
+	$tc = get_option('theme_compatibility_setting');
1891
+	if (!empty($tc['geodir_main_content_open_replace'])) {
1892
+		$text = $tc['geodir_main_content_open_replace'];
1893
+	} else {
1894
+		$text = '<main id="[id]" class="[class]" role="main">';
1895
+	}
1896 1896
 
1897
-    if (!empty($tc['geodir_main_content_open_id'])) {
1898
-        $id = $tc['geodir_main_content_open_id'];
1899
-    }
1900
-    if (!empty($tc['geodir_main_content_open_class'])) {
1901
-        $class = $tc['geodir_main_content_open_class'];
1902
-    }
1897
+	if (!empty($tc['geodir_main_content_open_id'])) {
1898
+		$id = $tc['geodir_main_content_open_id'];
1899
+	}
1900
+	if (!empty($tc['geodir_main_content_open_class'])) {
1901
+		$class = $tc['geodir_main_content_open_class'];
1902
+	}
1903 1903
 
1904
-    $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
1904
+	$text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
1905 1905
 
1906
-    echo $text;
1906
+	echo $text;
1907 1907
 }
1908 1908
 
1909 1909
 // action for adding the primary div closing tag
@@ -1916,13 +1916,13 @@  discard block
 block discarded – undo
1916 1916
  */
1917 1917
 function geodir_action_main_content_close()
1918 1918
 {
1919
-    $tc = get_option('theme_compatibility_setting');
1920
-    if (!empty($tc['geodir_main_content_close_replace'])) {
1921
-        $text = $tc['geodir_main_content_close_replace'];
1922
-    } else {
1923
-        $text = '</main><!-- main ends here-->';
1924
-    }
1925
-    echo $text;
1919
+	$tc = get_option('theme_compatibility_setting');
1920
+	if (!empty($tc['geodir_main_content_close_replace'])) {
1921
+		$text = $tc['geodir_main_content_close_replace'];
1922
+	} else {
1923
+		$text = '</main><!-- main ends here-->';
1924
+	}
1925
+	echo $text;
1926 1926
 }
1927 1927
 
1928 1928
 /**
@@ -1934,14 +1934,14 @@  discard block
 block discarded – undo
1934 1934
  */
1935 1935
 function geodir_action_listings_content_inside()
1936 1936
 {
1937
-    global $gridview_columns;
1938
-    $listing_view = get_option('geodir_listing_view');
1939
-    if (strstr($listing_view, 'gridview')) {
1940
-        $gridview_columns = $listing_view;
1941
-        $listing_view_exp = explode('_', $listing_view);
1942
-        $listing_view = $listing_view_exp[0];
1943
-    }
1944
-    geodir_get_template_part('listing', 'listview');
1937
+	global $gridview_columns;
1938
+	$listing_view = get_option('geodir_listing_view');
1939
+	if (strstr($listing_view, 'gridview')) {
1940
+		$gridview_columns = $listing_view;
1941
+		$listing_view_exp = explode('_', $listing_view);
1942
+		$listing_view = $listing_view_exp[0];
1943
+	}
1944
+	geodir_get_template_part('listing', 'listview');
1945 1945
 }
1946 1946
 
1947 1947
 add_action('geodir_listings_content_inside', 'geodir_action_listings_content_inside', 10);
@@ -1957,47 +1957,47 @@  discard block
 block discarded – undo
1957 1957
  */
1958 1958
 function geodir_action_listings_content()
1959 1959
 {
1960
-    /**
1961
-     * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc.
1962
-     *
1963
-     * @since 1.0.0
1964
-     * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
1965
-     * @param string $id The id for the div. Usually 'geodir-main-content'.
1966
-     * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
1967
-     * @see 'geodir_main_content_close' Where the oposing closing tag is added.
1968
-     */
1969
-    do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
1970
-    $extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
1971
-    echo '<div class="clearfix '.$extra_class.'">';
1972
-    /**
1973
-     * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
1974
-     *
1975
-     * @since 1.0.0
1976
-     */
1977
-    do_action('geodir_before_listing');
1978
-    echo '</div>';
1979
-
1980
-    /**
1981
-     * This actions calls the listings list content. Used on listings pages and search and author pages.
1982
-     *
1983
-     * @since 1.0.0
1984
-     */
1985
-    do_action('geodir_listings_content_inside');
1986
-
1987
-    /**
1988
-     * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages.
1989
-     *
1990
-     * @since 1.0.0
1991
-     */
1992
-    do_action('geodir_after_listing');
1993
-
1994
-    /**
1995
-     * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc.
1996
-     *
1997
-     * @since 1.0.0
1998
-     * @see 'geodir_main_content_open' Where the oposing opening tag is added.
1999
-     */
2000
-    do_action('geodir_main_content_close', 'listings-page');
1960
+	/**
1961
+	 * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc.
1962
+	 *
1963
+	 * @since 1.0.0
1964
+	 * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
1965
+	 * @param string $id The id for the div. Usually 'geodir-main-content'.
1966
+	 * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
1967
+	 * @see 'geodir_main_content_close' Where the oposing closing tag is added.
1968
+	 */
1969
+	do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
1970
+	$extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
1971
+	echo '<div class="clearfix '.$extra_class.'">';
1972
+	/**
1973
+	 * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
1974
+	 *
1975
+	 * @since 1.0.0
1976
+	 */
1977
+	do_action('geodir_before_listing');
1978
+	echo '</div>';
1979
+
1980
+	/**
1981
+	 * This actions calls the listings list content. Used on listings pages and search and author pages.
1982
+	 *
1983
+	 * @since 1.0.0
1984
+	 */
1985
+	do_action('geodir_listings_content_inside');
1986
+
1987
+	/**
1988
+	 * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages.
1989
+	 *
1990
+	 * @since 1.0.0
1991
+	 */
1992
+	do_action('geodir_after_listing');
1993
+
1994
+	/**
1995
+	 * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc.
1996
+	 *
1997
+	 * @since 1.0.0
1998
+	 * @see 'geodir_main_content_open' Where the oposing opening tag is added.
1999
+	 */
2000
+	do_action('geodir_main_content_close', 'listings-page');
2001 2001
 }
2002 2002
 
2003 2003
 
@@ -2012,10 +2012,10 @@  discard block
 block discarded – undo
2012 2012
  */
2013 2013
 function geodir_action_sidebar_listings_bottom_section()
2014 2014
 {
2015
-    if (get_option('geodir_show_listing_bottom_section')) { ?>
2015
+	if (get_option('geodir_show_listing_bottom_section')) { ?>
2016 2016
         <div class="<?php
2017
-            /** This action is documented in geodirectory_template_actions.php */
2018
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
2017
+			/** This action is documented in geodirectory_template_actions.php */
2018
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
2019 2019
             <?php dynamic_sidebar('geodir_listing_bottom'); ?>
2020 2020
         </div><!-- clearfix ends here-->
2021 2021
     <?php }
@@ -2035,38 +2035,38 @@  discard block
 block discarded – undo
2035 2035
  */
2036 2036
 function geodir_action_add_listing_page_title()
2037 2037
 {
2038
-    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2039
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2040
-    /** This action is documented in geodirectory_template_actions.php */
2041
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2042
-    /** This action is documented in geodirectory_template_actions.php */
2043
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2044
-
2045
-    $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2046
-
2047
-    if(geodir_is_page('add-listing')){
2048
-        $gd_page = 'add-listing';
2049
-        if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2050
-            $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2051
-        }elseif(isset($listing_type)){
2052
-            $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2053
-        }
2038
+	if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2039
+		$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2040
+	/** This action is documented in geodirectory_template_actions.php */
2041
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2042
+	/** This action is documented in geodirectory_template_actions.php */
2043
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2044
+
2045
+	$title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2054 2046
 
2055
-    }
2047
+	if(geodir_is_page('add-listing')){
2048
+		$gd_page = 'add-listing';
2049
+		if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2050
+			$title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2051
+		}elseif(isset($listing_type)){
2052
+			$title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2053
+		}
2056 2054
 
2055
+	}
2057 2056
 
2058
-    /**
2059
-     * Filter page title to replace variables.
2060
-     *
2061
-     * @since 1.5.4
2062
-     * @param string $title The page title including variables.
2063
-     * @param string $gd_page The GeoDirectory page type if any.
2064
-     */
2065
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2066 2057
 
2067
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2068
-    echo $title;
2069
-    echo '</h1></header>';
2058
+	/**
2059
+	 * Filter page title to replace variables.
2060
+	 *
2061
+	 * @since 1.5.4
2062
+	 * @param string $title The page title including variables.
2063
+	 * @param string $gd_page The GeoDirectory page type if any.
2064
+	 */
2065
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2066
+
2067
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2068
+	echo $title;
2069
+	echo '</h1></header>';
2070 2070
 }
2071 2071
 
2072 2072
 add_action('geodir_add_listing_page_mandatory', 'geodir_action_add_listing_page_mandatory', 10);
@@ -2097,54 +2097,54 @@  discard block
 block discarded – undo
2097 2097
  */
2098 2098
 function geodir_action_add_listing_form()
2099 2099
 {
2100
-    global $cat_display, $post_cat, $current_user, $gd_session;
2101
-    $page_id = get_the_ID();
2102
-    $post = '';
2103
-    $title = '';
2104
-    $desc = '';
2105
-    $kw_tags = '';
2106
-    $required_msg = '';
2107
-    $submit_button = '';
2108
-
2109
-    $ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add';
2110
-
2111
-    $thumb_img_arr = array();
2112
-    $curImages = '';
2113
-
2114
-    if (isset($_REQUEST['backandedit'])) {
2115
-        global $post;
2116
-        $post = (object)$gd_session->get('listing');
2117
-        $listing_type = $post->listing_type;
2118
-        $title = $post->post_title;
2119
-        $desc = $post->post_desc;
2120
-        $post_cat = $post->post_category;
2121
-
2122
-        $kw_tags = $post->post_tags;
2123
-        $curImages = isset($post->post_images) ? $post->post_images : '';
2124
-    } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2125
-        global $post, $post_images;
2126
-
2127
-        $post = geodir_get_post_info($_REQUEST['pid']);
2128
-        $thumb_img_arr = geodir_get_images($post->ID);
2129
-        if ($thumb_img_arr) {
2130
-            foreach ($thumb_img_arr as $post_img) {
2131
-                $curImages .= $post_img->src . ',';
2132
-            }
2133
-        }
2134
-
2135
-        $listing_type = $post->post_type;
2136
-        $title = $post->post_title;
2137
-        $desc = $post->post_content;
2138
-        $kw_tags = $post->post_tags;
2139
-        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2140
-    } else {
2141
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2142
-    }
2143
-
2144
-    if ($current_user->ID != '0') {
2145
-        $user_login = true;
2146
-    }
2147
-    ?>
2100
+	global $cat_display, $post_cat, $current_user, $gd_session;
2101
+	$page_id = get_the_ID();
2102
+	$post = '';
2103
+	$title = '';
2104
+	$desc = '';
2105
+	$kw_tags = '';
2106
+	$required_msg = '';
2107
+	$submit_button = '';
2108
+
2109
+	$ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add';
2110
+
2111
+	$thumb_img_arr = array();
2112
+	$curImages = '';
2113
+
2114
+	if (isset($_REQUEST['backandedit'])) {
2115
+		global $post;
2116
+		$post = (object)$gd_session->get('listing');
2117
+		$listing_type = $post->listing_type;
2118
+		$title = $post->post_title;
2119
+		$desc = $post->post_desc;
2120
+		$post_cat = $post->post_category;
2121
+
2122
+		$kw_tags = $post->post_tags;
2123
+		$curImages = isset($post->post_images) ? $post->post_images : '';
2124
+	} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2125
+		global $post, $post_images;
2126
+
2127
+		$post = geodir_get_post_info($_REQUEST['pid']);
2128
+		$thumb_img_arr = geodir_get_images($post->ID);
2129
+		if ($thumb_img_arr) {
2130
+			foreach ($thumb_img_arr as $post_img) {
2131
+				$curImages .= $post_img->src . ',';
2132
+			}
2133
+		}
2134
+
2135
+		$listing_type = $post->post_type;
2136
+		$title = $post->post_title;
2137
+		$desc = $post->post_content;
2138
+		$kw_tags = $post->post_tags;
2139
+		$kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2140
+	} else {
2141
+		$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2142
+	}
2143
+
2144
+	if ($current_user->ID != '0') {
2145
+		$user_login = true;
2146
+	}
2147
+	?>
2148 2148
     <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data">
2149 2149
         <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/>
2150 2150
         <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/>
@@ -2155,27 +2155,27 @@  discard block
 block discarded – undo
2155 2155
         <?php } if (isset($_REQUEST['backandedit'])) { ?>
2156 2156
             <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/>
2157 2157
         <?php
2158
-        } 
2159
-        /**
2160
-         * Called at the very top of the add listing page form for frontend.
2161
-         *
2162
-         * This is called just before the "Enter Listing Details" text.
2163
-         *
2164
-         * @since 1.0.0
2165
-         */
2166
-        do_action('geodir_before_detail_fields');
2167
-        ?>
2158
+		} 
2159
+		/**
2160
+		 * Called at the very top of the add listing page form for frontend.
2161
+		 *
2162
+		 * This is called just before the "Enter Listing Details" text.
2163
+		 *
2164
+		 * @since 1.0.0
2165
+		 */
2166
+		do_action('geodir_before_detail_fields');
2167
+		?>
2168 2168
         <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5>
2169 2169
         <?php
2170
-        /**
2171
-         * Called at the top of the add listing page form for frontend.
2172
-         *
2173
-         * This is called after the "Enter Listing Details" text.
2174
-         *
2175
-         * @since 1.0.0
2176
-         */
2177
-        do_action('geodir_before_main_form_fields');
2178
-        ?>
2170
+		/**
2171
+		 * Called at the top of the add listing page form for frontend.
2172
+		 *
2173
+		 * This is called after the "Enter Listing Details" text.
2174
+		 *
2175
+		 * @since 1.0.0
2176
+		 */
2177
+		do_action('geodir_before_main_form_fields');
2178
+		?>
2179 2179
         <div id="geodir_post_title_row" class="required_field geodir_form_row clearfix gd-fieldset-details">
2180 2180
             <label><?php echo PLACE_TITLE_TEXT;?><span>*</span> </label>
2181 2181
             <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield"
@@ -2183,57 +2183,57 @@  discard block
 block discarded – undo
2183 2183
             <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span>
2184 2184
         </div>
2185 2185
         <?php
2186
-        $show_editor = get_option('geodir_tiny_editor_on_add_listing');
2187
-
2188
-        $desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc));
2189
-        $desc_limit = '';
2190
-        /**
2191
-         * Filter the add listing description field character limit number.
2192
-         *
2193
-         * @since 1.0.0
2194
-         * @param int $desc_limit The amount of characters to limit the description to.
2195
-         */
2196
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
2197
-        /**
2198
-         * Filter the add listing description field text.
2199
-         *
2200
-         * @since 1.0.0
2201
-         * @param string $desc The text for the description field.
2202
-         * @param int $desc_limit The character limit numer if any.
2203
-         */
2204
-        $desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
2205
-        $desc_limit_msg = '';
2206
-        /**
2207
-         * Filter the add listing description limit message.
2208
-         *
2209
-         * This is the message shown if there is a limit applied to the amount of characters the description can use.
2210
-         *
2211
-         * @since 1.0.0
2212
-         * @param string $desc_limit_msg The limit message string if any.
2213
-         * @param int $desc_limit The character limit numer if any.
2214
-         */
2215
-        $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2186
+		$show_editor = get_option('geodir_tiny_editor_on_add_listing');
2187
+
2188
+		$desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc));
2189
+		$desc_limit = '';
2190
+		/**
2191
+		 * Filter the add listing description field character limit number.
2192
+		 *
2193
+		 * @since 1.0.0
2194
+		 * @param int $desc_limit The amount of characters to limit the description to.
2195
+		 */
2196
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
2197
+		/**
2198
+		 * Filter the add listing description field text.
2199
+		 *
2200
+		 * @since 1.0.0
2201
+		 * @param string $desc The text for the description field.
2202
+		 * @param int $desc_limit The character limit numer if any.
2203
+		 */
2204
+		$desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
2205
+		$desc_limit_msg = '';
2206
+		/**
2207
+		 * Filter the add listing description limit message.
2208
+		 *
2209
+		 * This is the message shown if there is a limit applied to the amount of characters the description can use.
2210
+		 *
2211
+		 * @since 1.0.0
2212
+		 * @param string $desc_limit_msg The limit message string if any.
2213
+		 * @param int $desc_limit The character limit numer if any.
2214
+		 */
2215
+		$desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2216 2216
         
2217
-        $desc_class = '';
2218
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2219
-            /**
2220
-             * Called on the add listing page form for frontend just before the description field.
2221
-             *
2222
-             * @since 1.0.0
2223
-             */
2224
-            do_action('geodir_before_description_field');
2217
+		$desc_class = '';
2218
+		if ($desc_limit === '' || (int)$desc_limit > 0) {
2219
+			/**
2220
+			 * Called on the add listing page form for frontend just before the description field.
2221
+			 *
2222
+			 * @since 1.0.0
2223
+			 */
2224
+			do_action('geodir_before_description_field');
2225 2225
             
2226
-            $desc_class = ' required_field';
2227
-        } else {
2228
-            $desc_class = ' hidden';
2229
-        }
2230
-        ?>
2226
+			$desc_class = ' required_field';
2227
+		} else {
2228
+			$desc_class = ' hidden';
2229
+		}
2230
+		?>
2231 2231
         <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>">
2232 2232
             <label><?php echo PLACE_DESC_TEXT;?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2233 2233
             <?php
2234
-            if (!empty($show_editor) && in_array($listing_type, $show_editor)) {
2235
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2236
-            ?>
2234
+			if (!empty($show_editor) && in_array($listing_type, $show_editor)) {
2235
+				$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2236
+			?>
2237 2237
                 <div class="editor" field_id="post_desc" field_type="editor">
2238 2238
                     <?php wp_editor($desc, "post_desc", $editor_settings); ?>
2239 2239
                 </div>
@@ -2247,56 +2247,56 @@  discard block
 block discarded – undo
2247 2247
             <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span>
2248 2248
         </div>
2249 2249
         <?php
2250
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2251
-            /**
2252
-             * Called on the add listing page form for frontend just after the description field.
2253
-             *
2254
-             * @since 1.0.0
2255
-             */
2256
-            do_action('geodir_after_description_field');
2257
-        }
2250
+		if ($desc_limit === '' || (int)$desc_limit > 0) {
2251
+			/**
2252
+			 * Called on the add listing page form for frontend just after the description field.
2253
+			 *
2254
+			 * @since 1.0.0
2255
+			 */
2256
+			do_action('geodir_after_description_field');
2257
+		}
2258 2258
         
2259
-        $kw_tags = esc_attr(stripslashes($kw_tags));
2260
-        $kw_tags_count = TAGKW_TEXT_COUNT;
2261
-        $kw_tags_msg = TAGKW_MSG;
2262
-        /**
2263
-         * Filter the add listing tags character limit.
2264
-         *
2265
-         * @since 1.0.0
2266
-         * @param int $kw_tags_count The character count limit if any.
2267
-         */
2268
-        $kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
2269
-        /**
2270
-         * Filter the add listing tags field value.
2271
-         *
2272
-         * You can use the $_REQUEST values to check if this is a go back and edit value etc.
2273
-         *
2274
-         * @since 1.0.0
2275
-         * @param string $kw_tags The tag field value, usually a comma separated list of tags.
2276
-         * @param int $kw_tags_count The character count limit if any.
2277
-         */
2278
-        $kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
2279
-        /**
2280
-         * Filter the add listing tags field message text.
2281
-         *
2282
-         * @since 1.0.0
2283
-         * @param string $kw_tags_msg The message shown under the field.
2284
-         * @param int $kw_tags_count The character count limit if any.
2285
-         */
2286
-        $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2259
+		$kw_tags = esc_attr(stripslashes($kw_tags));
2260
+		$kw_tags_count = TAGKW_TEXT_COUNT;
2261
+		$kw_tags_msg = TAGKW_MSG;
2262
+		/**
2263
+		 * Filter the add listing tags character limit.
2264
+		 *
2265
+		 * @since 1.0.0
2266
+		 * @param int $kw_tags_count The character count limit if any.
2267
+		 */
2268
+		$kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
2269
+		/**
2270
+		 * Filter the add listing tags field value.
2271
+		 *
2272
+		 * You can use the $_REQUEST values to check if this is a go back and edit value etc.
2273
+		 *
2274
+		 * @since 1.0.0
2275
+		 * @param string $kw_tags The tag field value, usually a comma separated list of tags.
2276
+		 * @param int $kw_tags_count The character count limit if any.
2277
+		 */
2278
+		$kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
2279
+		/**
2280
+		 * Filter the add listing tags field message text.
2281
+		 *
2282
+		 * @since 1.0.0
2283
+		 * @param string $kw_tags_msg The message shown under the field.
2284
+		 * @param int $kw_tags_count The character count limit if any.
2285
+		 */
2286
+		$kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2287 2287
         
2288
-        $tags_class = '';
2289
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2290
-            /**
2291
-             * Called on the add listing page form for frontend just before the tags field.
2292
-             *
2293
-             * @since 1.0.0
2294
-             */
2295
-            do_action('geodir_before_listing_tags_field');
2296
-        } else {
2297
-            $tags_class = ' hidden';
2298
-        }
2299
-        ?>
2288
+		$tags_class = '';
2289
+		if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2290
+			/**
2291
+			 * Called on the add listing page form for frontend just before the tags field.
2292
+			 *
2293
+			 * @since 1.0.0
2294
+			 */
2295
+			do_action('geodir_before_listing_tags_field');
2296
+		} else {
2297
+			$tags_class = ' hidden';
2298
+		}
2299
+		?>
2300 2300
         <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>">
2301 2301
             <label><?php echo TAGKW_TEXT; ?></label>
2302 2302
             <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield"
@@ -2304,90 +2304,90 @@  discard block
 block discarded – undo
2304 2304
             <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span>
2305 2305
         </div>
2306 2306
         <?php
2307
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2308
-            /**
2309
-             * Called on the add listing page form for frontend just after the tags field.
2310
-             *
2311
-             * @since 1.0.0
2312
-             */
2313
-            do_action('geodir_after_listing_tags_field');
2314
-        }
2307
+		if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2308
+			/**
2309
+			 * Called on the add listing page form for frontend just after the tags field.
2310
+			 *
2311
+			 * @since 1.0.0
2312
+			 */
2313
+			do_action('geodir_after_listing_tags_field');
2314
+		}
2315 2315
         
2316
-        $package_info = array();
2317
-        $package_info = geodir_post_package_info($package_info, $post);
2316
+		$package_info = array();
2317
+		$package_info = geodir_post_package_info($package_info, $post);
2318 2318
         
2319
-        geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type);
2319
+		geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type);
2320 2320
         
2321
-        // adjust values here
2322
-        $id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
2321
+		// adjust values here
2322
+		$id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
2323 2323
 
2324
-        $multiple = true; // allow multiple files upload
2324
+		$multiple = true; // allow multiple files upload
2325 2325
 
2326
-        $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2326
+		$width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2327 2327
 
2328
-        $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2328
+		$height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2329 2329
 
2330
-        $thumb_img_arr = array();
2331
-        $totImg = 0;
2332
-        if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2333
-            $post = (object)$gd_session->get('listing');
2334
-            if (isset($post->post_images))
2335
-                $curImages = trim($post->post_images, ",");
2330
+		$thumb_img_arr = array();
2331
+		$totImg = 0;
2332
+		if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2333
+			$post = (object)$gd_session->get('listing');
2334
+			if (isset($post->post_images))
2335
+				$curImages = trim($post->post_images, ",");
2336 2336
 
2337 2337
 
2338
-            if ($curImages != '') {
2339
-                $curImages_array = explode(',', $curImages);
2340
-                $totImg = count($curImages_array);
2341
-            }
2342
-
2343
-            $listing_type = $post->listing_type;
2338
+			if ($curImages != '') {
2339
+				$curImages_array = explode(',', $curImages);
2340
+				$totImg = count($curImages_array);
2341
+			}
2344 2342
 
2345
-        } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2346
-            $post = geodir_get_post_info((int)$_REQUEST['pid']);
2347
-            $listing_type = $post->post_type;
2348
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2343
+			$listing_type = $post->listing_type;
2349 2344
 
2350
-        } else {
2351
-            $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2352
-        }
2345
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2346
+			$post = geodir_get_post_info((int)$_REQUEST['pid']);
2347
+			$listing_type = $post->post_type;
2348
+			$thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2353 2349
 
2350
+		} else {
2351
+			$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2352
+		}
2354 2353
 
2355
-        if (!empty($thumb_img_arr)) {
2356
-            foreach ($thumb_img_arr as $img) {
2357
-                //$curImages = $img->src.",";
2358
-            }
2359 2354
 
2360
-            $totImg = count((array)$thumb_img_arr);
2361
-        }
2355
+		if (!empty($thumb_img_arr)) {
2356
+			foreach ($thumb_img_arr as $img) {
2357
+				//$curImages = $img->src.",";
2358
+			}
2362 2359
 
2363
-        if ($curImages != '')
2364
-            $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2365
-        else
2366
-            $svalue = '';
2367
-
2368
-        $image_limit = $package_info->image_limit;
2369
-        $show_image_input_box = ($image_limit != '0');
2370
-        /**
2371
-         * Filter to be able to show/hide the image upload section of the add listing form.
2372
-         *
2373
-         * @since 1.0.0
2374
-         * @param bool $show_image_input_box Set true to show. Set false to not show.
2375
-         * @param string $listing_type The custom post type slug.
2376
-         */
2377
-        $show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
2378
-        if ($show_image_input_box) {
2379
-            ?>
2360
+			$totImg = count((array)$thumb_img_arr);
2361
+		}
2362
+
2363
+		if ($curImages != '')
2364
+			$svalue = $curImages; // this will be initial value of the above form field. Image urls.
2365
+		else
2366
+			$svalue = '';
2367
+
2368
+		$image_limit = $package_info->image_limit;
2369
+		$show_image_input_box = ($image_limit != '0');
2370
+		/**
2371
+		 * Filter to be able to show/hide the image upload section of the add listing form.
2372
+		 *
2373
+		 * @since 1.0.0
2374
+		 * @param bool $show_image_input_box Set true to show. Set false to not show.
2375
+		 * @param string $listing_type The custom post type slug.
2376
+		 */
2377
+		$show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
2378
+		if ($show_image_input_box) {
2379
+			?>
2380 2380
 
2381 2381
             <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?>
2382 2382
                 <?php if ($image_limit == 1) {
2383
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2384
-                } ?>
2383
+					echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2384
+				} ?>
2385 2385
                 <?php if ($image_limit > 1) {
2386
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2387
-                } ?>
2386
+					echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2387
+				} ?>
2388 2388
                 <?php if ($image_limit == '') {
2389
-                    echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2390
-                } ?>
2389
+					echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2390
+				} ?>
2391 2391
             </h5>
2392 2392
 
2393 2393
             <div class="geodir_form_row clearfix" id="<?php echo $id; ?>dropbox"
@@ -2425,12 +2425,12 @@  discard block
 block discarded – undo
2425 2425
         <?php } ?>
2426 2426
 
2427 2427
         <?php
2428
-        /**
2429
-         * Called on the add listing page form for frontend just after the image upload field.
2430
-         *
2431
-         * @since 1.0.0
2432
-         */
2433
-        do_action('geodir_after_main_form_fields');?>
2428
+		/**
2429
+		 * Called on the add listing page form for frontend just after the image upload field.
2430
+		 *
2431
+		 * @since 1.0.0
2432
+		 */
2433
+		do_action('geodir_after_main_form_fields');?>
2434 2434
 
2435 2435
 
2436 2436
         <!-- add captcha code -->
@@ -2459,7 +2459,7 @@  discard block
 block discarded – undo
2459 2459
 
2460 2460
     </form>
2461 2461
     <?php
2462
-    wp_reset_query();
2462
+	wp_reset_query();
2463 2463
 }
2464 2464
 
2465 2465
 /**
@@ -2470,7 +2470,7 @@  discard block
 block discarded – undo
2470 2470
  */
2471 2471
 function geodir_add_listing_sidebar_widget_area()
2472 2472
 {
2473
-    dynamic_sidebar('geodir_add_listing_sidebar');
2473
+	dynamic_sidebar('geodir_add_listing_sidebar');
2474 2474
 }
2475 2475
 
2476 2476
 add_action('geodir_add_listing_sidebar_inside', 'geodir_add_listing_sidebar_widget_area', 10);
@@ -2485,16 +2485,16 @@  discard block
 block discarded – undo
2485 2485
  */
2486 2486
 function geodir_action_add_listing_sidebar()
2487 2487
 {
2488
-    /** This action is documented in geodirectory_template_actions.php */
2489
-    do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
2490
-    /**
2491
-     * This is used to add the content to the add listing page sidebar.
2492
-     *
2493
-     * @since 1.0.0
2494
-     */
2495
-    do_action('geodir_add_listing_sidebar_inside');
2496
-    /** This action is documented in geodirectory_template_actions.php */
2497
-    do_action('geodir_sidebar_right_close', 'details-page');
2488
+	/** This action is documented in geodirectory_template_actions.php */
2489
+	do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
2490
+	/**
2491
+	 * This is used to add the content to the add listing page sidebar.
2492
+	 *
2493
+	 * @since 1.0.0
2494
+	 */
2495
+	do_action('geodir_add_listing_sidebar_inside');
2496
+	/** This action is documented in geodirectory_template_actions.php */
2497
+	do_action('geodir_sidebar_right_close', 'details-page');
2498 2498
 }
2499 2499
 
2500 2500
 ###############################################
@@ -2511,11 +2511,11 @@  discard block
 block discarded – undo
2511 2511
  */
2512 2512
 function geodir_action_geodir_sidebar_signup_top()
2513 2513
 {
2514
-    ?>
2514
+	?>
2515 2515
     <div
2516 2516
         class="<?php
2517
-        /** This action is documented in geodirectory_template_actions.php */
2518
-        echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2517
+		/** This action is documented in geodirectory_template_actions.php */
2518
+		echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2519 2519
         <?php dynamic_sidebar('Reg/Login Top Section');?>
2520 2520
     </div><!-- clearfix ends here-->
2521 2521
 <?php
@@ -2534,9 +2534,9 @@  discard block
 block discarded – undo
2534 2534
 function geodir_action_signup_forms()
2535 2535
 {
2536 2536
 
2537
-    global $user_login;
2537
+	global $user_login;
2538 2538
 
2539
-    ?>
2539
+	?>
2540 2540
     <script type="text/javascript">
2541 2541
         <?php if ( $user_login ) { ?>
2542 2542
         setTimeout(function () {
@@ -2572,65 +2572,65 @@  discard block
 block discarded – undo
2572 2572
         <?php } ?>
2573 2573
     </script><?php
2574 2574
 
2575
-    global $errors;
2576
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2577
-        $errors->add('claim_login', LOGIN_CLAIM);
2578
-
2579
-    if (!empty($errors)) {
2580
-        foreach ($errors as $errorsObj) {
2581
-            foreach ($errorsObj as $key => $val) {
2582
-                for ($i = 0; $i < count($val); $i++) {
2583
-                    echo "<div class=sucess_msg>" . $val[$i] . '</div>';
2584
-                    $registration_error_msg = 1;
2585
-                }
2586
-            }
2587
-        }
2588
-    }
2575
+	global $errors;
2576
+	if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2577
+		$errors->add('claim_login', LOGIN_CLAIM);
2578
+
2579
+	if (!empty($errors)) {
2580
+		foreach ($errors as $errorsObj) {
2581
+			foreach ($errorsObj as $key => $val) {
2582
+				for ($i = 0; $i < count($val); $i++) {
2583
+					echo "<div class=sucess_msg>" . $val[$i] . '</div>';
2584
+					$registration_error_msg = 1;
2585
+				}
2586
+			}
2587
+		}
2588
+	}
2589 2589
 
2590
-    if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
2591
-        ?>
2590
+	if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
2591
+		?>
2592 2592
 
2593 2593
         <div class="login_form">
2594 2594
             <?php
2595
-            /**
2596
-             * Contains login form template.
2597
-             *
2598
-             * @since 1.0.0
2599
-             */
2600
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2595
+			/**
2596
+			 * Contains login form template.
2597
+			 *
2598
+			 * @since 1.0.0
2599
+			 */
2600
+			include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2601 2601
         </div>
2602 2602
 
2603 2603
     <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up') { ?>
2604 2604
 
2605 2605
         <div class="registration_form">
2606 2606
             <?php
2607
-            /**
2608
-             * Contains registration form template.
2609
-             *
2610
-             * @since 1.0.0
2611
-             */
2612
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2607
+			/**
2608
+			 * Contains registration form template.
2609
+			 *
2610
+			 * @since 1.0.0
2611
+			 */
2612
+			include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2613 2613
         </div>
2614 2614
 
2615 2615
     <?php } else { ?>
2616 2616
 
2617 2617
         <div class="login_form_l">
2618 2618
             <?php
2619
-            /**
2620
-             * Contains login form template.
2621
-             *
2622
-             * @since 1.0.0
2623
-             */
2624
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2619
+			/**
2620
+			 * Contains login form template.
2621
+			 *
2622
+			 * @since 1.0.0
2623
+			 */
2624
+			include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2625 2625
         </div>
2626 2626
         <div class="registration_form_r">
2627 2627
             <?php
2628
-            /**
2629
-             * Contains registration form template.
2630
-             *
2631
-             * @since 1.0.0
2632
-             */
2633
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2628
+			/**
2629
+			 * Contains registration form template.
2630
+			 *
2631
+			 * @since 1.0.0
2632
+			 */
2633
+			include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2634 2634
         </div>
2635 2635
 
2636 2636
     <?php }?>
@@ -2661,66 +2661,66 @@  discard block
 block discarded – undo
2661 2661
  */
2662 2662
 function geodir_action_author_page_title()
2663 2663
 {
2664
-    global $term;
2664
+	global $term;
2665 2665
 
2666
-    $gd_post_type = geodir_get_current_posttype();
2667
-    $post_type_info = get_post_type_object($gd_post_type);
2666
+	$gd_post_type = geodir_get_current_posttype();
2667
+	$post_type_info = get_post_type_object($gd_post_type);
2668 2668
 
2669
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
2670
-    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2671
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2672
-    }
2669
+	$add_string_in_title = __('All', 'geodirectory') . ' ';
2670
+	if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2671
+		$add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2672
+	}
2673 2673
 
2674
-    $list_title = $add_string_in_title . $post_type_info->labels->name;
2675
-    $single_name = $post_type_info->labels->singular_name;
2674
+	$list_title = $add_string_in_title . $post_type_info->labels->name;
2675
+	$single_name = $post_type_info->labels->singular_name;
2676 2676
 
2677
-    $taxonomy = geodir_get_taxonomies($gd_post_type);
2677
+	$taxonomy = geodir_get_taxonomies($gd_post_type);
2678 2678
 
2679
-    if (!empty($term)) {
2680
-        $current_term = get_term_by('slug', $term, $taxonomy[0]);
2681
-        if (!empty($current_term))
2682
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2683
-    }
2679
+	if (!empty($term)) {
2680
+		$current_term = get_term_by('slug', $term, $taxonomy[0]);
2681
+		if (!empty($current_term))
2682
+			$list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2683
+	}
2684 2684
 
2685 2685
 
2686
-    if (is_search()) {
2687
-        $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2686
+	if (is_search()) {
2687
+		$list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2688 2688
 
2689
-    }
2690
-    /** This action is documented in geodirectory_template_actions.php */
2691
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2692
-    /** This action is documented in geodirectory_template_actions.php */
2693
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2689
+	}
2690
+	/** This action is documented in geodirectory_template_actions.php */
2691
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2692
+	/** This action is documented in geodirectory_template_actions.php */
2693
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2694 2694
 
2695
-    $title = $list_title;
2696
-    if(geodir_is_page('author')){
2697
-        $gd_page = 'author';
2698
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2699
-            $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2700
-        }else{
2701
-            $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2702
-        }
2695
+	$title = $list_title;
2696
+	if(geodir_is_page('author')){
2697
+		$gd_page = 'author';
2698
+		if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2699
+			$title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2700
+		}else{
2701
+			$title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2702
+		}
2703 2703
 
2704
-    }
2704
+	}
2705 2705
 
2706 2706
 
2707
-    /**
2708
-     * Filter page title to replace variables.
2709
-     *
2710
-     * @since 1.5.4
2711
-     * @param string $title The page title including variables.
2712
-     * @param string $gd_page The GeoDirectory page type if any.
2713
-     */
2714
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2707
+	/**
2708
+	 * Filter page title to replace variables.
2709
+	 *
2710
+	 * @since 1.5.4
2711
+	 * @param string $title The page title including variables.
2712
+	 * @param string $gd_page The GeoDirectory page type if any.
2713
+	 */
2714
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2715 2715
 
2716
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2717
-        /**
2718
-         * Filter the author page title text.
2719
-         *
2720
-         * @since 1.0.0
2721
-         * @param string $list_title The title for the page.
2722
-         */
2723
-        apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2716
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2717
+		/**
2718
+		 * Filter the author page title text.
2719
+		 *
2720
+		 * @since 1.0.0
2721
+		 * @param string $list_title The title for the page.
2722
+		 */
2723
+		apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2724 2724
 }
2725 2725
 
2726 2726
 
@@ -2738,11 +2738,11 @@  discard block
 block discarded – undo
2738 2738
  */
2739 2739
 function geodir_action_geodir_sidebar_author_top()
2740 2740
 {
2741
-    if (get_option('geodir_show_author_top_section')) { ?>
2741
+	if (get_option('geodir_show_author_top_section')) { ?>
2742 2742
         <div
2743 2743
             class="<?php
2744
-            /** This action is documented in geodirectory_template_actions.php */
2745
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
2744
+			/** This action is documented in geodirectory_template_actions.php */
2745
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
2746 2746
             <?php dynamic_sidebar('geodir_author_top'); ?>
2747 2747
         </div><!-- clearfix ends here-->
2748 2748
     <?php }
@@ -2758,7 +2758,7 @@  discard block
 block discarded – undo
2758 2758
  */
2759 2759
 function geodir_author_left_section()
2760 2760
 {
2761
-    if (get_option('geodir_show_author_left_section')) { ?>
2761
+	if (get_option('geodir_show_author_left_section')) { ?>
2762 2762
         <div class="geodir-content-left geodir-sidebar-wrap">
2763 2763
             <?php dynamic_sidebar('geodir_author_left_sidebar'); ?>
2764 2764
         </div><!-- end geodir-content-left -->
@@ -2779,19 +2779,19 @@  discard block
 block discarded – undo
2779 2779
  */
2780 2780
 function geodir_action_author_sidebar_left()
2781 2781
 {
2782
-    if (get_option('geodir_show_author_left_section')) {
2782
+	if (get_option('geodir_show_author_left_section')) {
2783 2783
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
2784
-        /** This action is documented in geodirectory_template_actions.php */
2785
-        do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
2786
-        /**
2787
-         * This is used to add the content to the author page left sidebar (if active).
2788
-         *
2789
-         * @since 1.0.0
2790
-         */
2791
-        do_action('geodir_author_sidebar_left_inside');
2792
-        /** This action is documented in geodirectory_template_actions.php */
2793
-        do_action('geodir_sidebar_left_close', 'author-page');
2794
-    }
2784
+		/** This action is documented in geodirectory_template_actions.php */
2785
+		do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
2786
+		/**
2787
+		 * This is used to add the content to the author page left sidebar (if active).
2788
+		 *
2789
+		 * @since 1.0.0
2790
+		 */
2791
+		do_action('geodir_author_sidebar_left_inside');
2792
+		/** This action is documented in geodirectory_template_actions.php */
2793
+		do_action('geodir_sidebar_left_close', 'author-page');
2794
+	}
2795 2795
 }
2796 2796
 
2797 2797
 /**
@@ -2804,7 +2804,7 @@  discard block
 block discarded – undo
2804 2804
  */
2805 2805
 function geodir_author_right_section()
2806 2806
 {
2807
-    if (get_option('geodir_show_author_right_section')) { ?>
2807
+	if (get_option('geodir_show_author_right_section')) { ?>
2808 2808
         <div class="geodir-content-right geodir-sidebar-wrap">
2809 2809
             <?php dynamic_sidebar('geodir_author_right_sidebar'); ?>
2810 2810
         </div><!-- end geodir-content-right -->
@@ -2824,18 +2824,18 @@  discard block
 block discarded – undo
2824 2824
  */
2825 2825
 function geodir_action_author_sidebar_right()
2826 2826
 {
2827
-    if (get_option('geodir_show_author_right_section')) {
2828
-        /** This action is documented in geodirectory_template_actions.php */
2829
-        do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
2830
-        /**
2831
-         * This is used to add the content to the author page right sidebar (if active).
2832
-         *
2833
-         * @since 1.0.0
2834
-         */
2835
-        do_action('geodir_author_sidebar_right_inside');
2836
-        /** This action is documented in geodirectory_template_actions.php */
2837
-        do_action('geodir_sidebar_right_close', 'author-page');
2838
-    }
2827
+	if (get_option('geodir_show_author_right_section')) {
2828
+		/** This action is documented in geodirectory_template_actions.php */
2829
+		do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
2830
+		/**
2831
+		 * This is used to add the content to the author page right sidebar (if active).
2832
+		 *
2833
+		 * @since 1.0.0
2834
+		 */
2835
+		do_action('geodir_author_sidebar_right_inside');
2836
+		/** This action is documented in geodirectory_template_actions.php */
2837
+		do_action('geodir_sidebar_right_close', 'author-page');
2838
+	}
2839 2839
 }
2840 2840
 
2841 2841
 /**
@@ -2847,14 +2847,14 @@  discard block
 block discarded – undo
2847 2847
  */
2848 2848
 function geodir_action_author_content_inside()
2849 2849
 {
2850
-    global $gridview_columns;
2851
-    $listing_view = get_option('geodir_author_view');
2852
-    if (strstr($listing_view, 'gridview')) {
2853
-        $gridview_columns = $listing_view;
2854
-        $listing_view_exp = explode('_', $listing_view);
2855
-        $listing_view = $listing_view_exp[0];
2856
-    }
2857
-    geodir_get_template_part('listing', 'listview');
2850
+	global $gridview_columns;
2851
+	$listing_view = get_option('geodir_author_view');
2852
+	if (strstr($listing_view, 'gridview')) {
2853
+		$gridview_columns = $listing_view;
2854
+		$listing_view_exp = explode('_', $listing_view);
2855
+		$listing_view = $listing_view_exp[0];
2856
+	}
2857
+	geodir_get_template_part('listing', 'listview');
2858 2858
 }
2859 2859
 
2860 2860
 add_action('geodir_author_content_inside', 'geodir_action_author_content_inside', 10);
@@ -2869,22 +2869,22 @@  discard block
 block discarded – undo
2869 2869
  */
2870 2870
 function geodir_action_author_content()
2871 2871
 {
2872
-    /** This action is documented in geodirectory_template_actions.php */
2873
-    do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
2874
-    echo '<div class="clearfix">';
2875
-    /** This action is documented in geodirectory_template_actions.php */
2876
-    do_action('geodir_before_listing');
2877
-    echo '</div>';
2878
-    /**
2879
-     * This is used to add the content to the author page main content.
2880
-     *
2881
-     * @since 1.0.0
2882
-     */
2883
-    do_action('geodir_author_content_inside');
2884
-    /** This action is documented in geodirectory_template_actions.php */
2885
-    do_action('geodir_after_listing');
2886
-    /** This action is documented in geodirectory_template_actions.php */
2887
-    do_action('geodir_main_content_close', 'author-page');
2872
+	/** This action is documented in geodirectory_template_actions.php */
2873
+	do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
2874
+	echo '<div class="clearfix">';
2875
+	/** This action is documented in geodirectory_template_actions.php */
2876
+	do_action('geodir_before_listing');
2877
+	echo '</div>';
2878
+	/**
2879
+	 * This is used to add the content to the author page main content.
2880
+	 *
2881
+	 * @since 1.0.0
2882
+	 */
2883
+	do_action('geodir_author_content_inside');
2884
+	/** This action is documented in geodirectory_template_actions.php */
2885
+	do_action('geodir_after_listing');
2886
+	/** This action is documented in geodirectory_template_actions.php */
2887
+	do_action('geodir_main_content_close', 'author-page');
2888 2888
 }
2889 2889
 
2890 2890
 add_action('geodir_sidebar_author_bottom_section', 'geodir_action_sidebar_author_bottom_section', 10);
@@ -2898,11 +2898,11 @@  discard block
 block discarded – undo
2898 2898
  */
2899 2899
 function geodir_action_sidebar_author_bottom_section()
2900 2900
 {
2901
-    if (get_option('geodir_show_author_bottom_section')) { ?>
2901
+	if (get_option('geodir_show_author_bottom_section')) { ?>
2902 2902
         <div
2903 2903
             class="<?php
2904
-            /** This action is documented in geodirectory_template_actions.php */
2905
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
2904
+			/** This action is documented in geodirectory_template_actions.php */
2905
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
2906 2906
             <?php dynamic_sidebar('geodir_author_bottom'); ?>
2907 2907
         </div><!-- clearfix ends here-->
2908 2908
     <?php }
@@ -2921,23 +2921,23 @@  discard block
 block discarded – undo
2921 2921
  */
2922 2922
 function geodir_action_search_page_title()
2923 2923
 {
2924
-    $gd_post_type = geodir_get_current_posttype();
2925
-    $post_type_info = get_post_type_object($gd_post_type);
2924
+	$gd_post_type = geodir_get_current_posttype();
2925
+	$post_type_info = get_post_type_object($gd_post_type);
2926 2926
 
2927
-    $pt_name = '';
2928
-    if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
2927
+	$pt_name = '';
2928
+	if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
2929 2929
 
2930
-    if (is_search()) {
2931
-        $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2930
+	if (is_search()) {
2931
+		$list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2932 2932
 
2933
-    }
2934
-    /** This action is documented in geodirectory_template_actions.php */
2935
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2936
-    /** This action is documented in geodirectory_template_actions.php */
2937
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2938
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2939
-        /** This action is documented in geodirectory_template_actions.php */
2940
-        apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
2933
+	}
2934
+	/** This action is documented in geodirectory_template_actions.php */
2935
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2936
+	/** This action is documented in geodirectory_template_actions.php */
2937
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2938
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2939
+		/** This action is documented in geodirectory_template_actions.php */
2940
+		apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
2941 2941
 }
2942 2942
 
2943 2943
 // action for adding the listings page top widget area
@@ -2953,11 +2953,11 @@  discard block
 block discarded – undo
2953 2953
  */
2954 2954
 function geodir_action_geodir_sidebar_search_top()
2955 2955
 {
2956
-    if (get_option('geodir_show_search_top_section')) { ?>
2956
+	if (get_option('geodir_show_search_top_section')) { ?>
2957 2957
         <div
2958 2958
             class="<?php
2959
-            /** This action is documented in geodirectory_template_actions.php */
2960
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
2959
+			/** This action is documented in geodirectory_template_actions.php */
2960
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
2961 2961
             <?php dynamic_sidebar('geodir_search_top'); ?>
2962 2962
         </div><!-- clearfix ends here-->
2963 2963
     <?php }
@@ -2973,7 +2973,7 @@  discard block
 block discarded – undo
2973 2973
  */
2974 2974
 function geodir_search_left_section()
2975 2975
 {
2976
-    if (get_option('geodir_show_search_left_section')) { ?>
2976
+	if (get_option('geodir_show_search_left_section')) { ?>
2977 2977
         <div class="geodir-content-left geodir-sidebar-wrap">
2978 2978
             <?php dynamic_sidebar('geodir_search_left_sidebar'); ?>
2979 2979
         </div><!-- end geodir-content-left -->
@@ -2993,19 +2993,19 @@  discard block
 block discarded – undo
2993 2993
  */
2994 2994
 function geodir_action_search_sidebar_left()
2995 2995
 {
2996
-    if (get_option('geodir_show_search_left_section')) {
2996
+	if (get_option('geodir_show_search_left_section')) {
2997 2997
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
2998
-        /** This action is documented in geodirectory_template_actions.php */
2999
-        do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3000
-        /**
3001
-         * This is used to add the content to the search page left sidebar (if active).
3002
-         *
3003
-         * @since 1.0.0
3004
-         */
3005
-        do_action('geodir_search_sidebar_left_inside');
3006
-        /** This action is documented in geodirectory_template_actions.php */
3007
-        do_action('geodir_sidebar_left_close', 'search-page');
3008
-    }
2998
+		/** This action is documented in geodirectory_template_actions.php */
2999
+		do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3000
+		/**
3001
+		 * This is used to add the content to the search page left sidebar (if active).
3002
+		 *
3003
+		 * @since 1.0.0
3004
+		 */
3005
+		do_action('geodir_search_sidebar_left_inside');
3006
+		/** This action is documented in geodirectory_template_actions.php */
3007
+		do_action('geodir_sidebar_left_close', 'search-page');
3008
+	}
3009 3009
 }
3010 3010
 
3011 3011
 /**
@@ -3018,7 +3018,7 @@  discard block
 block discarded – undo
3018 3018
  */
3019 3019
 function geodir_search_right_section()
3020 3020
 {
3021
-    if (get_option('geodir_show_search_right_section')) { ?>
3021
+	if (get_option('geodir_show_search_right_section')) { ?>
3022 3022
         <div class="geodir-content-right geodir-sidebar-wrap">
3023 3023
             <?php dynamic_sidebar('geodir_search_right_sidebar'); ?>
3024 3024
         </div><!-- end geodir-content-right -->
@@ -3038,18 +3038,18 @@  discard block
 block discarded – undo
3038 3038
  */
3039 3039
 function geodir_action_search_sidebar_right()
3040 3040
 {
3041
-    if (get_option('geodir_show_search_right_section')) {
3042
-        /** This action is documented in geodirectory_template_actions.php */
3043
-        do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3044
-        /**
3045
-         * This is used to add the content to the search page right sidebar (if active).
3046
-         *
3047
-         * @since 1.0.0
3048
-         */
3049
-        do_action('geodir_search_sidebar_right_inside');
3050
-        /** This action is documented in geodirectory_template_actions.php */
3051
-        do_action('geodir_sidebar_right_close', 'search-page');
3052
-    }
3041
+	if (get_option('geodir_show_search_right_section')) {
3042
+		/** This action is documented in geodirectory_template_actions.php */
3043
+		do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3044
+		/**
3045
+		 * This is used to add the content to the search page right sidebar (if active).
3046
+		 *
3047
+		 * @since 1.0.0
3048
+		 */
3049
+		do_action('geodir_search_sidebar_right_inside');
3050
+		/** This action is documented in geodirectory_template_actions.php */
3051
+		do_action('geodir_sidebar_right_close', 'search-page');
3052
+	}
3053 3053
 }
3054 3054
 
3055 3055
 
@@ -3064,11 +3064,11 @@  discard block
 block discarded – undo
3064 3064
  */
3065 3065
 function geodir_action_sidebar_search_bottom_section()
3066 3066
 {
3067
-    if (get_option('geodir_show_search_bottom_section')) { ?>
3067
+	if (get_option('geodir_show_search_bottom_section')) { ?>
3068 3068
         <div
3069 3069
             class="<?php
3070
-            /** This action is documented in geodirectory_template_actions.php */
3071
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
3070
+			/** This action is documented in geodirectory_template_actions.php */
3071
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
3072 3072
             <?php dynamic_sidebar('geodir_search_bottom'); ?>
3073 3073
         </div><!-- clearfix ends here-->
3074 3074
     <?php }
@@ -3083,14 +3083,14 @@  discard block
 block discarded – undo
3083 3083
  */
3084 3084
 function geodir_action_search_content_inside()
3085 3085
 {
3086
-    global $gridview_columns;
3087
-    $listing_view = get_option('geodir_search_view');
3088
-    if (strstr($listing_view, 'gridview')) {
3089
-        $gridview_columns = $listing_view;
3090
-        $listing_view_exp = explode('_', $listing_view);
3091
-        $listing_view = $listing_view_exp[0];
3092
-    }
3093
-    geodir_get_template_part('listing', 'listview');
3086
+	global $gridview_columns;
3087
+	$listing_view = get_option('geodir_search_view');
3088
+	if (strstr($listing_view, 'gridview')) {
3089
+		$gridview_columns = $listing_view;
3090
+		$listing_view_exp = explode('_', $listing_view);
3091
+		$listing_view = $listing_view_exp[0];
3092
+	}
3093
+	geodir_get_template_part('listing', 'listview');
3094 3094
 }
3095 3095
 
3096 3096
 add_action('geodir_search_content_inside', 'geodir_action_search_content_inside', 10);
@@ -3106,22 +3106,22 @@  discard block
 block discarded – undo
3106 3106
  */
3107 3107
 function geodir_action_search_content()
3108 3108
 {
3109
-    /** This action is documented in geodirectory_template_actions.php */
3110
-    do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
3111
-    echo '<div class="clearfix">';
3112
-    /** This action is documented in geodirectory_template_actions.php */
3113
-    do_action('geodir_before_listing');
3114
-    echo '</div>';
3115
-    /**
3116
-     * This is used to add the content to the search page main content.
3117
-     *
3118
-     * @since 1.0.0
3119
-     */
3120
-    do_action('geodir_search_content_inside');
3121
-    /** This action is documented in geodirectory_template_actions.php */
3122
-    do_action('geodir_after_listing');
3123
-    /** This action is documented in geodirectory_template_actions.php */
3124
-    do_action('geodir_main_content_close', 'search-page');
3109
+	/** This action is documented in geodirectory_template_actions.php */
3110
+	do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
3111
+	echo '<div class="clearfix">';
3112
+	/** This action is documented in geodirectory_template_actions.php */
3113
+	do_action('geodir_before_listing');
3114
+	echo '</div>';
3115
+	/**
3116
+	 * This is used to add the content to the search page main content.
3117
+	 *
3118
+	 * @since 1.0.0
3119
+	 */
3120
+	do_action('geodir_search_content_inside');
3121
+	/** This action is documented in geodirectory_template_actions.php */
3122
+	do_action('geodir_after_listing');
3123
+	/** This action is documented in geodirectory_template_actions.php */
3124
+	do_action('geodir_main_content_close', 'search-page');
3125 3125
 }
3126 3126
 
3127 3127
 ###############################################
@@ -3144,11 +3144,11 @@  discard block
 block discarded – undo
3144 3144
  */
3145 3145
 function geodir_action_geodir_sidebar_home_top()
3146 3146
 {
3147
-    if (get_option('geodir_show_home_top_section')) { ?>
3147
+	if (get_option('geodir_show_home_top_section')) { ?>
3148 3148
         <div
3149 3149
             class="<?php
3150
-            /** This action is documented in geodirectory_template_actions.php */
3151
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
3150
+			/** This action is documented in geodirectory_template_actions.php */
3151
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
3152 3152
             <?php dynamic_sidebar('geodir_home_top'); ?>
3153 3153
         </div><!-- clearfix ends here-->
3154 3154
     <?php }
@@ -3164,7 +3164,7 @@  discard block
 block discarded – undo
3164 3164
  */
3165 3165
 function geodir_home_left_section()
3166 3166
 {
3167
-    if (get_option('geodir_show_home_left_section')) { ?>
3167
+	if (get_option('geodir_show_home_left_section')) { ?>
3168 3168
         <div class="geodir-content-left geodir-sidebar-wrap">
3169 3169
             <?php dynamic_sidebar('geodir_home_left'); ?>
3170 3170
         </div><!-- end geodir-content-left -->
@@ -3186,19 +3186,19 @@  discard block
 block discarded – undo
3186 3186
  */
3187 3187
 function geodir_action_home_sidebar_left()
3188 3188
 {
3189
-    if (get_option('geodir_show_home_left_section')) {
3189
+	if (get_option('geodir_show_home_left_section')) {
3190 3190
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
3191
-        /** This action is documented in geodirectory_template_actions.php */
3192
-        do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3193
-        /**
3194
-         * This is used to add the content to the home page left sidebar (if active).
3195
-         *
3196
-         * @since 1.0.0
3197
-         */
3198
-        do_action('geodir_home_sidebar_left_inside');
3199
-        /** This action is documented in geodirectory_template_actions.php */
3200
-        do_action('geodir_sidebar_left_close', 'home-page');
3201
-    }
3191
+		/** This action is documented in geodirectory_template_actions.php */
3192
+		do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3193
+		/**
3194
+		 * This is used to add the content to the home page left sidebar (if active).
3195
+		 *
3196
+		 * @since 1.0.0
3197
+		 */
3198
+		do_action('geodir_home_sidebar_left_inside');
3199
+		/** This action is documented in geodirectory_template_actions.php */
3200
+		do_action('geodir_sidebar_left_close', 'home-page');
3201
+	}
3202 3202
 }
3203 3203
 
3204 3204
 /**
@@ -3211,7 +3211,7 @@  discard block
 block discarded – undo
3211 3211
  */
3212 3212
 function geodir_home_right_section()
3213 3213
 {
3214
-    if (get_option('geodir_show_home_right_section')) { ?>
3214
+	if (get_option('geodir_show_home_right_section')) { ?>
3215 3215
         <div class="geodir-content-right geodir-sidebar-wrap">
3216 3216
             <?php dynamic_sidebar('geodir_home_right'); ?>
3217 3217
         </div><!-- end geodir-content-right -->
@@ -3232,18 +3232,18 @@  discard block
 block discarded – undo
3232 3232
  */
3233 3233
 function geodir_action_home_sidebar_right()
3234 3234
 {
3235
-    if (get_option('geodir_show_home_right_section')) {
3236
-        /** This action is documented in geodirectory_template_actions.php */
3237
-        do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3238
-        /**
3239
-         * This is used to add the content to the home page right sidebar (if active).
3240
-         *
3241
-         * @since 1.0.0
3242
-         */
3243
-        do_action('geodir_home_sidebar_right_inside');
3244
-        /** This action is documented in geodirectory_template_actions.php */
3245
-        do_action('geodir_sidebar_right_close', 'home-page');
3246
-    }
3235
+	if (get_option('geodir_show_home_right_section')) {
3236
+		/** This action is documented in geodirectory_template_actions.php */
3237
+		do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3238
+		/**
3239
+		 * This is used to add the content to the home page right sidebar (if active).
3240
+		 *
3241
+		 * @since 1.0.0
3242
+		 */
3243
+		do_action('geodir_home_sidebar_right_inside');
3244
+		/** This action is documented in geodirectory_template_actions.php */
3245
+		do_action('geodir_sidebar_right_close', 'home-page');
3246
+	}
3247 3247
 }
3248 3248
 
3249 3249
 /**
@@ -3254,7 +3254,7 @@  discard block
 block discarded – undo
3254 3254
  */
3255 3255
 function geodir_action_home_content_inside()
3256 3256
 {
3257
-    dynamic_sidebar('geodir_home_content');
3257
+	dynamic_sidebar('geodir_home_content');
3258 3258
 }
3259 3259
 
3260 3260
 add_action('geodir_home_content_inside', 'geodir_action_home_content_inside', 10);
@@ -3269,28 +3269,28 @@  discard block
 block discarded – undo
3269 3269
  */
3270 3270
 function geodir_action_home_content()
3271 3271
 {
3272
-    /** This action is documented in geodirectory_template_actions.php */
3273
-    do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
3274
-    /**
3275
-     * This called before the home page main content.
3276
-     *
3277
-     * @since 1.0.0
3278
-     */
3279
-    do_action('geodir_before_home_content');
3280
-    /**
3281
-     * This is used to add the content to the home page main content.
3282
-     *
3283
-     * @since 1.0.0
3284
-     */
3285
-    do_action('geodir_home_content_inside');
3286
-    /**
3287
-     * This is called after the homepage main content.
3288
-     *
3289
-     * @since 1.0.0
3290
-     */
3291
-    do_action('geodir_after_home_content');
3292
-    /** This action is documented in geodirectory_template_actions.php */
3293
-    do_action('geodir_main_content_close', 'home-page');
3272
+	/** This action is documented in geodirectory_template_actions.php */
3273
+	do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
3274
+	/**
3275
+	 * This called before the home page main content.
3276
+	 *
3277
+	 * @since 1.0.0
3278
+	 */
3279
+	do_action('geodir_before_home_content');
3280
+	/**
3281
+	 * This is used to add the content to the home page main content.
3282
+	 *
3283
+	 * @since 1.0.0
3284
+	 */
3285
+	do_action('geodir_home_content_inside');
3286
+	/**
3287
+	 * This is called after the homepage main content.
3288
+	 *
3289
+	 * @since 1.0.0
3290
+	 */
3291
+	do_action('geodir_after_home_content');
3292
+	/** This action is documented in geodirectory_template_actions.php */
3293
+	do_action('geodir_main_content_close', 'home-page');
3294 3294
 }
3295 3295
 
3296 3296
 add_action('geodir_sidebar_location_bottom_section', 'geodir_action_sidebar_home_bottom_section', 10);
@@ -3305,11 +3305,11 @@  discard block
 block discarded – undo
3305 3305
  */
3306 3306
 function geodir_action_sidebar_home_bottom_section()
3307 3307
 {
3308
-    if (get_option('geodir_show_home_bottom_section')) { ?>
3308
+	if (get_option('geodir_show_home_bottom_section')) { ?>
3309 3309
         <div
3310 3310
             class="<?php
3311
-            /** This action is documented in geodirectory_template_actions.php */
3312
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
3311
+			/** This action is documented in geodirectory_template_actions.php */
3312
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
3313 3313
             <?php dynamic_sidebar('geodir_home_bottom'); ?>
3314 3314
         </div><!-- clearfix ends here-->
3315 3315
     <?php }
@@ -3337,13 +3337,13 @@  discard block
 block discarded – undo
3337 3337
  */
3338 3338
 function geodir_filter_listing_page_title($list_title)
3339 3339
 {
3340
-    if (is_search() && trim(get_search_query()) == '') {
3341
-        $gd_post_type = geodir_get_current_posttype();
3342
-        $post_type_info = get_post_type_object($gd_post_type);
3340
+	if (is_search() && trim(get_search_query()) == '') {
3341
+		$gd_post_type = geodir_get_current_posttype();
3342
+		$post_type_info = get_post_type_object($gd_post_type);
3343 3343
 
3344
-        $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3345
-    }
3346
-    return $list_title;
3344
+		$list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3345
+	}
3346
+	return $list_title;
3347 3347
 }
3348 3348
 
3349 3349
 add_action('geodir_message_not_found_on_listing', 'geodir_display_message_not_found_on_listing');
Please login to merge, or discard this patch.
geodirectory-functions/listing_filters.php 3 patches
Braces   +30 added lines, -19 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function geodir_session_start()
18 18
 {
19
-    if (!session_id()) session_start();
19
+    if (!session_id()) {
20
+    	session_start();
21
+    }
20 22
     global $geodir_add_location_url;
21 23
 
22 24
     $geodir_add_location_url = NULL;
@@ -86,7 +88,9 @@  discard block
 block discarded – undo
86 88
 
87 89
     if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')):
88 90
 
89
-        if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = '';
91
+        if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') {
92
+        	$_REQUEST['scat'] = '';
93
+        }
90 94
         //if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = '';
91 95
 
92 96
         if (isset($_REQUEST['sdist'])) {
@@ -198,8 +202,9 @@  discard block
 block discarded – undo
198 202
         add_filter('posts_fields', 'geodir_posts_fields', 1);
199 203
         add_filter('posts_join', 'geodir_posts_join', 1);
200 204
         geodir_post_where();
201
-        if (!is_admin())
202
-            add_filter('posts_orderby', 'geodir_posts_orderby', 1);
205
+        if (!is_admin()) {
206
+                    add_filter('posts_orderby', 'geodir_posts_orderby', 1);
207
+        }
203 208
 
204 209
         // advanced filter for popular post view widget
205 210
         global $wp_query;
@@ -346,8 +351,9 @@  discard block
 block discarded – undo
346 351
     $sort_by = '';
347 352
     $orderby = ' ';
348 353
 
349
-    if (get_query_var('order_by'))
350
-        $sort_by = get_query_var('order_by');
354
+    if (get_query_var('order_by')) {
355
+            $sort_by = get_query_var('order_by');
356
+    }
351 357
 
352 358
     /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
353 359
         $current_term = $wp_query->get_queried_object();
@@ -367,14 +373,16 @@  discard block
 block discarded – undo
367 373
         $orderby .= " distance,";
368 374
     }
369 375
 
370
-    if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query())
371
-        $sort_by = esc_attr($_REQUEST['sort_by']);
376
+    if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) {
377
+            $sort_by = esc_attr($_REQUEST['sort_by']);
378
+    }
372 379
 
373 380
 
374 381
     if ($sort_by == '') {
375 382
         $default_sort = geodir_get_posts_default_sort($geodir_post_type);
376
-        if (!empty($default_sort))
377
-            $sort_by = $default_sort;
383
+        if (!empty($default_sort)) {
384
+                    $sort_by = $default_sort;
385
+        }
378 386
     }
379 387
 
380 388
     /*
@@ -562,8 +570,9 @@  discard block
 block discarded – undo
562 570
 
563 571
             add_filter('posts_where', 'searching_filter_where', 1);
564 572
 
565
-            if ($snear != '')
566
-                add_filter('posts_where', 'searching_filter_where', 1);
573
+            if ($snear != '') {
574
+                            add_filter('posts_where', 'searching_filter_where', 1);
575
+            }
567 576
 
568 577
             add_filter('posts_orderby', 'geodir_posts_orderby', 1);
569 578
 
@@ -731,10 +740,11 @@  discard block
 block discarded – undo
731 740
     }
732 741
 
733 742
     $better_search_terms = '';
734
-    if (isset($_REQUEST['stype']))
735
-        $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
736
-    else
737
-        $post_types = 'gd_place';
743
+    if (isset($_REQUEST['stype'])) {
744
+            $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
745
+    } else {
746
+            $post_types = 'gd_place';
747
+    }
738 748
 
739 749
     if ($s != '') {
740 750
         $keywords = explode(" ", $s);
@@ -762,7 +772,7 @@  discard block
 block discarded – undo
762 772
     if($taxonomies) {
763 773
         $taxonomies = implode("','", $taxonomies);
764 774
         $taxonomies = "'" . $taxonomies . "'";
765
-    }else{$taxonomies='';}
775
+    } else{$taxonomies='';}
766 776
 
767 777
     $content_where = $terms_where = '';
768 778
 	if ($s != '') {
@@ -878,8 +888,9 @@  discard block
 block discarded – undo
878 888
             $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
879 889
             $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
880 890
             $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
881
-        } else
882
-            $where .= " AND $wpdb->posts.post_author = $user_id";
891
+        } else {
892
+                    $where .= " AND $wpdb->posts.post_author = $user_id";
893
+        }
883 894
 
884 895
         if ($user_id == (int)get_current_user_id()) {
885 896
             $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -99,15 +99,15 @@  discard block
 block discarded – undo
99 99
         } //  Distance
100 100
 
101 101
         if (isset($_REQUEST['sgeo_lat'])) {
102
-            $mylat = (float)esc_attr($_REQUEST['sgeo_lat']);
102
+            $mylat = (float) esc_attr($_REQUEST['sgeo_lat']);
103 103
         } else {
104
-            $mylat = (float)geodir_get_current_city_lat();
104
+            $mylat = (float) geodir_get_current_city_lat();
105 105
         } //  Latatude
106 106
 
107 107
         if (isset($_REQUEST['sgeo_lon'])) {
108
-            $mylon = (float)esc_attr($_REQUEST['sgeo_lon']);
108
+            $mylon = (float) esc_attr($_REQUEST['sgeo_lon']);
109 109
         } else {
110
-            $mylon = (float)geodir_get_current_city_lng();
110
+            $mylon = (float) geodir_get_current_city_lng();
111 111
         } //  Distance
112 112
 
113 113
         if (isset($_REQUEST['snear'])) {
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
     if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
251 251
         $keywords = explode(" ", $s);
252 252
 
253
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
254
-            foreach($keywords as $kkey=>$kword){
255
-                if(mb_strlen($kword, 'UTF-8')<=$klimit){
253
+        if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
254
+            foreach ($keywords as $kkey=>$kword) {
255
+                if (mb_strlen($kword, 'UTF-8') <= $klimit) {
256 256
                     unset($keywords[$kkey]);
257 257
                 }
258 258
             }
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
                 $count = 0;
271 271
                 foreach ($keywords as $keyword) {
272 272
                     $keyword = trim($keyword);
273
-                    $keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
273
+                    $keyword = wp_specialchars_decode($keyword, ENT_QUOTES);
274 274
 					$count++;
275 275
                     if ($count < count($keywords)) {
276 276
                        // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " ";
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
         } else {
286 286
             $gd_titlematch_part = "";
287 287
         }
288
-        $s = stripslashes_deep( $s );
289
-        $s = wp_specialchars_decode($s,ENT_QUOTES);
288
+        $s = stripslashes_deep($s);
289
+        $s = wp_specialchars_decode($s, ENT_QUOTES);
290 290
 		$fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN ( " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s . '%', '% ' . $s . '%', $s, $s . ' %', '% ' . $s . ' %', '% ' . $s));
291 291
     }
292 292
 
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
 
442 442
     if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
443 443
         $keywords = explode(" ", $s);
444
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
445
-            foreach($keywords as $kkey=>$kword){
446
-                if(mb_strlen($kword, 'UTF-8')<=$klimit){
444
+        if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
445
+            foreach ($keywords as $kkey=>$kword) {
446
+                if (mb_strlen($kword, 'UTF-8') <= $klimit) {
447 447
                     unset($keywords[$kkey]);
448 448
                 }
449 449
             }
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
                 case 'post_date':
513 513
                 case 'comment_count':
514 514
 
515
-                    $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", ";
515
+                    $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", " . $table . ".overall_rating " . $order . ", ";
516 516
                     break;
517 517
 
518 518
                 case 'distance':
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
         }
578 578
 
579 579
         //if (!geodir_is_page('detail'))
580
-            add_filter('posts_where', 'geodir_default_where', 1);/**/
580
+            add_filter('posts_where', 'geodir_default_where', 1); /**/
581 581
 
582 582
         //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts
583 583
 
@@ -715,8 +715,8 @@  discard block
 block discarded – undo
715 715
 	}
716 716
 	
717 717
 	$s = trim($s);
718
-    $s  = wp_specialchars_decode($s ,ENT_QUOTES);
719
-    $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES);
718
+    $s = wp_specialchars_decode($s, ENT_QUOTES);
719
+    $s_A = wp_specialchars_decode($s_A, ENT_QUOTES);
720 720
 
721 721
     $where = '';
722 722
     $better_search_terms = '';
@@ -727,9 +727,9 @@  discard block
 block discarded – undo
727 727
 
728 728
     if ($s != '') {
729 729
         $keywords = explode(" ", $s);
730
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
731
-            foreach($keywords as $kkey=>$kword){
732
-                if(mb_strlen($kword, 'UTF-8')<=$klimit){
730
+        if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
731
+            foreach ($keywords as $kkey=>$kword) {
732
+                if (mb_strlen($kword, 'UTF-8') <= $klimit) {
733 733
                     unset($keywords[$kkey]);
734 734
                 }
735 735
             }
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
         if (!empty($keywords)) {
739 739
             foreach ($keywords as $keyword) {
740 740
                 $keyword = trim($keyword);
741
-                $keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
741
+                $keyword = wp_specialchars_decode($keyword, ENT_QUOTES);
742 742
                 if ($keyword != '') {
743 743
                     /**
744 744
                      * Filter the search query keywords SQL.
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
                      * @param array $keywords The array of keywords for the query.
750 750
                      * @param string $keyword The single keyword being searched.
751 751
                      */
752
-					$better_search_terms .= apply_filters("geodir_search_better_search_terms",' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )',$keywords,$keyword);
752
+					$better_search_terms .= apply_filters("geodir_search_better_search_terms", ' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )', $keywords, $keyword);
753 753
                 }
754 754
             }
755 755
         }
@@ -757,10 +757,10 @@  discard block
 block discarded – undo
757 757
 
758 758
     /* get taxonomy */
759 759
     $taxonomies = geodir_get_taxonomies($post_types, true);
760
-    if($taxonomies) {
760
+    if ($taxonomies) {
761 761
         $taxonomies = implode("','", $taxonomies);
762 762
         $taxonomies = "'" . $taxonomies . "'";
763
-    }else{$taxonomies='';}
763
+    } else {$taxonomies = ''; }
764 764
 
765 765
     $content_where = $terms_where = '';
766 766
 	if ($s != '') {
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
          * @package GeoDirectory
772 772
          * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`.
773 773
          */
774
-		$content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
774
+		$content_where = apply_filters("geodir_search_content_where", " OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
775 775
         /**
776 776
          * Filter the search query term values.
777 777
          *
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
          * @package GeoDirectory
780 780
          * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`.
781 781
          */
782
-        $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
782
+        $terms_where = apply_filters("geodir_search_terms_where", " AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
783 783
 	}
784 784
 		
785 785
     if ($snear != '') {
@@ -840,11 +840,11 @@  discard block
 block discarded – undo
840 840
     }
841 841
 	
842 842
 	########### WPML ###########
843
-    if ( function_exists( 'icl_object_id' ) ) {       
843
+    if (function_exists('icl_object_id')) {       
844 844
 		$lang_code = ICL_LANGUAGE_CODE;
845 845
 		
846 846
 		if ($lang_code && $post_types) {
847
-            $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
847
+            $where .= " AND icl_t.language_code = '" . $lang_code . "' AND icl_t.element_type IN('post_" . $post_types . "') ";
848 848
         }
849 849
     }
850 850
     ########### WPML ###########
@@ -867,10 +867,10 @@  discard block
 block discarded – undo
867 867
     global $wpdb, $geodir_post_type, $table, $curr;
868 868
 
869 869
     $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
870
-    $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0;
870
+    $user_id = !empty($curauth->ID) ? (int) $curauth->ID : 0;
871 871
     
872 872
     if (isset($_REQUEST['stype'])) {
873
-        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
873
+        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ", $_REQUEST['stype']);
874 874
     } else {
875 875
         $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
876 876
     }
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
         } else
884 884
             $where .= " AND $wpdb->posts.post_author = $user_id";
885 885
 
886
-        if ($user_id == (int)get_current_user_id()) {
886
+        if ($user_id == (int) get_current_user_id()) {
887 887
             $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
888 888
         } else {
889 889
             $where .= " AND $wpdb->posts.post_status = 'publish' ";
Please login to merge, or discard this patch.
Indentation   +503 added lines, -503 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Contains all function for filtering listing.
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+	 * Contains all function for filtering listing.
4
+	 *
5
+	 * @since 1.0.0
6
+	 * @package GeoDirectory
7
+	 */
8 8
  
9 9
 /**
10 10
  * Starts session if not started.
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function geodir_session_start()
18 18
 {
19
-    if (!session_id()) session_start();
20
-    global $geodir_add_location_url;
19
+	if (!session_id()) session_start();
20
+	global $geodir_add_location_url;
21 21
 
22
-    $geodir_add_location_url = NULL;
22
+	$geodir_add_location_url = NULL;
23 23
 }
24 24
 
25 25
 /**
@@ -33,18 +33,18 @@  discard block
 block discarded – undo
33 33
  */
34 34
 function geodir_modified_query($query)
35 35
 {
36
-    if ($query->is_main_query() && (
37
-            (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
38
-            || geodir_is_page('listing')
39
-            || geodir_is_page('author')
40
-            || geodir_is_page('search')
41
-            || geodir_is_page('detail'))
42
-    ) {
43
-
44
-        $query->set('is_geodir_loop', true);
45
-    }
36
+	if ($query->is_main_query() && (
37
+			(geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
38
+			|| geodir_is_page('listing')
39
+			|| geodir_is_page('author')
40
+			|| geodir_is_page('search')
41
+			|| geodir_is_page('detail'))
42
+	) {
43
+
44
+		$query->set('is_geodir_loop', true);
45
+	}
46 46
 
47
-    return $query;
47
+	return $query;
48 48
 }
49 49
 
50 50
 /**
@@ -67,81 +67,81 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function set_listing_request()
69 69
 {
70
-    global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA;
70
+	global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA;
71 71
 
72 72
 
73
-    // fix woocommerce shop products filtered by language for GD + WPML + Woocommerce
74
-    if (!geodir_is_geodir_page()) {
75
-        return;
76
-    }
73
+	// fix woocommerce shop products filtered by language for GD + WPML + Woocommerce
74
+	if (!geodir_is_geodir_page()) {
75
+		return;
76
+	}
77 77
 
78
-    /* remove all pre filters */
79
-    remove_all_filters('query');
80
-    remove_all_filters('posts_search');
81
-    remove_all_filters('posts_fields');
82
-    remove_all_filters('posts_join');
83
-    remove_all_filters('posts_orderby');
84
-    remove_all_filters('posts_where');
78
+	/* remove all pre filters */
79
+	remove_all_filters('query');
80
+	remove_all_filters('posts_search');
81
+	remove_all_filters('posts_fields');
82
+	remove_all_filters('posts_join');
83
+	remove_all_filters('posts_orderby');
84
+	remove_all_filters('posts_where');
85 85
 
86 86
 
87
-    if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')):
87
+	if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')):
88 88
 
89
-        if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = '';
90
-        //if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = '';
89
+		if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = '';
90
+		//if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = '';
91 91
 
92
-        if (isset($_REQUEST['sdist'])) {
93
-            ($_REQUEST['sdist'] != '0' && $_REQUEST['sdist'] != '') ? $dist = esc_attr($_REQUEST['sdist']) : $dist = 25000;
94
-        } elseif (get_option('geodir_search_dist') != '') {
95
-            $dist = get_option('geodir_search_dist');
92
+		if (isset($_REQUEST['sdist'])) {
93
+			($_REQUEST['sdist'] != '0' && $_REQUEST['sdist'] != '') ? $dist = esc_attr($_REQUEST['sdist']) : $dist = 25000;
94
+		} elseif (get_option('geodir_search_dist') != '') {
95
+			$dist = get_option('geodir_search_dist');
96 96
 
97
-        } else {
98
-            $dist = 25000;
99
-        } //  Distance
97
+		} else {
98
+			$dist = 25000;
99
+		} //  Distance
100 100
 
101
-        if (isset($_REQUEST['sgeo_lat'])) {
102
-            $mylat = (float)esc_attr($_REQUEST['sgeo_lat']);
103
-        } else {
104
-            $mylat = (float)geodir_get_current_city_lat();
105
-        } //  Latatude
101
+		if (isset($_REQUEST['sgeo_lat'])) {
102
+			$mylat = (float)esc_attr($_REQUEST['sgeo_lat']);
103
+		} else {
104
+			$mylat = (float)geodir_get_current_city_lat();
105
+		} //  Latatude
106 106
 
107
-        if (isset($_REQUEST['sgeo_lon'])) {
108
-            $mylon = (float)esc_attr($_REQUEST['sgeo_lon']);
109
-        } else {
110
-            $mylon = (float)geodir_get_current_city_lng();
111
-        } //  Distance
107
+		if (isset($_REQUEST['sgeo_lon'])) {
108
+			$mylon = (float)esc_attr($_REQUEST['sgeo_lon']);
109
+		} else {
110
+			$mylon = (float)geodir_get_current_city_lng();
111
+		} //  Distance
112 112
 
113
-        if (isset($_REQUEST['snear'])) {
114
-            $snear = trim(esc_attr($_REQUEST['snear']));
115
-        }
113
+		if (isset($_REQUEST['snear'])) {
114
+			$snear = trim(esc_attr($_REQUEST['snear']));
115
+		}
116 116
 
117
-        if (isset($_REQUEST['s'])) {
118
-            $s = trim(esc_attr(wp_strip_all_tags($_REQUEST['s'])));
119
-        }
117
+		if (isset($_REQUEST['s'])) {
118
+			$s = trim(esc_attr(wp_strip_all_tags($_REQUEST['s'])));
119
+		}
120 120
 
121
-        if ($snear == 'NEAR ME') {
122
-            $ip = $_SERVER['REMOTE_ADDR'];
123
-            $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip));
124
-            $mylat = stripslashes(ucfirst($addr_details[geoplugin_latitude]));
125
-            $mylon = stripslashes(ucfirst($addr_details[geoplugin_longitude]));
126
-        }
121
+		if ($snear == 'NEAR ME') {
122
+			$ip = $_SERVER['REMOTE_ADDR'];
123
+			$addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip));
124
+			$mylat = stripslashes(ucfirst($addr_details[geoplugin_latitude]));
125
+			$mylon = stripslashes(ucfirst($addr_details[geoplugin_longitude]));
126
+		}
127 127
 
128 128
 
129
-        if (strstr($s, ',')) {
130
-            $s_AA = str_replace(" ", "", $s);
131
-            $s_A = explode(",", $s_AA);
132
-            $s_A = implode('","', $s_A);
133
-            $s_A = '"' . $s_A . '"';
134
-        } else {
135
-            $s_A = '"' . $s . '"';
136
-        }
129
+		if (strstr($s, ',')) {
130
+			$s_AA = str_replace(" ", "", $s);
131
+			$s_A = explode(",", $s_AA);
132
+			$s_A = implode('","', $s_A);
133
+			$s_A = '"' . $s_A . '"';
134
+		} else {
135
+			$s_A = '"' . $s . '"';
136
+		}
137 137
 
138
-        if (strstr($s, ' ')) {
139
-            $s_SA = explode(" ", $s);
140
-        } else {
141
-            $s_SA = '';
142
-        }
138
+		if (strstr($s, ' ')) {
139
+			$s_SA = explode(" ", $s);
140
+		} else {
141
+			$s_SA = '';
142
+		}
143 143
 
144
-    endif;
144
+	endif;
145 145
 
146 146
 
147 147
 
@@ -162,56 +162,56 @@  discard block
 block discarded – undo
162 162
  */
163 163
 function geodir_listing_loop_filter($query)
164 164
 {
165
-    global $wp_query, $geodir_post_type, $table, $plugin_prefix, $table, $term;
165
+	global $wp_query, $geodir_post_type, $table, $plugin_prefix, $table, $term;
166 166
 
167
-    // fix wp_reset_query for popular post view widget
168
-    if (!geodir_is_geodir_page()) {
169
-        return;
170
-    }
167
+	// fix wp_reset_query for popular post view widget
168
+	if (!geodir_is_geodir_page()) {
169
+		return;
170
+	}
171 171
 
172
-    $geodir_post_type = geodir_get_current_posttype();
173
-
174
-    if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) {
175
-        $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy');
176
-
177
-        if (isset($wp_query->query[$taxonomies[0]])) {
178
-            $request_term = explode("/", $wp_query->query[$taxonomies[0]]);
179
-            $request_term = end($request_term);
180
-            if (!term_exists($request_term)) {
181
-                $args = array('number' => '1',);
182
-                $terms_arr = get_terms($taxonomies[0], $args);
183
-                foreach ($terms_arr as $location_term) {
184
-                    $term_arr = $location_term;
185
-                    $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term));
186
-                }
187
-                $wp_query->queried_object_id = 1;
188
-                $wp_query->queried_object = $term_arr;
189
-                //print_r($wp_query) ;
190
-            }
191
-        }
172
+	$geodir_post_type = geodir_get_current_posttype();
173
+
174
+	if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) {
175
+		$taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy');
176
+
177
+		if (isset($wp_query->query[$taxonomies[0]])) {
178
+			$request_term = explode("/", $wp_query->query[$taxonomies[0]]);
179
+			$request_term = end($request_term);
180
+			if (!term_exists($request_term)) {
181
+				$args = array('number' => '1',);
182
+				$terms_arr = get_terms($taxonomies[0], $args);
183
+				foreach ($terms_arr as $location_term) {
184
+					$term_arr = $location_term;
185
+					$term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term));
186
+				}
187
+				$wp_query->queried_object_id = 1;
188
+				$wp_query->queried_object = $term_arr;
189
+				//print_r($wp_query) ;
190
+			}
191
+		}
192 192
 
193
-    }
194
-    if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
195
-
196
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
197
-
198
-        add_filter('posts_fields', 'geodir_posts_fields', 1);
199
-        add_filter('posts_join', 'geodir_posts_join', 1);
200
-        geodir_post_where();
201
-        if (!is_admin())
202
-            add_filter('posts_orderby', 'geodir_posts_orderby', 1);
203
-
204
-        // advanced filter for popular post view widget
205
-        global $wp_query;
206
-        if (!is_admin()) {
207
-            if (!empty($wp_query->query['with_pics_only'])) {
208
-                add_filter('posts_join', 'geodir_filter_widget_join', 1000);
209
-            }
210
-            add_filter('posts_where', 'geodir_filter_widget_where', 1000);
211
-        }
193
+	}
194
+	if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
212 195
 
213
-    }
214
-    return $query;
196
+		$table = $plugin_prefix . $geodir_post_type . '_detail';
197
+
198
+		add_filter('posts_fields', 'geodir_posts_fields', 1);
199
+		add_filter('posts_join', 'geodir_posts_join', 1);
200
+		geodir_post_where();
201
+		if (!is_admin())
202
+			add_filter('posts_orderby', 'geodir_posts_orderby', 1);
203
+
204
+		// advanced filter for popular post view widget
205
+		global $wp_query;
206
+		if (!is_admin()) {
207
+			if (!empty($wp_query->query['with_pics_only'])) {
208
+				add_filter('posts_join', 'geodir_filter_widget_join', 1000);
209
+			}
210
+			add_filter('posts_where', 'geodir_filter_widget_where', 1000);
211
+		}
212
+
213
+	}
214
+	return $query;
215 215
 }
216 216
 
217 217
 
@@ -230,67 +230,67 @@  discard block
 block discarded – undo
230 230
  * @return string Modified fields query string.
231 231
  */
232 232
 function geodir_posts_fields($fields) {
233
-    global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session;
233
+	global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session;
234 234
 
235
-    // Filter-Location-Manager to add location table.
236
-    $fields .= ", " . $table . ".* ";
235
+	// Filter-Location-Manager to add location table.
236
+	$fields .= ", " . $table . ".* ";
237 237
     
238 238
 	if ($snear != '' || $gd_session->get('all_near_me')) {
239
-        $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
239
+		$DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
240 240
         
241 241
 		if ($gd_session->get('all_near_me')) {
242
-            $mylat = $gd_session->get('user_lat');
243
-            $mylon = $gd_session->get('user_lon');
244
-        }
245
-
246
-        $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
247
-    }
248
-
249
-    global $s;
250
-    if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
251
-        $keywords = explode(" ", $s);
252
-
253
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
254
-            foreach($keywords as $kkey=>$kword){
255
-                if(mb_strlen($kword, 'UTF-8')<=$klimit){
256
-                    unset($keywords[$kkey]);
257
-                }
258
-            }
259
-        }
242
+			$mylat = $gd_session->get('user_lat');
243
+			$mylon = $gd_session->get('user_lon');
244
+		}
260 245
 
246
+		$fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
247
+	}
261 248
 
262
-        if (count($keywords) > 1) {
263
-            $parts = array(
264
-                'AND' => 'gd_alltitlematch_part',
265
-                'OR' => 'gd_titlematch_part'
266
-            );
267
-            $gd_titlematch_part = "";
268
-            foreach ($parts as $key => $part) {
269
-                $gd_titlematch_part .= " CASE WHEN ";
270
-                $count = 0;
271
-                foreach ($keywords as $keyword) {
272
-                    $keyword = trim($keyword);
273
-                    $keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
249
+	global $s;
250
+	if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
251
+		$keywords = explode(" ", $s);
252
+
253
+		if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
254
+			foreach($keywords as $kkey=>$kword){
255
+				if(mb_strlen($kword, 'UTF-8')<=$klimit){
256
+					unset($keywords[$kkey]);
257
+				}
258
+			}
259
+		}
260
+
261
+
262
+		if (count($keywords) > 1) {
263
+			$parts = array(
264
+				'AND' => 'gd_alltitlematch_part',
265
+				'OR' => 'gd_titlematch_part'
266
+			);
267
+			$gd_titlematch_part = "";
268
+			foreach ($parts as $key => $part) {
269
+				$gd_titlematch_part .= " CASE WHEN ";
270
+				$count = 0;
271
+				foreach ($keywords as $keyword) {
272
+					$keyword = trim($keyword);
273
+					$keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
274 274
 					$count++;
275
-                    if ($count < count($keywords)) {
276
-                       // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " ";
275
+					if ($count < count($keywords)) {
276
+					   // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " ";
277 277
 						$gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) " . $key . " ";
278
-                    } else {
279
-                        //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' ";
278
+					} else {
279
+						//$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' ";
280 280
 						$gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) ";
281
-                    }
282
-                }
283
-                $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ",";
284
-            }
285
-        } else {
286
-            $gd_titlematch_part = "";
287
-        }
288
-        $s = stripslashes_deep( $s );
289
-        $s = wp_specialchars_decode($s,ENT_QUOTES);
281
+					}
282
+				}
283
+				$gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ",";
284
+			}
285
+		} else {
286
+			$gd_titlematch_part = "";
287
+		}
288
+		$s = stripslashes_deep( $s );
289
+		$s = wp_specialchars_decode($s,ENT_QUOTES);
290 290
 		$fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN ( " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s . '%', '% ' . $s . '%', $s, $s . ' %', '% ' . $s . ' %', '% ' . $s));
291
-    }
291
+	}
292 292
 
293
-    return $fields;
293
+	return $fields;
294 294
 }
295 295
 
296 296
 
@@ -307,26 +307,26 @@  discard block
 block discarded – undo
307 307
  */
308 308
 function geodir_posts_join($join)
309 309
 {
310
-    global $wpdb, $geodir_post_type, $table, $table_prefix, $plugin_prefix;
310
+	global $wpdb, $geodir_post_type, $table, $table_prefix, $plugin_prefix;
311 311
 
312
-    ########### WPML ###########
312
+	########### WPML ###########
313 313
 
314
-    if (function_exists('icl_object_id')) {
315
-        global $sitepress;
316
-        $lang_code = ICL_LANGUAGE_CODE;
317
-        $default_lang_code = $sitepress->get_default_language();
318
-        if ($lang_code) {
319
-            $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
320
-        }
314
+	if (function_exists('icl_object_id')) {
315
+		global $sitepress;
316
+		$lang_code = ICL_LANGUAGE_CODE;
317
+		$default_lang_code = $sitepress->get_default_language();
318
+		if ($lang_code) {
319
+			$join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
320
+		}
321 321
 
322
-    }
323
-    ########### WPML ###########
322
+	}
323
+	########### WPML ###########
324 324
 
325
-    $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID)  ";
326
-    //===old code start
327
-    //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id)  " ;//===old code end
325
+	$join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID)  ";
326
+	//===old code start
327
+	//$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id)  " ;//===old code end
328 328
 
329
-    return $join;
329
+	return $join;
330 330
 }
331 331
 
332 332
 
@@ -344,15 +344,15 @@  discard block
 block discarded – undo
344 344
  */
345 345
 function geodir_posts_orderby($orderby)
346 346
 {
347
-    global $wpdb, $wp_query, $geodir_post_type, $table, $plugin_prefix, $snear, $default_sort;
347
+	global $wpdb, $wp_query, $geodir_post_type, $table, $plugin_prefix, $snear, $default_sort;
348 348
 
349
-    $sort_by = '';
350
-    $orderby = ' ';
349
+	$sort_by = '';
350
+	$orderby = ' ';
351 351
 
352
-    if (get_query_var('order_by'))
353
-        $sort_by = get_query_var('order_by');
352
+	if (get_query_var('order_by'))
353
+		$sort_by = get_query_var('order_by');
354 354
 
355
-    /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
355
+	/*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
356 356
         $current_term = $wp_query->get_queried_object();
357 357
     }
358 358
 
@@ -366,116 +366,116 @@  discard block
 block discarded – undo
366 366
     }*/
367 367
 
368 368
 
369
-    if ($snear != '') {
370
-        $orderby .= " distance,";
371
-    }
369
+	if ($snear != '') {
370
+		$orderby .= " distance,";
371
+	}
372 372
 
373
-    if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query())
374
-        $sort_by = esc_attr($_REQUEST['sort_by']);
373
+	if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query())
374
+		$sort_by = esc_attr($_REQUEST['sort_by']);
375 375
 
376 376
 
377
-    if ($sort_by == '') {
378
-        $default_sort = geodir_get_posts_default_sort($geodir_post_type);
379
-        if (!empty($default_sort))
380
-            $sort_by = $default_sort;
381
-    }
377
+	if ($sort_by == '') {
378
+		$default_sort = geodir_get_posts_default_sort($geodir_post_type);
379
+		if (!empty($default_sort))
380
+			$sort_by = $default_sort;
381
+	}
382 382
 
383
-    /*
383
+	/*
384 384
     if search by term & no location then order always "relevance"
385 385
     if search by location then order always "nearest"
386 386
     */
387
-    if (is_main_query() && geodir_is_page('search')) {
388
-        $search_term = get_query_var('s');
387
+	if (is_main_query() && geodir_is_page('search')) {
388
+		$search_term = get_query_var('s');
389 389
 
390
-        if (trim($search_term) != '' && !isset($_REQUEST['sort_by'])) {
391
-            $sort_by = 'az';
392
-        }
390
+		if (trim($search_term) != '' && !isset($_REQUEST['sort_by'])) {
391
+			$sort_by = 'az';
392
+		}
393 393
 
394
-        if ($snear != '') {
395
-            $sort_by = 'nearest';
396
-        }
397
-    }
394
+		if ($snear != '') {
395
+			$sort_by = 'nearest';
396
+		}
397
+	}
398 398
 
399
-    switch ($sort_by):
400
-        case 'newest':
401
-            $orderby = "$wpdb->posts.post_date desc, ";
402
-            break;
403
-        case 'oldest':
404
-            $orderby = "$wpdb->posts.post_date asc, ";
405
-            break;
406
-        case 'low_review':
407
-        case 'rating_count_asc':
408
-            $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, ";
409
-            break;
410
-        case 'high_review':
411
-        case 'rating_count_desc':
399
+	switch ($sort_by):
400
+		case 'newest':
401
+			$orderby = "$wpdb->posts.post_date desc, ";
402
+			break;
403
+		case 'oldest':
404
+			$orderby = "$wpdb->posts.post_date asc, ";
405
+			break;
406
+		case 'low_review':
407
+		case 'rating_count_asc':
408
+			$orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, ";
409
+			break;
410
+		case 'high_review':
411
+		case 'rating_count_desc':
412 412
 			$orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
413
-            break;
414
-        case 'low_rating':
415
-            $orderby = "( " . $table . ".overall_rating  ) ASC, " . $table . ".rating_count ASC,  ";
416
-            break;
417
-        case 'high_rating':
418
-            $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
419
-            break;
420
-        case 'featured':
421
-            $orderby = $table . ".is_featured asc, ";
422
-            break;
423
-        case 'nearest':
424
-            $orderby = " distance asc, ";
425
-            break;
426
-        case 'farthest':
427
-            $orderby = " distance desc, ";
428
-            break;
429
-        case 'random':
430
-            $orderby = " rand(), ";
431
-            break;
432
-        case 'az':
433
-            $orderby = "$wpdb->posts.post_title asc, ";
434
-            break;
435
-        default:
436
-
437
-            break;
438
-    endswitch;
439
-
440
-    global $s;
441
-
442
-    if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
443
-        $keywords = explode(" ", $s);
444
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
445
-            foreach($keywords as $kkey=>$kword){
446
-                if(mb_strlen($kword, 'UTF-8')<=$klimit){
447
-                    unset($keywords[$kkey]);
448
-                }
449
-            }
450
-        }
451
-        if ($sort_by == 'nearest' || $sort_by == 'farthest') {
452
-            if (count($keywords) > 1) {
453
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
454
-            } else {
455
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
456
-            }
457
-        } else {
458
-            if (count($keywords) > 1) {
459
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby;
460
-            } else {
461
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby;
462
-            }
463
-        }
464
-    }
413
+			break;
414
+		case 'low_rating':
415
+			$orderby = "( " . $table . ".overall_rating  ) ASC, " . $table . ".rating_count ASC,  ";
416
+			break;
417
+		case 'high_rating':
418
+			$orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
419
+			break;
420
+		case 'featured':
421
+			$orderby = $table . ".is_featured asc, ";
422
+			break;
423
+		case 'nearest':
424
+			$orderby = " distance asc, ";
425
+			break;
426
+		case 'farthest':
427
+			$orderby = " distance desc, ";
428
+			break;
429
+		case 'random':
430
+			$orderby = " rand(), ";
431
+			break;
432
+		case 'az':
433
+			$orderby = "$wpdb->posts.post_title asc, ";
434
+			break;
435
+		default:
436
+
437
+			break;
438
+	endswitch;
439
+
440
+	global $s;
441
+
442
+	if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
443
+		$keywords = explode(" ", $s);
444
+		if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
445
+			foreach($keywords as $kkey=>$kword){
446
+				if(mb_strlen($kword, 'UTF-8')<=$klimit){
447
+					unset($keywords[$kkey]);
448
+				}
449
+			}
450
+		}
451
+		if ($sort_by == 'nearest' || $sort_by == 'farthest') {
452
+			if (count($keywords) > 1) {
453
+				$orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
454
+			} else {
455
+				$orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
456
+			}
457
+		} else {
458
+			if (count($keywords) > 1) {
459
+				$orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby;
460
+			} else {
461
+				$orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby;
462
+			}
463
+		}
464
+	}
465 465
 
466
-    /**
467
-     * Filter order by SQL.
468
-     *
469
-     * @since 1.0.0
470
-     * @param string $orderby The orderby query string.
471
-     * @param string $sort_by Sortby query string.
472
-     * @param string $table Listing table name.
473
-     */
474
-    $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
466
+	/**
467
+	 * Filter order by SQL.
468
+	 *
469
+	 * @since 1.0.0
470
+	 * @param string $orderby The orderby query string.
471
+	 * @param string $sort_by Sortby query string.
472
+	 * @param string $table Listing table name.
473
+	 */
474
+	$orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
475 475
 
476
-    $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
476
+	$orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
477 477
 
478
-    return $orderby;
478
+	return $orderby;
479 479
 }
480 480
 
481 481
 
@@ -493,53 +493,53 @@  discard block
 block discarded – undo
493 493
 function geodir_posts_order_by_custom_sort($orderby, $sort_by, $table)
494 494
 {
495 495
 
496
-    global $wpdb;
496
+	global $wpdb;
497 497
 
498
-    if ($sort_by != '' && !is_search()) {
498
+	if ($sort_by != '' && !is_search()) {
499 499
 
500
-        $sort_array = explode('_', $sort_by);
500
+		$sort_array = explode('_', $sort_by);
501 501
 
502
-        $sort_by_count = count($sort_array);
502
+		$sort_by_count = count($sort_array);
503 503
 
504
-        $order = $sort_array[$sort_by_count - 1];
504
+		$order = $sort_array[$sort_by_count - 1];
505 505
 
506
-        if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
506
+		if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
507 507
 
508
-            $sort_by = str_replace('_' . $order, '', $sort_by);
508
+			$sort_by = str_replace('_' . $order, '', $sort_by);
509 509
 
510
-            switch ($sort_by):
510
+			switch ($sort_by):
511 511
 
512
-                case 'post_date':
513
-                case 'comment_count':
512
+				case 'post_date':
513
+				case 'comment_count':
514 514
 
515
-                    $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", ";
516
-                    break;
515
+					$orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", ";
516
+					break;
517 517
 
518
-                case 'distance':
519
-                    $orderby = $sort_by . " " . $order . ", ";
520
-                    break;
518
+				case 'distance':
519
+					$orderby = $sort_by . " " . $order . ", ";
520
+					break;
521 521
 
522 522
 
523
-                // sort by rating
524
-                case 'overall_rating':
525
-                    $orderby = " " . $table . "." . $sort_by . "  " . $order . ", " . $table . ".rating_count " . $order . ", ";
523
+				// sort by rating
524
+				case 'overall_rating':
525
+					$orderby = " " . $table . "." . $sort_by . "  " . $order . ", " . $table . ".rating_count " . $order . ", ";
526 526
 
527
-                    break;
527
+					break;
528 528
 
529 529
 
530
-                default:
531
-                    if (geodir_column_exist($table, $sort_by)) {
530
+				default:
531
+					if (geodir_column_exist($table, $sort_by)) {
532 532
 						$orderby = $table . "." . $sort_by . " " . $order . ", ";
533 533
 					}
534
-                    break;
534
+					break;
535 535
 
536
-            endswitch;
536
+			endswitch;
537 537
 
538
-        }
538
+		}
539 539
 
540
-    }
540
+	}
541 541
 
542
-    return $orderby;
542
+	return $orderby;
543 543
 }
544 544
 
545 545
 /**
@@ -554,34 +554,34 @@  discard block
 block discarded – undo
554 554
 {
555 555
 
556 556
 
557
-    global $wpdb, $geodir_post_type, $table, $s, $snear;
557
+	global $wpdb, $geodir_post_type, $table, $s, $snear;
558 558
 
559
-    if (!is_admin()) {
559
+	if (!is_admin()) {
560 560
 
561
-        if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
562
-            add_filter('posts_where', 'geodir_edit_listing_where', 1);
561
+		if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
562
+			add_filter('posts_where', 'geodir_edit_listing_where', 1);
563 563
 
564
-        } elseif ((is_search() && $_REQUEST['geodir_search'])) {
564
+		} elseif ((is_search() && $_REQUEST['geodir_search'])) {
565 565
 
566
-            add_filter('posts_where', 'searching_filter_where', 1);
566
+			add_filter('posts_where', 'searching_filter_where', 1);
567 567
 
568
-            if ($snear != '')
569
-                add_filter('posts_where', 'searching_filter_where', 1);
568
+			if ($snear != '')
569
+				add_filter('posts_where', 'searching_filter_where', 1);
570 570
 
571
-            add_filter('posts_orderby', 'geodir_posts_orderby', 1);
571
+			add_filter('posts_orderby', 'geodir_posts_orderby', 1);
572 572
 
573
-        } elseif (geodir_is_page('author')) {
573
+		} elseif (geodir_is_page('author')) {
574 574
 
575
-            add_filter('posts_where', 'author_filter_where', 1);
575
+			add_filter('posts_where', 'author_filter_where', 1);
576 576
 
577
-        }
577
+		}
578 578
 
579
-        //if (!geodir_is_page('detail'))
580
-            add_filter('posts_where', 'geodir_default_where', 1);/**/
579
+		//if (!geodir_is_page('detail'))
580
+			add_filter('posts_where', 'geodir_default_where', 1);/**/
581 581
 
582
-        //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts
582
+		//add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts
583 583
 
584
-    }
584
+	}
585 585
 }
586 586
 
587 587
 /**
@@ -596,13 +596,13 @@  discard block
 block discarded – undo
596 596
  */
597 597
 function geodir_preview_post_cap($allcaps, $caps, $args)
598 598
 {
599
-    $user_id = get_current_user_id();
600
-    if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) {
599
+	$user_id = get_current_user_id();
600
+	if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) {
601 601
 
602
-        $allcaps['edit_posts'] = true;
603
-    }
604
-    //print_r($allcaps);
605
-    return $allcaps;
602
+		$allcaps['edit_posts'] = true;
603
+	}
604
+	//print_r($allcaps);
605
+	return $allcaps;
606 606
 }
607 607
 
608 608
 
@@ -617,9 +617,9 @@  discard block
 block discarded – undo
617 617
  */
618 618
 function geodir_edit_listing_where($where)
619 619
 {
620
-    global $wpdb;
621
-    $where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']);
622
-    return $where;
620
+	global $wpdb;
621
+	$where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']);
622
+	return $where;
623 623
 }
624 624
 
625 625
 
@@ -636,29 +636,29 @@  discard block
 block discarded – undo
636 636
  */
637 637
 function geodir_default_where($where)
638 638
 {
639
-    global $wp_query, $wpdb;
640
-
641
-    //print_r($wp_query);
642
-    ########### WPML ###########
643
-
644
-    if (function_exists('icl_object_id')) {
645
-        global $sitepress, $table_prefix;
646
-        $lang_code = ICL_LANGUAGE_CODE;
647
-        $default_lang_code = $sitepress->get_default_language();
648
-        $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : '';
649
-        //echo '##########'.$q_post_type;
650
-        if ($lang_code && $q_post_type) {
651
-            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
652
-            //$where .= " AND icl_t.language_code = '$lang_code' ";
653
-        }
639
+	global $wp_query, $wpdb;
654 640
 
655
-    }
656
-    ########### WPML ###########
641
+	//print_r($wp_query);
642
+	########### WPML ###########
657 643
 
644
+	if (function_exists('icl_object_id')) {
645
+		global $sitepress, $table_prefix;
646
+		$lang_code = ICL_LANGUAGE_CODE;
647
+		$default_lang_code = $sitepress->get_default_language();
648
+		$q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : '';
649
+		//echo '##########'.$q_post_type;
650
+		if ($lang_code && $q_post_type) {
651
+			$where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
652
+			//$where .= " AND icl_t.language_code = '$lang_code' ";
653
+		}
658 654
 
659
-    return $where = str_replace("0 = 1", "1=1", $where);
655
+	}
656
+	########### WPML ###########
660 657
 
661
-    /* ====== old code start ===
658
+
659
+	return $where = str_replace("0 = 1", "1=1", $where);
660
+
661
+	/* ====== old code start ===
662 662
     $where = str_replace("0 = 1", "1=1", $where);
663 663
     $country = get_query_var('gd_country');
664 664
     $region = get_query_var('gd_region');
@@ -699,108 +699,108 @@  discard block
 block discarded – undo
699 699
  * @return string Modified where query string.
700 700
  */
701 701
 function searching_filter_where($where) {
702
-    global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session;
702
+	global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session;
703 703
 	
704
-    $search_term = 'OR';
705
-    $search_term = 'AND';
706
-    $geodir_custom_search = '';
707
-    $category_search_range = '';
704
+	$search_term = 'OR';
705
+	$search_term = 'AND';
706
+	$geodir_custom_search = '';
707
+	$category_search_range = '';
708 708
 
709
-    if (is_single() && get_query_var('post_type')) {
709
+	if (is_single() && get_query_var('post_type')) {
710 710
 		return $where;
711 711
 	}
712 712
 
713
-    if (is_tax()) {
713
+	if (is_tax()) {
714 714
 		return $where;
715 715
 	}
716 716
 	
717 717
 	$s = trim($s);
718
-    $s  = wp_specialchars_decode($s ,ENT_QUOTES);
719
-    $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES);
720
-
721
-    $where = '';
722
-    $better_search_terms = '';
723
-    if (isset($_REQUEST['stype']))
724
-        $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
725
-    else
726
-        $post_types = 'gd_place';
727
-
728
-    if ($s != '') {
729
-        $keywords = explode(" ", $s);
730
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
731
-            foreach($keywords as $kkey=>$kword){
732
-                if(mb_strlen($kword, 'UTF-8')<=$klimit){
733
-                    unset($keywords[$kkey]);
734
-                }
735
-            }
736
-        }
718
+	$s  = wp_specialchars_decode($s ,ENT_QUOTES);
719
+	$s_A = wp_specialchars_decode($s_A ,ENT_QUOTES);
720
+
721
+	$where = '';
722
+	$better_search_terms = '';
723
+	if (isset($_REQUEST['stype']))
724
+		$post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
725
+	else
726
+		$post_types = 'gd_place';
737 727
 
738
-        if (!empty($keywords)) {
739
-            foreach ($keywords as $keyword) {
740
-                $keyword = trim($keyword);
741
-                $keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
742
-                if ($keyword != '') {
743
-                    /**
744
-                     * Filter the search query keywords SQL.
745
-                     *
746
-                     * @since 1.5.9
747
-                     * @package GeoDirectory
748
-                     * @param string $better_search_terms The query values, default: `' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )'`.
749
-                     * @param array $keywords The array of keywords for the query.
750
-                     * @param string $keyword The single keyword being searched.
751
-                     */
728
+	if ($s != '') {
729
+		$keywords = explode(" ", $s);
730
+		if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
731
+			foreach($keywords as $kkey=>$kword){
732
+				if(mb_strlen($kword, 'UTF-8')<=$klimit){
733
+					unset($keywords[$kkey]);
734
+				}
735
+			}
736
+		}
737
+
738
+		if (!empty($keywords)) {
739
+			foreach ($keywords as $keyword) {
740
+				$keyword = trim($keyword);
741
+				$keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
742
+				if ($keyword != '') {
743
+					/**
744
+					 * Filter the search query keywords SQL.
745
+					 *
746
+					 * @since 1.5.9
747
+					 * @package GeoDirectory
748
+					 * @param string $better_search_terms The query values, default: `' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )'`.
749
+					 * @param array $keywords The array of keywords for the query.
750
+					 * @param string $keyword The single keyword being searched.
751
+					 */
752 752
 					$better_search_terms .= apply_filters("geodir_search_better_search_terms",' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )',$keywords,$keyword);
753
-                }
754
-            }
755
-        }
756
-    }
753
+				}
754
+			}
755
+		}
756
+	}
757 757
 
758
-    /* get taxonomy */
759
-    $taxonomies = geodir_get_taxonomies($post_types, true);
760
-    if($taxonomies) {
761
-        $taxonomies = implode("','", $taxonomies);
762
-        $taxonomies = "'" . $taxonomies . "'";
763
-    }else{$taxonomies='';}
758
+	/* get taxonomy */
759
+	$taxonomies = geodir_get_taxonomies($post_types, true);
760
+	if($taxonomies) {
761
+		$taxonomies = implode("','", $taxonomies);
762
+		$taxonomies = "'" . $taxonomies . "'";
763
+	}else{$taxonomies='';}
764 764
 
765
-    $content_where = $terms_where = '';
765
+	$content_where = $terms_where = '';
766 766
 	if ($s != '') {
767
-        /**
768
-         * Filter the search query content where values.
769
-         *
770
-         * @since 1.5.0
771
-         * @package GeoDirectory
772
-         * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`.
773
-         */
767
+		/**
768
+		 * Filter the search query content where values.
769
+		 *
770
+		 * @since 1.5.0
771
+		 * @package GeoDirectory
772
+		 * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`.
773
+		 */
774 774
 		$content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
775
-        /**
776
-         * Filter the search query term values.
777
-         *
778
-         * @since 1.5.0
779
-         * @package GeoDirectory
780
-         * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`.
781
-         */
782
-        $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
775
+		/**
776
+		 * Filter the search query term values.
777
+		 *
778
+		 * @since 1.5.0
779
+		 * @package GeoDirectory
780
+		 * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`.
781
+		 */
782
+		$terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
783 783
 	}
784 784
 		
785
-    if ($snear != '') {
785
+	if ($snear != '') {
786 786
 
787 787
 
788
-        if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) {
789
-            $dist = $gd_session->get('near_me_range');
790
-        }
791
-        $lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69);
792
-        $lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69);
793
-        $lat1 = $mylat - ($dist / 69);
794
-        $lat2 = $mylat + ($dist / 69);
788
+		if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) {
789
+			$dist = $gd_session->get('near_me_range');
790
+		}
791
+		$lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69);
792
+		$lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69);
793
+		$lat1 = $mylat - ($dist / 69);
794
+		$lat2 = $mylat + ($dist / 69);
795 795
 
796
-        $rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : '';
797
-        $rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : '';
798
-        $rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : '';
799
-        $rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : '';
796
+		$rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : '';
797
+		$rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : '';
798
+		$rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : '';
799
+		$rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : '';
800 800
 
801 801
 
802 802
 
803
-	    $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
803
+		$where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
804 804
 			                    $content_where 
805 805
 								OR ($wpdb->posts.ID IN( 
806 806
 										SELECT $wpdb->term_relationships.object_id as post_id 
@@ -817,13 +817,13 @@  discard block
 block discarded – undo
817 817
 						AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 )
818 818
 						AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) ";
819 819
 
820
-        if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
821
-            $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
822
-            $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist;
823
-        }
820
+		if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
821
+			$DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
822
+			$where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist;
823
+		}
824 824
 
825
-    } else {
826
-        $where .= " AND (	( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
825
+	} else {
826
+		$where .= " AND (	( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
827 827
                             $content_where  
828 828
 							OR ( $wpdb->posts.ID IN(	
829 829
 									SELECT $wpdb->term_relationships.object_id as post_id                     
@@ -837,19 +837,19 @@  discard block
 block discarded – undo
837 837
 					) 
838 838
 				AND $wpdb->posts.post_type in ('$post_types')
839 839
 				AND ($wpdb->posts.post_status = 'publish') ";
840
-    }
840
+	}
841 841
 	
842 842
 	########### WPML ###########
843
-    if ( function_exists( 'icl_object_id' ) ) {       
843
+	if ( function_exists( 'icl_object_id' ) ) {       
844 844
 		$lang_code = ICL_LANGUAGE_CODE;
845 845
 		
846 846
 		if ($lang_code && $post_types) {
847
-            $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
848
-        }
849
-    }
850
-    ########### WPML ###########
847
+			$where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
848
+		}
849
+	}
850
+	########### WPML ###########
851 851
 	
852
-    return $where;
852
+	return $where;
853 853
 }
854 854
 
855 855
 
@@ -864,45 +864,45 @@  discard block
 block discarded – undo
864 864
  * @return string Modified where query string.
865 865
  */
866 866
 function author_filter_where($where) {
867
-    global $wpdb, $geodir_post_type, $table, $curr;
867
+	global $wpdb, $geodir_post_type, $table, $curr;
868 868
 
869
-    $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
870
-    $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0;
869
+	$curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
870
+	$user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0;
871 871
     
872
-    if (isset($_REQUEST['stype'])) {
873
-        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
874
-    } else {
875
-        $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
876
-    }
872
+	if (isset($_REQUEST['stype'])) {
873
+		$where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
874
+	} else {
875
+		$where = " AND $wpdb->posts.post_type IN ('gd_place') ";
876
+	}
877 877
 
878
-    if ($user_id > 0) {
879
-        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
880
-            $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
881
-            $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
882
-            $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
883
-        } else
884
-            $where .= " AND $wpdb->posts.post_author = $user_id";
885
-
886
-        if ($user_id == (int)get_current_user_id()) {
887
-            $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
888
-        } else {
889
-            $where .= " AND $wpdb->posts.post_status = 'publish' ";
890
-        }
891
-    } else {
892
-        $where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' ";
893
-    }
878
+	if ($user_id > 0) {
879
+		if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
880
+			$user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
881
+			$user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
882
+			$where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
883
+		} else
884
+			$where .= " AND $wpdb->posts.post_author = $user_id";
885
+
886
+		if ($user_id == (int)get_current_user_id()) {
887
+			$where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
888
+		} else {
889
+			$where .= " AND $wpdb->posts.post_status = 'publish' ";
890
+		}
891
+	} else {
892
+		$where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' ";
893
+	}
894 894
 
895
-    ########### WPML ###########
896
-    if (function_exists('icl_object_id')) {
897
-        $lang_code = ICL_LANGUAGE_CODE;
898
-        if ($lang_code) {
899
-            $where .= " AND icl_t.language_code='" . $lang_code . "' ";
900
-        }
895
+	########### WPML ###########
896
+	if (function_exists('icl_object_id')) {
897
+		$lang_code = ICL_LANGUAGE_CODE;
898
+		if ($lang_code) {
899
+			$where .= " AND icl_t.language_code='" . $lang_code . "' ";
900
+		}
901 901
 
902
-    }
903
-    ########### WPML ###########
902
+	}
903
+	########### WPML ###########
904 904
     
905
-    return $where;
905
+	return $where;
906 906
 }
907 907
 
908 908
 /**
@@ -917,11 +917,11 @@  discard block
 block discarded – undo
917 917
  */
918 918
 function geodir_filter_widget_join($join)
919 919
 {
920
-    global $wp_query, $table;
921
-    if (!empty($wp_query->query['with_pics_only'])) {
922
-        $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
923
-    }
924
-    return $join;
920
+	global $wp_query, $table;
921
+	if (!empty($wp_query->query['with_pics_only'])) {
922
+		$join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
923
+	}
924
+	return $join;
925 925
 }
926 926
 
927 927
 /**
@@ -936,18 +936,18 @@  discard block
 block discarded – undo
936 936
  */
937 937
 function geodir_filter_widget_where($where)
938 938
 {
939
-    global $wp_query, $table;
940
-    if (!empty($wp_query->query['show_featured_only'])) {
941
-        $where .= " AND " . $table . ".is_featured = '1'";
942
-    }
943
-    if (!empty($wp_query->query['show_special_only'])) {
944
-        $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
945
-    }
946
-    if (!empty($wp_query->query['with_pics_only'])) {
947
-        $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id";
948
-    }
949
-    if (!empty($wp_query->query['with_videos_only'])) {
950
-        $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
951
-    }
952
-    return $where;
939
+	global $wp_query, $table;
940
+	if (!empty($wp_query->query['show_featured_only'])) {
941
+		$where .= " AND " . $table . ".is_featured = '1'";
942
+	}
943
+	if (!empty($wp_query->query['show_special_only'])) {
944
+		$where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
945
+	}
946
+	if (!empty($wp_query->query['with_pics_only'])) {
947
+		$where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id";
948
+	}
949
+	if (!empty($wp_query->query['with_videos_only'])) {
950
+		$where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
951
+	}
952
+	return $where;
953 953
 }
954 954
\ No newline at end of file
Please login to merge, or discard this patch.
db-language.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Translate language string stored in database. Ex: Custom Fields
4
- *
5
- * @package GeoDirectory
6
- * @since 1.4.2
7
- */
3
+	 * Translate language string stored in database. Ex: Custom Fields
4
+	 *
5
+	 * @package GeoDirectory
6
+	 * @since 1.4.2
7
+	 */
8 8
 
9 9
 // Language keys
Please login to merge, or discard this patch.
geodirectory_shortcodes.php 2 patches
Indentation   +656 added lines, -656 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 // If this file is called directly, abort.
9 9
 if (!defined('WPINC')) {
10
-    die;
10
+	die;
11 11
 }
12 12
 require_once('geodirectory-functions/shortcode_functions.php');
13 13
 
@@ -32,48 +32,48 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function geodir_sc_add_listing($atts)
34 34
 {
35
-    ob_start();
36
-    $defaults = array(
37
-        'pid' => '',
38
-        'listing_type' => 'gd_place',
39
-        'login_msg' => __('You must login to post.', 'geodirectory'),
40
-        'show_login' => false,
41
-    );
42
-    $params = shortcode_atts($defaults, $atts);
43
-
44
-    foreach ($params as $key => $value) {
45
-        $_REQUEST[$key] = $value;
46
-    }
47
-
48
-    $user_id = get_current_user_id();
49
-    if (!$user_id) {
50
-        echo $params['login_msg'];
51
-        if ($params['show_login']) {
52
-            echo "<br />";
53
-            $defaults = array(
54
-                'before_widget' => '',
55
-                'after_widget' => '',
56
-                'before_title' => '',
57
-                'after_title' => '',
58
-            );
59
-
60
-            geodir_loginwidget_output($defaults, $defaults);
61
-        }
62
-
63
-
64
-    } else {
65
-        ###### MAIN CONTENT ######
66
-
67
-        /** This action is documented in geodirectory-templates/add-listing.php */
68
-        do_action('geodir_add_listing_page_mandatory');
69
-        /** This action is documented in geodirectory-templates/add-listing.php */
70
-        do_action('geodir_add_listing_form');
71
-    }
72
-    $output = ob_get_contents();
73
-
74
-    ob_end_clean();
75
-
76
-    return $output;
35
+	ob_start();
36
+	$defaults = array(
37
+		'pid' => '',
38
+		'listing_type' => 'gd_place',
39
+		'login_msg' => __('You must login to post.', 'geodirectory'),
40
+		'show_login' => false,
41
+	);
42
+	$params = shortcode_atts($defaults, $atts);
43
+
44
+	foreach ($params as $key => $value) {
45
+		$_REQUEST[$key] = $value;
46
+	}
47
+
48
+	$user_id = get_current_user_id();
49
+	if (!$user_id) {
50
+		echo $params['login_msg'];
51
+		if ($params['show_login']) {
52
+			echo "<br />";
53
+			$defaults = array(
54
+				'before_widget' => '',
55
+				'after_widget' => '',
56
+				'before_title' => '',
57
+				'after_title' => '',
58
+			);
59
+
60
+			geodir_loginwidget_output($defaults, $defaults);
61
+		}
62
+
63
+
64
+	} else {
65
+		###### MAIN CONTENT ######
66
+
67
+		/** This action is documented in geodirectory-templates/add-listing.php */
68
+		do_action('geodir_add_listing_page_mandatory');
69
+		/** This action is documented in geodirectory-templates/add-listing.php */
70
+		do_action('geodir_add_listing_form');
71
+	}
72
+	$output = ob_get_contents();
73
+
74
+	ob_end_clean();
75
+
76
+	return $output;
77 77
 }
78 78
 
79 79
 /**
@@ -101,136 +101,136 @@  discard block
 block discarded – undo
101 101
  */
102 102
 function geodir_sc_home_map($atts)
103 103
 {
104
-    ob_start();
105
-    $defaults = array(
106
-        'width' => '960',
107
-        'height' => '425',
108
-        'maptype' => 'ROADMAP',
109
-        'zoom' => '13',
110
-        'autozoom' => '',
111
-        'child_collapse' => '0',
112
-        'scrollwheel' => '0',
104
+	ob_start();
105
+	$defaults = array(
106
+		'width' => '960',
107
+		'height' => '425',
108
+		'maptype' => 'ROADMAP',
109
+		'zoom' => '13',
110
+		'autozoom' => '',
111
+		'child_collapse' => '0',
112
+		'scrollwheel' => '0',
113 113
 		'marker_cluster' => false,
114
-        'latitude' => '',
115
-        'longitude' => ''
116
-    );
117
-
118
-    $params = shortcode_atts($defaults, $atts);
119
-
120
-    $params = gdsc_validate_map_args($params);
121
-
122
-    $map_args = array(
123
-        'map_canvas_name' => 'gd_home_map',
124
-        'latitude' => $params['latitude'],
125
-        'longitude' => $params['longitude'],
126
-
127
-        /**
128
-         * Filter the widget width of the map on home/listings page.
129
-         *
130
-         * @since 1.0.0
131
-         * @param mixed(string|int|float) $params['width'] The map width.
132
-         */
133
-        'width' => apply_filters('widget_width', $params['width']),
134
-        /**
135
-         * Filter the widget height of the map on home/listings page.
136
-         *
137
-         * @since 1.0.0
138
-         * @param mixed(string|int|float) $params['height'] The map height.
139
-         */
140
-        'height' => apply_filters('widget_heigh', $params['height']),
141
-        /**
142
-         * Filter the widget maptype of the map on home/listings page.
143
-         *
144
-         * @since 1.0.0
114
+		'latitude' => '',
115
+		'longitude' => ''
116
+	);
117
+
118
+	$params = shortcode_atts($defaults, $atts);
119
+
120
+	$params = gdsc_validate_map_args($params);
121
+
122
+	$map_args = array(
123
+		'map_canvas_name' => 'gd_home_map',
124
+		'latitude' => $params['latitude'],
125
+		'longitude' => $params['longitude'],
126
+
127
+		/**
128
+		 * Filter the widget width of the map on home/listings page.
129
+		 *
130
+		 * @since 1.0.0
131
+		 * @param mixed(string|int|float) $params['width'] The map width.
132
+		 */
133
+		'width' => apply_filters('widget_width', $params['width']),
134
+		/**
135
+		 * Filter the widget height of the map on home/listings page.
136
+		 *
137
+		 * @since 1.0.0
138
+		 * @param mixed(string|int|float) $params['height'] The map height.
139
+		 */
140
+		'height' => apply_filters('widget_heigh', $params['height']),
141
+		/**
142
+		 * Filter the widget maptype of the map on home/listings page.
143
+		 *
144
+		 * @since 1.0.0
145 145
 		 * @since 1.5.2 Added TERRAIN map type.
146
-         * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN.
147
-         */
148
-        'maptype' => apply_filters('widget_maptype', $params['maptype']),
149
-        /**
150
-         * Filter the widget scrollwheel value of the map on home/listings page.
151
-         *
152
-         * Should the scrollwheel zoom the map or not.
153
-         *
154
-         * @since 1.0.0
155
-         * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not.
156
-         */
157
-        'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']),
158
-        /**
159
-         * Filter the widget zoom level of the map on home/listings page.
160
-         *
161
-         * @since 1.0.0
162
-         * @param int $params['zoom'] The zoom level of the map. Between 1-19.
163
-         */
164
-        'zoom' => apply_filters('widget_zoom', $params['zoom']),
165
-        /**
166
-         * Filter the widget auto zoom value of the map on home/listings page.
167
-         *
168
-         * If the map should autozoom to fit the markers shown.
169
-         *
170
-         * @since 1.0.0
171
-         * @param bool $params['autozoom'] True if the map should autozoom, false if not.
172
-         */
173
-        'autozoom' => apply_filters('widget_autozoom', $params['autozoom']),
174
-        /**
175
-         * Filter the widget child_collapse value of the map on home/listings page.
176
-         *
177
-         * If the map should auto collapse the child categories if the category bar is present.
178
-         *
179
-         * @since 1.0.0
180
-         * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not.
181
-         */
182
-        'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']),
183
-        'enable_cat_filters' => true,
184
-        'enable_text_search' => true,
185
-        'enable_post_type_filters' => true,
186
-        /**
187
-         * Filter the widget enable_location_filters value of the map on home/listings page.
188
-         *
189
-         * This is used when the location addon is used.
190
-         *
191
-         * @since 1.0.0
192
-         * @param bool $val True if location filters should be used, false if not.
193
-         */
194
-        'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false),
195
-        'enable_jason_on_load' => false,
196
-        'enable_marker_cluster' => false,
197
-        'enable_map_resize_button' => true,
198
-        'map_class_name' => 'geodir-map-home-page',
199
-        'is_geodir_home_map_widget' => true,
200
-    );
146
+		 * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN.
147
+		 */
148
+		'maptype' => apply_filters('widget_maptype', $params['maptype']),
149
+		/**
150
+		 * Filter the widget scrollwheel value of the map on home/listings page.
151
+		 *
152
+		 * Should the scrollwheel zoom the map or not.
153
+		 *
154
+		 * @since 1.0.0
155
+		 * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not.
156
+		 */
157
+		'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']),
158
+		/**
159
+		 * Filter the widget zoom level of the map on home/listings page.
160
+		 *
161
+		 * @since 1.0.0
162
+		 * @param int $params['zoom'] The zoom level of the map. Between 1-19.
163
+		 */
164
+		'zoom' => apply_filters('widget_zoom', $params['zoom']),
165
+		/**
166
+		 * Filter the widget auto zoom value of the map on home/listings page.
167
+		 *
168
+		 * If the map should autozoom to fit the markers shown.
169
+		 *
170
+		 * @since 1.0.0
171
+		 * @param bool $params['autozoom'] True if the map should autozoom, false if not.
172
+		 */
173
+		'autozoom' => apply_filters('widget_autozoom', $params['autozoom']),
174
+		/**
175
+		 * Filter the widget child_collapse value of the map on home/listings page.
176
+		 *
177
+		 * If the map should auto collapse the child categories if the category bar is present.
178
+		 *
179
+		 * @since 1.0.0
180
+		 * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not.
181
+		 */
182
+		'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']),
183
+		'enable_cat_filters' => true,
184
+		'enable_text_search' => true,
185
+		'enable_post_type_filters' => true,
186
+		/**
187
+		 * Filter the widget enable_location_filters value of the map on home/listings page.
188
+		 *
189
+		 * This is used when the location addon is used.
190
+		 *
191
+		 * @since 1.0.0
192
+		 * @param bool $val True if location filters should be used, false if not.
193
+		 */
194
+		'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false),
195
+		'enable_jason_on_load' => false,
196
+		'enable_marker_cluster' => false,
197
+		'enable_map_resize_button' => true,
198
+		'map_class_name' => 'geodir-map-home-page',
199
+		'is_geodir_home_map_widget' => true,
200
+	);
201 201
 
202 202
 	// Add marker cluster
203 203
 	if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
204
-        $map_args['enable_marker_cluster'] = true;
205
-        if(get_option('geodir_marker_cluster_type')) {
206
-            if ($map_args['autozoom']) {
207
-                $map_args['enable_marker_cluster_no_reposition'] = false;
208
-            } else {
209
-                $map_args['enable_marker_cluster_no_reposition'] = true;
210
-            }
204
+		$map_args['enable_marker_cluster'] = true;
205
+		if(get_option('geodir_marker_cluster_type')) {
206
+			if ($map_args['autozoom']) {
207
+				$map_args['enable_marker_cluster_no_reposition'] = false;
208
+			} else {
209
+				$map_args['enable_marker_cluster_no_reposition'] = true;
210
+			}
211 211
 
212
-            $map_args['enable_marker_cluster_server'] = true ;
212
+			$map_args['enable_marker_cluster_server'] = true ;
213 213
 
214
-        }
214
+		}
215 215
 	} else {
216 216
 		$map_args['enable_marker_cluster'] = false;
217 217
 	}
218 218
 
219
-    // if lat and long set in shortcode, hack it so the map is not repositioned
220
-    if(!empty($params['latitude']) && !empty($params['longitude']) ){
221
-        $map_args['enable_marker_cluster_no_reposition'] = true;
222
-    }
219
+	// if lat and long set in shortcode, hack it so the map is not repositioned
220
+	if(!empty($params['latitude']) && !empty($params['longitude']) ){
221
+		$map_args['enable_marker_cluster_no_reposition'] = true;
222
+	}
223 223
 
224 224
 
225
-    geodir_draw_map($map_args);
225
+	geodir_draw_map($map_args);
226 226
 
227
-    add_action('wp_footer', 'geodir_home_map_add_script', 100);
227
+	add_action('wp_footer', 'geodir_home_map_add_script', 100);
228 228
 
229
-    $output = ob_get_contents();
229
+	$output = ob_get_contents();
230 230
 
231
-    ob_end_clean();
231
+	ob_end_clean();
232 232
 
233
-    return $output;
233
+	return $output;
234 234
 }
235 235
 add_shortcode('gd_homepage_map', 'geodir_sc_home_map');
236 236
 
@@ -264,77 +264,77 @@  discard block
 block discarded – undo
264 264
  */
265 265
 function geodir_sc_listing_map($atts)
266 266
 {
267
-    ob_start();
268
-    add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
269
-
270
-    add_action('the_post', 'create_list_jsondata'); // Add marker in json array
271
-
272
-    add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
273
-
274
-    $defaults = array(
275
-        'width' => '294',
276
-        'height' => '370',
277
-        'zoom' => '13',
278
-        'autozoom' => '',
279
-        'sticky' => '',
280
-        'showall' => '0',
281
-        'scrollwheel' => '0',
282
-        'maptype' => 'ROADMAP',
283
-        'child_collapse' => 0,
267
+	ob_start();
268
+	add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
269
+
270
+	add_action('the_post', 'create_list_jsondata'); // Add marker in json array
271
+
272
+	add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
273
+
274
+	$defaults = array(
275
+		'width' => '294',
276
+		'height' => '370',
277
+		'zoom' => '13',
278
+		'autozoom' => '',
279
+		'sticky' => '',
280
+		'showall' => '0',
281
+		'scrollwheel' => '0',
282
+		'maptype' => 'ROADMAP',
283
+		'child_collapse' => 0,
284 284
 		'marker_cluster' => false
285
-    );
286
-
287
-    $params = shortcode_atts($defaults, $atts);
288
-
289
-    $params = gdsc_validate_map_args($params);
290
-
291
-    $map_args = array(
292
-        'map_canvas_name' => 'gd_listing_map',
293
-        'width' => $params['width'],
294
-        'height' => $params['height'],
295
-        'zoom' => $params['zoom'],
296
-        'autozoom' => $params['autozoom'],
297
-        'sticky' => $params['sticky'],
298
-        'showall' => $params['showall'],
299
-        'scrollwheel' => $params['scrollwheel'],
300
-        'child_collapse' => 0,
301
-        'enable_cat_filters' => false,
302
-        'enable_text_search' => false,
303
-        'enable_post_type_filters' => false,
304
-        'enable_location_filters' => false,
305
-        'enable_jason_on_load' => true,
306
-    );
307
-
308
-    if (is_single()) {
309
-
310
-        global $post;
311
-        $map_default_lat = $address_latitude = $post->post_latitude;
312
-        $map_default_lng = $address_longitude = $post->post_longitude;
313
-        $mapview = $post->post_mapview;
314
-        $map_args['zoom'] = $post->post_mapzoom;
315
-        $map_args['map_class_name'] = 'geodir-map-listing-page-single';
316
-
317
-    } else {
318
-        $default_location = geodir_get_default_location();
319
-
320
-        $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
321
-        $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
322
-        $map_args['map_class_name'] = 'geodir-map-listing-page';
323
-    }
324
-
325
-    if (empty($mapview)) {
326
-        $mapview = 'ROADMAP';
327
-    }
328
-
329
-    // Set default map options
330
-    $map_args['ajax_url'] = geodir_get_ajax_url();
331
-    $map_args['latitude'] = $map_default_lat;
332
-    $map_args['longitude'] = $map_default_lng;
333
-    $map_args['streetViewControl'] = true;
334
-    $map_args['maptype'] = $mapview;
335
-    $map_args['showPreview'] = '0';
336
-    $map_args['maxZoom'] = 21;
337
-    $map_args['bubble_size'] = 'small';
285
+	);
286
+
287
+	$params = shortcode_atts($defaults, $atts);
288
+
289
+	$params = gdsc_validate_map_args($params);
290
+
291
+	$map_args = array(
292
+		'map_canvas_name' => 'gd_listing_map',
293
+		'width' => $params['width'],
294
+		'height' => $params['height'],
295
+		'zoom' => $params['zoom'],
296
+		'autozoom' => $params['autozoom'],
297
+		'sticky' => $params['sticky'],
298
+		'showall' => $params['showall'],
299
+		'scrollwheel' => $params['scrollwheel'],
300
+		'child_collapse' => 0,
301
+		'enable_cat_filters' => false,
302
+		'enable_text_search' => false,
303
+		'enable_post_type_filters' => false,
304
+		'enable_location_filters' => false,
305
+		'enable_jason_on_load' => true,
306
+	);
307
+
308
+	if (is_single()) {
309
+
310
+		global $post;
311
+		$map_default_lat = $address_latitude = $post->post_latitude;
312
+		$map_default_lng = $address_longitude = $post->post_longitude;
313
+		$mapview = $post->post_mapview;
314
+		$map_args['zoom'] = $post->post_mapzoom;
315
+		$map_args['map_class_name'] = 'geodir-map-listing-page-single';
316
+
317
+	} else {
318
+		$default_location = geodir_get_default_location();
319
+
320
+		$map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
321
+		$map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
322
+		$map_args['map_class_name'] = 'geodir-map-listing-page';
323
+	}
324
+
325
+	if (empty($mapview)) {
326
+		$mapview = 'ROADMAP';
327
+	}
328
+
329
+	// Set default map options
330
+	$map_args['ajax_url'] = geodir_get_ajax_url();
331
+	$map_args['latitude'] = $map_default_lat;
332
+	$map_args['longitude'] = $map_default_lng;
333
+	$map_args['streetViewControl'] = true;
334
+	$map_args['maptype'] = $mapview;
335
+	$map_args['showPreview'] = '0';
336
+	$map_args['maxZoom'] = 21;
337
+	$map_args['bubble_size'] = 'small';
338 338
 	
339 339
 	// Add marker cluster
340 340
 	if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
@@ -343,13 +343,13 @@  discard block
 block discarded – undo
343 343
 		$map_args['enable_marker_cluster'] = false;
344 344
 	}
345 345
 
346
-    geodir_draw_map($map_args);
346
+	geodir_draw_map($map_args);
347 347
 
348
-    $output = ob_get_contents();
348
+	$output = ob_get_contents();
349 349
 
350
-    ob_end_clean();
350
+	ob_end_clean();
351 351
 
352
-    return $output;
352
+	return $output;
353 353
 }
354 354
 
355 355
 add_shortcode('gd_listing_slider', 'geodir_sc_listing_slider');
@@ -382,120 +382,120 @@  discard block
 block discarded – undo
382 382
  */
383 383
 function geodir_sc_listing_slider($atts)
384 384
 {
385
-    ob_start();
386
-    $defaults = array(
387
-        'post_type' => 'gd_place',
388
-        'category' => '0',
389
-        'post_number' => '5',
390
-        'slideshow' => '0',
391
-        'animation_loop' => 0,
392
-        'direction_nav' => 0,
393
-        'slideshow_speed' => 5000,
394
-        'animation_speed' => 600,
395
-        'animation' => 'slide',
396
-        'order_by' => 'latest',
397
-        'show_title' => '',
398
-        'show_featured_only' => '',
399
-        'title' => '',
400
-    );
401
-
402
-    $params = shortcode_atts($defaults, $atts);
403
-
404
-
405
-    /*
385
+	ob_start();
386
+	$defaults = array(
387
+		'post_type' => 'gd_place',
388
+		'category' => '0',
389
+		'post_number' => '5',
390
+		'slideshow' => '0',
391
+		'animation_loop' => 0,
392
+		'direction_nav' => 0,
393
+		'slideshow_speed' => 5000,
394
+		'animation_speed' => 600,
395
+		'animation' => 'slide',
396
+		'order_by' => 'latest',
397
+		'show_title' => '',
398
+		'show_featured_only' => '',
399
+		'title' => '',
400
+	);
401
+
402
+	$params = shortcode_atts($defaults, $atts);
403
+
404
+
405
+	/*
406 406
      *
407 407
      * Now we begin the validation of the attributes.
408 408
      */
409
-    // Check we have a valid post_type
410
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
411
-        $params['post_type'] = 'gd_place';
412
-    }
413
-
414
-    // Check we have a valid sort_order
415
-    $params['order_by'] = gdsc_validate_sort_choice($params['order_by']);
416
-
417
-    // Match the chosen animation to our options
418
-    $animation_list = array('slide', 'fade');
419
-    if (!(in_array($params['animation'], $animation_list))) {
420
-        $params['animation'] = 'slide';
421
-    }
422
-
423
-    // Post_number needs to be a positive integer
424
-    $params['post_number'] = absint($params['post_number']);
425
-    if (0 == $params['post_number']) {
426
-        $params['post_number'] = 1;
427
-    }
428
-
429
-    // Manage the entered categories
430
-    if (0 != $params['category'] || '' != $params['category']) {
431
-        $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']);
432
-    }
433
-    // Convert show_title to a bool
434
-    $params['show_title'] = intval(gdsc_to_bool_val($params['show_title']));
435
-
436
-    // Convert show_featured_only to a bool
437
-    $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only']));
438
-
439
-    /*
409
+	// Check we have a valid post_type
410
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
411
+		$params['post_type'] = 'gd_place';
412
+	}
413
+
414
+	// Check we have a valid sort_order
415
+	$params['order_by'] = gdsc_validate_sort_choice($params['order_by']);
416
+
417
+	// Match the chosen animation to our options
418
+	$animation_list = array('slide', 'fade');
419
+	if (!(in_array($params['animation'], $animation_list))) {
420
+		$params['animation'] = 'slide';
421
+	}
422
+
423
+	// Post_number needs to be a positive integer
424
+	$params['post_number'] = absint($params['post_number']);
425
+	if (0 == $params['post_number']) {
426
+		$params['post_number'] = 1;
427
+	}
428
+
429
+	// Manage the entered categories
430
+	if (0 != $params['category'] || '' != $params['category']) {
431
+		$params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']);
432
+	}
433
+	// Convert show_title to a bool
434
+	$params['show_title'] = intval(gdsc_to_bool_val($params['show_title']));
435
+
436
+	// Convert show_featured_only to a bool
437
+	$params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only']));
438
+
439
+	/*
440 440
      * Hopefully all attributes are now valid, and safe to pass forward
441 441
      */
442 442
 
443
-    // redeclare vars after validation
444
-
445
-    if (isset($params['direction_nav'])) {
446
-        $params['directionNav'] = $params['direction_nav'];
447
-    }
448
-    if (isset($params['animation_loop'])) {
449
-        $params['animationLoop'] = $params['animation_loop'];
450
-    }
451
-    if (isset($params['slideshow_speed'])) {
452
-        $params['slideshowSpeed'] = $params['slideshow_speed'];
453
-    }
454
-    if (isset($params['animation_speed'])) {
455
-        $params['animationSpeed'] = $params['animation_speed'];
456
-    }
457
-    if (isset($params['order_by'])) {
458
-        $params['list_sort'] = $params['order_by'];
459
-    }
460
-
461
-    $query_args = array(
462
-        'post_number' => $params['post_number'],
463
-        'is_geodir_loop' => true,
464
-        'post_type' => $params['post_type'],
465
-        'order_by' => $params['order_by']
466
-    );
467
-
468
-    if (1 == $params['show_featured_only']) {
469
-        $query_args['show_featured_only'] = 1;
470
-    }
471
-
472
-    if (0 != $params['category'] && '' != $params['category']) {
473
-        $category_taxonomy = geodir_get_taxonomies($params['post_type']);
474
-        $tax_query = array(
475
-            'taxonomy' => $category_taxonomy[0],
476
-            'field' => 'id',
477
-            'terms' => $params['category'],
478
-        );
479
-
480
-        $query_args['tax_query'] = array($tax_query);
481
-    }
482
-
483
-    $defaults = array(
484
-        'before_widget' => '',
485
-        'after_widget' => '',
486
-        'before_title' => '',
487
-        'after_title' => '',
488
-    );
489
-
490
-    $query_args = array_merge($query_args, $params);
491
-
492
-    geodir_listing_slider_widget_output($defaults, $query_args);
493
-
494
-    $output = ob_get_contents();
495
-
496
-    ob_end_clean();
497
-
498
-    return $output;
443
+	// redeclare vars after validation
444
+
445
+	if (isset($params['direction_nav'])) {
446
+		$params['directionNav'] = $params['direction_nav'];
447
+	}
448
+	if (isset($params['animation_loop'])) {
449
+		$params['animationLoop'] = $params['animation_loop'];
450
+	}
451
+	if (isset($params['slideshow_speed'])) {
452
+		$params['slideshowSpeed'] = $params['slideshow_speed'];
453
+	}
454
+	if (isset($params['animation_speed'])) {
455
+		$params['animationSpeed'] = $params['animation_speed'];
456
+	}
457
+	if (isset($params['order_by'])) {
458
+		$params['list_sort'] = $params['order_by'];
459
+	}
460
+
461
+	$query_args = array(
462
+		'post_number' => $params['post_number'],
463
+		'is_geodir_loop' => true,
464
+		'post_type' => $params['post_type'],
465
+		'order_by' => $params['order_by']
466
+	);
467
+
468
+	if (1 == $params['show_featured_only']) {
469
+		$query_args['show_featured_only'] = 1;
470
+	}
471
+
472
+	if (0 != $params['category'] && '' != $params['category']) {
473
+		$category_taxonomy = geodir_get_taxonomies($params['post_type']);
474
+		$tax_query = array(
475
+			'taxonomy' => $category_taxonomy[0],
476
+			'field' => 'id',
477
+			'terms' => $params['category'],
478
+		);
479
+
480
+		$query_args['tax_query'] = array($tax_query);
481
+	}
482
+
483
+	$defaults = array(
484
+		'before_widget' => '',
485
+		'after_widget' => '',
486
+		'before_title' => '',
487
+		'after_title' => '',
488
+	);
489
+
490
+	$query_args = array_merge($query_args, $params);
491
+
492
+	geodir_listing_slider_widget_output($defaults, $query_args);
493
+
494
+	$output = ob_get_contents();
495
+
496
+	ob_end_clean();
497
+
498
+	return $output;
499 499
 }
500 500
 
501 501
 add_shortcode('gd_login_box', 'geodir_sc_login_box');
@@ -519,22 +519,22 @@  discard block
 block discarded – undo
519 519
  */
520 520
 function geodir_sc_login_box($atts)
521 521
 {
522
-    ob_start();
522
+	ob_start();
523 523
 
524
-    $defaults = array(
525
-        'before_widget' => '',
526
-        'after_widget' => '',
527
-        'before_title' => '',
528
-        'after_title' => '',
529
-    );
524
+	$defaults = array(
525
+		'before_widget' => '',
526
+		'after_widget' => '',
527
+		'before_title' => '',
528
+		'after_title' => '',
529
+	);
530 530
 
531
-    geodir_loginwidget_output($defaults, $defaults);
531
+	geodir_loginwidget_output($defaults, $defaults);
532 532
 
533
-    $output = ob_get_contents();
533
+	$output = ob_get_contents();
534 534
 
535
-    ob_end_clean();
535
+	ob_end_clean();
536 536
 
537
-    return $output;
537
+	return $output;
538 538
 }
539 539
 
540 540
 add_shortcode('gd_popular_post_category', 'geodir_sc_popular_post_category');
@@ -563,28 +563,28 @@  discard block
 block discarded – undo
563 563
  */
564 564
 function geodir_sc_popular_post_category($atts)
565 565
 {
566
-    ob_start();
567
-    global $geodir_post_category_str;
568
-    $defaults = array(
569
-        'category_limit' => 15,
570
-        'before_widget' => '',
571
-        'after_widget' => '',
572
-        'before_title' => '',
573
-        'after_title' => '',
574
-        'title' => '',
566
+	ob_start();
567
+	global $geodir_post_category_str;
568
+	$defaults = array(
569
+		'category_limit' => 15,
570
+		'before_widget' => '',
571
+		'after_widget' => '',
572
+		'before_title' => '',
573
+		'after_title' => '',
574
+		'title' => '',
575 575
 		'default_post_type' => '',
576
-    );
576
+	);
577 577
 
578
-    $params = shortcode_atts($defaults, $atts, 'popular_post_category');
579
-    $params['category_limit'] = absint($params['category_limit']);
578
+	$params = shortcode_atts($defaults, $atts, 'popular_post_category');
579
+	$params['category_limit'] = absint($params['category_limit']);
580 580
 	$params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : '';
581
-    geodir_popular_post_category_output($params, $params);
581
+	geodir_popular_post_category_output($params, $params);
582 582
 
583
-    $output = ob_get_contents();
583
+	$output = ob_get_contents();
584 584
 
585
-    ob_end_clean();
585
+	ob_end_clean();
586 586
 
587
-    return $output;
587
+	return $output;
588 588
 }
589 589
 
590 590
 add_shortcode('gd_popular_post_view', 'geodir_sc_popular_post_view');
@@ -624,97 +624,97 @@  discard block
 block discarded – undo
624 624
  */
625 625
 function geodir_sc_popular_post_view($atts)
626 626
 {
627
-    ob_start();
628
-    $defaults = array(
629
-        'post_type' => 'gd_place',
630
-        'category' => '0',
631
-        'post_number' => '5',
632
-        'layout' => 'gridview_onehalf',
633
-        'add_location_filter' => '0',
634
-        'list_sort' => 'latest',
635
-        'use_viewing_post_type' => '1',
636
-        'character_count' => '20',
637
-        'listing_width' => '',
638
-        'show_featured_only' => '0',
639
-        'show_special_only' => '0',
640
-        'with_pics_only' => '0',
641
-        'with_videos_only' => '0',
642
-        'before_widget' => '',
643
-        'after_widget' => '',
644
-        'before_title' => '<h3 class="widget-title">',
645
-        'after_title' => '</h3>',
646
-        'title' => '',
647
-        'category_title' => '',
648
-    );
649
-
650
-    $params = shortcode_atts($defaults, $atts);
651
-
652
-    /**
653
-     * Validate our incoming params
654
-     */
627
+	ob_start();
628
+	$defaults = array(
629
+		'post_type' => 'gd_place',
630
+		'category' => '0',
631
+		'post_number' => '5',
632
+		'layout' => 'gridview_onehalf',
633
+		'add_location_filter' => '0',
634
+		'list_sort' => 'latest',
635
+		'use_viewing_post_type' => '1',
636
+		'character_count' => '20',
637
+		'listing_width' => '',
638
+		'show_featured_only' => '0',
639
+		'show_special_only' => '0',
640
+		'with_pics_only' => '0',
641
+		'with_videos_only' => '0',
642
+		'before_widget' => '',
643
+		'after_widget' => '',
644
+		'before_title' => '<h3 class="widget-title">',
645
+		'after_title' => '</h3>',
646
+		'title' => '',
647
+		'category_title' => '',
648
+	);
655 649
 
656
-    // Validate the selected post type, default to gd_place on fail
657
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
658
-        $params['post_type'] = 'gd_place';
659
-    }
660
-
661
-    // Validate the selected category/ies - Grab the current list based on post_type
662
-    $category_taxonomy = geodir_get_taxonomies($params['post_type']);
663
-    $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
664
-
665
-    // Make sure we have an array
666
-    if (!(is_array($params['category']))) {
667
-        $params['category'] = explode(',', $params['category']);
668
-    }
669
-
670
-    // Array_intersect returns only the items in $params['category'] that are also in our category list
671
-    // Otherwise it becomes empty and later on that will mean "All"
672
-    $params['category'] = array_intersect($params['category'], $categories);
673
-
674
-    // Post_number needs to be a positive integer
675
-    $params['post_number'] = absint($params['post_number']);
676
-    if (0 == $params['post_number']) {
677
-        $params['post_number'] = 1;
678
-    }
679
-
680
-    // Validate our layout choice
681
-    // Outside of the norm, I added some more simple terms to match the existing
682
-    // So now I just run the switch to set it properly.
683
-    $params['layout'] = gdsc_validate_layout_choice($params['layout']);
684
-
685
-    // Validate our sorting choice
686
-    $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
687
-
688
-    // Validate character_count
689
-    $params['character_count'] = absint($params['character_count']);
690
-    if (20 > $params['character_count']) {
691
-        $params['character_count'] = 20;
692
-    }
693
-
694
-    // Validate Listing width, used in the template widget-listing-listview.php
695
-    // The context is in width=$listing_width% - So we need a positive number between 0 & 100
696
-    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
697
-
698
-    // Validate the checkboxes used on the widget
699
-    $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
700
-    $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']);
701
-    $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']);
702
-    $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']);
703
-    $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']);
704
-    $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']);
705
-
706
-    /**
707
-     * End of validation
708
-     */
650
+	$params = shortcode_atts($defaults, $atts);
651
+
652
+	/**
653
+	 * Validate our incoming params
654
+	 */
655
+
656
+	// Validate the selected post type, default to gd_place on fail
657
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
658
+		$params['post_type'] = 'gd_place';
659
+	}
709 660
 
710
-    geodir_popular_postview_output($params, $params);
661
+	// Validate the selected category/ies - Grab the current list based on post_type
662
+	$category_taxonomy = geodir_get_taxonomies($params['post_type']);
663
+	$categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
711 664
 
665
+	// Make sure we have an array
666
+	if (!(is_array($params['category']))) {
667
+		$params['category'] = explode(',', $params['category']);
668
+	}
669
+
670
+	// Array_intersect returns only the items in $params['category'] that are also in our category list
671
+	// Otherwise it becomes empty and later on that will mean "All"
672
+	$params['category'] = array_intersect($params['category'], $categories);
673
+
674
+	// Post_number needs to be a positive integer
675
+	$params['post_number'] = absint($params['post_number']);
676
+	if (0 == $params['post_number']) {
677
+		$params['post_number'] = 1;
678
+	}
712 679
 
713
-    $output = ob_get_contents();
680
+	// Validate our layout choice
681
+	// Outside of the norm, I added some more simple terms to match the existing
682
+	// So now I just run the switch to set it properly.
683
+	$params['layout'] = gdsc_validate_layout_choice($params['layout']);
714 684
 
715
-    ob_end_clean();
685
+	// Validate our sorting choice
686
+	$params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
716 687
 
717
-    return $output;
688
+	// Validate character_count
689
+	$params['character_count'] = absint($params['character_count']);
690
+	if (20 > $params['character_count']) {
691
+		$params['character_count'] = 20;
692
+	}
693
+
694
+	// Validate Listing width, used in the template widget-listing-listview.php
695
+	// The context is in width=$listing_width% - So we need a positive number between 0 & 100
696
+	$params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
697
+
698
+	// Validate the checkboxes used on the widget
699
+	$params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
700
+	$params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']);
701
+	$params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']);
702
+	$params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']);
703
+	$params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']);
704
+	$params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']);
705
+
706
+	/**
707
+	 * End of validation
708
+	 */
709
+
710
+	geodir_popular_postview_output($params, $params);
711
+
712
+
713
+	$output = ob_get_contents();
714
+
715
+	ob_end_clean();
716
+
717
+	return $output;
718 718
 }
719 719
 
720 720
 add_shortcode('gd_recent_reviews', 'geodir_sc_recent_reviews');
@@ -736,37 +736,37 @@  discard block
 block discarded – undo
736 736
  * @return string Recent reviews HTML.
737 737
  */
738 738
 function geodir_sc_recent_reviews($atts) {
739
-    ob_start();
740
-    $defaults = array(
739
+	ob_start();
740
+	$defaults = array(
741 741
 		'title' => '',
742 742
 		'count' => 5,
743
-    );
743
+	);
744 744
 
745
-    $params = shortcode_atts($defaults, $atts);
745
+	$params = shortcode_atts($defaults, $atts);
746 746
 
747
-    $count = absint($params['count']);
748
-    if (0 == $count) {
749
-        $count = 1;
750
-    }
747
+	$count = absint($params['count']);
748
+	if (0 == $count) {
749
+		$count = 1;
750
+	}
751 751
 	
752 752
 	$title = !empty($params['title']) ? __($params['title'], 'geodirectory') : '';
753 753
 
754
-    $comments_li = geodir_get_recent_reviews(30, $count, 100, false);
754
+	$comments_li = geodir_get_recent_reviews(30, $count, 100, false);
755 755
 
756
-    if ($comments_li) {
757
-        if ($title != '') { ?>
756
+	if ($comments_li) {
757
+		if ($title != '') { ?>
758 758
 		<h3 class="geodir-sc-recent-reviews-title widget-title"><?php echo $title; ?></h3>
759 759
 		<?php } ?>
760 760
         <div class="geodir_sc_recent_reviews_section">
761 761
             <ul class="geodir_sc_recent_reviews"><?php echo $comments_li; ?></ul>
762 762
         </div>
763 763
     <?php
764
-    }
765
-    $output = ob_get_contents();
764
+	}
765
+	$output = ob_get_contents();
766 766
 
767
-    ob_end_clean();
767
+	ob_end_clean();
768 768
 
769
-    return $output;
769
+	return $output;
770 770
 }
771 771
 
772 772
 add_shortcode('gd_related_listings', 'geodir_sc_related_listings');
@@ -796,64 +796,64 @@  discard block
 block discarded – undo
796 796
  */
797 797
 function geodir_sc_related_listings($atts)
798 798
 {
799
-    ob_start();
800
-    $defaults = array(
801
-        'post_number' => 5,
802
-        'relate_to' => 'category',
803
-        'layout' => 'gridview_onehalf',
804
-        'add_location_filter' => 0,
805
-        'listing_width' => '',
806
-        'list_sort' => 'latest',
807
-        'character_count' => 20,
808
-        'is_widget' => 1,
809
-        'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>',
810
-    );
811
-    // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet.
812
-
813
-    $params = shortcode_atts($defaults, $atts);
814
-
815
-    /**
816
-     * Begin validating parameters
817
-     */
799
+	ob_start();
800
+	$defaults = array(
801
+		'post_number' => 5,
802
+		'relate_to' => 'category',
803
+		'layout' => 'gridview_onehalf',
804
+		'add_location_filter' => 0,
805
+		'listing_width' => '',
806
+		'list_sort' => 'latest',
807
+		'character_count' => 20,
808
+		'is_widget' => 1,
809
+		'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>',
810
+	);
811
+	// The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet.
812
+
813
+	$params = shortcode_atts($defaults, $atts);
814
+
815
+	/**
816
+	 * Begin validating parameters
817
+	 */
818 818
 
819
-    // Validate that post_number is a number and is 1 or higher
820
-    $params['post_number'] = absint($params['post_number']);
821
-    if (0 === $params['post_number']) {
822
-        $params['post_number'] = 1;
823
-    }
819
+	// Validate that post_number is a number and is 1 or higher
820
+	$params['post_number'] = absint($params['post_number']);
821
+	if (0 === $params['post_number']) {
822
+		$params['post_number'] = 1;
823
+	}
824 824
 
825
-    // Validate relate_to - only category or tags
826
-    $params['relate_to'] = geodir_strtolower($params['relate_to']);
827
-    if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) {
828
-        $params['relate_to'] = 'category';
829
-    }
825
+	// Validate relate_to - only category or tags
826
+	$params['relate_to'] = geodir_strtolower($params['relate_to']);
827
+	if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) {
828
+		$params['relate_to'] = 'category';
829
+	}
830 830
 
831
-    // Validate layout selection
832
-    $params['layout'] = gdsc_validate_layout_choice($params['layout']);
831
+	// Validate layout selection
832
+	$params['layout'] = gdsc_validate_layout_choice($params['layout']);
833 833
 
834
-    // Validate sorting option
835
-    $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
834
+	// Validate sorting option
835
+	$params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
836 836
 
837
-    // Validate add_location_filter
838
-    $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
837
+	// Validate add_location_filter
838
+	$params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
839 839
 
840
-    // Validate listing_width
841
-    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
840
+	// Validate listing_width
841
+	$params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
842 842
 
843
-    // Validate character_count
844
-    $params['character_count'] = absint($params['character_count']);
845
-    if (20 > $params['character_count']) {
846
-        $params['character_count'] = 20;
847
-    }
843
+	// Validate character_count
844
+	$params['character_count'] = absint($params['character_count']);
845
+	if (20 > $params['character_count']) {
846
+		$params['character_count'] = 20;
847
+	}
848 848
 
849
-    if ($related_display = geodir_related_posts_display($params)) {
850
-        echo $related_display;
851
-    }
852
-    $output = ob_get_contents();
849
+	if ($related_display = geodir_related_posts_display($params)) {
850
+		echo $related_display;
851
+	}
852
+	$output = ob_get_contents();
853 853
 
854
-    ob_end_clean();
854
+	ob_end_clean();
855 855
 
856
-    return $output;
856
+	return $output;
857 857
 }
858 858
 
859 859
 /**
@@ -877,12 +877,12 @@  discard block
 block discarded – undo
877 877
  * @return string Advanced search widget HTML.
878 878
  */
879 879
 function geodir_sc_advanced_search($atts) {
880
-    $defaults = array(
880
+	$defaults = array(
881 881
 		'title' => '',
882 882
 		'before_widget' => '<section id="geodir_advanced_search-1" class="widget geodir-widget geodir_advanced_search_widget">',
883
-        'after_widget' => '</section>',
884
-        'before_title' => '<h3 class="widget-title">',
885
-        'after_title' => '</h3>',
883
+		'after_widget' => '</section>',
884
+		'before_title' => '<h3 class="widget-title">',
885
+		'after_title' => '</h3>',
886 886
 		'show_adv_search' => 'default'
887 887
 	);
888 888
 	
@@ -906,9 +906,9 @@  discard block
 block discarded – undo
906 906
 	the_widget('geodir_advance_search_widget', $params, $params );
907 907
 	
908 908
 	$output = ob_get_contents();
909
-    ob_end_clean();
909
+	ob_end_clean();
910 910
 
911
-    return $output;
911
+	return $output;
912 912
 }
913 913
 add_shortcode('gd_advanced_search', 'geodir_sc_advanced_search');
914 914
 
@@ -954,48 +954,48 @@  discard block
 block discarded – undo
954 954
 		'add_location_filter' => '1',
955 955
 		'tab_layout' => 'bestof-tabs-on-top',
956 956
 		'before_widget' => '<section id="bestof_widget-1" class="widget geodir-widget geodir_bestof_widget geodir_sc_bestof_widget">',
957
-        'after_widget' => '</section>',
958
-        'before_title' => '<h3 class="widget-title">',
959
-        'after_title' => '</h3>',
957
+		'after_widget' => '</section>',
958
+		'before_title' => '<h3 class="widget-title">',
959
+		'after_title' => '</h3>',
960 960
 	);
961 961
 	$params = shortcode_atts($defaults, $atts);
962 962
 
963
-    /**
964
-     * Validate our incoming params
965
-     */
963
+	/**
964
+	 * Validate our incoming params
965
+	 */
966 966
 
967
-    // Validate the selected post type, default to gd_place on fail
968
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
969
-        $params['post_type'] = 'gd_place';
970
-    }
967
+	// Validate the selected post type, default to gd_place on fail
968
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
969
+		$params['post_type'] = 'gd_place';
970
+	}
971 971
 	
972 972
 	// Post limit needs to be a positive integer
973
-    $params['post_limit'] = absint($params['post_limit']);
974
-    if (0 == $params['post_limit']) {
975
-        $params['post_limit'] = 5;
976
-    }
973
+	$params['post_limit'] = absint($params['post_limit']);
974
+	if (0 == $params['post_limit']) {
975
+		$params['post_limit'] = 5;
976
+	}
977 977
 	
978 978
 	// Category limit needs to be a positive integer
979
-    $params['categ_limit'] = absint($params['categ_limit']);
980
-    if (0 == $params['categ_limit']) {
981
-        $params['categ_limit'] = 3;
982
-    }
979
+	$params['categ_limit'] = absint($params['categ_limit']);
980
+	if (0 == $params['categ_limit']) {
981
+		$params['categ_limit'] = 3;
982
+	}
983 983
 	
984 984
 	// Tab layout validation
985
-    $params['tab_layout'] = $params['tab_layout'];
986
-    if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) {
987
-        $params['tab_layout'] = 'bestof-tabs-on-top';
988
-    }
985
+	$params['tab_layout'] = $params['tab_layout'];
986
+	if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) {
987
+		$params['tab_layout'] = 'bestof-tabs-on-top';
988
+	}
989 989
 	
990 990
 	// Validate character_count
991
-    $params['character_count'] = $params['character_count'];
991
+	$params['character_count'] = $params['character_count'];
992 992
 
993 993
 	ob_start();
994 994
 	the_widget('geodir_bestof_widget', $params, $params);
995
-    $output = ob_get_contents();
996
-    ob_end_clean();
995
+	$output = ob_get_contents();
996
+	ob_end_clean();
997 997
 
998
-    return $output;
998
+	return $output;
999 999
 }
1000 1000
 add_shortcode('gd_bestof_widget', 'geodir_sc_bestof_widget');
1001 1001
 
@@ -1041,105 +1041,105 @@  discard block
 block discarded – undo
1041 1041
  * @return string HTML content to display geodirectory listings.
1042 1042
  */
1043 1043
 function geodir_sc_gd_listings($atts, $content = '') {
1044
-    global $post;
1044
+	global $post;
1045 1045
     
1046
-    $defaults = array(
1047
-        'title'                 => '',
1048
-        'post_type'             => 'gd_place',
1049
-        'category'              => 0,
1050
-        'list_sort'             => 'latest',
1051
-        'event_type'            => '',
1052
-        'post_number'           => 10,
1053
-        'post_author'           => '',
1054
-        'layout'                => 'gridview_onehalf',
1055
-        'listing_width'         => '',
1056
-        'character_count'       => 20,
1057
-        'add_location_filter'   => 1,
1058
-        'show_featured_only'    => '',
1059
-        'show_special_only'     => '',
1060
-        'with_pics_only'        => '',
1061
-        'with_videos_only'      => '',
1062
-        'with_pagination'       => '1',
1063
-        'top_pagination'        => '0',
1064
-        'bottom_pagination'     => '1',
1065
-    );
1066
-    $params = shortcode_atts($defaults, $atts);
1067
-
1068
-    $params['title']        = wp_strip_all_tags($params['title']);
1069
-    $params['post_type']    = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1070
-
1071
-    // Validate the selected category/ies - Grab the current list based on post_type
1072
-    $category_taxonomy      = geodir_get_taxonomies($params['post_type']);
1073
-    $categories             = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
1074
-
1075
-    // Make sure we have an array
1076
-    if (!(is_array($params['category']))) {
1077
-        $params['category'] = explode(',', $params['category']);
1078
-    }
1079
-
1080
-    // Array_intersect returns only the items in $params['category'] that are also in our category list
1081
-    // Otherwise it becomes empty and later on that will mean "All"
1082
-    $params['category']     = array_intersect($params['category'], $categories);
1083
-
1084
-    // Post_number needs to be a positive integer
1085
-    $params['post_number']  = absint($params['post_number']);
1086
-    $params['post_number']  = $params['post_number'] > 0 ? $params['post_number'] : 10;
1046
+	$defaults = array(
1047
+		'title'                 => '',
1048
+		'post_type'             => 'gd_place',
1049
+		'category'              => 0,
1050
+		'list_sort'             => 'latest',
1051
+		'event_type'            => '',
1052
+		'post_number'           => 10,
1053
+		'post_author'           => '',
1054
+		'layout'                => 'gridview_onehalf',
1055
+		'listing_width'         => '',
1056
+		'character_count'       => 20,
1057
+		'add_location_filter'   => 1,
1058
+		'show_featured_only'    => '',
1059
+		'show_special_only'     => '',
1060
+		'with_pics_only'        => '',
1061
+		'with_videos_only'      => '',
1062
+		'with_pagination'       => '1',
1063
+		'top_pagination'        => '0',
1064
+		'bottom_pagination'     => '1',
1065
+	);
1066
+	$params = shortcode_atts($defaults, $atts);
1067
+
1068
+	$params['title']        = wp_strip_all_tags($params['title']);
1069
+	$params['post_type']    = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1070
+
1071
+	// Validate the selected category/ies - Grab the current list based on post_type
1072
+	$category_taxonomy      = geodir_get_taxonomies($params['post_type']);
1073
+	$categories             = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
1074
+
1075
+	// Make sure we have an array
1076
+	if (!(is_array($params['category']))) {
1077
+		$params['category'] = explode(',', $params['category']);
1078
+	}
1079
+
1080
+	// Array_intersect returns only the items in $params['category'] that are also in our category list
1081
+	// Otherwise it becomes empty and later on that will mean "All"
1082
+	$params['category']     = array_intersect($params['category'], $categories);
1083
+
1084
+	// Post_number needs to be a positive integer
1085
+	$params['post_number']  = absint($params['post_number']);
1086
+	$params['post_number']  = $params['post_number'] > 0 ? $params['post_number'] : 10;
1087 1087
     
1088
-    // Post_number needs to be a positive integer
1089
-    if (!empty($atts['post_author'])) {
1090
-        if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') {
1091
-            $params['post_author'] = $post->post_author;
1092
-        } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) {
1093
-            $params['post_author'] = absint($atts['post_author']);
1094
-        } else {
1095
-            unset($params['post_author']);
1096
-        }
1097
-    } else {
1098
-        unset($params['post_author']);
1099
-    }
1100
-
1101
-    // Validate character_count
1102
-    //todo: is this necessary?
1103
-    $params['character_count']  = $params['character_count'];
1104
-
1105
-    // Validate our layout choice
1106
-    // Outside of the norm, I added some more simple terms to match the existing
1107
-    // So now I just run the switch to set it properly.
1108
-    $params['layout']           = gdsc_validate_layout_choice($params['layout']);
1109
-
1110
-    // Validate our sorting choice
1111
-    $params['list_sort']        = gdsc_validate_sort_choice($params['list_sort']);
1112
-
1113
-    // Validate Listing width, used in the template widget-listing-listview.php
1114
-    // The context is in width=$listing_width% - So we need a positive number between 0 & 100
1115
-    $params['listing_width']    = gdsc_validate_listing_width($params['listing_width']);
1116
-
1117
-    // Validate the checkboxes used on the widget
1118
-    $params['add_location_filter']  = gdsc_to_bool_val($params['add_location_filter']);
1119
-    $params['show_featured_only']   = gdsc_to_bool_val($params['show_featured_only']);
1120
-    $params['show_special_only']    = gdsc_to_bool_val($params['show_special_only']);
1121
-    $params['with_pics_only']       = gdsc_to_bool_val($params['with_pics_only']);
1122
-    $params['with_videos_only']     = gdsc_to_bool_val($params['with_videos_only']);
1123
-    $params['with_pagination']      = gdsc_to_bool_val($params['with_pagination']);
1124
-    $params['top_pagination']       = gdsc_to_bool_val($params['top_pagination']);
1125
-    $params['bottom_pagination']    = gdsc_to_bool_val($params['bottom_pagination']);
1126
-
1127
-    /**
1128
-     * End of validation
1129
-     */
1130
-    if (isset($atts['geodir_ajax'])) {
1131
-        $params['geodir_ajax'] = $atts['geodir_ajax'];
1132
-        unset($atts['geodir_ajax']);
1133
-    }
1134
-    if (isset($atts['pageno'])) {
1135
-        $params['pageno'] = $atts['pageno'];
1136
-        unset($atts['pageno']);
1137
-    }
1138
-    $params['shortcode_atts']       = $atts;
1139
-
1140
-    $output = geodir_sc_gd_listings_output($params);
1141
-
1142
-    return $output;
1088
+	// Post_number needs to be a positive integer
1089
+	if (!empty($atts['post_author'])) {
1090
+		if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') {
1091
+			$params['post_author'] = $post->post_author;
1092
+		} else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) {
1093
+			$params['post_author'] = absint($atts['post_author']);
1094
+		} else {
1095
+			unset($params['post_author']);
1096
+		}
1097
+	} else {
1098
+		unset($params['post_author']);
1099
+	}
1100
+
1101
+	// Validate character_count
1102
+	//todo: is this necessary?
1103
+	$params['character_count']  = $params['character_count'];
1104
+
1105
+	// Validate our layout choice
1106
+	// Outside of the norm, I added some more simple terms to match the existing
1107
+	// So now I just run the switch to set it properly.
1108
+	$params['layout']           = gdsc_validate_layout_choice($params['layout']);
1109
+
1110
+	// Validate our sorting choice
1111
+	$params['list_sort']        = gdsc_validate_sort_choice($params['list_sort']);
1112
+
1113
+	// Validate Listing width, used in the template widget-listing-listview.php
1114
+	// The context is in width=$listing_width% - So we need a positive number between 0 & 100
1115
+	$params['listing_width']    = gdsc_validate_listing_width($params['listing_width']);
1116
+
1117
+	// Validate the checkboxes used on the widget
1118
+	$params['add_location_filter']  = gdsc_to_bool_val($params['add_location_filter']);
1119
+	$params['show_featured_only']   = gdsc_to_bool_val($params['show_featured_only']);
1120
+	$params['show_special_only']    = gdsc_to_bool_val($params['show_special_only']);
1121
+	$params['with_pics_only']       = gdsc_to_bool_val($params['with_pics_only']);
1122
+	$params['with_videos_only']     = gdsc_to_bool_val($params['with_videos_only']);
1123
+	$params['with_pagination']      = gdsc_to_bool_val($params['with_pagination']);
1124
+	$params['top_pagination']       = gdsc_to_bool_val($params['top_pagination']);
1125
+	$params['bottom_pagination']    = gdsc_to_bool_val($params['bottom_pagination']);
1126
+
1127
+	/**
1128
+	 * End of validation
1129
+	 */
1130
+	if (isset($atts['geodir_ajax'])) {
1131
+		$params['geodir_ajax'] = $atts['geodir_ajax'];
1132
+		unset($atts['geodir_ajax']);
1133
+	}
1134
+	if (isset($atts['pageno'])) {
1135
+		$params['pageno'] = $atts['pageno'];
1136
+		unset($atts['pageno']);
1137
+	}
1138
+	$params['shortcode_atts']       = $atts;
1139
+
1140
+	$output = geodir_sc_gd_listings_output($params);
1141
+
1142
+	return $output;
1143 1143
 }
1144 1144
 add_shortcode('gd_listings', 'geodir_sc_gd_listings');
1145 1145
 
@@ -1187,23 +1187,23 @@  discard block
 block discarded – undo
1187 1187
 		'max_count' => 'all',
1188 1188
 		'max_level' => '1',
1189 1189
 		'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">',
1190
-        'after_widget' => '</section>',
1191
-        'before_title' => '<h3 class="widget-title">',
1192
-        'after_title' => '</h3>',
1190
+		'after_widget' => '</section>',
1191
+		'before_title' => '<h3 class="widget-title">',
1192
+		'after_title' => '</h3>',
1193 1193
 	);
1194 1194
 	$params = shortcode_atts($defaults, $atts);
1195 1195
 
1196
-    /**
1197
-     * Validate our incoming params
1198
-     */
1196
+	/**
1197
+	 * Validate our incoming params
1198
+	 */
1199 1199
 	// Make sure we have an array
1200
-    $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array();
1200
+	$params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array();
1201 1201
 	 
1202 1202
 	// Validate the checkboxes used on the widget
1203
-    $params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1204
-    $params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1205
-    $params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1206
-    $params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1203
+	$params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1204
+	$params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1205
+	$params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1206
+	$params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1207 1207
 	
1208 1208
 	if ($params['max_count'] != 'all') {
1209 1209
 		$params['max_count'] = absint($params['max_count']);
@@ -1217,10 +1217,10 @@  discard block
 block discarded – undo
1217 1217
 
1218 1218
 	ob_start();
1219 1219
 	the_widget('geodir_cpt_categories_widget', $params, $params);
1220
-    $output = ob_get_contents();
1221
-    ob_end_clean();
1220
+	$output = ob_get_contents();
1221
+	ob_end_clean();
1222 1222
 
1223
-    return $output;
1223
+	return $output;
1224 1224
 }
1225 1225
 add_shortcode('gd_cpt_categories', 'geodir_sc_cpt_categories_widget');
1226 1226
 ?>
1227 1227
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
 	// Add marker cluster
203 203
 	if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
204 204
         $map_args['enable_marker_cluster'] = true;
205
-        if(get_option('geodir_marker_cluster_type')) {
205
+        if (get_option('geodir_marker_cluster_type')) {
206 206
             if ($map_args['autozoom']) {
207 207
                 $map_args['enable_marker_cluster_no_reposition'] = false;
208 208
             } else {
209 209
                 $map_args['enable_marker_cluster_no_reposition'] = true;
210 210
             }
211 211
 
212
-            $map_args['enable_marker_cluster_server'] = true ;
212
+            $map_args['enable_marker_cluster_server'] = true;
213 213
 
214 214
         }
215 215
 	} else {
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	}
218 218
 
219 219
     // if lat and long set in shortcode, hack it so the map is not repositioned
220
-    if(!empty($params['latitude']) && !empty($params['longitude']) ){
220
+    if (!empty($params['latitude']) && !empty($params['longitude'])) {
221 221
         $map_args['enable_marker_cluster_no_reposition'] = true;
222 222
     }
223 223
 
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
 	
891 891
 	$show_adv_search = isset($params['show_adv_search']) && in_array($params['show_adv_search'], array('default', 'always', 'searched')) ? $params['show_adv_search'] : '';
892 892
 	
893
-	if ($show_adv_search != '' ) {
893
+	if ($show_adv_search != '') {
894 894
 		$show_adv_class = 'geodir-advance-search-' . $show_adv_search . ' ';
895 895
 		if ($show_adv_search == 'searched' && geodir_is_page('search')) {
896 896
 			$show_adv_search = 'search';
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 	ob_start();
904 904
 	
905 905
 	//geodir_get_template_part('listing', 'filter-form');
906
-	the_widget('geodir_advance_search_widget', $params, $params );
906
+	the_widget('geodir_advance_search_widget', $params, $params);
907 907
 	
908 908
 	$output = ob_get_contents();
909 909
     ob_end_clean();
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
 
1101 1101
     // Validate character_count
1102 1102
     //todo: is this necessary?
1103
-    $params['character_count']  = $params['character_count'];
1103
+    $params['character_count'] = $params['character_count'];
1104 1104
 
1105 1105
     // Validate our layout choice
1106 1106
     // Outside of the norm, I added some more simple terms to match the existing
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
 
1113 1113
     // Validate Listing width, used in the template widget-listing-listview.php
1114 1114
     // The context is in width=$listing_width% - So we need a positive number between 0 & 100
1115
-    $params['listing_width']    = gdsc_validate_listing_width($params['listing_width']);
1115
+    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
1116 1116
 
1117 1117
     // Validate the checkboxes used on the widget
1118 1118
     $params['add_location_filter']  = gdsc_to_bool_val($params['add_location_filter']);
@@ -1135,7 +1135,7 @@  discard block
 block discarded – undo
1135 1135
         $params['pageno'] = $atts['pageno'];
1136 1136
         unset($atts['pageno']);
1137 1137
     }
1138
-    $params['shortcode_atts']       = $atts;
1138
+    $params['shortcode_atts'] = $atts;
1139 1139
 
1140 1140
     $output = geodir_sc_gd_listings_output($params);
1141 1141
 
@@ -1202,8 +1202,8 @@  discard block
 block discarded – undo
1202 1202
 	// Validate the checkboxes used on the widget
1203 1203
     $params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1204 1204
     $params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1205
-    $params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1206
-    $params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1205
+    $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']);
1206
+    $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']);
1207 1207
 	
1208 1208
 	if ($params['max_count'] != 'all') {
1209 1209
 		$params['max_count'] = absint($params['max_count']);
Please login to merge, or discard this patch.
geodirectory-templates/reg_frm.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
  * @package GeoDirectory
10 10
  */
11 11
 if (isset($_GET['redirect_to']) && $_GET['redirect_to'] != '') {
12
-    $redirect_to = $_GET['redirect_to'];
12
+	$redirect_to = $_GET['redirect_to'];
13 13
 } else {
14
-    //echo $_SERVER['HTTP_HOST'] ;
15
-    $redirect_to = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
16
-    if (strpos($redirect_to, $_SERVER['HTTP_HOST']) === false) {
17
-        $redirect_to = home_url();
18
-    }
14
+	//echo $_SERVER['HTTP_HOST'] ;
15
+	$redirect_to = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
16
+	if (strpos($redirect_to, $_SERVER['HTTP_HOST']) === false) {
17
+		$redirect_to = home_url();
18
+	}
19 19
 }
20 20
 ?>
21 21
 <div id="sign_up">
@@ -26,28 +26,28 @@  discard block
 block discarded – undo
26 26
         <h4>
27 27
             <?php
28 28
 
29
-            /**
30
-             * Filter the `REGISTRATION_NOW_TEXT` title text on the register form template.
31
-             *
32
-             * @since 1.0.0
33
-             */
34
-            echo apply_filters('geodir_registration_page_title', REGISTRATION_NOW_TEXT);
29
+			/**
30
+			 * Filter the `REGISTRATION_NOW_TEXT` title text on the register form template.
31
+			 *
32
+			 * @since 1.0.0
33
+			 */
34
+			echo apply_filters('geodir_registration_page_title', REGISTRATION_NOW_TEXT);
35 35
 
36
-            ?>
36
+			?>
37 37
         </h4>
38 38
         <?php
39
-        global $geodir_signup_error;
40
-        if ($geodir_signup_error != '') {
41
-            echo '<p class="error_msg">' . $geodir_signup_error . '</p>';
42
-            unset($geodir_signup_error);
43
-        } else {
44
-            if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 1) {
45
-                echo '<p class="error_msg">' . EMAIL_USERNAME_EXIST_MSG . '</p>';
46
-            } else if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'regnewusr') {
47
-                echo '<p class="error_msg">' . REGISTRATION_DESABLED_MSG . '</p>';
48
-            }
49
-        }
50
-        ?>
39
+		global $geodir_signup_error;
40
+		if ($geodir_signup_error != '') {
41
+			echo '<p class="error_msg">' . $geodir_signup_error . '</p>';
42
+			unset($geodir_signup_error);
43
+		} else {
44
+			if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 1) {
45
+				echo '<p class="error_msg">' . EMAIL_USERNAME_EXIST_MSG . '</p>';
46
+			} else if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'regnewusr') {
47
+				echo '<p class="error_msg">' . REGISTRATION_DESABLED_MSG . '</p>';
48
+			}
49
+		}
50
+		?>
51 51
 
52 52
         <form name="cus_registerform" id="cus_registerform"
53 53
               action="<?php echo htmlspecialchars(geodir_curPageURL()); ?>" method="post">
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
             <div class="form_row clearfix">
58 58
                 <input placeholder='<?php echo EMAIL_TEXT; ?>' type="text" name="user_email" id="user_email"
59 59
                        class="textfield" value="<?php global $user_email;
60
-                if (!isset($user_email)) {
61
-                    $user_email = '';
62
-                }
63
-                echo esc_attr(stripslashes($user_email)); ?>" size="25"/>
60
+				if (!isset($user_email)) {
61
+					$user_email = '';
62
+				}
63
+				echo esc_attr(stripslashes($user_email)); ?>" size="25"/>
64 64
 
65 65
                 <?php if (!get_option('geodir_allow_cpass')) { ?>
66 66
 				<div id="reg_passmail">
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
                 <div class="form_row clearfix">
75 75
                     <input placeholder='<?php echo FIRST_NAME_TEXT; ?>' type="text" name="user_fname" id="user_fname"
76 76
                            class="textfield" value="<?php if (isset($user_fname)) {
77
-                        echo esc_attr(stripslashes($user_fname));
78
-                    } ?>" size="25"/>
77
+						echo esc_attr(stripslashes($user_fname));
78
+					} ?>" size="25"/>
79 79
                     <span id="user_fnameInfo"></span>
80 80
                 </div>
81 81
             </div>
@@ -101,14 +101,14 @@  discard block
 block discarded – undo
101 101
             <?php } ?>
102 102
 
103 103
             <?php
104
-            /**
105
-             * Called just before the register new user button on the register form template.
106
-             *
107
-             * Also used by other plugins to add social connect buttons.
108
-             *
109
-             * @since 1.0.0
110
-             */
111
-            do_action('social_connect_form'); ?>
104
+			/**
105
+			 * Called just before the register new user button on the register form template.
106
+			 *
107
+			 * Also used by other plugins to add social connect buttons.
108
+			 *
109
+			 * @since 1.0.0
110
+			 */
111
+			do_action('social_connect_form'); ?>
112 112
             <input type="submit" name="registernow" value="<?php echo REGISTER_NOW_TEXT; ?>" class="geodir_button"/>
113 113
         </form>
114 114
     </div>
Please login to merge, or discard this patch.