Test Failed
Pull Request — master (#348)
by Viruthagiri
21:56
created
geodirectory-functions/map-functions/map_on_add_listing_page.php 3 patches
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -35,19 +35,19 @@  discard block
 block discarded – undo
35 35
 $defaultcity = isset($default_location->city) ? $default_location->city : '';
36 36
 $lat_lng_blank = false;
37 37
 if ($lat == '' && $lng == '') {
38
-    $lat_lng_blank = true;
39
-    $city = $defaultcity;
40
-    $region = isset($default_location->region) ? $default_location->region : '';
41
-    $country = isset($default_location->country) ? $default_location->country : '';
42
-    $lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
43
-    $lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
38
+	$lat_lng_blank = true;
39
+	$city = $defaultcity;
40
+	$region = isset($default_location->region) ? $default_location->region : '';
41
+	$country = isset($default_location->country) ? $default_location->country : '';
42
+	$lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
43
+	$lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
44 44
 }
45 45
 $default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
46 46
 $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
47 47
 if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') {
48
-    $mapzoom = 4;
49
-    if (isset($_REQUEST['add_hood']))
50
-        $mapzoom = 10;
48
+	$mapzoom = 4;
49
+	if (isset($_REQUEST['add_hood']))
50
+		$mapzoom = 10;
51 51
 }
52 52
 
53 53
 /**
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * Fires at the start of the add javascript on the add lsitings map.
69 69
 	 *
70 70
 	 * @since 1.0.0
71
-     * @param string $prefix The prefix for all elements.
71
+	 * @param string $prefix The prefix for all elements.
72 72
 	 */
73 73
 	do_action('geodir_add_listing_js_start', $prefix);
74 74
 	?>
@@ -260,12 +260,12 @@  discard block
 block discarded – undo
260 260
             // fix for regions in GB
261 261
 
262 262
             $country_arr = <?php
263
-            /**
264
-             * Filter the regions array that uses administrative_area_level_2 instead of administrative_area_level_1.
265
-             *
266
-             * @since 1.6.16
267
-             */
268
-            echo apply_filters("geodir_geocode_region_level",'["GB","ES"]');?>;
263
+			/**
264
+			 * Filter the regions array that uses administrative_area_level_2 instead of administrative_area_level_1.
265
+			 *
266
+			 * @since 1.6.16
267
+			 */
268
+			echo apply_filters("geodir_geocode_region_level",'["GB","ES"]');?>;
269 269
             if (jQuery.inArray(rr, $country_arr) !== -1) {
270 270
                 if (administrative_area_level_2.long_name) {
271 271
                     getState = administrative_area_level_2.long_name;
@@ -339,13 +339,13 @@  discard block
 block discarded – undo
339 339
                 getZip = postal_code.long_name;
340 340
             }
341 341
             <?php 
342
-            /**
343
-             * Fires to add javascript variable to use in google map.
344
-             *
345
-             * @since 1.0.0
346
-             */
347
-            do_action('geodir_add_listing_geocode_js_vars');
348
-            ?>
342
+			/**
343
+			 * Fires to add javascript variable to use in google map.
344
+			 *
345
+			 * @since 1.0.0
346
+			 */
347
+			do_action('geodir_add_listing_geocode_js_vars');
348
+			?>
349 349
             <?php if ($is_map_restrict) { ?>
350 350
             if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
351 351
                 alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
@@ -426,15 +426,15 @@  discard block
 block discarded – undo
426 426
             }
427 427
         }
428 428
         <?php
429
-        /**
430
-         * Fires when marker address updated on map.
431
-         *
432
-         * @since 1.0.0
433
-         * @param string $prefix Identifier used as a prefix for field name
434
-         */
435
-        do_action('geodir_update_marker_address', $prefix);
436
-        echo $updateMarkerAddress = ob_get_clean();
437
-        ?>
429
+		/**
430
+		 * Fires when marker address updated on map.
431
+		 *
432
+		 * @since 1.0.0
433
+		 * @param string $prefix Identifier used as a prefix for field name
434
+		 */
435
+		do_action('geodir_update_marker_address', $prefix);
436
+		echo $updateMarkerAddress = ob_get_clean();
437
+		?>
438 438
     }
439 439
     function geodir_codeAddress(set_on_map) {
440 440
         var address = jQuery('#<?php echo $prefix.'address';?>').val();
@@ -464,9 +464,9 @@  discard block
 block discarded – undo
464 464
         }
465 465
         var is_restrict = '<?php echo $is_map_restrict; ?>';
466 466
         <?php ob_start();
467
-        $defaultregion = isset($default_location->region) ? $default_location->region : '';
468
-        $defaultcountry = isset($default_location->country) ? $default_location->country : '';
469
-        ?>
467
+		$defaultregion = isset($default_location->region) ? $default_location->region : '';
468
+		$defaultcountry = isset($default_location->country) ? $default_location->country : '';
469
+		?>
470 470
         if (set_on_map && is_restrict) {
471 471
             if (zip != '' && address != '') {
472 472
                 address = address + ',' + zip;
@@ -478,12 +478,12 @@  discard block
 block discarded – undo
478 478
             if( address == city || address == region || address == country || address == zip )
479 479
                 address = '';
480 480
             <?php
481
-            if(is_admin() && isset($_REQUEST['tab'])){?>
481
+			if(is_admin() && isset($_REQUEST['tab'])){?>
482 482
             if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
483 483
                 address = '';
484 484
             }
485 485
             <?php
486
-               }?>
486
+			   }?>
487 487
 
488 488
             if (ISO2 == 'GB') {
489 489
                 address = address + ',' + city + ',' + country; // UK is funny with regions
@@ -499,15 +499,15 @@  discard block
 block discarded – undo
499 499
             address =  address.replace(",null,", ",");
500 500
         }
501 501
         <?php $codeAddress = ob_get_clean();
502
-        /**
503
-         * Filter the address variable
504
-         *
505
-         * @since 1.0.0
506
-         *
507
-         * @param string $codeAddress Row of address to use in google map.
508
-         */
509
-        echo apply_filters('geodir_codeaddress', $codeAddress);
510
-        ?>
502
+		/**
503
+		 * Filter the address variable
504
+		 *
505
+		 * @since 1.0.0
506
+		 *
507
+		 * @param string $codeAddress Row of address to use in google map.
508
+		 */
509
+		echo apply_filters('geodir_codeaddress', $codeAddress);
510
+		?>
511 511
         if (!window.gdMaps) { // No Google Map Loaded
512 512
             return;
513 513
         }
@@ -532,13 +532,13 @@  discard block
 block discarded – undo
532 532
                         updateMarkerPosition(baseMarker.getPosition());
533 533
                         //if(set_on_map && is_restrict) {
534 534
                         <?php 
535
-                        /**
536
-                         * Fires before set geocode position.
537
-                         *
538
-                         * @since 1.0.0
539
-                         */
540
-                        do_action('geodir_add_listing_codeaddress_before_geocode');
541
-                        ?>
535
+						/**
536
+						 * Fires before set geocode position.
537
+						 *
538
+						 * @since 1.0.0
539
+						 */
540
+						do_action('geodir_add_listing_codeaddress_before_geocode');
541
+						?>
542 542
                         geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
543 543
                         //}
544 544
                     } else {
@@ -584,13 +584,13 @@  discard block
 block discarded – undo
584 584
                 updateMarkerPositionOSM(baseMarker.getLatLng());
585 585
             }
586 586
             <?php 
587
-            /**
588
-             * Fires to add javascript variable to use in google map.
589
-             *
590
-             * @since 1.0.0
591
-             */
592
-            do_action('geodir_add_listing_geocode_js_vars');
593
-            ?>
587
+			/**
588
+			 * Fires to add javascript variable to use in google map.
589
+			 *
590
+			 * @since 1.0.0
591
+			 */
592
+			do_action('geodir_add_listing_geocode_js_vars');
593
+			?>
594 594
             <?php if ($is_map_restrict) { ?>
595 595
             if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
596 596
                 alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 <?php
739 739
 $set_button_class = 'geodir_button';
740 740
 if (is_admin())
741
-    $set_button_class = 'button-primary';
741
+	$set_button_class = 'button-primary';
742 742
 ?>
743 743
 <input type="button" id="<?php echo $prefix; ?>set_address_button" class="<?php echo $set_button_class; ?>" value="<?php esc_attr_e($map_title, 'geodirectory'); ?>" style="float:none;"/>
744 744
 <div id="<?php echo $prefix; ?>d_mouseClick"></div>
Please login to merge, or discard this patch.
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -82,16 +82,16 @@  discard block
 block discarded – undo
82 82
     window.gdMaps = window.gdMaps || gdMaps;
83 83
     
84 84
     user_address = false;
85
-    jQuery('#<?php echo $prefix.'address';?>').keypress(function () {
85
+    jQuery('#<?php echo $prefix.'address'; ?>').keypress(function () {
86 86
         user_address = true;
87 87
     });
88 88
 
89 89
     baseMarker = '';
90 90
     geocoder = '';
91
-    var <?php echo $prefix;?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat :  '39.952484'; ?>;
92
-    var <?php echo $prefix;?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng :  '-75.163786'; ?>;
93
-    <?php if($lat_lng_blank){$lat='';$lng='';}?>
94
-    var <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12;?>;
91
+    var <?php echo $prefix; ?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat : '39.952484'; ?>;
92
+    var <?php echo $prefix; ?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng : '-75.163786'; ?>;
93
+    <?php if ($lat_lng_blank) {$lat = ''; $lng = ''; }?>
94
+    var <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12; ?>;
95 95
     var minZoomLevel = <?php echo ($is_map_restrict) ? 5 : 0; ?>;
96 96
     var oldstr_address;
97 97
     var oldstr_zip;
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
              *
266 266
              * @since 1.6.16
267 267
              */
268
-            echo apply_filters("geodir_geocode_region_level",'["GB","ES"]');?>;
268
+            echo apply_filters("geodir_geocode_region_level", '["GB","ES"]'); ?>;
269 269
             if (jQuery.inArray(rr, $country_arr) !== -1) {
270 270
                 if (administrative_area_level_2.long_name) {
271 271
                     getState = administrative_area_level_2.long_name;
@@ -347,9 +347,9 @@  discard block
 block discarded – undo
347 347
             do_action('geodir_add_listing_geocode_js_vars');
348 348
             ?>
349 349
             <?php if ($is_map_restrict) { ?>
350
-            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
351
-                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
352
-                jQuery("#<?php echo $prefix.'map';?>").goMap();
350
+            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
351
+                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
352
+                jQuery("#<?php echo $prefix.'map'; ?>").goMap();
353 353
                 jQuery.goMap.map.setCenter(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
354 354
                 baseMarker.setPosition(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
355 355
                 updateMarkerPosition(baseMarker.getPosition());
@@ -358,11 +358,11 @@  discard block
 block discarded – undo
358 358
             <?php } ?>
359 359
             updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry);
360 360
         } else {
361
-            updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
361
+            updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
362 362
         }
363 363
     }
364 364
     function centerMap(latlng) {
365
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
365
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
366 366
         if (window.gdMaps == 'google') {
367 367
             jQuery.goMap.map.panTo(baseMarker.getPosition());
368 368
         } else if (window.gdMaps == 'osm') {
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         }
372 372
     }
373 373
     function centerMarker() {
374
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
374
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
375 375
         var center = jQuery.goMap.map.getCenter();
376 376
         if (window.gdMaps == 'google') {
377 377
             baseMarker.setPosition(center);
@@ -380,48 +380,48 @@  discard block
 block discarded – undo
380 380
         }
381 381
     }
382 382
     function updateMapZoom(zoom) {
383
-        jQuery('#<?php echo $prefix.'mapzoom';?>').val(zoom);
383
+        jQuery('#<?php echo $prefix.'mapzoom'; ?>').val(zoom);
384 384
     }
385 385
     function updateMarkerPosition(markerlatLng) {
386
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
387
-        jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat());
388
-        jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng());
386
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
387
+        jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat());
388
+        jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng());
389 389
     }
390 390
     function updateMarkerPositionOSM(markerlatLng) {
391
-        jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat);
392
-        jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng);
391
+        jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat);
392
+        jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng);
393 393
     }
394 394
     function updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry) {
395
-        var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields);?>';
396
-        <?php ob_start();?>
397
-        var old_country = jQuery("#<?php echo $prefix.'country';?>").val();
398
-        var old_region = jQuery("#<?php echo $prefix.'region';?>").val();
395
+        var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields); ?>';
396
+        <?php ob_start(); ?>
397
+        var old_country = jQuery("#<?php echo $prefix.'country'; ?>").val();
398
+        var old_region = jQuery("#<?php echo $prefix.'region'; ?>").val();
399 399
         
400
-        if (user_address == false || jQuery('#<?php echo $prefix.'address';?>').val() == '') {
401
-            jQuery("#<?php echo $prefix.'address';?>").val(getAddress);
400
+        if (user_address == false || jQuery('#<?php echo $prefix.'address'; ?>').val() == '') {
401
+            jQuery("#<?php echo $prefix.'address'; ?>").val(getAddress);
402 402
         }
403 403
         if (getAddress) {
404 404
             oldstr_address = getAddress;
405 405
         }
406 406
 
407
-        jQuery("#<?php echo $prefix.'zip';?>").val(getZip);
407
+        jQuery("#<?php echo $prefix.'zip'; ?>").val(getZip);
408 408
         if (getZip) {
409 409
             oldstr_zip = getZip;
410 410
         }
411 411
         if (set_map_val_in_fields) {
412 412
             if (getCountry) {
413
-                jQuery('#<?php echo $prefix .'country'; ?> option[value=""]').attr("selected",false);
414
-                jQuery('#<?php echo $prefix.'country';?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
415
-                jQuery("#<?php echo $prefix.'country';?>").trigger("chosen:updated");
413
+                jQuery('#<?php echo $prefix.'country'; ?> option[value=""]').attr("selected",false);
414
+                jQuery('#<?php echo $prefix.'country'; ?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
415
+                jQuery("#<?php echo $prefix.'country'; ?>").trigger("chosen:updated");
416 416
             }
417 417
             if (getState) {
418
-                if (jQuery('input[id="<?php echo $prefix.'region';?>"]').attr('id')) {
419
-                    jQuery("#<?php echo $prefix.'region';?>").val(getState);
418
+                if (jQuery('input[id="<?php echo $prefix.'region'; ?>"]').attr('id')) {
419
+                    jQuery("#<?php echo $prefix.'region'; ?>").val(getState);
420 420
                 }
421 421
             }
422 422
             if (getCity) {
423
-                if (jQuery('input[id="<?php echo $prefix.'city';?>"]').attr('id')) {
424
-                    jQuery("#<?php echo $prefix.'city';?>").val(getCity);
423
+                if (jQuery('input[id="<?php echo $prefix.'city'; ?>"]').attr('id')) {
424
+                    jQuery("#<?php echo $prefix.'city'; ?>").val(getCity);
425 425
                 }
426 426
             }
427 427
         }
@@ -437,15 +437,15 @@  discard block
 block discarded – undo
437 437
         ?>
438 438
     }
439 439
     function geodir_codeAddress(set_on_map) {
440
-        var address = jQuery('#<?php echo $prefix.'address';?>').val();
441
-        var zip = jQuery('#<?php echo $prefix.'zip';?>').val();
442
-        var city = jQuery('#<?php echo $prefix.'city';?>').val();
443
-        var region = jQuery('#<?php echo $prefix.'region';?>').val();
444
-        var country = jQuery('#<?php echo $prefix.'country';?>').val();
445
-        var country_selected = jQuery('#<?php echo $prefix.'country';?>').find('option:selected');
440
+        var address = jQuery('#<?php echo $prefix.'address'; ?>').val();
441
+        var zip = jQuery('#<?php echo $prefix.'zip'; ?>').val();
442
+        var city = jQuery('#<?php echo $prefix.'city'; ?>').val();
443
+        var region = jQuery('#<?php echo $prefix.'region'; ?>').val();
444
+        var country = jQuery('#<?php echo $prefix.'country'; ?>').val();
445
+        var country_selected = jQuery('#<?php echo $prefix.'country'; ?>').find('option:selected');
446 446
         var ISO2 = country_selected.data('country_code');
447
-        if (!ISO2 && jQuery('#<?php echo $prefix.'country';?>').data('country_code')) {
448
-            ISO2 = jQuery('#<?php echo $prefix.'country';?>').data('country_code');
447
+        if (!ISO2 && jQuery('#<?php echo $prefix.'country'; ?>').data('country_code')) {
448
+            ISO2 = jQuery('#<?php echo $prefix.'country'; ?>').data('country_code');
449 449
         }
450 450
         if (ISO2 == '--') {
451 451
             ISO2 = '';
@@ -454,13 +454,13 @@  discard block
 block discarded – undo
454 454
             zip = '';
455 455
         }
456 456
         if (typeof city == "undefined") {
457
-            city = '<?php echo addslashes_gpc($city);?>';
457
+            city = '<?php echo addslashes_gpc($city); ?>';
458 458
         }
459 459
         if (typeof region == "undefined") {
460
-            region = '<?php echo addslashes_gpc($region);?>';
460
+            region = '<?php echo addslashes_gpc($region); ?>';
461 461
         }
462 462
         if (typeof country == "undefined") {
463
-            country = '<?php echo addslashes_gpc($country);?>';
463
+            country = '<?php echo addslashes_gpc($country); ?>';
464 464
         }
465 465
         var is_restrict = '<?php echo $is_map_restrict; ?>';
466 466
         <?php ob_start();
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
             if( address == city || address == region || address == country || address == zip )
479 479
                 address = '';
480 480
             <?php
481
-            if(is_admin() && isset($_REQUEST['tab'])){?>
481
+            if (is_admin() && isset($_REQUEST['tab'])) {?>
482 482
             if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
483 483
                 address = '';
484 484
             }
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
             geocoder.geocode({'address': address, 'country': ISO2},
526 526
                 function (results, status) {
527 527
                     console.log(status);
528
-                    jQuery("#<?php echo $prefix.'map';?>").goMap();
528
+                    jQuery("#<?php echo $prefix.'map'; ?>").goMap();
529 529
                     if (status == google.maps.GeocoderStatus.OK) {
530 530
                         baseMarker.setPosition(results[0].geometry.location);
531 531
                         jQuery.goMap.map.setCenter(results[0].geometry.location);
@@ -542,21 +542,21 @@  discard block
 block discarded – undo
542 542
                         geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
543 543
                         //}
544 544
                     } else {
545
-                        alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:','geodirectory'));?> ' + status);
545
+                        alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:', 'geodirectory')); ?> ' + status);
546 546
                     }
547 547
                 });
548 548
         }
549 549
     }
550 550
     function gdMaxMap() {
551
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
551
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
552 552
 
553
-        jQuery('#<?php echo $prefix.'map';?>').toggleClass('map-fullscreen');
553
+        jQuery('#<?php echo $prefix.'map'; ?>').toggleClass('map-fullscreen');
554 554
         jQuery('.map_category').toggleClass('map_category_fullscreen');
555
-        jQuery('#<?php echo $prefix;?>trigger').toggleClass('map_category_fullscreen');
555
+        jQuery('#<?php echo $prefix; ?>trigger').toggleClass('map_category_fullscreen');
556 556
         jQuery('body').toggleClass('body_fullscreen');
557
-        jQuery('#<?php echo $prefix;?>loading_div').toggleClass('loading_div_fullscreen');
558
-        jQuery('#<?php echo $prefix;?>advmap_nofound').toggleClass('nofound_fullscreen');
559
-        jQuery('#<?php echo $prefix;?>triggermap').toggleClass('triggermap_fullscreen');
557
+        jQuery('#<?php echo $prefix; ?>loading_div').toggleClass('loading_div_fullscreen');
558
+        jQuery('#<?php echo $prefix; ?>advmap_nofound').toggleClass('nofound_fullscreen');
559
+        jQuery('#<?php echo $prefix; ?>triggermap').toggleClass('triggermap_fullscreen');
560 560
         jQuery('.TopLeft').toggleClass('TopLeft_fullscreen');
561 561
         window.setTimeout(function () {
562 562
             if (window.gdMaps == 'google') {
@@ -592,9 +592,9 @@  discard block
 block discarded – undo
592 592
             do_action('geodir_add_listing_geocode_js_vars');
593 593
             ?>
594 594
             <?php if ($is_map_restrict) { ?>
595
-            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
596
-                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
597
-                jQuery("#<?php echo $prefix.'map';?>").goMap();
595
+            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
596
+                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
597
+                jQuery("#<?php echo $prefix.'map'; ?>").goMap();
598 598
                 centerMap(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
599 599
                 baseMarker.setLatLng(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
600 600
                 updateMarkerPositionOSM(baseMarker.getLatLng());
@@ -603,39 +603,39 @@  discard block
 block discarded – undo
603 603
             <?php } ?>
604 604
             updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry);
605 605
         } else {
606
-            alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
606
+            alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
607 607
         }
608 608
     }
609 609
     
610 610
     jQuery(function ($) {
611
-        $("#<?php echo $prefix.'map';?>").goMap({
612
-            latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT,
613
-            longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG,
614
-            zoom: <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT,
611
+        $("#<?php echo $prefix.'map'; ?>").goMap({
612
+            latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT,
613
+            longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG,
614
+            zoom: <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT,
615 615
             maptype: 'ROADMAP', // Map type - HYBRID, ROADMAP, SATELLITE, TERRAIN
616 616
             streetViewControl: true,
617
-            <?php if(get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,';}?>
617
+            <?php if (get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,'; }?>
618 618
         });
619 619
 
620 620
         if (window.gdMaps) {
621 621
             geocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : [];
622 622
 
623 623
             baseMarker = $.goMap.createMarker({
624
-                latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT,
625
-                longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG,
624
+                latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT,
625
+                longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG,
626 626
                 id: 'baseMarker',
627
-                icon: '<?php echo $marker_icon;?>',
627
+                icon: '<?php echo $marker_icon; ?>',
628 628
                 draggable: true,
629 629
                 addToMap: true, // For OSM
630
-                w: parseFloat('<?php echo $icon_size['w'];?>'),
631
-                h: parseFloat('<?php echo $icon_size['h'];?>'),
630
+                w: parseFloat('<?php echo $icon_size['w']; ?>'),
631
+                h: parseFloat('<?php echo $icon_size['h']; ?>'),
632 632
             });
633 633
         } else {
634
-            jQuery('#<?php echo $prefix.'advmap_nofound';?>').hide();
635
-            jQuery('#<?php echo $prefix.'advmap_notloaded';?>').show();
634
+            jQuery('#<?php echo $prefix.'advmap_nofound'; ?>').hide();
635
+            jQuery('#<?php echo $prefix.'advmap_notloaded'; ?>').show();
636 636
         }
637 637
         
638
-        $("#<?php echo $prefix;?>set_address_button").click(function () {
638
+        $("#<?php echo $prefix; ?>set_address_button").click(function () {
639 639
             var set_on_map = true;
640 640
             geodir_codeAddress(set_on_map);
641 641
         });
@@ -669,14 +669,14 @@  discard block
 block discarded – undo
669 669
                 updateMapZoom($.goMap.map.zoom);
670 670
             });
671 671
 
672
-            var maxMap = document.getElementById('<?php echo $prefix;?>triggermap');
672
+            var maxMap = document.getElementById('<?php echo $prefix; ?>triggermap');
673 673
             google.maps.event.addDomListener(maxMap, 'click', gdMaxMap);
674 674
 
675 675
             <?php if ($is_map_restrict) { ?>
676
-            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country);?>';
676
+            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country); ?>';
677 677
             geocoder.geocode({'address': CITY_ADDRESS},
678 678
                 function (results, status) {
679
-                    $("#<?php echo $prefix.'map';?>").goMap();
679
+                    $("#<?php echo $prefix.'map'; ?>").goMap();
680 680
                     if (status == google.maps.GeocoderStatus.OK) {
681 681
                         // Bounds for North America
682 682
                         var bound_lat_lng = String(results[0].geometry.bounds);
@@ -687,13 +687,13 @@  discard block
 block discarded – undo
687 687
                             new google.maps.LatLng(bound_lat_lng[2], bound_lat_lng[3])
688 688
                         );
689 689
                     } else {
690
-                        alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status);
690
+                        alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
691 691
                     }
692 692
                 });
693 693
             <?php } ?>
694 694
             // Limit the zoom level
695 695
             google.maps.event.addListener($.goMap.map, 'zoom_changed', function () {
696
-                $("#<?php echo $prefix.'map';?>").goMap();
696
+                $("#<?php echo $prefix.'map'; ?>").goMap();
697 697
                 if ($.goMap.map.getZoom() < minZoomLevel) $.goMap.map.setZoom(minZoomLevel);
698 698
             });
699 699
         } else if (window.gdMaps == 'osm') {
@@ -719,10 +719,10 @@  discard block
 block discarded – undo
719 719
                 updateMapZoom($.goMap.map.getZoom());
720 720
             });
721 721
 
722
-            L.DomEvent.addListener($('<?php echo $prefix;?>triggermap'), 'click', gdMaxMap);
722
+            L.DomEvent.addListener($('<?php echo $prefix; ?>triggermap'), 'click', gdMaxMap);
723 723
 
724 724
             <?php if ($is_map_restrict) { ?>
725
-            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country);?>';
725
+            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country); ?>';
726 726
             geocodePositionOSM('', CITY_ADDRESS);
727 727
             <?php } ?>
728 728
             // Limit the zoom level
@@ -745,14 +745,14 @@  discard block
 block discarded – undo
745 745
 <div class="top_banner_section_inn geodir_map_container clearfix" style="margin-top:10px;">
746 746
     <div class="TopLeft"><span id="<?php echo $prefix; ?>triggermap" style="margin-top:-11px;margin-left:-12px;"></span></div>
747 747
     <div class="TopRight"></div>
748
-    <div id="<?php echo $prefix . 'map'; ?>" class="geodir_map" style="height:300px">
748
+    <div id="<?php echo $prefix.'map'; ?>" class="geodir_map" style="height:300px">
749 749
         <!-- new map start -->
750 750
         <div class="iprelative">
751
-            <div id="<?php echo $prefix . 'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div>
751
+            <div id="<?php echo $prefix.'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div>
752 752
             <div id="<?php echo $prefix; ?>loading_div" style="height:300px"></div>
753 753
             <div id="<?php echo $prefix; ?>advmap_counter"></div>
754 754
             <div id="<?php echo $prefix; ?>advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div>
755
-            <div id="<?php echo $prefix;?>advmap_notloaded" class="advmap_notloaded"><?php _e('<h3>Map Not Loaded</h3><p>Sorry, unable to load Maps API.', 'geodirectory'); ?></div>
755
+            <div id="<?php echo $prefix; ?>advmap_notloaded" class="advmap_notloaded"><?php _e('<h3>Map Not Loaded</h3><p>Sorry, unable to load Maps API.', 'geodirectory'); ?></div>
756 756
         </div>
757 757
         <!-- new map end -->
758 758
     </div>
Please login to merge, or discard this patch.
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,9 +46,10 @@  discard block
 block discarded – undo
46 46
 $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
47 47
 if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') {
48 48
     $mapzoom = 4;
49
-    if (isset($_REQUEST['add_hood']))
50
-        $mapzoom = 10;
51
-}
49
+    if (isset($_REQUEST['add_hood'])) {
50
+            $mapzoom = 10;
51
+    }
52
+    }
52 53
 
53 54
 /**
54 55
  * Filter the auto change address fields values
@@ -737,8 +738,9 @@  discard block
 block discarded – undo
737 738
 </script>
738 739
 <?php
739 740
 $set_button_class = 'geodir_button';
740
-if (is_admin())
741
-    $set_button_class = 'button-primary';
741
+if (is_admin()) {
742
+    $set_button_class = 'button-primary';
743
+}
742 744
 ?>
743 745
 <input type="button" id="<?php echo $prefix; ?>set_address_button" class="<?php echo $set_button_class; ?>" value="<?php esc_attr_e($map_title, 'geodirectory'); ?>" style="float:none;"/>
744 746
 <div id="<?php echo $prefix; ?>d_mouseClick"></div>
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
@@ -715,8 +715,9 @@  discard block
 block discarded – undo
715 715
 
716 716
                         if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
717 717
                             if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
718
-                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
719
-                                    $term_icon = $term_icon_url['src'];
718
+                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '') {
719
+                                                                    $term_icon = $term_icon_url['src'];
720
+                                }
720 721
                                 break;
721 722
                             }
722 723
                         }
@@ -1265,8 +1266,9 @@  discard block
 block discarded – undo
1265 1266
         echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1266 1267
     }
1267 1268
 
1268
-    if (isset($taxonomies[$post_type . '_tags']))
1269
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1269
+    if (isset($taxonomies[$post_type . '_tags'])) {
1270
+            echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1271
+    }
1270 1272
 
1271 1273
     ?>
1272 1274
     </p><?php
@@ -1634,23 +1636,21 @@  discard block
 block discarded – undo
1634 1636
     if(geodir_is_page('pt')){
1635 1637
         $gd_page = 'pt';
1636 1638
         $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1637
-    }
1638
-    elseif(geodir_is_page('listing')){
1639
+    } elseif(geodir_is_page('listing')){
1639 1640
         $gd_page = 'listing';
1640 1641
         global $wp_query;
1641 1642
         $current_term = $wp_query->get_queried_object();
1642 1643
         if (strpos($current_term->taxonomy,'_tags') !== false) {
1643 1644
             $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1644
-        }else{
1645
+        } else{
1645 1646
             $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1646 1647
         }
1647 1648
 
1648
-    }
1649
-    elseif(geodir_is_page('author')){
1649
+    } elseif(geodir_is_page('author')){
1650 1650
         $gd_page = 'author';
1651 1651
         if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1652 1652
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1653
-        }else{
1653
+        } else{
1654 1654
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1655 1655
         }
1656 1656
 
@@ -2074,8 +2074,9 @@  discard block
 block discarded – undo
2074 2074
  */
2075 2075
 function geodir_action_add_listing_page_title()
2076 2076
 {
2077
-    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2078
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2077
+    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '') {
2078
+            $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2079
+    }
2079 2080
     /** This action is documented in geodirectory_template_actions.php */
2080 2081
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2081 2082
     /** This action is documented in geodirectory_template_actions.php */
@@ -2087,7 +2088,7 @@  discard block
 block discarded – undo
2087 2088
         $gd_page = 'add-listing';
2088 2089
         if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2089 2090
             $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2090
-        }elseif(isset($listing_type)){
2091
+        } elseif(isset($listing_type)){
2091 2092
             $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2092 2093
         }
2093 2094
 
@@ -2406,8 +2407,9 @@  discard block
 block discarded – undo
2406 2407
         $totImg = 0;
2407 2408
         if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2408 2409
             $post = (object)$gd_session->get('listing');
2409
-            if (isset($post->post_images))
2410
-                $curImages = trim($post->post_images, ",");
2410
+            if (isset($post->post_images)) {
2411
+                            $curImages = trim($post->post_images, ",");
2412
+            }
2411 2413
 
2412 2414
 
2413 2415
             if ($curImages != '') {
@@ -2435,10 +2437,13 @@  discard block
 block discarded – undo
2435 2437
             $totImg = count((array)$thumb_img_arr);
2436 2438
         }
2437 2439
 
2438
-        if ($curImages != '')
2439
-            $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2440
-        else
2441
-            $svalue = '';
2440
+        if ($curImages != '') {
2441
+                    $svalue = $curImages;
2442
+        }
2443
+        // this will be initial value of the above form field. Image urls.
2444
+        else {
2445
+                    $svalue = '';
2446
+        }
2442 2447
 
2443 2448
         $image_limit = isset($package_info->image_limit) ? $package_info->image_limit : '0';
2444 2449
         $show_image_input_box = ($image_limit != '0');
@@ -2648,8 +2653,9 @@  discard block
 block discarded – undo
2648 2653
     </script><?php
2649 2654
 
2650 2655
     global $errors;
2651
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2652
-        $errors->add('claim_login', LOGIN_CLAIM);
2656
+    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim') {
2657
+            $errors->add('claim_login', LOGIN_CLAIM);
2658
+    }
2653 2659
 
2654 2660
     if (!empty($errors)) {
2655 2661
         foreach ($errors as $errorsObj) {
@@ -2753,8 +2759,9 @@  discard block
 block discarded – undo
2753 2759
 
2754 2760
     if (!empty($term)) {
2755 2761
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
2756
-        if (!empty($current_term))
2757
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2762
+        if (!empty($current_term)) {
2763
+                    $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2764
+        }
2758 2765
     }
2759 2766
 
2760 2767
 
@@ -2772,7 +2779,7 @@  discard block
 block discarded – undo
2772 2779
         $gd_page = 'author';
2773 2780
         if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2774 2781
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2775
-        }else{
2782
+        } else{
2776 2783
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2777 2784
         }
2778 2785
 
Please login to merge, or discard this patch.
Indentation   +1838 added lines, -1838 removed lines patch added patch discarded remove patch
@@ -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,107 +275,107 @@  discard block
 block discarded – undo
275 275
 function geodir_content_actions_dynamic()
276 276
 {
277 277
 
278
-    $tc = get_option('theme_compatibility_setting');
278
+	$tc = get_option('theme_compatibility_setting');
279 279
 //print_r($tc);
280
-    if (empty($tc)) {
281
-        return;
282
-    }
283
-
284
-    //php
285
-    if (!empty($tc['geodir_theme_compat_code'])) {
286
-        include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
287
-    }
288
-
289
-    //geodir_full_page_class
290
-    if (!empty($tc['geodir_full_page_class_filter'])) {
291
-        add_filter('geodir_full_page_class', 'geodir_full_page_class_dynamic', 10);
292
-    }
293
-
294
-    //widget before filter
295
-    if (!empty($tc['geodir_before_widget_filter'])) {
296
-        add_filter('geodir_before_widget', 'geodir_before_widget_dynamic', 10);
297
-    }
298
-
299
-    //widget after filter
300
-    if (!empty($tc['geodir_after_widget_filter'])) {
301
-        add_filter('geodir_after_widget', 'geodir_after_widget_dynamic', 10);
302
-    }
303
-
304
-    //widget before title filter
305
-    if (!empty($tc['geodir_before_title_filter'])) {
306
-        add_filter('geodir_before_title', 'geodir_before_title_dynamic', 10);
307
-    }
308
-
309
-    //widget before title filter
310
-    if (!empty($tc['geodir_after_title_filter'])) {
311
-        add_filter('geodir_after_title', 'geodir_after_title_dynamic', 10);
312
-    }
313
-
314
-    //menu li class
315
-    if (!empty($tc['geodir_menu_li_class_filter'])) {
316
-        add_filter('geodir_menu_li_class', 'geodir_menu_li_class_dynamic', 10);
317
-    }
318
-
319
-    //menu ul class
320
-    if (!empty($tc['geodir_sub_menu_ul_class_filter'])) {
321
-        add_filter('geodir_sub_menu_ul_class', 'geodir_sub_menu_ul_class_dynamic', 10);
322
-    }
323
-
324
-    //menu sub li class
325
-    if (!empty($tc['geodir_sub_menu_li_class_filter'])) {
326
-        add_filter('geodir_sub_menu_li_class', 'geodir_sub_menu_li_class_dynamic', 10);
327
-    }
328
-
329
-    //menu a class
330
-    if (!empty($tc['geodir_menu_a_class_filter'])) {
331
-        add_filter('geodir_menu_a_class', 'geodir_menu_a_class_dynamic', 10);
332
-    }
333
-
334
-    //menu sub a class
335
-    if (!empty($tc['geodir_sub_menu_a_class_filter'])) {
336
-        add_filter('geodir_sub_menu_a_class', 'geodir_sub_menu_a_class_dynamic', 10);
337
-    }
338
-
339
-    //location menu li class
340
-    if (!empty($tc['geodir_location_switcher_menu_li_class_filter'])) {
341
-        add_filter('geodir_location_switcher_menu_li_class', 'geodir_location_switcher_menu_li_class_dynamic', 10);
342
-    }
343
-
344
-    //location menu sub ul class
345
-    if (!empty($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
346
-        add_filter('geodir_location_switcher_menu_sub_ul_class', 'geodir_location_switcher_menu_sub_ul_class_dynamic', 10);
347
-    }
348
-
349
-    //location menu sub li class
350
-    if (!empty($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
351
-        add_filter('geodir_location_switcher_menu_sub_li_class', 'geodir_location_switcher_menu_sub_li_class_dynamic', 10);
352
-    }
353
-
354
-    //location menu a class
355
-    if (!empty($tc['geodir_location_switcher_menu_a_class_filter'])) {
356
-        add_filter('geodir_location_switcher_menu_a_class', 'geodir_location_switcher_menu_a_class_dynamic', 10);
357
-    }
358
-
359
-    // compat styles
360
-    if (!empty($tc['geodir_theme_compat_css'])) {
361
-        add_action('wp_head', 'gd_compat_styles');
362
-    }
363
-
364
-    // compat js
365
-    if (!empty($tc['geodir_theme_compat_js'])) {
366
-        add_action('wp_footer', 'gd_compat_script');
367
-    }
368
-
369
-
370
-    // geodir_top_content_add
371
-    if (!empty($tc['geodir_top_content_add'])) {
372
-        add_action('geodir_top_content', 'geodir_top_content_add_dynamic', 10, 1);
373
-    }
374
-
375
-    // geodir_before_main_content_add
376
-    if (!empty($tc['geodir_before_main_content_add'])) {
377
-        add_action('geodir_before_main_content', 'geodir_before_main_content_add_dynamic', 10, 1);
378
-    }
280
+	if (empty($tc)) {
281
+		return;
282
+	}
283
+
284
+	//php
285
+	if (!empty($tc['geodir_theme_compat_code'])) {
286
+		include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
287
+	}
288
+
289
+	//geodir_full_page_class
290
+	if (!empty($tc['geodir_full_page_class_filter'])) {
291
+		add_filter('geodir_full_page_class', 'geodir_full_page_class_dynamic', 10);
292
+	}
293
+
294
+	//widget before filter
295
+	if (!empty($tc['geodir_before_widget_filter'])) {
296
+		add_filter('geodir_before_widget', 'geodir_before_widget_dynamic', 10);
297
+	}
298
+
299
+	//widget after filter
300
+	if (!empty($tc['geodir_after_widget_filter'])) {
301
+		add_filter('geodir_after_widget', 'geodir_after_widget_dynamic', 10);
302
+	}
303
+
304
+	//widget before title filter
305
+	if (!empty($tc['geodir_before_title_filter'])) {
306
+		add_filter('geodir_before_title', 'geodir_before_title_dynamic', 10);
307
+	}
308
+
309
+	//widget before title filter
310
+	if (!empty($tc['geodir_after_title_filter'])) {
311
+		add_filter('geodir_after_title', 'geodir_after_title_dynamic', 10);
312
+	}
313
+
314
+	//menu li class
315
+	if (!empty($tc['geodir_menu_li_class_filter'])) {
316
+		add_filter('geodir_menu_li_class', 'geodir_menu_li_class_dynamic', 10);
317
+	}
318
+
319
+	//menu ul class
320
+	if (!empty($tc['geodir_sub_menu_ul_class_filter'])) {
321
+		add_filter('geodir_sub_menu_ul_class', 'geodir_sub_menu_ul_class_dynamic', 10);
322
+	}
323
+
324
+	//menu sub li class
325
+	if (!empty($tc['geodir_sub_menu_li_class_filter'])) {
326
+		add_filter('geodir_sub_menu_li_class', 'geodir_sub_menu_li_class_dynamic', 10);
327
+	}
328
+
329
+	//menu a class
330
+	if (!empty($tc['geodir_menu_a_class_filter'])) {
331
+		add_filter('geodir_menu_a_class', 'geodir_menu_a_class_dynamic', 10);
332
+	}
333
+
334
+	//menu sub a class
335
+	if (!empty($tc['geodir_sub_menu_a_class_filter'])) {
336
+		add_filter('geodir_sub_menu_a_class', 'geodir_sub_menu_a_class_dynamic', 10);
337
+	}
338
+
339
+	//location menu li class
340
+	if (!empty($tc['geodir_location_switcher_menu_li_class_filter'])) {
341
+		add_filter('geodir_location_switcher_menu_li_class', 'geodir_location_switcher_menu_li_class_dynamic', 10);
342
+	}
343
+
344
+	//location menu sub ul class
345
+	if (!empty($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
346
+		add_filter('geodir_location_switcher_menu_sub_ul_class', 'geodir_location_switcher_menu_sub_ul_class_dynamic', 10);
347
+	}
348
+
349
+	//location menu sub li class
350
+	if (!empty($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
351
+		add_filter('geodir_location_switcher_menu_sub_li_class', 'geodir_location_switcher_menu_sub_li_class_dynamic', 10);
352
+	}
353
+
354
+	//location menu a class
355
+	if (!empty($tc['geodir_location_switcher_menu_a_class_filter'])) {
356
+		add_filter('geodir_location_switcher_menu_a_class', 'geodir_location_switcher_menu_a_class_dynamic', 10);
357
+	}
358
+
359
+	// compat styles
360
+	if (!empty($tc['geodir_theme_compat_css'])) {
361
+		add_action('wp_head', 'gd_compat_styles');
362
+	}
363
+
364
+	// compat js
365
+	if (!empty($tc['geodir_theme_compat_js'])) {
366
+		add_action('wp_footer', 'gd_compat_script');
367
+	}
368
+
369
+
370
+	// geodir_top_content_add
371
+	if (!empty($tc['geodir_top_content_add'])) {
372
+		add_action('geodir_top_content', 'geodir_top_content_add_dynamic', 10, 1);
373
+	}
374
+
375
+	// geodir_before_main_content_add
376
+	if (!empty($tc['geodir_before_main_content_add'])) {
377
+		add_action('geodir_before_main_content', 'geodir_before_main_content_add_dynamic', 10, 1);
378
+	}
379 379
 
380 380
 
381 381
 }
@@ -398,23 +398,23 @@  discard block
 block discarded – undo
398 398
  */
399 399
 function geodir_action_wrapper_open($type = '', $id = '', $class = '')
400 400
 {
401
-    $tc = get_option('theme_compatibility_setting');
402
-    if (!empty($tc['geodir_wrapper_open_replace'])) {
403
-        $text = $tc['geodir_wrapper_open_replace'];
404
-    } else {
405
-        $text = '<div id="[id]" class="[class]">';
406
-    }
401
+	$tc = get_option('theme_compatibility_setting');
402
+	if (!empty($tc['geodir_wrapper_open_replace'])) {
403
+		$text = $tc['geodir_wrapper_open_replace'];
404
+	} else {
405
+		$text = '<div id="[id]" class="[class]">';
406
+	}
407 407
 
408
-    if (!empty($tc['geodir_wrapper_open_id'])) {
409
-        $id = $tc['geodir_wrapper_open_id'];
410
-    }
411
-    if (!empty($tc['geodir_wrapper_open_class'])) {
412
-        $class = $tc['geodir_wrapper_open_class'];
413
-    }
408
+	if (!empty($tc['geodir_wrapper_open_id'])) {
409
+		$id = $tc['geodir_wrapper_open_id'];
410
+	}
411
+	if (!empty($tc['geodir_wrapper_open_class'])) {
412
+		$class = $tc['geodir_wrapper_open_class'];
413
+	}
414 414
 
415
-    $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
415
+	$text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
416 416
 
417
-    echo $text;
417
+	echo $text;
418 418
 }
419 419
 
420 420
 // action for adding the wrapperdiv closing tag
@@ -429,14 +429,14 @@  discard block
 block discarded – undo
429 429
  */
430 430
 function geodir_action_wrapper_close($type = '')
431 431
 {
432
-    $tc = get_option('theme_compatibility_setting');
433
-    if (!empty($tc['geodir_wrapper_close_replace'])) {
434
-        $text = $tc['geodir_wrapper_close_replace'];
435
-    } else {
436
-        $text = '</div><!-- wrapper ends here-->';
437
-    }
432
+	$tc = get_option('theme_compatibility_setting');
433
+	if (!empty($tc['geodir_wrapper_close_replace'])) {
434
+		$text = $tc['geodir_wrapper_close_replace'];
435
+	} else {
436
+		$text = '</div><!-- wrapper ends here-->';
437
+	}
438 438
 
439
-    echo $text;
439
+	echo $text;
440 440
 }
441 441
 
442 442
 // action for adding the content div opening tag
@@ -452,35 +452,35 @@  discard block
 block discarded – undo
452 452
  */
453 453
 function geodir_action_wrapper_content_open($type = '', $id = '', $class = '')
454 454
 {
455
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
456
-        $width_css = 'style="width:' . $width . '%;"';
457
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
458
-        $width_css = 'style="width:' . $width . '%;"';
459
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
460
-        $width_css = 'style="width:' . $width . '%;"';
461
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
462
-        $width_css = 'style="width:' . $width . '%;"';
463
-    } else {
464
-        $width_css = '';
465
-    }
466
-
467
-    $tc = get_option('theme_compatibility_setting');
468
-    if (!empty($tc['geodir_wrapper_content_open_replace'])) {
469
-        $text = $tc['geodir_wrapper_content_open_replace'];
470
-    } else {
471
-        $text = '<div id="[id]" class="[class]" role="main" [width_css]>';
472
-    }
473
-
474
-    if (!empty($tc['geodir_wrapper_content_open_id'])) {
475
-        $id = $tc['geodir_wrapper_content_open_id'];
476
-    }
477
-    if (!empty($tc['geodir_wrapper_content_open_class'])) {
478
-        $class = $tc['geodir_wrapper_content_open_class'];
479
-    }
480
-
481
-    $text = str_replace(array("[id]", "[class]", "[width_css]"), array($id, $class, $width_css), $text);
482
-
483
-    echo $text;
455
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
456
+		$width_css = 'style="width:' . $width . '%;"';
457
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
458
+		$width_css = 'style="width:' . $width . '%;"';
459
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
460
+		$width_css = 'style="width:' . $width . '%;"';
461
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
462
+		$width_css = 'style="width:' . $width . '%;"';
463
+	} else {
464
+		$width_css = '';
465
+	}
466
+
467
+	$tc = get_option('theme_compatibility_setting');
468
+	if (!empty($tc['geodir_wrapper_content_open_replace'])) {
469
+		$text = $tc['geodir_wrapper_content_open_replace'];
470
+	} else {
471
+		$text = '<div id="[id]" class="[class]" role="main" [width_css]>';
472
+	}
473
+
474
+	if (!empty($tc['geodir_wrapper_content_open_id'])) {
475
+		$id = $tc['geodir_wrapper_content_open_id'];
476
+	}
477
+	if (!empty($tc['geodir_wrapper_content_open_class'])) {
478
+		$class = $tc['geodir_wrapper_content_open_class'];
479
+	}
480
+
481
+	$text = str_replace(array("[id]", "[class]", "[width_css]"), array($id, $class, $width_css), $text);
482
+
483
+	echo $text;
484 484
 }
485 485
 
486 486
 // action for adding the primary div closing tag
@@ -494,13 +494,13 @@  discard block
 block discarded – undo
494 494
  */
495 495
 function geodir_action_wrapper_content_close($type = '')
496 496
 {
497
-    $tc = get_option('theme_compatibility_setting');
498
-    if (!empty($tc['geodir_wrapper_content_close_replace'])) {
499
-        $text = $tc['geodir_wrapper_content_close_replace'];
500
-    } else {
501
-        $text = '</div><!-- content ends here-->';
502
-    }
503
-    echo $text;
497
+	$tc = get_option('theme_compatibility_setting');
498
+	if (!empty($tc['geodir_wrapper_content_close_replace'])) {
499
+		$text = $tc['geodir_wrapper_content_close_replace'];
500
+	} else {
501
+		$text = '</div><!-- content ends here-->';
502
+	}
503
+	echo $text;
504 504
 }
505 505
 
506 506
 // action for adding the <article> opening tag
@@ -518,24 +518,24 @@  discard block
 block discarded – undo
518 518
  */
519 519
 function geodir_action_article_open($type = '', $id = '', $class = '', $itemtype = '')
520 520
 {
521
-    $class = implode(" ", $class);
522
-    $tc = get_option('theme_compatibility_setting');
523
-    if (!empty($tc['geodir_article_open_replace'])) {
524
-        $text = $tc['geodir_article_open_replace'];
525
-    } else {
526
-        $text = '<article  id="[id]" class="[class]" >';
527
-    }
521
+	$class = implode(" ", $class);
522
+	$tc = get_option('theme_compatibility_setting');
523
+	if (!empty($tc['geodir_article_open_replace'])) {
524
+		$text = $tc['geodir_article_open_replace'];
525
+	} else {
526
+		$text = '<article  id="[id]" class="[class]" >';
527
+	}
528 528
 
529
-    if (!empty($tc['geodir_article_open_id'])) {
530
-        $id = $tc['geodir_article_open_id'];
531
-    }
532
-    if (!empty($tc['geodir_article_open_class'])) {
533
-        $class = $tc['geodir_article_open_class'];
534
-    }
529
+	if (!empty($tc['geodir_article_open_id'])) {
530
+		$id = $tc['geodir_article_open_id'];
531
+	}
532
+	if (!empty($tc['geodir_article_open_class'])) {
533
+		$class = $tc['geodir_article_open_class'];
534
+	}
535 535
 
536
-    $text = str_replace(array("[id]", "[class]", "[itemtype]"), array($id, $class, $itemtype), $text);
536
+	$text = str_replace(array("[id]", "[class]", "[itemtype]"), array($id, $class, $itemtype), $text);
537 537
 
538
-    echo $text;
538
+	echo $text;
539 539
 }
540 540
 
541 541
 // action for adding the primary div closing tag
@@ -549,13 +549,13 @@  discard block
 block discarded – undo
549 549
  */
550 550
 function geodir_action_article_close($type = '')
551 551
 {
552
-    $tc = get_option('theme_compatibility_setting');
553
-    if (!empty($tc['geodir_article_close_replace'])) {
554
-        $text = $tc['geodir_article_close_replace'];
555
-    } else {
556
-        $text = '</article><!-- article ends here-->';
557
-    }
558
-    echo $text;
552
+	$tc = get_option('theme_compatibility_setting');
553
+	if (!empty($tc['geodir_article_close_replace'])) {
554
+		$text = $tc['geodir_article_close_replace'];
555
+	} else {
556
+		$text = '</article><!-- article ends here-->';
557
+	}
558
+	echo $text;
559 559
 }
560 560
 
561 561
 // action for adding the sidebar opening tag
@@ -572,35 +572,35 @@  discard block
 block discarded – undo
572 572
  */
573 573
 function geodir_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')
574 574
 {
575
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
576
-        $width_css = 'style="width:' . $width . '%;"';
577
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
578
-        $width_css = 'style="width:' . $width . '%;"';
579
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
580
-        $width_css = 'style="width:' . $width . '%;"';
581
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
582
-        $width_css = 'style="width:' . $width . '%;"';
583
-    } else {
584
-        $width_css = '';
585
-    }
586
-
587
-    $tc = get_option('theme_compatibility_setting');
588
-    if (!empty($tc['geodir_sidebar_right_open_replace'])) {
589
-        $text = $tc['geodir_sidebar_right_open_replace'];
590
-    } else {
591
-        $text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
592
-    }
593
-
594
-    if (!empty($tc['geodir_sidebar_right_open_id'])) {
595
-        $id = $tc['geodir_sidebar_right_open_id'];
596
-    }
597
-    if (!empty($tc['geodir_sidebar_right_open_class'])) {
598
-        $class = $tc['geodir_sidebar_right_open_class'];
599
-    }
600
-
601
-    $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
602
-
603
-    echo $text;
575
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
576
+		$width_css = 'style="width:' . $width . '%;"';
577
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
578
+		$width_css = 'style="width:' . $width . '%;"';
579
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
580
+		$width_css = 'style="width:' . $width . '%;"';
581
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
582
+		$width_css = 'style="width:' . $width . '%;"';
583
+	} else {
584
+		$width_css = '';
585
+	}
586
+
587
+	$tc = get_option('theme_compatibility_setting');
588
+	if (!empty($tc['geodir_sidebar_right_open_replace'])) {
589
+		$text = $tc['geodir_sidebar_right_open_replace'];
590
+	} else {
591
+		$text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
592
+	}
593
+
594
+	if (!empty($tc['geodir_sidebar_right_open_id'])) {
595
+		$id = $tc['geodir_sidebar_right_open_id'];
596
+	}
597
+	if (!empty($tc['geodir_sidebar_right_open_class'])) {
598
+		$class = $tc['geodir_sidebar_right_open_class'];
599
+	}
600
+
601
+	$text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
602
+
603
+	echo $text;
604 604
 }
605 605
 
606 606
 // action for adding the primary div closing tag
@@ -614,13 +614,13 @@  discard block
 block discarded – undo
614 614
  */
615 615
 function geodir_action_sidebar_right_close($type = '')
616 616
 {
617
-    $tc = get_option('theme_compatibility_setting');
618
-    if (!empty($tc['geodir_sidebar_right_close_replace'])) {
619
-        $text = $tc['geodir_sidebar_right_close_replace'];
620
-    } else {
621
-        $text = '</aside><!-- sidebar ends here-->';
622
-    }
623
-    echo $text;
617
+	$tc = get_option('theme_compatibility_setting');
618
+	if (!empty($tc['geodir_sidebar_right_close_replace'])) {
619
+		$text = $tc['geodir_sidebar_right_close_replace'];
620
+	} else {
621
+		$text = '</aside><!-- sidebar ends here-->';
622
+	}
623
+	echo $text;
624 624
 }
625 625
 
626 626
 
@@ -641,121 +641,121 @@  discard block
 block discarded – undo
641 641
  */
642 642
 function geodir_action_geodir_set_preview_post()
643 643
 {
644
-    global $post, $preview, $gd_session;
645
-    $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
646
-    if (!$preview || $is_backend_preview) {
647
-        return;
648
-    }// bail if not previewing
649
-
650
-    $listing_type = isset($_REQUEST['listing_type']) ? sanitize_text_field($_REQUEST['listing_type']) : '';
651
-
652
-    $fields_info = geodir_get_custom_fields_type($listing_type);
653
-
654
-    foreach ($_REQUEST as $pkey => $pval) {
655
-        if ($pkey == 'geodir_video') {
656
-            $tags = '<iframe>';
657
-        } else if ($pkey == 'post_desc') {
658
-            $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
659
-        } else if (is_array($fields_info) && isset($fields_info[$pkey]) && ($fields_info[$pkey] == 'textarea' || $fields_info[$pkey] == 'html')) {
660
-            $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
661
-        } else if (is_array($_REQUEST[$pkey])) {
662
-            $tags = 'skip_field';
663
-        } else {
664
-            $tags = '';
665
-        }
666
-        /**
667
-         * Allows the filtering of the allowed HTML tags per field when submitting from frontend add listing page.
668
-         *
669
-         * @since 1.0.0
670
-         * @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>'.
671
-         * @param string|array $pkey The field id/name. If array then value is set as "skip_field".
672
-         */
673
-        $tags = apply_filters('geodir_save_post_key', $tags, $pkey);
674
-
675
-        if ($tags != 'skip_field') {
676
-            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
677
-        }
678
-    }
679
-
680
-    $post = (object)$_REQUEST;
681
-
682
-
683
-    if (isset($post->video)) {
684
-        $post->video = stripslashes($post->video);
685
-    }
686
-
687
-    if (isset($post->Video2)) {
688
-        $post->Video2 = stripslashes($post->Video2);
689
-    }
690
-
691
-    $post_type = $post->listing_type;
692
-    $post_type_info = get_post_type_object($post_type);
693
-
694
-    $listing_label = $post_type_info->labels->singular_name;
695
-
696
-    $term_icon = '';
697
-
698
-    if (!empty($post->post_category)) {
699
-        foreach ($post->post_category as $post_taxonomy => $post_term) {
700
-
701
-            if ($post_term != '' && !is_array($post_term)) {
702
-                $post_term = explode(',', trim($post_term, ','));
703
-            }
644
+	global $post, $preview, $gd_session;
645
+	$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
646
+	if (!$preview || $is_backend_preview) {
647
+		return;
648
+	}// bail if not previewing
649
+
650
+	$listing_type = isset($_REQUEST['listing_type']) ? sanitize_text_field($_REQUEST['listing_type']) : '';
651
+
652
+	$fields_info = geodir_get_custom_fields_type($listing_type);
653
+
654
+	foreach ($_REQUEST as $pkey => $pval) {
655
+		if ($pkey == 'geodir_video') {
656
+			$tags = '<iframe>';
657
+		} else if ($pkey == 'post_desc') {
658
+			$tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
659
+		} else if (is_array($fields_info) && isset($fields_info[$pkey]) && ($fields_info[$pkey] == 'textarea' || $fields_info[$pkey] == 'html')) {
660
+			$tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
661
+		} else if (is_array($_REQUEST[$pkey])) {
662
+			$tags = 'skip_field';
663
+		} else {
664
+			$tags = '';
665
+		}
666
+		/**
667
+		 * Allows the filtering of the allowed HTML tags per field when submitting from frontend add listing page.
668
+		 *
669
+		 * @since 1.0.0
670
+		 * @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>'.
671
+		 * @param string|array $pkey The field id/name. If array then value is set as "skip_field".
672
+		 */
673
+		$tags = apply_filters('geodir_save_post_key', $tags, $pkey);
674
+
675
+		if ($tags != 'skip_field') {
676
+			$_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
677
+		}
678
+	}
679
+
680
+	$post = (object)$_REQUEST;
681
+
682
+
683
+	if (isset($post->video)) {
684
+		$post->video = stripslashes($post->video);
685
+	}
686
+
687
+	if (isset($post->Video2)) {
688
+		$post->Video2 = stripslashes($post->Video2);
689
+	}
690
+
691
+	$post_type = $post->listing_type;
692
+	$post_type_info = get_post_type_object($post_type);
693
+
694
+	$listing_label = $post_type_info->labels->singular_name;
695
+
696
+	$term_icon = '';
697
+
698
+	if (!empty($post->post_category)) {
699
+		foreach ($post->post_category as $post_taxonomy => $post_term) {
700
+
701
+			if ($post_term != '' && !is_array($post_term)) {
702
+				$post_term = explode(',', trim($post_term, ','));
703
+			}
704 704
 
705
-            if (is_array($post_term)) {
706
-                $post_term = array_unique($post_term);
707
-            }
705
+			if (is_array($post_term)) {
706
+				$post_term = array_unique($post_term);
707
+			}
708 708
 
709
-            if (!empty($post_term)) {
710
-                foreach ($post_term as $cat_id) {
711
-                    $cat_id = trim($cat_id);
712
-
713
-                    if ($cat_id != '') {
714
-                        $term_icon = get_option('geodir_default_marker_icon');
715
-
716
-                        if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
717
-                            if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
718
-                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
719
-                                    $term_icon = $term_icon_url['src'];
720
-                                break;
721
-                            }
722
-                        }
723
-                    }
724
-                }
725
-            }
726
-        }
727
-    }
709
+			if (!empty($post_term)) {
710
+				foreach ($post_term as $cat_id) {
711
+					$cat_id = trim($cat_id);
712
+
713
+					if ($cat_id != '') {
714
+						$term_icon = get_option('geodir_default_marker_icon');
715
+
716
+						if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
717
+							if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
718
+								if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
719
+									$term_icon = $term_icon_url['src'];
720
+								break;
721
+							}
722
+						}
723
+					}
724
+				}
725
+			}
726
+		}
727
+	}
728 728
 
729
-    $post_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
730
-    $post_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
729
+	$post_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
730
+	$post_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
731 731
 
732
-    $srcharr = array("'", "/", "-", '"', '\\');
733
-    $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
732
+	$srcharr = array("'", "/", "-", '"', '\\');
733
+	$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
734 734
 
735
-    $json_title = str_replace($srcharr, $replarr, $post->post_title);
735
+	$json_title = str_replace($srcharr, $replarr, $post->post_title);
736 736
 
737
-    $json = '{';
738
-    $json .= '"post_preview": "1",';
739
-    $json .= '"t": "' . $json_title . '",';
740
-    $json .= '"lt": "' . $post_latitude . '",';
741
-    $json .= '"ln": "' . $post_longitude . '",';
742
-    $json .= '"i":"' . $term_icon . '"';
743
-    $json .= '}';
737
+	$json = '{';
738
+	$json .= '"post_preview": "1",';
739
+	$json .= '"t": "' . $json_title . '",';
740
+	$json .= '"lt": "' . $post_latitude . '",';
741
+	$json .= '"ln": "' . $post_longitude . '",';
742
+	$json .= '"i":"' . $term_icon . '"';
743
+	$json .= '}';
744 744
 
745
-    $post->marker_json = $json;
745
+	$post->marker_json = $json;
746 746
 
747
-    $gd_session->set('listing', $_REQUEST);
747
+	$gd_session->set('listing', $_REQUEST);
748 748
 
749
-    // we need to define a few things to trick the setup_postdata
750
-    if (!isset($post->ID)) {
751
-        $post->ID = '';
752
-        $post->post_author = '';
753
-        $post->post_date = '';
754
-        $post->post_content = '';
755
-        $post->default_category = '';
756
-        $post->post_type = '';
757
-    }
758
-    setup_postdata($post);
749
+	// we need to define a few things to trick the setup_postdata
750
+	if (!isset($post->ID)) {
751
+		$post->ID = '';
752
+		$post->post_author = '';
753
+		$post->post_date = '';
754
+		$post->post_content = '';
755
+		$post->default_category = '';
756
+		$post->post_type = '';
757
+	}
758
+	setup_postdata($post);
759 759
 }
760 760
 
761 761
 /**
@@ -767,15 +767,15 @@  discard block
 block discarded – undo
767 767
  */
768 768
 function geodir_action_geodir_preview_code()
769 769
 {
770
-    global $preview;
770
+	global $preview;
771 771
 
772
-    $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
+	$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
773 773
 
774
-    if (!$preview || $is_backend_preview) {
775
-        return;
776
-    }// bail if not previewing
774
+	if (!$preview || $is_backend_preview) {
775
+		return;
776
+	}// bail if not previewing
777 777
 
778
-    geodir_get_template_part('preview', 'buttons');
778
+	geodir_get_template_part('preview', 'buttons');
779 779
 }
780 780
 
781 781
 // action for adding the details page top widget area
@@ -791,20 +791,20 @@  discard block
 block discarded – undo
791 791
  */
792 792
 function geodir_action_geodir_sidebar_detail_top($class = '')
793 793
 {
794
-    if (get_option('geodir_show_detail_top_section')) { ?>
794
+	if (get_option('geodir_show_detail_top_section')) { ?>
795 795
         <div
796 796
             class="<?php
797
-            /**
798
-             * Filter the div class for the wrapper of the full width widget areas.
799
-             *
800
-             * 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.
801
-             *
802
-             * @since 1.0.0
803
-             * @param string $class The class of the div.
804
-             * @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',
805
-             *               'geodir_author_top','geodir_author_bottom', 'geodir_search_top', 'geodir_search_bottom', 'geodir_home_top' or 'geodir_home_bottom'.
806
-             */
807
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_top'); ?> <?php echo $class; ?>">
797
+			/**
798
+			 * Filter the div class for the wrapper of the full width widget areas.
799
+			 *
800
+			 * 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.
801
+			 *
802
+			 * @since 1.0.0
803
+			 * @param string $class The class of the div.
804
+			 * @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',
805
+			 *               'geodir_author_top','geodir_author_bottom', 'geodir_search_top', 'geodir_search_bottom', 'geodir_home_top' or 'geodir_home_bottom'.
806
+			 */
807
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_top'); ?> <?php echo $class; ?>">
808 808
             <?php dynamic_sidebar('geodir_detail_top'); ?>
809 809
         </div>
810 810
     <?php }
@@ -828,11 +828,11 @@  discard block
 block discarded – undo
828 828
  */
829 829
 function geodir_action_geodir_sidebar_detail_bottom_section($class = '')
830 830
 {
831
-    if (get_option('geodir_show_detail_bottom_section')) { ?>
831
+	if (get_option('geodir_show_detail_bottom_section')) { ?>
832 832
         <div
833 833
             class="<?php
834
-            /** This action is documented in geodirectory_template_actions.php */
835
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_bottom'); ?> <?php echo $class; ?>">
834
+			/** This action is documented in geodirectory_template_actions.php */
835
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_bottom'); ?> <?php echo $class; ?>">
836 836
             <?php dynamic_sidebar('geodir_detail_bottom'); ?>
837 837
         </div><!-- clearfix ends here-->
838 838
     <?php }
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
  */
847 847
 function geodir_details_sidebar_widget_area()
848 848
 {
849
-    dynamic_sidebar('geodir_detail_sidebar');
849
+	dynamic_sidebar('geodir_detail_sidebar');
850 850
 }
851 851
 
852 852
 /**
@@ -857,12 +857,12 @@  discard block
 block discarded – undo
857 857
  */
858 858
 function geodir_details_sidebar_place_details()
859 859
 {
860
-    /**
861
-     * Used to add items to the details page sidebar.
862
-     *
863
-     * @since 1.0.0
864
-     */
865
-    do_action('geodir_detail_page_sidebar');
860
+	/**
861
+	 * Used to add items to the details page sidebar.
862
+	 *
863
+	 * @since 1.0.0
864
+	 */
865
+	do_action('geodir_detail_page_sidebar');
866 866
 }
867 867
 
868 868
 add_action('geodir_detail_sidebar_inside', 'geodir_details_sidebar_place_details', 10);
@@ -877,68 +877,68 @@  discard block
 block discarded – undo
877 877
  */
878 878
 function geodir_action_details_sidebar()
879 879
 {
880
-    // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
881
-    if (get_option('geodir_detail_sidebar_left_section')) {
882
-        /**
883
-         * Called before the details page left sidebar is opened.
884
-         *
885
-         * This is used to add opening wrapper HTML to the details page left sidebar.
886
-         *
887
-         * @since 1.0.0
888
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
889
-         * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-left'.
890
-         * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-left geodir-details-sidebar-left'.
891
-         * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
892
-         */
893
-        do_action('geodir_sidebar_left_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-left geodir-details-sidebar-left', 'https://schema.org/WPSideBar');
894
-        ?>
880
+	// this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
881
+	if (get_option('geodir_detail_sidebar_left_section')) {
882
+		/**
883
+		 * Called before the details page left sidebar is opened.
884
+		 *
885
+		 * This is used to add opening wrapper HTML to the details page left sidebar.
886
+		 *
887
+		 * @since 1.0.0
888
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
889
+		 * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-left'.
890
+		 * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-left geodir-details-sidebar-left'.
891
+		 * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
892
+		 */
893
+		do_action('geodir_sidebar_left_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-left geodir-details-sidebar-left', 'https://schema.org/WPSideBar');
894
+		?>
895 895
         <div class="geodir-content-left geodir-sidebar-wrap"><?php
896
-        /**
897
-         * Called inside the HTML wrapper of the details sidebar for either the left and right sidebar.
898
-         *
899
-         * This is used to add all info to the details page sidebars.
900
-         *
901
-         * @since 1.0.0
902
-         */
903
-        do_action('geodir_detail_sidebar_inside');
904
-        ?></div><!-- end geodir-content-left --><?php
905
-        /**
906
-         * Called after the details page left sidebar.
907
-         *
908
-         * This is used to add closing wrapper HTML to the details page left sidebar.
909
-         *
910
-         * @since 1.0.0
911
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
912
-         */
913
-        do_action('geodir_sidebar_left_close', 'details-page');
914
-    } else {
915
-        /**
916
-         * Called before the details page right sidebar is opened.
917
-         *
918
-         * This is used to add opening wrapper HTML to the details page right sidebar.
919
-         *
920
-         * @since 1.0.0
921
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'add-listing-page', 'author-page', 'search-page' or 'home-page'.
922
-         * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-right'.
923
-         * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-right geodir-details-sidebar-right'.
924
-         * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
925
-         */
926
-        do_action('geodir_sidebar_right_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-right geodir-details-sidebar-right', 'http://schema.org/WPSideBar');
927
-        ?>
896
+		/**
897
+		 * Called inside the HTML wrapper of the details sidebar for either the left and right sidebar.
898
+		 *
899
+		 * This is used to add all info to the details page sidebars.
900
+		 *
901
+		 * @since 1.0.0
902
+		 */
903
+		do_action('geodir_detail_sidebar_inside');
904
+		?></div><!-- end geodir-content-left --><?php
905
+		/**
906
+		 * Called after the details page left sidebar.
907
+		 *
908
+		 * This is used to add closing wrapper HTML to the details page left sidebar.
909
+		 *
910
+		 * @since 1.0.0
911
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
912
+		 */
913
+		do_action('geodir_sidebar_left_close', 'details-page');
914
+	} else {
915
+		/**
916
+		 * Called before the details page right sidebar is opened.
917
+		 *
918
+		 * This is used to add opening wrapper HTML to the details page right sidebar.
919
+		 *
920
+		 * @since 1.0.0
921
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'add-listing-page', 'author-page', 'search-page' or 'home-page'.
922
+		 * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-right'.
923
+		 * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-right geodir-details-sidebar-right'.
924
+		 * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
925
+		 */
926
+		do_action('geodir_sidebar_right_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-right geodir-details-sidebar-right', 'http://schema.org/WPSideBar');
927
+		?>
928 928
         <div class="geodir-content-right geodir-sidebar-wrap"><?php
929
-        /** This action is documented in geodirectory_template_actions.php */
930
-        do_action('geodir_detail_sidebar_inside');
931
-        ?></div><!-- end geodir-content-right --><?php
932
-        /**
933
-         * Called after the details page right sidebar.
934
-         *
935
-         * This is used to add closing wrapper HTML to the details page right sidebar.
936
-         *
937
-         * @since 1.0.0
938
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
939
-         */
940
-        do_action('geodir_sidebar_right_close', 'details-page');
941
-    }
929
+		/** This action is documented in geodirectory_template_actions.php */
930
+		do_action('geodir_detail_sidebar_inside');
931
+		?></div><!-- end geodir-content-right --><?php
932
+		/**
933
+		 * Called after the details page right sidebar.
934
+		 *
935
+		 * This is used to add closing wrapper HTML to the details page right sidebar.
936
+		 *
937
+		 * @since 1.0.0
938
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
939
+		 */
940
+		do_action('geodir_sidebar_right_close', 'details-page');
941
+	}
942 942
 }
943 943
 
944 944
 add_action('geodir_page_title', 'geodir_action_page_title', 10);
@@ -952,21 +952,21 @@  discard block
 block discarded – undo
952 952
  */
953 953
 function geodir_action_page_title()
954 954
 {
955
-    /**
956
-     * Filter the page title HTML h1 class.
957
-     *
958
-     * @since 1.0.0
959
-     * @param string $class The class to use. Default is 'entry-title fn'.
960
-     */
961
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
962
-    /**
963
-     * Filter the page title HTML header wrapper class.
964
-     *
965
-     * @since 1.0.0
966
-     * @param string $class The class to use. Default is 'entry-header'.
967
-     */
968
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
969
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
955
+	/**
956
+	 * Filter the page title HTML h1 class.
957
+	 *
958
+	 * @since 1.0.0
959
+	 * @param string $class The class to use. Default is 'entry-title fn'.
960
+	 */
961
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
962
+	/**
963
+	 * Filter the page title HTML header wrapper class.
964
+	 *
965
+	 * @since 1.0.0
966
+	 * @param string $class The class to use. Default is 'entry-header'.
967
+	 */
968
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
969
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
970 970
 }
971 971
 
972 972
 
@@ -983,94 +983,94 @@  discard block
 block discarded – undo
983 983
  */
984 984
 function geodir_action_details_slider()
985 985
 {
986
-    global $preview, $post;
986
+	global $preview, $post;
987 987
 
988
-    $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // preview from backend
988
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // preview from backend
989 989
 
990
-    if ($is_backend_preview && !empty($post) && !empty($post->ID) && !isset($post->post_images)) {
991
-        $preview_get_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
990
+	if ($is_backend_preview && !empty($post) && !empty($post->ID) && !isset($post->post_images)) {
991
+		$preview_get_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
992 992
 
993
-        $preview_post_images = array();
994
-        if ($preview_get_images) {
995
-            foreach ($preview_get_images as $row) {
996
-                $preview_post_images[] = $row->src;
997
-            }
998
-        }
999
-        if (!empty($preview_post_images)) {
1000
-            $post->post_images = implode(',', $preview_post_images);
1001
-        }
1002
-    }
1003
-
1004
-    if ($preview) {
1005
-        $post_images = array();
1006
-        if (isset($post->post_images) && !empty($post->post_images)) {
1007
-            $post->post_images = trim($post->post_images, ",");
1008
-            $post_images = explode(",", $post->post_images);
1009
-        }
1010
-
1011
-        $main_slides = '';
1012
-        $nav_slides = '';
1013
-        $slides = 0;
1014
-
1015
-        if (!empty($post_images)) {
1016
-            foreach ($post_images as $image) {
1017
-                if (!empty($image)) {
1018
-                    $sizes = getimagesize(trim($image));
1019
-                    $width = !empty($sizes) && isset($sizes[0]) ? $sizes[0] : 0;
1020
-                    $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1021
-
1022
-                    if ($image && $width && $height) {
1023
-                        $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1024
-                    }
1025
-
1026
-                    if (isset($image->src)) {
1027
-                        if ($image->height >= 400) {
1028
-                            $spacer_height = 0;
1029
-                        } else {
1030
-                            $spacer_height = ((400 - $image->height) / 2);
1031
-                        }
1032
-
1033
-                        $image_title = isset($image->title) ? $image->title : '';
1034
-
1035
-                        $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;" />';
1036
-                        $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1037
-                        $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1038
-                        $slides++;
1039
-                    }
1040
-                }
1041
-            }// endfore
1042
-        } //end if
1043
-    } else {
1044
-        $main_slides = '';
1045
-        $nav_slides = '';
1046
-        /**
1047
-         * Filter if default images should show on the details page.
1048
-         *
1049
-         * @param bool $use_default_image Default false.
1050
-         * @since 1.6.16
1051
-         */
1052
-        $use_default_image = apply_filters('geodir_details_default_image_show', false);
1053
-        $post_images = geodir_get_images($post->ID, 'thumbnail', $use_default_image); // Hide default image on listing preview/detail page.
1054
-        $slides = 0;
1055
-
1056
-        if (!empty($post_images)) {
1057
-            foreach ($post_images as $image) {
1058
-                if ($image->height >= 400) {
1059
-                    $spacer_height = 0;
1060
-                } else {
1061
-                    $spacer_height = ((400 - $image->height) / 2);
1062
-                }
1063
-                $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1064
-                $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;" />';
1065
-                $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1066
-                $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1067
-                $slides++;
1068
-            }
1069
-        }// endfore
1070
-    }
993
+		$preview_post_images = array();
994
+		if ($preview_get_images) {
995
+			foreach ($preview_get_images as $row) {
996
+				$preview_post_images[] = $row->src;
997
+			}
998
+		}
999
+		if (!empty($preview_post_images)) {
1000
+			$post->post_images = implode(',', $preview_post_images);
1001
+		}
1002
+	}
1003
+
1004
+	if ($preview) {
1005
+		$post_images = array();
1006
+		if (isset($post->post_images) && !empty($post->post_images)) {
1007
+			$post->post_images = trim($post->post_images, ",");
1008
+			$post_images = explode(",", $post->post_images);
1009
+		}
1010
+
1011
+		$main_slides = '';
1012
+		$nav_slides = '';
1013
+		$slides = 0;
1014
+
1015
+		if (!empty($post_images)) {
1016
+			foreach ($post_images as $image) {
1017
+				if (!empty($image)) {
1018
+					$sizes = getimagesize(trim($image));
1019
+					$width = !empty($sizes) && isset($sizes[0]) ? $sizes[0] : 0;
1020
+					$height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1021
+
1022
+					if ($image && $width && $height) {
1023
+						$image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1024
+					}
1025
+
1026
+					if (isset($image->src)) {
1027
+						if ($image->height >= 400) {
1028
+							$spacer_height = 0;
1029
+						} else {
1030
+							$spacer_height = ((400 - $image->height) / 2);
1031
+						}
1032
+
1033
+						$image_title = isset($image->title) ? $image->title : '';
1034
+
1035
+						$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;" />';
1036
+						$main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1037
+						$nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1038
+						$slides++;
1039
+					}
1040
+				}
1041
+			}// endfore
1042
+		} //end if
1043
+	} else {
1044
+		$main_slides = '';
1045
+		$nav_slides = '';
1046
+		/**
1047
+		 * Filter if default images should show on the details page.
1048
+		 *
1049
+		 * @param bool $use_default_image Default false.
1050
+		 * @since 1.6.16
1051
+		 */
1052
+		$use_default_image = apply_filters('geodir_details_default_image_show', false);
1053
+		$post_images = geodir_get_images($post->ID, 'thumbnail', $use_default_image); // Hide default image on listing preview/detail page.
1054
+		$slides = 0;
1055
+
1056
+		if (!empty($post_images)) {
1057
+			foreach ($post_images as $image) {
1058
+				if ($image->height >= 400) {
1059
+					$spacer_height = 0;
1060
+				} else {
1061
+					$spacer_height = ((400 - $image->height) / 2);
1062
+				}
1063
+				$caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1064
+				$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;" />';
1065
+				$main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1066
+				$nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1067
+				$slides++;
1068
+			}
1069
+		}// endfore
1070
+	}
1071 1071
 
1072
-    if (!empty($post_images)) {
1073
-        ?>
1072
+	if (!empty($post_images)) {
1073
+		?>
1074 1074
         <div class="geodir_flex-container">
1075 1075
             <div class="geodir_flex-loader"><i class="fa fa-refresh fa-spin"></i></div>
1076 1076
             <div id="geodir_slider" class="geodir_flexslider ">
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
             <?php } ?>
1084 1084
         </div>
1085 1085
     <?php
1086
-    }
1086
+	}
1087 1087
 }
1088 1088
 
1089 1089
 add_action('geodir_details_taxonomies', 'geodir_action_details_taxonomies', 10);
@@ -1098,177 +1098,177 @@  discard block
 block discarded – undo
1098 1098
  */
1099 1099
 function geodir_action_details_taxonomies()
1100 1100
 {
1101
-    global $preview, $post;?>
1101
+	global $preview, $post;?>
1102 1102
     <p class="geodir_post_taxomomies clearfix">
1103 1103
     <?php
1104
-    $taxonomies = array();
1105
-
1106
-    $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
1107
-
1108
-    if ($preview && !$is_backend_preview) {
1109
-        $post_type = $post->listing_type;
1110
-        $post_taxonomy = $post_type . 'category';
1111
-        $post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1112
-    } else {
1113
-        $post_type = $post->post_type;
1114
-        $post_taxonomy = $post_type . 'category';
1115
-    }
1104
+	$taxonomies = array();
1105
+
1106
+	$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
1107
+
1108
+	if ($preview && !$is_backend_preview) {
1109
+		$post_type = $post->listing_type;
1110
+		$post_taxonomy = $post_type . 'category';
1111
+		$post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1112
+	} else {
1113
+		$post_type = $post->post_type;
1114
+		$post_taxonomy = $post_type . 'category';
1115
+	}
1116 1116
 //{	
1117
-    $post_type_info = get_post_type_object($post_type);
1118
-    $listing_label = __($post_type_info->labels->singular_name, 'geodirectory');
1119
-
1120
-    if (!empty($post->post_tags)) {
1121
-
1122
-        if (taxonomy_exists($post_type . '_tags')):
1123
-            $links = array();
1124
-            $terms = array();
1125
-            // to limit post tags
1126
-            $post_tags = trim($post->post_tags, ",");
1127
-            $post_id = isset($post->ID) ? $post->ID : '';
1128
-            /**
1129
-             * Filter the post tags.
1130
-             *
1131
-             * Allows you to filter the post tags output on the details page of a post.
1132
-             *
1133
-             * @since 1.0.0
1134
-             * @param string $post_tags A comma seperated list of tags.
1135
-             * @param int $post_id The current post id.
1136
-             */
1137
-            $post_tags = apply_filters('geodir_action_details_post_tags', $post_tags, $post_id);
1138
-
1139
-            $post->post_tags = $post_tags;
1140
-            $post_tags = explode(",", trim($post->post_tags, ","));
1141
-
1142
-
1143
-            foreach ($post_tags as $post_term) {
1144
-
1145
-                // fix slug creation order for tags & location
1146
-                $post_term = trim($post_term);
1147
-
1148
-                $priority_location = false;
1149
-                if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1150
-                    $term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
1151
-                } else {
1152
-                    $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1153
-                    $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
1154
-                    $post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL;
1155
-                    $match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false;
1156
-                    $match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false;
1157
-                    $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1158
-                    if ($match_country || $match_region || $match_city) {
1159
-                        $priority_location = true;
1160
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1161
-                    } else {
1162
-                        $insert_term = wp_insert_term($post_term, $post_type . '_tags');
1163
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1164
-                    }
1165
-                }
1166
-
1167
-                if (!is_wp_error($term) && is_object($term)) {
1168
-
1169
-                    // fix tag link on detail page
1170
-                    if ($priority_location) {
1171
-
1172
-                        $tag_link = "<a href=''>$post_term</a>";
1173
-                        /**
1174
-                         * Filter the tag name on the details page.
1175
-                         *
1176
-                         * @since 1.5.6
1177
-                         * @param string $tag_link The tag link html.
1178
-                         * @param object $term The tag term object.
1179
-                         */
1180
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1181
-                        $links[] = $tag_link;
1182
-                    } else {
1183
-                        $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1184
-                        /** This action is documented in geodirectory-template_actions.php */
1185
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1186
-                        $links[] = $tag_link;
1187
-                    }
1188
-                    $terms[] = $term;
1189
-                }
1190
-                //
1191
-            }
1192
-            if (!isset($listing_label)) {
1193
-                $listing_label = '';
1194
-            }
1195
-            $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1196
-        endif;
1197
-
1198
-    }
1199
-
1200
-    if (!empty($post->{$post_taxonomy})) {
1201
-        $links = array();
1202
-        $terms = array();
1203
-        $termsOrdered = array();
1204
-        if (!is_array($post->{$post_taxonomy})) {
1205
-            $post_term = explode(",", trim($post->{$post_taxonomy}, ","));
1206
-        } else {
1207
-            $post_term = $post->{$post_taxonomy};
1117
+	$post_type_info = get_post_type_object($post_type);
1118
+	$listing_label = __($post_type_info->labels->singular_name, 'geodirectory');
1119
+
1120
+	if (!empty($post->post_tags)) {
1121
+
1122
+		if (taxonomy_exists($post_type . '_tags')):
1123
+			$links = array();
1124
+			$terms = array();
1125
+			// to limit post tags
1126
+			$post_tags = trim($post->post_tags, ",");
1127
+			$post_id = isset($post->ID) ? $post->ID : '';
1128
+			/**
1129
+			 * Filter the post tags.
1130
+			 *
1131
+			 * Allows you to filter the post tags output on the details page of a post.
1132
+			 *
1133
+			 * @since 1.0.0
1134
+			 * @param string $post_tags A comma seperated list of tags.
1135
+			 * @param int $post_id The current post id.
1136
+			 */
1137
+			$post_tags = apply_filters('geodir_action_details_post_tags', $post_tags, $post_id);
1138
+
1139
+			$post->post_tags = $post_tags;
1140
+			$post_tags = explode(",", trim($post->post_tags, ","));
1141
+
1142
+
1143
+			foreach ($post_tags as $post_term) {
1144
+
1145
+				// fix slug creation order for tags & location
1146
+				$post_term = trim($post_term);
1147
+
1148
+				$priority_location = false;
1149
+				if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1150
+					$term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
1151
+				} else {
1152
+					$post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1153
+					$post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
1154
+					$post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL;
1155
+					$match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false;
1156
+					$match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false;
1157
+					$match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1158
+					if ($match_country || $match_region || $match_city) {
1159
+						$priority_location = true;
1160
+						$term = get_term_by('name', $post_term, $post_type . '_tags');
1161
+					} else {
1162
+						$insert_term = wp_insert_term($post_term, $post_type . '_tags');
1163
+						$term = get_term_by('name', $post_term, $post_type . '_tags');
1164
+					}
1165
+				}
1166
+
1167
+				if (!is_wp_error($term) && is_object($term)) {
1168
+
1169
+					// fix tag link on detail page
1170
+					if ($priority_location) {
1171
+
1172
+						$tag_link = "<a href=''>$post_term</a>";
1173
+						/**
1174
+						 * Filter the tag name on the details page.
1175
+						 *
1176
+						 * @since 1.5.6
1177
+						 * @param string $tag_link The tag link html.
1178
+						 * @param object $term The tag term object.
1179
+						 */
1180
+						$tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1181
+						$links[] = $tag_link;
1182
+					} else {
1183
+						$tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1184
+						/** This action is documented in geodirectory-template_actions.php */
1185
+						$tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1186
+						$links[] = $tag_link;
1187
+					}
1188
+					$terms[] = $term;
1189
+				}
1190
+				//
1191
+			}
1192
+			if (!isset($listing_label)) {
1193
+				$listing_label = '';
1194
+			}
1195
+			$taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1196
+		endif;
1197
+
1198
+	}
1199
+
1200
+	if (!empty($post->{$post_taxonomy})) {
1201
+		$links = array();
1202
+		$terms = array();
1203
+		$termsOrdered = array();
1204
+		if (!is_array($post->{$post_taxonomy})) {
1205
+			$post_term = explode(",", trim($post->{$post_taxonomy}, ","));
1206
+		} else {
1207
+			$post_term = $post->{$post_taxonomy};
1208 1208
 			
1209 1209
 			if ($preview && !$is_backend_preview) {
1210 1210
 				$post_term = geodir_add_parent_terms($post_term, $post_taxonomy);
1211 1211
 			}
1212
-        }
1213
-
1214
-        $post_term = array_unique($post_term);
1215
-        if (!empty($post_term)) {
1216
-            foreach ($post_term as $post_term) {
1217
-                $post_term = trim($post_term);
1218
-
1219
-                if ($post_term != ''):
1220
-                    $term = get_term_by('id', $post_term, $post_taxonomy);
1221
-
1222
-                    if (is_object($term)) {
1223
-                        $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1224
-                        /**
1225
-                         * Filter the category name on the details page.
1226
-                         *
1227
-                         * @since 1.5.6
1228
-                         * @param string $term_link The link html to the category.
1229
-                         * @param object $term The category term object.
1230
-                         */
1231
-                        $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1232
-                        $links[] = $term_link;
1233
-                        $terms[] = $term;
1234
-                    }
1235
-                endif;
1236
-            }
1237
-            // order alphabetically
1238
-            asort($links);
1239
-            foreach (array_keys($links) as $key) {
1240
-                $termsOrdered[$key] = $terms[$key];
1241
-            }
1242
-            $terms = $termsOrdered;
1212
+		}
1213
+
1214
+		$post_term = array_unique($post_term);
1215
+		if (!empty($post_term)) {
1216
+			foreach ($post_term as $post_term) {
1217
+				$post_term = trim($post_term);
1218
+
1219
+				if ($post_term != ''):
1220
+					$term = get_term_by('id', $post_term, $post_taxonomy);
1221
+
1222
+					if (is_object($term)) {
1223
+						$term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1224
+						/**
1225
+						 * Filter the category name on the details page.
1226
+						 *
1227
+						 * @since 1.5.6
1228
+						 * @param string $term_link The link html to the category.
1229
+						 * @param object $term The category term object.
1230
+						 */
1231
+						$term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1232
+						$links[] = $term_link;
1233
+						$terms[] = $term;
1234
+					}
1235
+				endif;
1236
+			}
1237
+			// order alphabetically
1238
+			asort($links);
1239
+			foreach (array_keys($links) as $key) {
1240
+				$termsOrdered[$key] = $terms[$key];
1241
+			}
1242
+			$terms = $termsOrdered;
1243 1243
 
1244
-        }
1244
+		}
1245 1245
 
1246
-        if (!isset($listing_label)) {
1247
-            $listing_label = '';
1248
-        }
1249
-        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1246
+		if (!isset($listing_label)) {
1247
+			$listing_label = '';
1248
+		}
1249
+		$taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1250 1250
 
1251
-    }
1251
+	}
1252 1252
 
1253
-    /**
1254
-     * Filter the taxonomies array before output.
1255
-     *
1256
-     * @since 1.5.9
1257
-     * @param array $taxonomies The array of cats and tags.
1258
-     * @param string $post_type The post type being output.
1259
-     * @param string $listing_label The post type label.
1260
-     * @param string $listing_label The post type label with ucwords function.
1261
-     */
1262
-    $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1253
+	/**
1254
+	 * Filter the taxonomies array before output.
1255
+	 *
1256
+	 * @since 1.5.9
1257
+	 * @param array $taxonomies The array of cats and tags.
1258
+	 * @param string $post_type The post type being output.
1259
+	 * @param string $listing_label The post type label.
1260
+	 * @param string $listing_label The post type label with ucwords function.
1261
+	 */
1262
+	$taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1263 1263
 
1264
-    if (isset($taxonomies[$post_taxonomy])) {
1265
-        echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1266
-    }
1264
+	if (isset($taxonomies[$post_taxonomy])) {
1265
+		echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1266
+	}
1267 1267
 
1268
-    if (isset($taxonomies[$post_type . '_tags']))
1269
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1268
+	if (isset($taxonomies[$post_type . '_tags']))
1269
+		echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1270 1270
 
1271
-    ?>
1271
+	?>
1272 1272
     </p><?php
1273 1273
 }
1274 1274
 
@@ -1290,140 +1290,140 @@  discard block
 block discarded – undo
1290 1290
 function geodir_action_details_micordata($post='')
1291 1291
 {
1292 1292
 
1293
-    global $preview;
1294
-    if(empty($post)){global $post;}
1295
-    if ($preview || !geodir_is_page('detail')) {
1296
-        return;
1297
-    }
1298
-
1299
-    // url
1300
-    $c_url = geodir_curPageURL();
1301
-
1302
-    // post reviews
1303
-    $post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
1304
-    if (empty($post_reviews)) {
1305
-        $reviews = '';
1306
-    } else {
1307
-        foreach ($post_reviews as $review) {
1308
-            $reviews[] = array(
1309
-                "@type" => "Review",
1310
-                "author" => $review->comment_author,
1311
-                "datePublished" => $review->comment_date,
1312
-                "description" => $review->comment_content,
1313
-                "reviewRating" => array(
1314
-                    "@type" => "Rating",
1315
-                    "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1316
-                    "ratingValue" => geodir_get_commentoverall($review->comment_ID),
1317
-                    "worstRating" => "1"
1318
-                )
1319
-            );
1320
-        }
1321
-
1322
-    }
1323
-
1324
-    // post images
1325
-    $post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
1326
-    if (empty($post_images)) {
1327
-        $images = '';
1328
-    } else {
1329
-        $i_arr = array();
1330
-        foreach ($post_images as $img) {
1331
-            $i_arr[] = $img->src;
1332
-        }
1333
-
1334
-        if (count($i_arr) == 1) {
1335
-            $images = $i_arr[0];
1336
-        } else {
1337
-            $images = $i_arr;
1338
-        }
1339
-
1340
-    }
1341
-    //print_r($post);
1342
-    // external links
1343
-    $external_links =  array();
1344
-    $external_links[] = $post->geodir_website;
1345
-    $external_links[] = $post->geodir_twitter;
1346
-    $external_links[] = $post->geodir_facebook;
1347
-    $external_links = array_filter($external_links);
1348
-
1349
-    if(!empty($external_links)){
1350
-        $external_links = array_values($external_links);
1351
-    }
1352
-
1353
-    // reviews
1354
-    $comment_count = geodir_get_review_count_total($post->ID);
1355
-    $post_avgratings = geodir_get_post_rating($post->ID);
1356
-
1357
-    // schema type
1358
-    $schema_type = 'LocalBusiness';
1359
-    if(isset($post->default_category) && $post->default_category){
1360
-        $cat_schema = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1361
-        if($cat_schema){$schema_type = $cat_schema;}
1362
-        if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1363
-    }
1364
-
1365
-    $schema = array();
1366
-    $schema['@context'] = "https://schema.org";
1367
-    $schema['@type'] = $schema_type;
1368
-    $schema['name'] = $post->post_title;
1369
-    $schema['description'] = wp_strip_all_tags( $post->post_content, true );
1370
-    $schema['telephone'] = $post->geodir_contact;
1371
-    $schema['url'] = $c_url;
1372
-    $schema['sameAs'] = $external_links;
1373
-    $schema['image'] = $images;
1374
-    $schema['address'] = array(
1375
-        "@type" => "PostalAddress",
1376
-        "streetAddress" => $post->post_address,
1377
-        "addressLocality" => $post->post_city,
1378
-        "addressRegion" => $post->post_region,
1379
-        "addressCountry" => $post->post_country,
1380
-        "postalCode" => $post->post_zip
1381
-    );
1382
-
1383
-    if($post->post_latitude && $post->post_longitude) {
1384
-        $schema['geo'] = array(
1385
-            "@type" => "GeoCoordinates",
1386
-            "latitude" => $post->post_latitude,
1387
-            "longitude" => $post->post_longitude
1388
-        );
1389
-    }
1390
-
1391
-    if($post_avgratings) {
1392
-        $schema['aggregateRating'] = array(
1393
-            "@type" => "AggregateRating",
1394
-            "ratingValue" => $post_avgratings,
1395
-            "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1396
-            "worstRating" => "1",
1397
-            "ratingCount" => $comment_count
1398
-        );
1399
-    }
1400
-    $schema['review'] = $reviews;
1401
-
1402
-    /**
1403
-     * Allow the schema JSON-LD info to be filtered.
1404
-     *
1405
-     * @since 1.5.4
1406
-     * @since 1.5.7 Added $post variable.
1407
-     * @param array $schema The array of schema data to be filtered.
1408
-     * @param object $post The post object.
1409
-     */
1410
-    $schema = apply_filters('geodir_details_schema', $schema,$post);
1411
-
1412
-
1413
-    echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1414
-
1415
-
1416
-    $uploads = wp_upload_dir();
1417
-    $facebook_og = (isset($post->featured_image) && $post->featured_image) ? '<meta property="og:image" content="'.$uploads['baseurl'].$post->featured_image.'"/>' : '';
1418
-
1419
-    /**
1420
-     * Show facebook open graph meta info
1421
-     *
1422
-     * @since 1.6.6
1423
-     * @param string $facebook_og The open graph html to be filtered.
1424
-     * @param object $post The post object.
1425
-     */
1426
-    echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
1293
+	global $preview;
1294
+	if(empty($post)){global $post;}
1295
+	if ($preview || !geodir_is_page('detail')) {
1296
+		return;
1297
+	}
1298
+
1299
+	// url
1300
+	$c_url = geodir_curPageURL();
1301
+
1302
+	// post reviews
1303
+	$post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
1304
+	if (empty($post_reviews)) {
1305
+		$reviews = '';
1306
+	} else {
1307
+		foreach ($post_reviews as $review) {
1308
+			$reviews[] = array(
1309
+				"@type" => "Review",
1310
+				"author" => $review->comment_author,
1311
+				"datePublished" => $review->comment_date,
1312
+				"description" => $review->comment_content,
1313
+				"reviewRating" => array(
1314
+					"@type" => "Rating",
1315
+					"bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1316
+					"ratingValue" => geodir_get_commentoverall($review->comment_ID),
1317
+					"worstRating" => "1"
1318
+				)
1319
+			);
1320
+		}
1321
+
1322
+	}
1323
+
1324
+	// post images
1325
+	$post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
1326
+	if (empty($post_images)) {
1327
+		$images = '';
1328
+	} else {
1329
+		$i_arr = array();
1330
+		foreach ($post_images as $img) {
1331
+			$i_arr[] = $img->src;
1332
+		}
1333
+
1334
+		if (count($i_arr) == 1) {
1335
+			$images = $i_arr[0];
1336
+		} else {
1337
+			$images = $i_arr;
1338
+		}
1339
+
1340
+	}
1341
+	//print_r($post);
1342
+	// external links
1343
+	$external_links =  array();
1344
+	$external_links[] = $post->geodir_website;
1345
+	$external_links[] = $post->geodir_twitter;
1346
+	$external_links[] = $post->geodir_facebook;
1347
+	$external_links = array_filter($external_links);
1348
+
1349
+	if(!empty($external_links)){
1350
+		$external_links = array_values($external_links);
1351
+	}
1352
+
1353
+	// reviews
1354
+	$comment_count = geodir_get_review_count_total($post->ID);
1355
+	$post_avgratings = geodir_get_post_rating($post->ID);
1356
+
1357
+	// schema type
1358
+	$schema_type = 'LocalBusiness';
1359
+	if(isset($post->default_category) && $post->default_category){
1360
+		$cat_schema = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1361
+		if($cat_schema){$schema_type = $cat_schema;}
1362
+		if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1363
+	}
1364
+
1365
+	$schema = array();
1366
+	$schema['@context'] = "https://schema.org";
1367
+	$schema['@type'] = $schema_type;
1368
+	$schema['name'] = $post->post_title;
1369
+	$schema['description'] = wp_strip_all_tags( $post->post_content, true );
1370
+	$schema['telephone'] = $post->geodir_contact;
1371
+	$schema['url'] = $c_url;
1372
+	$schema['sameAs'] = $external_links;
1373
+	$schema['image'] = $images;
1374
+	$schema['address'] = array(
1375
+		"@type" => "PostalAddress",
1376
+		"streetAddress" => $post->post_address,
1377
+		"addressLocality" => $post->post_city,
1378
+		"addressRegion" => $post->post_region,
1379
+		"addressCountry" => $post->post_country,
1380
+		"postalCode" => $post->post_zip
1381
+	);
1382
+
1383
+	if($post->post_latitude && $post->post_longitude) {
1384
+		$schema['geo'] = array(
1385
+			"@type" => "GeoCoordinates",
1386
+			"latitude" => $post->post_latitude,
1387
+			"longitude" => $post->post_longitude
1388
+		);
1389
+	}
1390
+
1391
+	if($post_avgratings) {
1392
+		$schema['aggregateRating'] = array(
1393
+			"@type" => "AggregateRating",
1394
+			"ratingValue" => $post_avgratings,
1395
+			"bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1396
+			"worstRating" => "1",
1397
+			"ratingCount" => $comment_count
1398
+		);
1399
+	}
1400
+	$schema['review'] = $reviews;
1401
+
1402
+	/**
1403
+	 * Allow the schema JSON-LD info to be filtered.
1404
+	 *
1405
+	 * @since 1.5.4
1406
+	 * @since 1.5.7 Added $post variable.
1407
+	 * @param array $schema The array of schema data to be filtered.
1408
+	 * @param object $post The post object.
1409
+	 */
1410
+	$schema = apply_filters('geodir_details_schema', $schema,$post);
1411
+
1412
+
1413
+	echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1414
+
1415
+
1416
+	$uploads = wp_upload_dir();
1417
+	$facebook_og = (isset($post->featured_image) && $post->featured_image) ? '<meta property="og:image" content="'.$uploads['baseurl'].$post->featured_image.'"/>' : '';
1418
+
1419
+	/**
1420
+	 * Show facebook open graph meta info
1421
+	 *
1422
+	 * @since 1.6.6
1423
+	 * @param string $facebook_og The open graph html to be filtered.
1424
+	 * @param object $post The post object.
1425
+	 */
1426
+	echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
1427 1427
 
1428 1428
 
1429 1429
 
@@ -1443,7 +1443,7 @@  discard block
 block discarded – undo
1443 1443
  */
1444 1444
 function geodir_action_details_next_prev()
1445 1445
 {
1446
-    ?>
1446
+	?>
1447 1447
     <div class="geodir-pos_navigation clearfix">
1448 1448
     <div
1449 1449
         class="geodir-post_left"><?php previous_post_link('%link', '' . __('Previous', 'geodirectory'), false) ?></div>
@@ -1461,15 +1461,15 @@  discard block
 block discarded – undo
1461 1461
  */
1462 1462
 function geodir_action_before_single_post()
1463 1463
 {
1464
-    global $post;
1465
-    /**
1466
-     * Called at the very start of the details page output, before the title section.
1467
-     *
1468
-     * @since 1.0.0
1469
-     * @param object $post The current post object.
1470
-     * @global WP_Post|null $post The current post, if available.
1471
-     */
1472
-    do_action('geodir_before_single_post', $post); // extra action	
1464
+	global $post;
1465
+	/**
1466
+	 * Called at the very start of the details page output, before the title section.
1467
+	 *
1468
+	 * @since 1.0.0
1469
+	 * @param object $post The current post object.
1470
+	 * @global WP_Post|null $post The current post, if available.
1471
+	 */
1472
+	do_action('geodir_before_single_post', $post); // extra action	
1473 1473
 }
1474 1474
 
1475 1475
 /**
@@ -1480,13 +1480,13 @@  discard block
 block discarded – undo
1480 1480
  */
1481 1481
 function geodir_action_after_single_post($post)
1482 1482
 {
1483
-    /**
1484
-     * Called on the details page after the details page tabs section and before the next/prev buttons.
1485
-     *
1486
-     * @since 1.0.0
1487
-     * @param object $post The current post object.
1488
-     */
1489
-    do_action('geodir_after_single_post', $post); // extra action	
1483
+	/**
1484
+	 * Called on the details page after the details page tabs section and before the next/prev buttons.
1485
+	 *
1486
+	 * @since 1.0.0
1487
+	 * @param object $post The current post object.
1488
+	 */
1489
+	do_action('geodir_after_single_post', $post); // extra action	
1490 1490
 }
1491 1491
 
1492 1492
 add_action('geodir_details_main_content', 'geodir_action_before_single_post', 10);
@@ -1512,168 +1512,168 @@  discard block
 block discarded – undo
1512 1512
  */
1513 1513
 function geodir_action_listings_title()
1514 1514
 {
1515
-    global $wp, $term;
1516
-
1517
-    $gd_post_type = geodir_get_current_posttype();
1518
-    $post_type_info = get_post_type_object($gd_post_type);
1519
-
1520
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
1521
-    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1522
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1523
-    }
1524
-
1525
-    $list_title = $add_string_in_title . __($post_type_info->labels->name, 'geodirectory');
1526
-    $single_name = $post_type_info->labels->singular_name;
1527
-
1528
-    $taxonomy = geodir_get_taxonomies($gd_post_type, true);
1529
-
1530
-    $gd_country = get_query_var('gd_country');
1531
-    $gd_region = get_query_var('gd_region');
1532
-    $gd_city = get_query_var('gd_city');
1533
-
1534
-    if (!empty($term)) {
1535
-        $location_name = '';
1536
-        if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
1537
-            if ($gd_country != '') {
1538
-                $location_name = geodir_sanitize_location_name('gd_country', $gd_country);
1539
-            }
1540
-
1541
-            if ($gd_region != '') {
1542
-                $location_name = geodir_sanitize_location_name('gd_region', $gd_region);
1543
-            }
1544
-
1545
-            if ($gd_city != '') {
1546
-                $location_name = geodir_sanitize_location_name('gd_city', $gd_city);
1547
-            }
1548
-        }
1549
-
1550
-        $current_term = get_term_by('slug', $term, $taxonomy[0]);
1551
-        if (!empty($current_term)) {
1552
-            $current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1553
-            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1554
-                $location_last_char = substr($location_name, -1);
1555
-                $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1556
-                $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1557
-            } else {
1558
-                $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1559
-            }
1560
-        } else {
1561
-            if (count($taxonomy) > 1) {
1562
-                $current_term = get_term_by('slug', $term, $taxonomy[1]);
1563
-
1564
-                if (!empty($current_term)) {
1565
-                    $current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1566
-                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1567
-                        $location_last_char = substr($location_name, -1);
1568
-                        $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1569
-                        $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1570
-                    } else {
1571
-                        $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1572
-                    }
1573
-                }
1574
-            }
1575
-        }
1515
+	global $wp, $term;
1576 1516
 
1577
-    } else {
1578
-        $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
1579
-        $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
1580
-        $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
1517
+	$gd_post_type = geodir_get_current_posttype();
1518
+	$post_type_info = get_post_type_object($gd_post_type);
1581 1519
 
1582
-        $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
1520
+	$add_string_in_title = __('All', 'geodirectory') . ' ';
1521
+	if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1522
+		$add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1523
+	}
1583 1524
 
1584
-        if (function_exists('get_actual_location_name')) {
1585
-            $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
1586
-            $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
1587
-            $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
1588
-        }
1525
+	$list_title = $add_string_in_title . __($post_type_info->labels->name, 'geodirectory');
1526
+	$single_name = $post_type_info->labels->singular_name;
1589 1527
 
1590
-        if ($gd_city != '') {
1591
-            if ($gd_city_actual != '') {
1592
-                $gd_city = $gd_city_actual;
1593
-            } else {
1594
-                $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
1595
-                $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
1596
-                $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1597
-            }
1528
+	$taxonomy = geodir_get_taxonomies($gd_post_type, true);
1598 1529
 
1599
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1600
-        } else if ($gd_region != '') {
1601
-            if ($gd_region_actual != '') {
1602
-                $gd_region = $gd_region_actual;
1603
-            } else {
1604
-                $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
1605
-                $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
1606
-                $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1607
-            }
1530
+	$gd_country = get_query_var('gd_country');
1531
+	$gd_region = get_query_var('gd_region');
1532
+	$gd_city = get_query_var('gd_city');
1608 1533
 
1609
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1610
-        } else if ($gd_country != '') {
1611
-            if ($gd_country_actual != '') {
1612
-                $gd_country = $gd_country_actual;
1613
-            } else {
1614
-                $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
1615
-                $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
1616
-                $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1617
-            }
1618
-
1619
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1620
-        }
1621
-    }
1622
-
1623
-    if (is_search()) {
1624
-        $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1625
-    }
1626
-    /** This action is documented in geodirectory_template_actions.php */
1627
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
1628
-    /** This action is documented in geodirectory_template_actions.php */
1629
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
1630
-
1631
-
1632
-    $title = $list_title;
1633
-    $gd_page = '';
1634
-    if(geodir_is_page('pt')){
1635
-        $gd_page = 'pt';
1636
-        $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1637
-    }
1638
-    elseif(geodir_is_page('listing')){
1639
-        $gd_page = 'listing';
1640
-        global $wp_query;
1641
-        $current_term = $wp_query->get_queried_object();
1642
-        if (strpos($current_term->taxonomy,'_tags') !== false) {
1643
-            $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1644
-        }else{
1645
-            $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1646
-        }
1534
+	if (!empty($term)) {
1535
+		$location_name = '';
1536
+		if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
1537
+			if ($gd_country != '') {
1538
+				$location_name = geodir_sanitize_location_name('gd_country', $gd_country);
1539
+			}
1647 1540
 
1648
-    }
1649
-    elseif(geodir_is_page('author')){
1650
-        $gd_page = 'author';
1651
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1652
-            $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1653
-        }else{
1654
-            $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1655
-        }
1541
+			if ($gd_region != '') {
1542
+				$location_name = geodir_sanitize_location_name('gd_region', $gd_region);
1543
+			}
1656 1544
 
1657
-    }
1545
+			if ($gd_city != '') {
1546
+				$location_name = geodir_sanitize_location_name('gd_city', $gd_city);
1547
+			}
1548
+		}
1549
+
1550
+		$current_term = get_term_by('slug', $term, $taxonomy[0]);
1551
+		if (!empty($current_term)) {
1552
+			$current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1553
+			if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1554
+				$location_last_char = substr($location_name, -1);
1555
+				$location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1556
+				$list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1557
+			} else {
1558
+				$list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1559
+			}
1560
+		} else {
1561
+			if (count($taxonomy) > 1) {
1562
+				$current_term = get_term_by('slug', $term, $taxonomy[1]);
1563
+
1564
+				if (!empty($current_term)) {
1565
+					$current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1566
+					if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1567
+						$location_last_char = substr($location_name, -1);
1568
+						$location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1569
+						$list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1570
+					} else {
1571
+						$list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1572
+					}
1573
+				}
1574
+			}
1575
+		}
1576
+
1577
+	} else {
1578
+		$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
1579
+		$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
1580
+		$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
1581
+
1582
+		$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
1583
+
1584
+		if (function_exists('get_actual_location_name')) {
1585
+			$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
1586
+			$gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
1587
+			$gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
1588
+		}
1589
+
1590
+		if ($gd_city != '') {
1591
+			if ($gd_city_actual != '') {
1592
+				$gd_city = $gd_city_actual;
1593
+			} else {
1594
+				$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
1595
+				$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
1596
+				$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1597
+			}
1658 1598
 
1599
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1600
+		} else if ($gd_region != '') {
1601
+			if ($gd_region_actual != '') {
1602
+				$gd_region = $gd_region_actual;
1603
+			} else {
1604
+				$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
1605
+				$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
1606
+				$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1607
+			}
1659 1608
 
1660
-    /**
1661
-     * Filter page title to replace variables.
1662
-     *
1663
-     * @since 1.5.4
1664
-     * @param string $title The page title including variables.
1665
-     * @param string $gd_page The GeoDirectory page type if any.
1666
-     */
1667
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1609
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1610
+		} else if ($gd_country != '') {
1611
+			if ($gd_country_actual != '') {
1612
+				$gd_country = $gd_country_actual;
1613
+			} else {
1614
+				$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
1615
+				$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
1616
+				$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1617
+			}
1668 1618
 
1669
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1670
-        /**
1671
-         * Filter the listing page title.
1672
-         *
1673
-         * @since 1.0.0
1674
-         * @param string $list_title The title for the category page.
1675
-         */
1676
-        apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1619
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1620
+		}
1621
+	}
1622
+
1623
+	if (is_search()) {
1624
+		$list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1625
+	}
1626
+	/** This action is documented in geodirectory_template_actions.php */
1627
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
1628
+	/** This action is documented in geodirectory_template_actions.php */
1629
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
1630
+
1631
+
1632
+	$title = $list_title;
1633
+	$gd_page = '';
1634
+	if(geodir_is_page('pt')){
1635
+		$gd_page = 'pt';
1636
+		$title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1637
+	}
1638
+	elseif(geodir_is_page('listing')){
1639
+		$gd_page = 'listing';
1640
+		global $wp_query;
1641
+		$current_term = $wp_query->get_queried_object();
1642
+		if (strpos($current_term->taxonomy,'_tags') !== false) {
1643
+			$title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1644
+		}else{
1645
+			$title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1646
+		}
1647
+
1648
+	}
1649
+	elseif(geodir_is_page('author')){
1650
+		$gd_page = 'author';
1651
+		if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1652
+			$title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1653
+		}else{
1654
+			$title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1655
+		}
1656
+
1657
+	}
1658
+
1659
+
1660
+	/**
1661
+	 * Filter page title to replace variables.
1662
+	 *
1663
+	 * @since 1.5.4
1664
+	 * @param string $title The page title including variables.
1665
+	 * @param string $gd_page The GeoDirectory page type if any.
1666
+	 */
1667
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1668
+
1669
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1670
+		/**
1671
+		 * Filter the listing page title.
1672
+		 *
1673
+		 * @since 1.0.0
1674
+		 * @param string $list_title The title for the category page.
1675
+		 */
1676
+		apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1677 1677
 }
1678 1678
 
1679 1679
 add_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
@@ -1686,46 +1686,46 @@  discard block
 block discarded – undo
1686 1686
  */
1687 1687
 function geodir_action_listings_description()
1688 1688
 {
1689
-    global $wp_query;
1690
-    $current_term = $wp_query->get_queried_object();
1689
+	global $wp_query;
1690
+	$current_term = $wp_query->get_queried_object();
1691 1691
 
1692
-    $gd_post_type = geodir_get_current_posttype();
1693
-    if (isset($current_term->term_id) && $current_term->term_id != '') {
1692
+	$gd_post_type = geodir_get_current_posttype();
1693
+	if (isset($current_term->term_id) && $current_term->term_id != '') {
1694 1694
 
1695
-        $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1696
-        $saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1697
-        if ($term_desc && !$saved_data) {
1698
-            $saved_data = $term_desc;
1699
-        }
1695
+		$term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1696
+		$saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1697
+		if ($term_desc && !$saved_data) {
1698
+			$saved_data = $term_desc;
1699
+		}
1700 1700
 
1701
-        // stop payment manager filtering content length
1702
-        $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1703
-        if ( false !== $filter_priority ) {
1704
-            remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1705
-        }
1701
+		// stop payment manager filtering content length
1702
+		$filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1703
+		if ( false !== $filter_priority ) {
1704
+			remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1705
+		}
1706 1706
 
1707
-        /**
1708
-         * Apply the core filter `the_content` filter to the variable string.
1709
-         *
1710
-         * This is a WordPress core filter that does many things.
1711
-         *
1712
-         * @since 1.0.0
1713
-         * @param string $var The string to apply the filter to.
1714
-         */
1715
-        $cat_description = apply_filters('the_content', $saved_data);
1707
+		/**
1708
+		 * Apply the core filter `the_content` filter to the variable string.
1709
+		 *
1710
+		 * This is a WordPress core filter that does many things.
1711
+		 *
1712
+		 * @since 1.0.0
1713
+		 * @param string $var The string to apply the filter to.
1714
+		 */
1715
+		$cat_description = apply_filters('the_content', $saved_data);
1716 1716
 
1717 1717
 
1718
-        if ( false !== $filter_priority ) {
1719
-            add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1720
-        }
1718
+		if ( false !== $filter_priority ) {
1719
+			add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1720
+		}
1721 1721
 
1722
-        if ($cat_description) {
1723
-            ?>
1722
+		if ($cat_description) {
1723
+			?>
1724 1724
 
1725 1725
             <div class="term_description"><?php echo $cat_description;?></div> <?php
1726
-        }
1726
+		}
1727 1727
 
1728
-    }
1728
+	}
1729 1729
 }
1730 1730
 
1731 1731
 // action for adding the listings page top widget area
@@ -1744,11 +1744,11 @@  discard block
 block discarded – undo
1744 1744
  */
1745 1745
 function geodir_action_geodir_sidebar_listings_top()
1746 1746
 {
1747
-    if (get_option('geodir_show_listing_top_section')) { ?>
1747
+	if (get_option('geodir_show_listing_top_section')) { ?>
1748 1748
         <div
1749 1749
             class="<?php
1750
-            /** This action is documented in geodirectory_template_actions.php */
1751
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
1750
+			/** This action is documented in geodirectory_template_actions.php */
1751
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
1752 1752
             <?php dynamic_sidebar('geodir_listing_top'); ?>
1753 1753
         </div><!-- clearfix ends here-->
1754 1754
     <?php }
@@ -1771,35 +1771,35 @@  discard block
 block discarded – undo
1771 1771
  */
1772 1772
 function geodir_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')
1773 1773
 {
1774
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1775
-        $width_css = 'style="width:' . $width . '%;"';
1776
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1777
-        $width_css = 'style="width:' . $width . '%;"';
1778
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1779
-        $width_css = 'style="width:' . $width . '%;"';
1780
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1781
-        $width_css = 'style="width:' . $width . '%;"';
1782
-    } else {
1783
-        $width_css = '';
1784
-    }
1785
-
1786
-    $tc = get_option('theme_compatibility_setting');
1787
-    if (!empty($tc['geodir_sidebar_left_open_replace'])) {
1788
-        $text = $tc['geodir_sidebar_left_open_replace'];
1789
-    } else {
1790
-        $text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
1791
-    }
1792
-
1793
-    if (!empty($tc['geodir_sidebar_left_open_id'])) {
1794
-        $id = $tc['geodir_sidebar_left_open_id'];
1795
-    }
1796
-    if (!empty($tc['geodir_sidebar_left_open_class'])) {
1797
-        $class = $tc['geodir_sidebar_left_open_class'];
1798
-    }
1799
-
1800
-    $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
1801
-
1802
-    echo $text;
1774
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1775
+		$width_css = 'style="width:' . $width . '%;"';
1776
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1777
+		$width_css = 'style="width:' . $width . '%;"';
1778
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1779
+		$width_css = 'style="width:' . $width . '%;"';
1780
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1781
+		$width_css = 'style="width:' . $width . '%;"';
1782
+	} else {
1783
+		$width_css = '';
1784
+	}
1785
+
1786
+	$tc = get_option('theme_compatibility_setting');
1787
+	if (!empty($tc['geodir_sidebar_left_open_replace'])) {
1788
+		$text = $tc['geodir_sidebar_left_open_replace'];
1789
+	} else {
1790
+		$text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
1791
+	}
1792
+
1793
+	if (!empty($tc['geodir_sidebar_left_open_id'])) {
1794
+		$id = $tc['geodir_sidebar_left_open_id'];
1795
+	}
1796
+	if (!empty($tc['geodir_sidebar_left_open_class'])) {
1797
+		$class = $tc['geodir_sidebar_left_open_class'];
1798
+	}
1799
+
1800
+	$text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
1801
+
1802
+	echo $text;
1803 1803
 }
1804 1804
 
1805 1805
 // action for adding the primary div closing tag
@@ -1815,13 +1815,13 @@  discard block
 block discarded – undo
1815 1815
  */
1816 1816
 function geodir_action_sidebar_left_close($type = '')
1817 1817
 {
1818
-    $tc = get_option('theme_compatibility_setting');
1819
-    if (!empty($tc['geodir_sidebar_left_close_replace'])) {
1820
-        $text = $tc['geodir_sidebar_left_close_replace'];
1821
-    } else {
1822
-        $text = '</aside><!-- sidebar ends here-->';
1823
-    }
1824
-    echo $text;
1818
+	$tc = get_option('theme_compatibility_setting');
1819
+	if (!empty($tc['geodir_sidebar_left_close_replace'])) {
1820
+		$text = $tc['geodir_sidebar_left_close_replace'];
1821
+	} else {
1822
+		$text = '</aside><!-- sidebar ends here-->';
1823
+	}
1824
+	echo $text;
1825 1825
 }
1826 1826
 
1827 1827
 /**
@@ -1834,7 +1834,7 @@  discard block
 block discarded – undo
1834 1834
  */
1835 1835
 function geodir_listing_left_section()
1836 1836
 {
1837
-    if (get_option('geodir_show_listing_left_section')) { ?>
1837
+	if (get_option('geodir_show_listing_left_section')) { ?>
1838 1838
         <div class="geodir-content-left geodir-sidebar-wrap">
1839 1839
             <?php dynamic_sidebar('geodir_listing_left_sidebar'); ?>
1840 1840
         </div><!-- end geodir-content-left -->
@@ -1852,20 +1852,20 @@  discard block
 block discarded – undo
1852 1852
  */
1853 1853
 function geodir_action_listings_sidebar_left()
1854 1854
 {
1855
-    if (get_option('geodir_show_listing_left_section')) {
1856
-        /** This action is documented in geodirectory_template_actions.php */
1857
-        do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'https://schema.org/WPSideBar');
1858
-        /**
1859
-         * Calls the listings page (category) left sidebar content.
1860
-         *
1861
-         * All the content for the listings page left sidebar is added via this hook.
1862
-         *
1863
-         * @since 1.0.0
1864
-         */
1865
-        do_action('geodir_listings_sidebar_left_inside');
1866
-        /** This action is documented in geodirectory_template_actions.php */
1867
-        do_action('geodir_sidebar_left_close', 'listings-page');
1868
-    }
1855
+	if (get_option('geodir_show_listing_left_section')) {
1856
+		/** This action is documented in geodirectory_template_actions.php */
1857
+		do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'https://schema.org/WPSideBar');
1858
+		/**
1859
+		 * Calls the listings page (category) left sidebar content.
1860
+		 *
1861
+		 * All the content for the listings page left sidebar is added via this hook.
1862
+		 *
1863
+		 * @since 1.0.0
1864
+		 */
1865
+		do_action('geodir_listings_sidebar_left_inside');
1866
+		/** This action is documented in geodirectory_template_actions.php */
1867
+		do_action('geodir_sidebar_left_close', 'listings-page');
1868
+	}
1869 1869
 }
1870 1870
 
1871 1871
 /**
@@ -1878,7 +1878,7 @@  discard block
 block discarded – undo
1878 1878
  */
1879 1879
 function geodir_listing_right_section()
1880 1880
 {
1881
-    if (get_option('geodir_show_listing_right_section')) { ?>
1881
+	if (get_option('geodir_show_listing_right_section')) { ?>
1882 1882
         <div class="geodir-content-right geodir-sidebar-wrap">
1883 1883
             <?php dynamic_sidebar('geodir_listing_right_sidebar'); ?>
1884 1884
         </div><!-- end geodir-content-right -->
@@ -1896,20 +1896,20 @@  discard block
 block discarded – undo
1896 1896
  */
1897 1897
 function geodir_action_listings_sidebar_right()
1898 1898
 {
1899
-    if (get_option('geodir_show_listing_right_section')) {
1900
-        /** This action is documented in geodirectory_template_actions.php */
1901
-        do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
1902
-        /**
1903
-         * Calls the listings page (category) right sidebar content.
1904
-         *
1905
-         * All the content for the listings page right sidebar is added via this hook.
1906
-         *
1907
-         * @since 1.0.0
1908
-         */
1909
-        do_action('geodir_listings_sidebar_right_inside');
1910
-        /** This action is documented in geodirectory_template_actions.php */
1911
-        do_action('geodir_sidebar_right_close', 'listings-page');
1912
-    }
1899
+	if (get_option('geodir_show_listing_right_section')) {
1900
+		/** This action is documented in geodirectory_template_actions.php */
1901
+		do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
1902
+		/**
1903
+		 * Calls the listings page (category) right sidebar content.
1904
+		 *
1905
+		 * All the content for the listings page right sidebar is added via this hook.
1906
+		 *
1907
+		 * @since 1.0.0
1908
+		 */
1909
+		do_action('geodir_listings_sidebar_right_inside');
1910
+		/** This action is documented in geodirectory_template_actions.php */
1911
+		do_action('geodir_sidebar_right_close', 'listings-page');
1912
+	}
1913 1913
 }
1914 1914
 
1915 1915
 
@@ -1926,23 +1926,23 @@  discard block
 block discarded – undo
1926 1926
  */
1927 1927
 function geodir_action_main_content_open($type = '', $id = '', $class = '')
1928 1928
 {
1929
-    $tc = get_option('theme_compatibility_setting');
1930
-    if (!empty($tc['geodir_main_content_open_replace'])) {
1931
-        $text = $tc['geodir_main_content_open_replace'];
1932
-    } else {
1933
-        $text = '<main id="[id]" class="[class]" role="main">';
1934
-    }
1929
+	$tc = get_option('theme_compatibility_setting');
1930
+	if (!empty($tc['geodir_main_content_open_replace'])) {
1931
+		$text = $tc['geodir_main_content_open_replace'];
1932
+	} else {
1933
+		$text = '<main id="[id]" class="[class]" role="main">';
1934
+	}
1935 1935
 
1936
-    if (!empty($tc['geodir_main_content_open_id'])) {
1937
-        $id = $tc['geodir_main_content_open_id'];
1938
-    }
1939
-    if (!empty($tc['geodir_main_content_open_class'])) {
1940
-        $class = $tc['geodir_main_content_open_class'];
1941
-    }
1936
+	if (!empty($tc['geodir_main_content_open_id'])) {
1937
+		$id = $tc['geodir_main_content_open_id'];
1938
+	}
1939
+	if (!empty($tc['geodir_main_content_open_class'])) {
1940
+		$class = $tc['geodir_main_content_open_class'];
1941
+	}
1942 1942
 
1943
-    $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
1943
+	$text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
1944 1944
 
1945
-    echo $text;
1945
+	echo $text;
1946 1946
 }
1947 1947
 
1948 1948
 // action for adding the primary div closing tag
@@ -1955,13 +1955,13 @@  discard block
 block discarded – undo
1955 1955
  */
1956 1956
 function geodir_action_main_content_close()
1957 1957
 {
1958
-    $tc = get_option('theme_compatibility_setting');
1959
-    if (!empty($tc['geodir_main_content_close_replace'])) {
1960
-        $text = $tc['geodir_main_content_close_replace'];
1961
-    } else {
1962
-        $text = '</main><!-- main ends here-->';
1963
-    }
1964
-    echo $text;
1958
+	$tc = get_option('theme_compatibility_setting');
1959
+	if (!empty($tc['geodir_main_content_close_replace'])) {
1960
+		$text = $tc['geodir_main_content_close_replace'];
1961
+	} else {
1962
+		$text = '</main><!-- main ends here-->';
1963
+	}
1964
+	echo $text;
1965 1965
 }
1966 1966
 
1967 1967
 /**
@@ -1973,14 +1973,14 @@  discard block
 block discarded – undo
1973 1973
  */
1974 1974
 function geodir_action_listings_content_inside()
1975 1975
 {
1976
-    global $gridview_columns;
1977
-    $listing_view = get_option('geodir_listing_view');
1978
-    if (strstr($listing_view, 'gridview')) {
1979
-        $gridview_columns = $listing_view;
1980
-        $listing_view_exp = explode('_', $listing_view);
1981
-        $listing_view = $listing_view_exp[0];
1982
-    }
1983
-    geodir_get_template_part('listing', 'listview');
1976
+	global $gridview_columns;
1977
+	$listing_view = get_option('geodir_listing_view');
1978
+	if (strstr($listing_view, 'gridview')) {
1979
+		$gridview_columns = $listing_view;
1980
+		$listing_view_exp = explode('_', $listing_view);
1981
+		$listing_view = $listing_view_exp[0];
1982
+	}
1983
+	geodir_get_template_part('listing', 'listview');
1984 1984
 }
1985 1985
 
1986 1986
 add_action('geodir_listings_content_inside', 'geodir_action_listings_content_inside', 10);
@@ -1996,47 +1996,47 @@  discard block
 block discarded – undo
1996 1996
  */
1997 1997
 function geodir_action_listings_content()
1998 1998
 {
1999
-    /**
2000
-     * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc.
2001
-     *
2002
-     * @since 1.0.0
2003
-     * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
2004
-     * @param string $id The id for the div. Usually 'geodir-main-content'.
2005
-     * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
2006
-     * @see 'geodir_main_content_close' Where the oposing closing tag is added.
2007
-     */
2008
-    do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
2009
-    $extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
2010
-    echo '<div class="clearfix '.$extra_class.'">';
2011
-    /**
2012
-     * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
2013
-     *
2014
-     * @since 1.0.0
2015
-     */
2016
-    do_action('geodir_before_listing');
2017
-    echo '</div>';
2018
-
2019
-    /**
2020
-     * This actions calls the listings list content. Used on listings pages and search and author pages.
2021
-     *
2022
-     * @since 1.0.0
2023
-     */
2024
-    do_action('geodir_listings_content_inside');
2025
-
2026
-    /**
2027
-     * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages.
2028
-     *
2029
-     * @since 1.0.0
2030
-     */
2031
-    do_action('geodir_after_listing');
2032
-
2033
-    /**
2034
-     * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc.
2035
-     *
2036
-     * @since 1.0.0
2037
-     * @see 'geodir_main_content_open' Where the oposing opening tag is added.
2038
-     */
2039
-    do_action('geodir_main_content_close', 'listings-page');
1999
+	/**
2000
+	 * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc.
2001
+	 *
2002
+	 * @since 1.0.0
2003
+	 * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
2004
+	 * @param string $id The id for the div. Usually 'geodir-main-content'.
2005
+	 * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
2006
+	 * @see 'geodir_main_content_close' Where the oposing closing tag is added.
2007
+	 */
2008
+	do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
2009
+	$extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
2010
+	echo '<div class="clearfix '.$extra_class.'">';
2011
+	/**
2012
+	 * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
2013
+	 *
2014
+	 * @since 1.0.0
2015
+	 */
2016
+	do_action('geodir_before_listing');
2017
+	echo '</div>';
2018
+
2019
+	/**
2020
+	 * This actions calls the listings list content. Used on listings pages and search and author pages.
2021
+	 *
2022
+	 * @since 1.0.0
2023
+	 */
2024
+	do_action('geodir_listings_content_inside');
2025
+
2026
+	/**
2027
+	 * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages.
2028
+	 *
2029
+	 * @since 1.0.0
2030
+	 */
2031
+	do_action('geodir_after_listing');
2032
+
2033
+	/**
2034
+	 * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc.
2035
+	 *
2036
+	 * @since 1.0.0
2037
+	 * @see 'geodir_main_content_open' Where the oposing opening tag is added.
2038
+	 */
2039
+	do_action('geodir_main_content_close', 'listings-page');
2040 2040
 }
2041 2041
 
2042 2042
 
@@ -2051,10 +2051,10 @@  discard block
 block discarded – undo
2051 2051
  */
2052 2052
 function geodir_action_sidebar_listings_bottom_section()
2053 2053
 {
2054
-    if (get_option('geodir_show_listing_bottom_section')) { ?>
2054
+	if (get_option('geodir_show_listing_bottom_section')) { ?>
2055 2055
         <div class="<?php
2056
-            /** This action is documented in geodirectory_template_actions.php */
2057
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
2056
+			/** This action is documented in geodirectory_template_actions.php */
2057
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
2058 2058
             <?php dynamic_sidebar('geodir_listing_bottom'); ?>
2059 2059
         </div><!-- clearfix ends here-->
2060 2060
     <?php }
@@ -2074,38 +2074,38 @@  discard block
 block discarded – undo
2074 2074
  */
2075 2075
 function geodir_action_add_listing_page_title()
2076 2076
 {
2077
-    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2078
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2079
-    /** This action is documented in geodirectory_template_actions.php */
2080
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2081
-    /** This action is documented in geodirectory_template_actions.php */
2082
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2083
-
2084
-    $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2085
-
2086
-    if(geodir_is_page('add-listing')){
2087
-        $gd_page = 'add-listing';
2088
-        if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2089
-            $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2090
-        }elseif(isset($listing_type)){
2091
-            $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2092
-        }
2077
+	if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2078
+		$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2079
+	/** This action is documented in geodirectory_template_actions.php */
2080
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2081
+	/** This action is documented in geodirectory_template_actions.php */
2082
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2083
+
2084
+	$title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2085
+
2086
+	if(geodir_is_page('add-listing')){
2087
+		$gd_page = 'add-listing';
2088
+		if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2089
+			$title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2090
+		}elseif(isset($listing_type)){
2091
+			$title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2092
+		}
2093 2093
 
2094
-    }
2094
+	}
2095 2095
 
2096 2096
 
2097
-    /**
2098
-     * Filter page title to replace variables.
2099
-     *
2100
-     * @since 1.5.4
2101
-     * @param string $title The page title including variables.
2102
-     * @param string $gd_page The GeoDirectory page type if any.
2103
-     */
2104
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2097
+	/**
2098
+	 * Filter page title to replace variables.
2099
+	 *
2100
+	 * @since 1.5.4
2101
+	 * @param string $title The page title including variables.
2102
+	 * @param string $gd_page The GeoDirectory page type if any.
2103
+	 */
2104
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2105 2105
 
2106
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2107
-    echo $title;
2108
-    echo '</h1></header>';
2106
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2107
+	echo $title;
2108
+	echo '</h1></header>';
2109 2109
 }
2110 2110
 
2111 2111
 add_action('geodir_add_listing_page_mandatory', 'geodir_action_add_listing_page_mandatory', 10);
@@ -2136,61 +2136,61 @@  discard block
 block discarded – undo
2136 2136
  */
2137 2137
 function geodir_action_add_listing_form()
2138 2138
 {
2139
-    global $cat_display, $post_cat, $current_user, $gd_session;
2140
-    $page_id = get_the_ID();
2141
-    $post = '';
2142
-    $title = '';
2143
-    $desc = '';
2144
-    $kw_tags = '';
2145
-    $required_msg = '';
2146
-    $submit_button = '';
2147
-
2148
-    $ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add';
2149
-
2150
-    $thumb_img_arr = array();
2151
-    $curImages = '';
2152
-
2153
-    if (isset($_REQUEST['backandedit'])) {
2154
-        global $post;
2155
-        $post = (object)$gd_session->get('listing');
2156
-        $listing_type = $post->listing_type;
2157
-        $title = $post->post_title;
2158
-        $desc = $post->post_desc;
2159
-        $post_cat = $post->post_category;
2160
-
2161
-        $kw_tags = $post->post_tags;
2162
-        $curImages = isset($post->post_images) ? $post->post_images : '';
2163
-    } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2164
-        global $post, $post_images;
2165
-
2166
-        $post = geodir_get_post_info($_REQUEST['pid']);
2167
-        $thumb_img_arr = geodir_get_images($post->ID);
2168
-        if ($thumb_img_arr) {
2169
-            foreach ($thumb_img_arr as $post_img) {
2170
-                $curImages .= $post_img->src . ',';
2171
-            }
2172
-        }
2139
+	global $cat_display, $post_cat, $current_user, $gd_session;
2140
+	$page_id = get_the_ID();
2141
+	$post = '';
2142
+	$title = '';
2143
+	$desc = '';
2144
+	$kw_tags = '';
2145
+	$required_msg = '';
2146
+	$submit_button = '';
2147
+
2148
+	$ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add';
2149
+
2150
+	$thumb_img_arr = array();
2151
+	$curImages = '';
2152
+
2153
+	if (isset($_REQUEST['backandedit'])) {
2154
+		global $post;
2155
+		$post = (object)$gd_session->get('listing');
2156
+		$listing_type = $post->listing_type;
2157
+		$title = $post->post_title;
2158
+		$desc = $post->post_desc;
2159
+		$post_cat = $post->post_category;
2160
+
2161
+		$kw_tags = $post->post_tags;
2162
+		$curImages = isset($post->post_images) ? $post->post_images : '';
2163
+	} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2164
+		global $post, $post_images;
2165
+
2166
+		$post = geodir_get_post_info($_REQUEST['pid']);
2167
+		$thumb_img_arr = geodir_get_images($post->ID);
2168
+		if ($thumb_img_arr) {
2169
+			foreach ($thumb_img_arr as $post_img) {
2170
+				$curImages .= $post_img->src . ',';
2171
+			}
2172
+		}
2173 2173
 
2174
-        $listing_type = $post->post_type;
2175
-        $title = $post->post_title;
2176
-        $desc = $post->post_content;
2177
-        $kw_tags = $post->post_tags;
2178
-        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2179
-    } else {
2180
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2181
-    }
2174
+		$listing_type = $post->post_type;
2175
+		$title = $post->post_title;
2176
+		$desc = $post->post_content;
2177
+		$kw_tags = $post->post_tags;
2178
+		$kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2179
+	} else {
2180
+		$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2181
+	}
2182 2182
 
2183
-    if ($current_user->ID != '0') {
2184
-        $user_login = true;
2185
-    }
2183
+	if ($current_user->ID != '0') {
2184
+		$user_login = true;
2185
+	}
2186 2186
 
2187
-    $post_type_info = geodir_get_posttype_info($listing_type);
2187
+	$post_type_info = geodir_get_posttype_info($listing_type);
2188 2188
 
2189
-    $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing','geodirectory');
2189
+	$cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing','geodirectory');
2190 2190
     
2191
-    $package_info = array();
2192
-    $package_info = geodir_post_package_info($package_info, $post);
2193
-    ?>
2191
+	$package_info = array();
2192
+	$package_info = geodir_post_package_info($package_info, $post);
2193
+	?>
2194 2194
     <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data">
2195 2195
         <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/>
2196 2196
         <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/>
@@ -2201,114 +2201,114 @@  discard block
 block discarded – undo
2201 2201
         <?php } if (isset($_REQUEST['backandedit'])) { ?>
2202 2202
             <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/>
2203 2203
         <?php
2204
-        } 
2205
-        /**
2206
-         * Called at the very top of the add listing page form for frontend.
2207
-         *
2208
-         * This is called just before the "Enter Listing Details" text.
2209
-         *
2210
-         * @since 1.0.0
2211
-         */
2212
-        do_action('geodir_before_detail_fields');
2213
-        ?>
2204
+		} 
2205
+		/**
2206
+		 * Called at the very top of the add listing page form for frontend.
2207
+		 *
2208
+		 * This is called just before the "Enter Listing Details" text.
2209
+		 *
2210
+		 * @since 1.0.0
2211
+		 */
2212
+		do_action('geodir_before_detail_fields');
2213
+		?>
2214 2214
         <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5>
2215 2215
         <?php
2216
-        /**
2217
-         * Called at the top of the add listing page form for frontend.
2218
-         *
2219
-         * This is called after the "Enter Listing Details" text.
2220
-         *
2221
-         * @since 1.0.0
2222
-         */
2223
-        do_action('geodir_before_main_form_fields');
2224
-        ?>
2216
+		/**
2217
+		 * Called at the top of the add listing page form for frontend.
2218
+		 *
2219
+		 * This is called after the "Enter Listing Details" text.
2220
+		 *
2221
+		 * @since 1.0.0
2222
+		 */
2223
+		do_action('geodir_before_main_form_fields');
2224
+		?>
2225 2225
         <div id="geodir_post_title_row" class="required_field geodir_form_row clearfix gd-fieldset-details">
2226 2226
             <label><?php
2227
-                /**
2228
-                 * Filter the add listing page title input label.
2229
-                 *
2230
-                 * @since 1.6.11
2231
-                 * @param string $title The title to be output.
2232
-                 * @param string $cpt_singular_name The singular title of the curent CPT.
2233
-                 * @param string $listing_type The CPT being requested. ie: gd_place.
2234
-                 */
2235
-                echo apply_filters('geodir_add_listing_title_label', sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span>*</span> </label>
2227
+				/**
2228
+				 * Filter the add listing page title input label.
2229
+				 *
2230
+				 * @since 1.6.11
2231
+				 * @param string $title The title to be output.
2232
+				 * @param string $cpt_singular_name The singular title of the curent CPT.
2233
+				 * @param string $listing_type The CPT being requested. ie: gd_place.
2234
+				 */
2235
+				echo apply_filters('geodir_add_listing_title_label', sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span>*</span> </label>
2236 2236
             <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield"
2237 2237
                    value="<?php echo esc_attr(stripslashes($title)); ?>"/>
2238 2238
             <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span>
2239 2239
         </div>
2240 2240
         <?php
2241
-        $show_editor = get_option('geodir_tiny_editor_on_add_listing');
2242
-        $show_editor = !empty($show_editor) && in_array($listing_type, $show_editor) ? true : false;
2243
-        /**
2244
-         * Filter whether to show or don't show the editor.
2245
-         *
2246
-         * @since 1.6.16
2247
-         * @param bool $show_editor If true the editor will be available for description field.
2248
-         * @param object $package_info The listing package.
2249
-         * @param string $listing_type The current post type.
2250
-         * @param object $post The current post object.
2251
-         */
2252
-        $show_editor = apply_filters('geodir_description_field_show_editor', $show_editor, $package_info, $listing_type, $post);
2253
-
2254
-        $desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc));
2255
-        $desc_limit = '';
2256
-        /**
2257
-         * Filter the add listing description field character limit number.
2258
-         *
2259
-         * @since 1.0.0
2260
-         * @param int $desc_limit The amount of characters to limit the description to.
2261
-         */
2262
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
2263
-        /**
2264
-         * Filter the add listing description field text.
2265
-         *
2266
-         * @since 1.0.0
2267
-         * @param string $desc The text for the description field.
2268
-         * @param int $desc_limit The character limit number if any.
2269
-         */
2270
-        $desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
2271
-        $desc_limit_msg = '';
2272
-        /**
2273
-         * Filter the add listing description limit message.
2274
-         *
2275
-         * This is the message shown if there is a limit applied to the amount of characters the description can use.
2276
-         *
2277
-         * @since 1.0.0
2278
-         * @param string $desc_limit_msg The limit message string if any.
2279
-         * @param int $desc_limit The character limit numer if any.
2280
-         */
2281
-        $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2241
+		$show_editor = get_option('geodir_tiny_editor_on_add_listing');
2242
+		$show_editor = !empty($show_editor) && in_array($listing_type, $show_editor) ? true : false;
2243
+		/**
2244
+		 * Filter whether to show or don't show the editor.
2245
+		 *
2246
+		 * @since 1.6.16
2247
+		 * @param bool $show_editor If true the editor will be available for description field.
2248
+		 * @param object $package_info The listing package.
2249
+		 * @param string $listing_type The current post type.
2250
+		 * @param object $post The current post object.
2251
+		 */
2252
+		$show_editor = apply_filters('geodir_description_field_show_editor', $show_editor, $package_info, $listing_type, $post);
2253
+
2254
+		$desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc));
2255
+		$desc_limit = '';
2256
+		/**
2257
+		 * Filter the add listing description field character limit number.
2258
+		 *
2259
+		 * @since 1.0.0
2260
+		 * @param int $desc_limit The amount of characters to limit the description to.
2261
+		 */
2262
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
2263
+		/**
2264
+		 * Filter the add listing description field text.
2265
+		 *
2266
+		 * @since 1.0.0
2267
+		 * @param string $desc The text for the description field.
2268
+		 * @param int $desc_limit The character limit number if any.
2269
+		 */
2270
+		$desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
2271
+		$desc_limit_msg = '';
2272
+		/**
2273
+		 * Filter the add listing description limit message.
2274
+		 *
2275
+		 * This is the message shown if there is a limit applied to the amount of characters the description can use.
2276
+		 *
2277
+		 * @since 1.0.0
2278
+		 * @param string $desc_limit_msg The limit message string if any.
2279
+		 * @param int $desc_limit The character limit numer if any.
2280
+		 */
2281
+		$desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2282 2282
         
2283
-        $desc_class = '';
2284
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2285
-            /**
2286
-             * Called on the add listing page form for frontend just before the description field.
2287
-             *
2288
-             * @since 1.0.0
2289
-             */
2290
-            do_action('geodir_before_description_field');
2283
+		$desc_class = '';
2284
+		if ($desc_limit === '' || (int)$desc_limit > 0) {
2285
+			/**
2286
+			 * Called on the add listing page form for frontend just before the description field.
2287
+			 *
2288
+			 * @since 1.0.0
2289
+			 */
2290
+			do_action('geodir_before_description_field');
2291 2291
             
2292
-            $desc_class = ' required_field';
2293
-        } else {
2294
-            $desc_class = ' hidden';
2295
-        }
2296
-        ?>
2292
+			$desc_class = ' required_field';
2293
+		} else {
2294
+			$desc_class = ' hidden';
2295
+		}
2296
+		?>
2297 2297
         <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>">
2298 2298
             <label><?php
2299
-                /**
2300
-                 * Filter the add listing page description input label.
2301
-                 *
2302
-                 * @since 1.6.11
2303
-                 * @param string $title The title to be output.
2304
-                 * @param string $cpt_singular_name The singular title of the curent CPT.
2305
-                 * @param string $listing_type The CPT being requested. ie: gd_place.
2306
-                 */
2307
-                echo apply_filters('geodir_add_listing_description_label',sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2299
+				/**
2300
+				 * Filter the add listing page description input label.
2301
+				 *
2302
+				 * @since 1.6.11
2303
+				 * @param string $title The title to be output.
2304
+				 * @param string $cpt_singular_name The singular title of the curent CPT.
2305
+				 * @param string $listing_type The CPT being requested. ie: gd_place.
2306
+				 */
2307
+				echo apply_filters('geodir_add_listing_description_label',sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2308 2308
             <?php
2309
-            if ($show_editor) {
2310
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2311
-            ?>
2309
+			if ($show_editor) {
2310
+				$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2311
+			?>
2312 2312
                 <div class="editor" field_id="post_desc" field_type="editor">
2313 2313
                     <?php wp_editor($desc, "post_desc", $editor_settings); ?>
2314 2314
                 </div>
@@ -2322,56 +2322,56 @@  discard block
 block discarded – undo
2322 2322
             <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span>
2323 2323
         </div>
2324 2324
         <?php
2325
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2326
-            /**
2327
-             * Called on the add listing page form for frontend just after the description field.
2328
-             *
2329
-             * @since 1.0.0
2330
-             */
2331
-            do_action('geodir_after_description_field');
2332
-        }
2325
+		if ($desc_limit === '' || (int)$desc_limit > 0) {
2326
+			/**
2327
+			 * Called on the add listing page form for frontend just after the description field.
2328
+			 *
2329
+			 * @since 1.0.0
2330
+			 */
2331
+			do_action('geodir_after_description_field');
2332
+		}
2333 2333
         
2334
-        $kw_tags = esc_attr(stripslashes($kw_tags));
2335
-        $kw_tags_count = TAGKW_TEXT_COUNT;
2336
-        $kw_tags_msg = TAGKW_MSG;
2337
-        /**
2338
-         * Filter the add listing tags character limit.
2339
-         *
2340
-         * @since 1.0.0
2341
-         * @param int $kw_tags_count The character count limit if any.
2342
-         */
2343
-        $kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
2344
-        /**
2345
-         * Filter the add listing tags field value.
2346
-         *
2347
-         * You can use the $_REQUEST values to check if this is a go back and edit value etc.
2348
-         *
2349
-         * @since 1.0.0
2350
-         * @param string $kw_tags The tag field value, usually a comma separated list of tags.
2351
-         * @param int $kw_tags_count The character count limit if any.
2352
-         */
2353
-        $kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
2354
-        /**
2355
-         * Filter the add listing tags field message text.
2356
-         *
2357
-         * @since 1.0.0
2358
-         * @param string $kw_tags_msg The message shown under the field.
2359
-         * @param int $kw_tags_count The character count limit if any.
2360
-         */
2361
-        $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2334
+		$kw_tags = esc_attr(stripslashes($kw_tags));
2335
+		$kw_tags_count = TAGKW_TEXT_COUNT;
2336
+		$kw_tags_msg = TAGKW_MSG;
2337
+		/**
2338
+		 * Filter the add listing tags character limit.
2339
+		 *
2340
+		 * @since 1.0.0
2341
+		 * @param int $kw_tags_count The character count limit if any.
2342
+		 */
2343
+		$kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
2344
+		/**
2345
+		 * Filter the add listing tags field value.
2346
+		 *
2347
+		 * You can use the $_REQUEST values to check if this is a go back and edit value etc.
2348
+		 *
2349
+		 * @since 1.0.0
2350
+		 * @param string $kw_tags The tag field value, usually a comma separated list of tags.
2351
+		 * @param int $kw_tags_count The character count limit if any.
2352
+		 */
2353
+		$kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
2354
+		/**
2355
+		 * Filter the add listing tags field message text.
2356
+		 *
2357
+		 * @since 1.0.0
2358
+		 * @param string $kw_tags_msg The message shown under the field.
2359
+		 * @param int $kw_tags_count The character count limit if any.
2360
+		 */
2361
+		$kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2362 2362
         
2363
-        $tags_class = '';
2364
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2365
-            /**
2366
-             * Called on the add listing page form for frontend just before the tags field.
2367
-             *
2368
-             * @since 1.0.0
2369
-             */
2370
-            do_action('geodir_before_listing_tags_field');
2371
-        } else {
2372
-            $tags_class = ' hidden';
2373
-        }
2374
-        ?>
2363
+		$tags_class = '';
2364
+		if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2365
+			/**
2366
+			 * Called on the add listing page form for frontend just before the tags field.
2367
+			 *
2368
+			 * @since 1.0.0
2369
+			 */
2370
+			do_action('geodir_before_listing_tags_field');
2371
+		} else {
2372
+			$tags_class = ' hidden';
2373
+		}
2374
+		?>
2375 2375
         <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>">
2376 2376
             <label><?php echo TAGKW_TEXT; ?></label>
2377 2377
             <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield"
@@ -2379,90 +2379,90 @@  discard block
 block discarded – undo
2379 2379
             <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span>
2380 2380
         </div>
2381 2381
         <?php
2382
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2383
-            /**
2384
-             * Called on the add listing page form for frontend just after the tags field.
2385
-             *
2386
-             * @since 1.0.0
2387
-             */
2388
-            do_action('geodir_after_listing_tags_field');
2389
-        }
2382
+		if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2383
+			/**
2384
+			 * Called on the add listing page form for frontend just after the tags field.
2385
+			 *
2386
+			 * @since 1.0.0
2387
+			 */
2388
+			do_action('geodir_after_listing_tags_field');
2389
+		}
2390 2390
         
2391
-        $package_info = array();
2392
-        $package_info = geodir_post_package_info($package_info, $post);
2391
+		$package_info = array();
2392
+		$package_info = geodir_post_package_info($package_info, $post);
2393 2393
         
2394
-        geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type);
2394
+		geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type);
2395 2395
         
2396
-        // adjust values here
2397
-        $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
2396
+		// adjust values here
2397
+		$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
2398 2398
 
2399
-        $multiple = true; // allow multiple files upload
2399
+		$multiple = true; // allow multiple files upload
2400 2400
 
2401
-        $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2401
+		$width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2402 2402
 
2403
-        $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2403
+		$height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2404 2404
 
2405
-        $thumb_img_arr = array();
2406
-        $totImg = 0;
2407
-        if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2408
-            $post = (object)$gd_session->get('listing');
2409
-            if (isset($post->post_images))
2410
-                $curImages = trim($post->post_images, ",");
2405
+		$thumb_img_arr = array();
2406
+		$totImg = 0;
2407
+		if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2408
+			$post = (object)$gd_session->get('listing');
2409
+			if (isset($post->post_images))
2410
+				$curImages = trim($post->post_images, ",");
2411 2411
 
2412 2412
 
2413
-            if ($curImages != '') {
2414
-                $curImages_array = explode(',', $curImages);
2415
-                $totImg = count($curImages_array);
2416
-            }
2413
+			if ($curImages != '') {
2414
+				$curImages_array = explode(',', $curImages);
2415
+				$totImg = count($curImages_array);
2416
+			}
2417 2417
 
2418
-            $listing_type = $post->listing_type;
2418
+			$listing_type = $post->listing_type;
2419 2419
 
2420
-        } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2421
-            $post = geodir_get_post_info((int)$_REQUEST['pid']);
2422
-            $listing_type = $post->post_type;
2423
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2420
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2421
+			$post = geodir_get_post_info((int)$_REQUEST['pid']);
2422
+			$listing_type = $post->post_type;
2423
+			$thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2424 2424
 
2425
-        } else {
2426
-            $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2427
-        }
2425
+		} else {
2426
+			$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2427
+		}
2428 2428
 
2429 2429
 
2430
-        if (!empty($thumb_img_arr)) {
2431
-            foreach ($thumb_img_arr as $img) {
2432
-                //$curImages = $img->src.",";
2433
-            }
2434
-
2435
-            $totImg = count((array)$thumb_img_arr);
2436
-        }
2430
+		if (!empty($thumb_img_arr)) {
2431
+			foreach ($thumb_img_arr as $img) {
2432
+				//$curImages = $img->src.",";
2433
+			}
2437 2434
 
2438
-        if ($curImages != '')
2439
-            $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2440
-        else
2441
-            $svalue = '';
2442
-
2443
-        $image_limit = isset($package_info->image_limit) ? $package_info->image_limit : '0';
2444
-        $show_image_input_box = ($image_limit != '0');
2445
-        /**
2446
-         * Filter to be able to show/hide the image upload section of the add listing form.
2447
-         *
2448
-         * @since 1.0.0
2449
-         * @param bool $show_image_input_box Set true to show. Set false to not show.
2450
-         * @param string $listing_type The custom post type slug.
2451
-         */
2452
-        $show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
2453
-        if ($show_image_input_box) {
2454
-            ?>
2435
+			$totImg = count((array)$thumb_img_arr);
2436
+		}
2437
+
2438
+		if ($curImages != '')
2439
+			$svalue = $curImages; // this will be initial value of the above form field. Image urls.
2440
+		else
2441
+			$svalue = '';
2442
+
2443
+		$image_limit = isset($package_info->image_limit) ? $package_info->image_limit : '0';
2444
+		$show_image_input_box = ($image_limit != '0');
2445
+		/**
2446
+		 * Filter to be able to show/hide the image upload section of the add listing form.
2447
+		 *
2448
+		 * @since 1.0.0
2449
+		 * @param bool $show_image_input_box Set true to show. Set false to not show.
2450
+		 * @param string $listing_type The custom post type slug.
2451
+		 */
2452
+		$show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
2453
+		if ($show_image_input_box) {
2454
+			?>
2455 2455
 
2456 2456
             <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?>
2457 2457
                 <?php if ($image_limit == 1) {
2458
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2459
-                } ?>
2458
+					echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2459
+				} ?>
2460 2460
                 <?php if ($image_limit > 1) {
2461
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2462
-                } ?>
2461
+					echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2462
+				} ?>
2463 2463
                 <?php if ($image_limit == '') {
2464
-                    echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2465
-                } ?>
2464
+					echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2465
+				} ?>
2466 2466
             </h5>
2467 2467
 
2468 2468
             <div class="geodir_form_row clearfix" id="<?php echo $id; ?>dropbox"
@@ -2500,12 +2500,12 @@  discard block
 block discarded – undo
2500 2500
         <?php } ?>
2501 2501
 
2502 2502
         <?php
2503
-        /**
2504
-         * Called on the add listing page form for frontend just after the image upload field.
2505
-         *
2506
-         * @since 1.0.0
2507
-         */
2508
-        do_action('geodir_after_main_form_fields');?>
2503
+		/**
2504
+		 * Called on the add listing page form for frontend just after the image upload field.
2505
+		 *
2506
+		 * @since 1.0.0
2507
+		 */
2508
+		do_action('geodir_after_main_form_fields');?>
2509 2509
 
2510 2510
 
2511 2511
         <!-- add captcha code -->
@@ -2534,7 +2534,7 @@  discard block
 block discarded – undo
2534 2534
 
2535 2535
     </form>
2536 2536
     <?php
2537
-    wp_reset_query();
2537
+	wp_reset_query();
2538 2538
 }
2539 2539
 
2540 2540
 /**
@@ -2545,7 +2545,7 @@  discard block
 block discarded – undo
2545 2545
  */
2546 2546
 function geodir_add_listing_sidebar_widget_area()
2547 2547
 {
2548
-    dynamic_sidebar('geodir_add_listing_sidebar');
2548
+	dynamic_sidebar('geodir_add_listing_sidebar');
2549 2549
 }
2550 2550
 
2551 2551
 add_action('geodir_add_listing_sidebar_inside', 'geodir_add_listing_sidebar_widget_area', 10);
@@ -2560,16 +2560,16 @@  discard block
 block discarded – undo
2560 2560
  */
2561 2561
 function geodir_action_add_listing_sidebar()
2562 2562
 {
2563
-    /** This action is documented in geodirectory_template_actions.php */
2564
-    do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
2565
-    /**
2566
-     * This is used to add the content to the add listing page sidebar.
2567
-     *
2568
-     * @since 1.0.0
2569
-     */
2570
-    do_action('geodir_add_listing_sidebar_inside');
2571
-    /** This action is documented in geodirectory_template_actions.php */
2572
-    do_action('geodir_sidebar_right_close', 'details-page');
2563
+	/** This action is documented in geodirectory_template_actions.php */
2564
+	do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
2565
+	/**
2566
+	 * This is used to add the content to the add listing page sidebar.
2567
+	 *
2568
+	 * @since 1.0.0
2569
+	 */
2570
+	do_action('geodir_add_listing_sidebar_inside');
2571
+	/** This action is documented in geodirectory_template_actions.php */
2572
+	do_action('geodir_sidebar_right_close', 'details-page');
2573 2573
 }
2574 2574
 
2575 2575
 ###############################################
@@ -2586,11 +2586,11 @@  discard block
 block discarded – undo
2586 2586
  */
2587 2587
 function geodir_action_geodir_sidebar_signup_top()
2588 2588
 {
2589
-    ?>
2589
+	?>
2590 2590
     <div
2591 2591
         class="<?php
2592
-        /** This action is documented in geodirectory_template_actions.php */
2593
-        echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2592
+		/** This action is documented in geodirectory_template_actions.php */
2593
+		echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2594 2594
         <?php dynamic_sidebar('Reg/Login Top Section');?>
2595 2595
     </div><!-- clearfix ends here-->
2596 2596
 <?php
@@ -2609,11 +2609,11 @@  discard block
 block discarded – undo
2609 2609
 function geodir_action_signup_forms()
2610 2610
 {
2611 2611
 
2612
-    global $user_login;
2612
+	global $user_login;
2613 2613
     
2614
-    $is_enable_signup = get_option( 'users_can_register' );
2614
+	$is_enable_signup = get_option( 'users_can_register' );
2615 2615
     
2616
-    ?>
2616
+	?>
2617 2617
     <script type="text/javascript">
2618 2618
         <?php if ( $user_login ) { ?>
2619 2619
         setTimeout(function () {
@@ -2649,67 +2649,67 @@  discard block
 block discarded – undo
2649 2649
         <?php } ?>
2650 2650
     </script><?php
2651 2651
 
2652
-    global $errors;
2653
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2654
-        $errors->add('claim_login', LOGIN_CLAIM);
2655
-
2656
-    if (!empty($errors)) {
2657
-        foreach ($errors as $errorsObj) {
2658
-            foreach ($errorsObj as $key => $val) {
2659
-                for ($i = 0; $i < count($val); $i++) {
2660
-                    echo "<div class=error_msg_fix>" . $val[$i] . '</div>';
2661
-                    $registration_error_msg = 1;
2662
-                }
2663
-            }
2664
-        }
2665
-    }
2652
+	global $errors;
2653
+	if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2654
+		$errors->add('claim_login', LOGIN_CLAIM);
2655
+
2656
+	if (!empty($errors)) {
2657
+		foreach ($errors as $errorsObj) {
2658
+			foreach ($errorsObj as $key => $val) {
2659
+				for ($i = 0; $i < count($val); $i++) {
2660
+					echo "<div class=error_msg_fix>" . $val[$i] . '</div>';
2661
+					$registration_error_msg = 1;
2662
+				}
2663
+			}
2664
+		}
2665
+	}
2666 2666
 
2667
-    if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
2668
-        ?>
2667
+	if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
2668
+		?>
2669 2669
 
2670 2670
         <div class="login_form">
2671 2671
             <?php
2672
-            /**
2673
-             * Contains login form template.
2674
-             *
2675
-             * @since 1.0.0
2676
-             */
2677
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2672
+			/**
2673
+			 * Contains login form template.
2674
+			 *
2675
+			 * @since 1.0.0
2676
+			 */
2677
+			include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2678 2678
         </div>
2679 2679
 
2680 2680
     <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up' && $is_enable_signup ) { ?>
2681 2681
 
2682 2682
         <div class="registration_form">
2683 2683
             <?php
2684
-            /**
2685
-             * Contains registration form template.
2686
-             *
2687
-             * @since 1.0.0
2688
-             */
2689
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2684
+			/**
2685
+			 * Contains registration form template.
2686
+			 *
2687
+			 * @since 1.0.0
2688
+			 */
2689
+			include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2690 2690
         </div>
2691 2691
 
2692 2692
     <?php } else { ?>
2693 2693
 
2694 2694
         <div class="login_form_l">
2695 2695
             <?php
2696
-            /**
2697
-             * Contains login form template.
2698
-             *
2699
-             * @since 1.0.0
2700
-             */
2701
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2696
+			/**
2697
+			 * Contains login form template.
2698
+			 *
2699
+			 * @since 1.0.0
2700
+			 */
2701
+			include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2702 2702
         </div>
2703 2703
         
2704 2704
         <?php if ( $is_enable_signup ) { ?>
2705 2705
             <div class="registration_form_r">
2706 2706
                 <?php
2707
-                /**
2708
-                 * Contains registration form template.
2709
-                 *
2710
-                 * @since 1.0.0
2711
-                 */
2712
-                include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2707
+				/**
2708
+				 * Contains registration form template.
2709
+				 *
2710
+				 * @since 1.0.0
2711
+				 */
2712
+				include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2713 2713
             </div>
2714 2714
         <?php } ?>
2715 2715
 
@@ -2741,66 +2741,66 @@  discard block
 block discarded – undo
2741 2741
  */
2742 2742
 function geodir_action_author_page_title()
2743 2743
 {
2744
-    global $term;
2744
+	global $term;
2745 2745
 
2746
-    $gd_post_type = geodir_get_current_posttype();
2747
-    $post_type_info = get_post_type_object($gd_post_type);
2746
+	$gd_post_type = geodir_get_current_posttype();
2747
+	$post_type_info = get_post_type_object($gd_post_type);
2748 2748
 
2749
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
2750
-    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2751
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2752
-    }
2749
+	$add_string_in_title = __('All', 'geodirectory') . ' ';
2750
+	if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2751
+		$add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2752
+	}
2753 2753
 
2754
-    $list_title = $add_string_in_title . $post_type_info->labels->name;
2755
-    $single_name = $post_type_info->labels->singular_name;
2754
+	$list_title = $add_string_in_title . $post_type_info->labels->name;
2755
+	$single_name = $post_type_info->labels->singular_name;
2756 2756
 
2757
-    $taxonomy = geodir_get_taxonomies($gd_post_type);
2757
+	$taxonomy = geodir_get_taxonomies($gd_post_type);
2758 2758
 
2759
-    if (!empty($term)) {
2760
-        $current_term = get_term_by('slug', $term, $taxonomy[0]);
2761
-        if (!empty($current_term))
2762
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2763
-    }
2759
+	if (!empty($term)) {
2760
+		$current_term = get_term_by('slug', $term, $taxonomy[0]);
2761
+		if (!empty($current_term))
2762
+			$list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2763
+	}
2764 2764
 
2765 2765
 
2766
-    if (is_search()) {
2767
-        $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2766
+	if (is_search()) {
2767
+		$list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2768 2768
 
2769
-    }
2770
-    /** This action is documented in geodirectory_template_actions.php */
2771
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2772
-    /** This action is documented in geodirectory_template_actions.php */
2773
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2769
+	}
2770
+	/** This action is documented in geodirectory_template_actions.php */
2771
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2772
+	/** This action is documented in geodirectory_template_actions.php */
2773
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2774 2774
 
2775
-    $title = $list_title;
2776
-    if(geodir_is_page('author')){
2777
-        $gd_page = 'author';
2778
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2779
-            $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2780
-        }else{
2781
-            $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2782
-        }
2775
+	$title = $list_title;
2776
+	if(geodir_is_page('author')){
2777
+		$gd_page = 'author';
2778
+		if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2779
+			$title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2780
+		}else{
2781
+			$title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2782
+		}
2783 2783
 
2784
-    }
2784
+	}
2785 2785
 
2786 2786
 
2787
-    /**
2788
-     * Filter page title to replace variables.
2789
-     *
2790
-     * @since 1.5.4
2791
-     * @param string $title The page title including variables.
2792
-     * @param string $gd_page The GeoDirectory page type if any.
2793
-     */
2794
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2787
+	/**
2788
+	 * Filter page title to replace variables.
2789
+	 *
2790
+	 * @since 1.5.4
2791
+	 * @param string $title The page title including variables.
2792
+	 * @param string $gd_page The GeoDirectory page type if any.
2793
+	 */
2794
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2795 2795
 
2796
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2797
-        /**
2798
-         * Filter the author page title text.
2799
-         *
2800
-         * @since 1.0.0
2801
-         * @param string $list_title The title for the page.
2802
-         */
2803
-        apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2796
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2797
+		/**
2798
+		 * Filter the author page title text.
2799
+		 *
2800
+		 * @since 1.0.0
2801
+		 * @param string $list_title The title for the page.
2802
+		 */
2803
+		apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2804 2804
 }
2805 2805
 
2806 2806
 
@@ -2818,11 +2818,11 @@  discard block
 block discarded – undo
2818 2818
  */
2819 2819
 function geodir_action_geodir_sidebar_author_top()
2820 2820
 {
2821
-    if (get_option('geodir_show_author_top_section')) { ?>
2821
+	if (get_option('geodir_show_author_top_section')) { ?>
2822 2822
         <div
2823 2823
             class="<?php
2824
-            /** This action is documented in geodirectory_template_actions.php */
2825
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
2824
+			/** This action is documented in geodirectory_template_actions.php */
2825
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
2826 2826
             <?php dynamic_sidebar('geodir_author_top'); ?>
2827 2827
         </div><!-- clearfix ends here-->
2828 2828
     <?php }
@@ -2838,7 +2838,7 @@  discard block
 block discarded – undo
2838 2838
  */
2839 2839
 function geodir_author_left_section()
2840 2840
 {
2841
-    if (get_option('geodir_show_author_left_section')) { ?>
2841
+	if (get_option('geodir_show_author_left_section')) { ?>
2842 2842
         <div class="geodir-content-left geodir-sidebar-wrap">
2843 2843
             <?php dynamic_sidebar('geodir_author_left_sidebar'); ?>
2844 2844
         </div><!-- end geodir-content-left -->
@@ -2859,19 +2859,19 @@  discard block
 block discarded – undo
2859 2859
  */
2860 2860
 function geodir_action_author_sidebar_left()
2861 2861
 {
2862
-    if (get_option('geodir_show_author_left_section')) {
2862
+	if (get_option('geodir_show_author_left_section')) {
2863 2863
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
2864
-        /** This action is documented in geodirectory_template_actions.php */
2865
-        do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
2866
-        /**
2867
-         * This is used to add the content to the author page left sidebar (if active).
2868
-         *
2869
-         * @since 1.0.0
2870
-         */
2871
-        do_action('geodir_author_sidebar_left_inside');
2872
-        /** This action is documented in geodirectory_template_actions.php */
2873
-        do_action('geodir_sidebar_left_close', 'author-page');
2874
-    }
2864
+		/** This action is documented in geodirectory_template_actions.php */
2865
+		do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
2866
+		/**
2867
+		 * This is used to add the content to the author page left sidebar (if active).
2868
+		 *
2869
+		 * @since 1.0.0
2870
+		 */
2871
+		do_action('geodir_author_sidebar_left_inside');
2872
+		/** This action is documented in geodirectory_template_actions.php */
2873
+		do_action('geodir_sidebar_left_close', 'author-page');
2874
+	}
2875 2875
 }
2876 2876
 
2877 2877
 /**
@@ -2884,7 +2884,7 @@  discard block
 block discarded – undo
2884 2884
  */
2885 2885
 function geodir_author_right_section()
2886 2886
 {
2887
-    if (get_option('geodir_show_author_right_section')) { ?>
2887
+	if (get_option('geodir_show_author_right_section')) { ?>
2888 2888
         <div class="geodir-content-right geodir-sidebar-wrap">
2889 2889
             <?php dynamic_sidebar('geodir_author_right_sidebar'); ?>
2890 2890
         </div><!-- end geodir-content-right -->
@@ -2904,18 +2904,18 @@  discard block
 block discarded – undo
2904 2904
  */
2905 2905
 function geodir_action_author_sidebar_right()
2906 2906
 {
2907
-    if (get_option('geodir_show_author_right_section')) {
2908
-        /** This action is documented in geodirectory_template_actions.php */
2909
-        do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
2910
-        /**
2911
-         * This is used to add the content to the author page right sidebar (if active).
2912
-         *
2913
-         * @since 1.0.0
2914
-         */
2915
-        do_action('geodir_author_sidebar_right_inside');
2916
-        /** This action is documented in geodirectory_template_actions.php */
2917
-        do_action('geodir_sidebar_right_close', 'author-page');
2918
-    }
2907
+	if (get_option('geodir_show_author_right_section')) {
2908
+		/** This action is documented in geodirectory_template_actions.php */
2909
+		do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
2910
+		/**
2911
+		 * This is used to add the content to the author page right sidebar (if active).
2912
+		 *
2913
+		 * @since 1.0.0
2914
+		 */
2915
+		do_action('geodir_author_sidebar_right_inside');
2916
+		/** This action is documented in geodirectory_template_actions.php */
2917
+		do_action('geodir_sidebar_right_close', 'author-page');
2918
+	}
2919 2919
 }
2920 2920
 
2921 2921
 /**
@@ -2927,14 +2927,14 @@  discard block
 block discarded – undo
2927 2927
  */
2928 2928
 function geodir_action_author_content_inside()
2929 2929
 {
2930
-    global $gridview_columns;
2931
-    $listing_view = get_option('geodir_author_view');
2932
-    if (strstr($listing_view, 'gridview')) {
2933
-        $gridview_columns = $listing_view;
2934
-        $listing_view_exp = explode('_', $listing_view);
2935
-        $listing_view = $listing_view_exp[0];
2936
-    }
2937
-    geodir_get_template_part('listing', 'listview');
2930
+	global $gridview_columns;
2931
+	$listing_view = get_option('geodir_author_view');
2932
+	if (strstr($listing_view, 'gridview')) {
2933
+		$gridview_columns = $listing_view;
2934
+		$listing_view_exp = explode('_', $listing_view);
2935
+		$listing_view = $listing_view_exp[0];
2936
+	}
2937
+	geodir_get_template_part('listing', 'listview');
2938 2938
 }
2939 2939
 
2940 2940
 add_action('geodir_author_content_inside', 'geodir_action_author_content_inside', 10);
@@ -2949,22 +2949,22 @@  discard block
 block discarded – undo
2949 2949
  */
2950 2950
 function geodir_action_author_content()
2951 2951
 {
2952
-    /** This action is documented in geodirectory_template_actions.php */
2953
-    do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
2954
-    echo '<div class="clearfix">';
2955
-    /** This action is documented in geodirectory_template_actions.php */
2956
-    do_action('geodir_before_listing');
2957
-    echo '</div>';
2958
-    /**
2959
-     * This is used to add the content to the author page main content.
2960
-     *
2961
-     * @since 1.0.0
2962
-     */
2963
-    do_action('geodir_author_content_inside');
2964
-    /** This action is documented in geodirectory_template_actions.php */
2965
-    do_action('geodir_after_listing');
2966
-    /** This action is documented in geodirectory_template_actions.php */
2967
-    do_action('geodir_main_content_close', 'author-page');
2952
+	/** This action is documented in geodirectory_template_actions.php */
2953
+	do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
2954
+	echo '<div class="clearfix">';
2955
+	/** This action is documented in geodirectory_template_actions.php */
2956
+	do_action('geodir_before_listing');
2957
+	echo '</div>';
2958
+	/**
2959
+	 * This is used to add the content to the author page main content.
2960
+	 *
2961
+	 * @since 1.0.0
2962
+	 */
2963
+	do_action('geodir_author_content_inside');
2964
+	/** This action is documented in geodirectory_template_actions.php */
2965
+	do_action('geodir_after_listing');
2966
+	/** This action is documented in geodirectory_template_actions.php */
2967
+	do_action('geodir_main_content_close', 'author-page');
2968 2968
 }
2969 2969
 
2970 2970
 add_action('geodir_sidebar_author_bottom_section', 'geodir_action_sidebar_author_bottom_section', 10);
@@ -2978,11 +2978,11 @@  discard block
 block discarded – undo
2978 2978
  */
2979 2979
 function geodir_action_sidebar_author_bottom_section()
2980 2980
 {
2981
-    if (get_option('geodir_show_author_bottom_section')) { ?>
2981
+	if (get_option('geodir_show_author_bottom_section')) { ?>
2982 2982
         <div
2983 2983
             class="<?php
2984
-            /** This action is documented in geodirectory_template_actions.php */
2985
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
2984
+			/** This action is documented in geodirectory_template_actions.php */
2985
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
2986 2986
             <?php dynamic_sidebar('geodir_author_bottom'); ?>
2987 2987
         </div><!-- clearfix ends here-->
2988 2988
     <?php }
@@ -3001,23 +3001,23 @@  discard block
 block discarded – undo
3001 3001
  */
3002 3002
 function geodir_action_search_page_title()
3003 3003
 {
3004
-    $gd_post_type = geodir_get_current_posttype();
3005
-    $post_type_info = get_post_type_object($gd_post_type);
3004
+	$gd_post_type = geodir_get_current_posttype();
3005
+	$post_type_info = get_post_type_object($gd_post_type);
3006 3006
 
3007
-    $pt_name = '';
3008
-    if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
3007
+	$pt_name = '';
3008
+	if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
3009 3009
 
3010
-    if (is_search()) {
3011
-        $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
3010
+	if (is_search()) {
3011
+		$list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
3012 3012
 
3013
-    }
3014
-    /** This action is documented in geodirectory_template_actions.php */
3015
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
3016
-    /** This action is documented in geodirectory_template_actions.php */
3017
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
3018
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
3019
-        /** This action is documented in geodirectory_template_actions.php */
3020
-        apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
3013
+	}
3014
+	/** This action is documented in geodirectory_template_actions.php */
3015
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
3016
+	/** This action is documented in geodirectory_template_actions.php */
3017
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
3018
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
3019
+		/** This action is documented in geodirectory_template_actions.php */
3020
+		apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
3021 3021
 }
3022 3022
 
3023 3023
 // action for adding the listings page top widget area
@@ -3033,11 +3033,11 @@  discard block
 block discarded – undo
3033 3033
  */
3034 3034
 function geodir_action_geodir_sidebar_search_top()
3035 3035
 {
3036
-    if (get_option('geodir_show_search_top_section')) { ?>
3036
+	if (get_option('geodir_show_search_top_section')) { ?>
3037 3037
         <div
3038 3038
             class="<?php
3039
-            /** This action is documented in geodirectory_template_actions.php */
3040
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
3039
+			/** This action is documented in geodirectory_template_actions.php */
3040
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
3041 3041
             <?php dynamic_sidebar('geodir_search_top'); ?>
3042 3042
         </div><!-- clearfix ends here-->
3043 3043
     <?php }
@@ -3053,7 +3053,7 @@  discard block
 block discarded – undo
3053 3053
  */
3054 3054
 function geodir_search_left_section()
3055 3055
 {
3056
-    if (get_option('geodir_show_search_left_section')) { ?>
3056
+	if (get_option('geodir_show_search_left_section')) { ?>
3057 3057
         <div class="geodir-content-left geodir-sidebar-wrap">
3058 3058
             <?php dynamic_sidebar('geodir_search_left_sidebar'); ?>
3059 3059
         </div><!-- end geodir-content-left -->
@@ -3073,19 +3073,19 @@  discard block
 block discarded – undo
3073 3073
  */
3074 3074
 function geodir_action_search_sidebar_left()
3075 3075
 {
3076
-    if (get_option('geodir_show_search_left_section')) {
3076
+	if (get_option('geodir_show_search_left_section')) {
3077 3077
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
3078
-        /** This action is documented in geodirectory_template_actions.php */
3079
-        do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3080
-        /**
3081
-         * This is used to add the content to the search page left sidebar (if active).
3082
-         *
3083
-         * @since 1.0.0
3084
-         */
3085
-        do_action('geodir_search_sidebar_left_inside');
3086
-        /** This action is documented in geodirectory_template_actions.php */
3087
-        do_action('geodir_sidebar_left_close', 'search-page');
3088
-    }
3078
+		/** This action is documented in geodirectory_template_actions.php */
3079
+		do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3080
+		/**
3081
+		 * This is used to add the content to the search page left sidebar (if active).
3082
+		 *
3083
+		 * @since 1.0.0
3084
+		 */
3085
+		do_action('geodir_search_sidebar_left_inside');
3086
+		/** This action is documented in geodirectory_template_actions.php */
3087
+		do_action('geodir_sidebar_left_close', 'search-page');
3088
+	}
3089 3089
 }
3090 3090
 
3091 3091
 /**
@@ -3098,7 +3098,7 @@  discard block
 block discarded – undo
3098 3098
  */
3099 3099
 function geodir_search_right_section()
3100 3100
 {
3101
-    if (get_option('geodir_show_search_right_section')) { ?>
3101
+	if (get_option('geodir_show_search_right_section')) { ?>
3102 3102
         <div class="geodir-content-right geodir-sidebar-wrap">
3103 3103
             <?php dynamic_sidebar('geodir_search_right_sidebar'); ?>
3104 3104
         </div><!-- end geodir-content-right -->
@@ -3118,18 +3118,18 @@  discard block
 block discarded – undo
3118 3118
  */
3119 3119
 function geodir_action_search_sidebar_right()
3120 3120
 {
3121
-    if (get_option('geodir_show_search_right_section')) {
3122
-        /** This action is documented in geodirectory_template_actions.php */
3123
-        do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3124
-        /**
3125
-         * This is used to add the content to the search page right sidebar (if active).
3126
-         *
3127
-         * @since 1.0.0
3128
-         */
3129
-        do_action('geodir_search_sidebar_right_inside');
3130
-        /** This action is documented in geodirectory_template_actions.php */
3131
-        do_action('geodir_sidebar_right_close', 'search-page');
3132
-    }
3121
+	if (get_option('geodir_show_search_right_section')) {
3122
+		/** This action is documented in geodirectory_template_actions.php */
3123
+		do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3124
+		/**
3125
+		 * This is used to add the content to the search page right sidebar (if active).
3126
+		 *
3127
+		 * @since 1.0.0
3128
+		 */
3129
+		do_action('geodir_search_sidebar_right_inside');
3130
+		/** This action is documented in geodirectory_template_actions.php */
3131
+		do_action('geodir_sidebar_right_close', 'search-page');
3132
+	}
3133 3133
 }
3134 3134
 
3135 3135
 
@@ -3144,11 +3144,11 @@  discard block
 block discarded – undo
3144 3144
  */
3145 3145
 function geodir_action_sidebar_search_bottom_section()
3146 3146
 {
3147
-    if (get_option('geodir_show_search_bottom_section')) { ?>
3147
+	if (get_option('geodir_show_search_bottom_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_search_bottom'); ?>">
3150
+			/** This action is documented in geodirectory_template_actions.php */
3151
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
3152 3152
             <?php dynamic_sidebar('geodir_search_bottom'); ?>
3153 3153
         </div><!-- clearfix ends here-->
3154 3154
     <?php }
@@ -3163,14 +3163,14 @@  discard block
 block discarded – undo
3163 3163
  */
3164 3164
 function geodir_action_search_content_inside()
3165 3165
 {
3166
-    global $gridview_columns;
3167
-    $listing_view = get_option('geodir_search_view');
3168
-    if (strstr($listing_view, 'gridview')) {
3169
-        $gridview_columns = $listing_view;
3170
-        $listing_view_exp = explode('_', $listing_view);
3171
-        $listing_view = $listing_view_exp[0];
3172
-    }
3173
-    geodir_get_template_part('listing', 'listview');
3166
+	global $gridview_columns;
3167
+	$listing_view = get_option('geodir_search_view');
3168
+	if (strstr($listing_view, 'gridview')) {
3169
+		$gridview_columns = $listing_view;
3170
+		$listing_view_exp = explode('_', $listing_view);
3171
+		$listing_view = $listing_view_exp[0];
3172
+	}
3173
+	geodir_get_template_part('listing', 'listview');
3174 3174
 }
3175 3175
 
3176 3176
 add_action('geodir_search_content_inside', 'geodir_action_search_content_inside', 10);
@@ -3186,22 +3186,22 @@  discard block
 block discarded – undo
3186 3186
  */
3187 3187
 function geodir_action_search_content()
3188 3188
 {
3189
-    /** This action is documented in geodirectory_template_actions.php */
3190
-    do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
3191
-    echo '<div class="clearfix">';
3192
-    /** This action is documented in geodirectory_template_actions.php */
3193
-    do_action('geodir_before_listing');
3194
-    echo '</div>';
3195
-    /**
3196
-     * This is used to add the content to the search page main content.
3197
-     *
3198
-     * @since 1.0.0
3199
-     */
3200
-    do_action('geodir_search_content_inside');
3201
-    /** This action is documented in geodirectory_template_actions.php */
3202
-    do_action('geodir_after_listing');
3203
-    /** This action is documented in geodirectory_template_actions.php */
3204
-    do_action('geodir_main_content_close', 'search-page');
3189
+	/** This action is documented in geodirectory_template_actions.php */
3190
+	do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
3191
+	echo '<div class="clearfix">';
3192
+	/** This action is documented in geodirectory_template_actions.php */
3193
+	do_action('geodir_before_listing');
3194
+	echo '</div>';
3195
+	/**
3196
+	 * This is used to add the content to the search page main content.
3197
+	 *
3198
+	 * @since 1.0.0
3199
+	 */
3200
+	do_action('geodir_search_content_inside');
3201
+	/** This action is documented in geodirectory_template_actions.php */
3202
+	do_action('geodir_after_listing');
3203
+	/** This action is documented in geodirectory_template_actions.php */
3204
+	do_action('geodir_main_content_close', 'search-page');
3205 3205
 }
3206 3206
 
3207 3207
 ###############################################
@@ -3224,11 +3224,11 @@  discard block
 block discarded – undo
3224 3224
  */
3225 3225
 function geodir_action_geodir_sidebar_home_top()
3226 3226
 {
3227
-    if (get_option('geodir_show_home_top_section')) { ?>
3227
+	if (get_option('geodir_show_home_top_section')) { ?>
3228 3228
         <div
3229 3229
             class="<?php
3230
-            /** This action is documented in geodirectory_template_actions.php */
3231
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
3230
+			/** This action is documented in geodirectory_template_actions.php */
3231
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
3232 3232
             <?php dynamic_sidebar('geodir_home_top'); ?>
3233 3233
         </div><!-- clearfix ends here-->
3234 3234
     <?php }
@@ -3244,7 +3244,7 @@  discard block
 block discarded – undo
3244 3244
  */
3245 3245
 function geodir_home_left_section()
3246 3246
 {
3247
-    if (get_option('geodir_show_home_left_section')) { ?>
3247
+	if (get_option('geodir_show_home_left_section')) { ?>
3248 3248
         <div class="geodir-content-left geodir-sidebar-wrap">
3249 3249
             <?php dynamic_sidebar('geodir_home_left'); ?>
3250 3250
         </div><!-- end geodir-content-left -->
@@ -3266,19 +3266,19 @@  discard block
 block discarded – undo
3266 3266
  */
3267 3267
 function geodir_action_home_sidebar_left()
3268 3268
 {
3269
-    if (get_option('geodir_show_home_left_section')) {
3269
+	if (get_option('geodir_show_home_left_section')) {
3270 3270
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
3271
-        /** This action is documented in geodirectory_template_actions.php */
3272
-        do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3273
-        /**
3274
-         * This is used to add the content to the home page left sidebar (if active).
3275
-         *
3276
-         * @since 1.0.0
3277
-         */
3278
-        do_action('geodir_home_sidebar_left_inside');
3279
-        /** This action is documented in geodirectory_template_actions.php */
3280
-        do_action('geodir_sidebar_left_close', 'home-page');
3281
-    }
3271
+		/** This action is documented in geodirectory_template_actions.php */
3272
+		do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3273
+		/**
3274
+		 * This is used to add the content to the home page left sidebar (if active).
3275
+		 *
3276
+		 * @since 1.0.0
3277
+		 */
3278
+		do_action('geodir_home_sidebar_left_inside');
3279
+		/** This action is documented in geodirectory_template_actions.php */
3280
+		do_action('geodir_sidebar_left_close', 'home-page');
3281
+	}
3282 3282
 }
3283 3283
 
3284 3284
 /**
@@ -3291,7 +3291,7 @@  discard block
 block discarded – undo
3291 3291
  */
3292 3292
 function geodir_home_right_section()
3293 3293
 {
3294
-    if (get_option('geodir_show_home_right_section')) { ?>
3294
+	if (get_option('geodir_show_home_right_section')) { ?>
3295 3295
         <div class="geodir-content-right geodir-sidebar-wrap">
3296 3296
             <?php dynamic_sidebar('geodir_home_right'); ?>
3297 3297
         </div><!-- end geodir-content-right -->
@@ -3312,18 +3312,18 @@  discard block
 block discarded – undo
3312 3312
  */
3313 3313
 function geodir_action_home_sidebar_right()
3314 3314
 {
3315
-    if (get_option('geodir_show_home_right_section')) {
3316
-        /** This action is documented in geodirectory_template_actions.php */
3317
-        do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3318
-        /**
3319
-         * This is used to add the content to the home page right sidebar (if active).
3320
-         *
3321
-         * @since 1.0.0
3322
-         */
3323
-        do_action('geodir_home_sidebar_right_inside');
3324
-        /** This action is documented in geodirectory_template_actions.php */
3325
-        do_action('geodir_sidebar_right_close', 'home-page');
3326
-    }
3315
+	if (get_option('geodir_show_home_right_section')) {
3316
+		/** This action is documented in geodirectory_template_actions.php */
3317
+		do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3318
+		/**
3319
+		 * This is used to add the content to the home page right sidebar (if active).
3320
+		 *
3321
+		 * @since 1.0.0
3322
+		 */
3323
+		do_action('geodir_home_sidebar_right_inside');
3324
+		/** This action is documented in geodirectory_template_actions.php */
3325
+		do_action('geodir_sidebar_right_close', 'home-page');
3326
+	}
3327 3327
 }
3328 3328
 
3329 3329
 /**
@@ -3334,7 +3334,7 @@  discard block
 block discarded – undo
3334 3334
  */
3335 3335
 function geodir_action_home_content_inside()
3336 3336
 {
3337
-    dynamic_sidebar('geodir_home_content');
3337
+	dynamic_sidebar('geodir_home_content');
3338 3338
 }
3339 3339
 
3340 3340
 add_action('geodir_home_content_inside', 'geodir_action_home_content_inside', 10);
@@ -3349,28 +3349,28 @@  discard block
 block discarded – undo
3349 3349
  */
3350 3350
 function geodir_action_home_content()
3351 3351
 {
3352
-    /** This action is documented in geodirectory_template_actions.php */
3353
-    do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
3354
-    /**
3355
-     * This called before the home page main content.
3356
-     *
3357
-     * @since 1.0.0
3358
-     */
3359
-    do_action('geodir_before_home_content');
3360
-    /**
3361
-     * This is used to add the content to the home page main content.
3362
-     *
3363
-     * @since 1.0.0
3364
-     */
3365
-    do_action('geodir_home_content_inside');
3366
-    /**
3367
-     * This is called after the homepage main content.
3368
-     *
3369
-     * @since 1.0.0
3370
-     */
3371
-    do_action('geodir_after_home_content');
3372
-    /** This action is documented in geodirectory_template_actions.php */
3373
-    do_action('geodir_main_content_close', 'home-page');
3352
+	/** This action is documented in geodirectory_template_actions.php */
3353
+	do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
3354
+	/**
3355
+	 * This called before the home page main content.
3356
+	 *
3357
+	 * @since 1.0.0
3358
+	 */
3359
+	do_action('geodir_before_home_content');
3360
+	/**
3361
+	 * This is used to add the content to the home page main content.
3362
+	 *
3363
+	 * @since 1.0.0
3364
+	 */
3365
+	do_action('geodir_home_content_inside');
3366
+	/**
3367
+	 * This is called after the homepage main content.
3368
+	 *
3369
+	 * @since 1.0.0
3370
+	 */
3371
+	do_action('geodir_after_home_content');
3372
+	/** This action is documented in geodirectory_template_actions.php */
3373
+	do_action('geodir_main_content_close', 'home-page');
3374 3374
 }
3375 3375
 
3376 3376
 add_action('geodir_sidebar_location_bottom_section', 'geodir_action_sidebar_home_bottom_section', 10);
@@ -3385,11 +3385,11 @@  discard block
 block discarded – undo
3385 3385
  */
3386 3386
 function geodir_action_sidebar_home_bottom_section()
3387 3387
 {
3388
-    if (get_option('geodir_show_home_bottom_section')) { ?>
3388
+	if (get_option('geodir_show_home_bottom_section')) { ?>
3389 3389
         <div
3390 3390
             class="<?php
3391
-            /** This action is documented in geodirectory_template_actions.php */
3392
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
3391
+			/** This action is documented in geodirectory_template_actions.php */
3392
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
3393 3393
             <?php dynamic_sidebar('geodir_home_bottom'); ?>
3394 3394
         </div><!-- clearfix ends here-->
3395 3395
     <?php }
@@ -3417,13 +3417,13 @@  discard block
 block discarded – undo
3417 3417
  */
3418 3418
 function geodir_filter_listing_page_title($list_title)
3419 3419
 {
3420
-    if (is_search() && trim(get_search_query()) == '') {
3421
-        $gd_post_type = geodir_get_current_posttype();
3422
-        $post_type_info = get_post_type_object($gd_post_type);
3420
+	if (is_search() && trim(get_search_query()) == '') {
3421
+		$gd_post_type = geodir_get_current_posttype();
3422
+		$post_type_info = get_post_type_object($gd_post_type);
3423 3423
 
3424
-        $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3425
-    }
3426
-    return $list_title;
3424
+		$list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3425
+	}
3426
+	return $list_title;
3427 3427
 }
3428 3428
 
3429 3429
 add_action('geodir_message_not_found_on_listing', 'geodir_display_message_not_found_on_listing');
@@ -3438,62 +3438,62 @@  discard block
 block discarded – undo
3438 3438
  * @param string $gd_page The geodirectory page type. Default null.
3439 3439
  */
3440 3440
 function geodir_add_page_content( $position = 'before', $gd_page = '' ) {
3441
-    global $post;
3442
-
3443
-    $gd_page_id = NULL;
3444
-    if ($gd_page == 'home-page' && geodir_is_page('home')) {
3445
-        $gd_page_id = geodir_home_page_id();
3446
-    } else if ($gd_page == 'details-page' && geodir_is_page('preview')) {
3447
-        $gd_page_id = geodir_preview_page_id();
3448
-    } else if ($gd_page == 'add-listing-page' && geodir_is_page('add-listing')) {
3449
-        $gd_page_id = geodir_add_listing_page_id();
3450
-    } else if ($gd_page == 'success-page' && geodir_is_page('listing-success')) {
3451
-        $gd_page_id = geodir_success_page_id();
3452
-    } else if ($gd_page == 'location-page' && geodir_is_page('location')) {
3453
-        $gd_page_id = geodir_location_page_id();
3454
-    } else if ($gd_page == 'info-page' && geodir_is_page('info')) {
3455
-        $gd_page_id = geodir_info_page_id();
3456
-    } else if ($gd_page == 'signup-page' && geodir_is_page('login')) {
3457
-        $gd_page_id = geodir_login_page_id();
3458
-    } else if ($gd_page == 'checkout-page' && geodir_is_page('checkout')) {
3459
-        $gd_page_id = geodir_payment_checkout_page_id();
3460
-    } else if ($gd_page == 'invoices-page' && geodir_is_page('invoices')) {
3461
-        $gd_page_id = geodir_payment_invoices_page_id();
3462
-    }
3463
-
3464
-    if (!$gd_page_id > 0) {
3465
-        return;
3466
-    }
3441
+	global $post;
3442
+
3443
+	$gd_page_id = NULL;
3444
+	if ($gd_page == 'home-page' && geodir_is_page('home')) {
3445
+		$gd_page_id = geodir_home_page_id();
3446
+	} else if ($gd_page == 'details-page' && geodir_is_page('preview')) {
3447
+		$gd_page_id = geodir_preview_page_id();
3448
+	} else if ($gd_page == 'add-listing-page' && geodir_is_page('add-listing')) {
3449
+		$gd_page_id = geodir_add_listing_page_id();
3450
+	} else if ($gd_page == 'success-page' && geodir_is_page('listing-success')) {
3451
+		$gd_page_id = geodir_success_page_id();
3452
+	} else if ($gd_page == 'location-page' && geodir_is_page('location')) {
3453
+		$gd_page_id = geodir_location_page_id();
3454
+	} else if ($gd_page == 'info-page' && geodir_is_page('info')) {
3455
+		$gd_page_id = geodir_info_page_id();
3456
+	} else if ($gd_page == 'signup-page' && geodir_is_page('login')) {
3457
+		$gd_page_id = geodir_login_page_id();
3458
+	} else if ($gd_page == 'checkout-page' && geodir_is_page('checkout')) {
3459
+		$gd_page_id = geodir_payment_checkout_page_id();
3460
+	} else if ($gd_page == 'invoices-page' && geodir_is_page('invoices')) {
3461
+		$gd_page_id = geodir_payment_invoices_page_id();
3462
+	}
3463
+
3464
+	if (!$gd_page_id > 0) {
3465
+		return;
3466
+	}
3467 3467
     
3468
-    $display = 'before';
3469
-    /**
3470
-     * Filter the position to display the page content.
3471
-     *
3472
-     * @since 1.6.3
3473
-     *
3474
-     * @param string $display Position to add the post content.
3475
-     * @param string $gd_page The geodirectory page type.
3476
-     */
3477
-    $display = apply_filters('geodir_add_page_content_position', $display, $gd_page);
3478
-
3479
-    if ($position !== $display) {
3480
-        return;
3481
-    }
3482
-
3483
-    $gd_post = $post;
3468
+	$display = 'before';
3469
+	/**
3470
+	 * Filter the position to display the page content.
3471
+	 *
3472
+	 * @since 1.6.3
3473
+	 *
3474
+	 * @param string $display Position to add the post content.
3475
+	 * @param string $gd_page The geodirectory page type.
3476
+	 */
3477
+	$display = apply_filters('geodir_add_page_content_position', $display, $gd_page);
3478
+
3479
+	if ($position !== $display) {
3480
+		return;
3481
+	}
3482
+
3483
+	$gd_post = $post;
3484 3484
     
3485
-    setup_postdata(get_post($gd_page_id));
3485
+	setup_postdata(get_post($gd_page_id));
3486 3486
 
3487
-    if (get_the_content()) {
3488
-        ?>
3487
+	if (get_the_content()) {
3488
+		?>
3489 3489
         <section class="entry-content clearfix" itemprop="articleBody"><?php the_content(); ?></section>
3490 3490
         <?php
3491
-    }
3491
+	}
3492 3492
 
3493
-    $post = $gd_post;
3494
-    if (!empty($gd_post) && is_object($gd_post)) {
3495
-        setup_postdata($gd_post);
3496
-    }
3493
+	$post = $gd_post;
3494
+	if (!empty($gd_post) && is_object($gd_post)) {
3495
+		setup_postdata($gd_post);
3496
+	}
3497 3497
 
3498 3498
 }
3499 3499
 add_action('geodir_add_page_content', 'geodir_add_page_content', 10, 2);
@@ -3514,13 +3514,13 @@  discard block
 block discarded – undo
3514 3514
  * @return string Filtered SQL JOIN clause.
3515 3515
  */
3516 3516
 function geodir_previous_next_post_join( $join, $in_same_term, $excluded_terms, $taxonomy, $post ) {
3517
-    global $plugin_prefix;
3517
+	global $plugin_prefix;
3518 3518
 
3519
-    if ( !empty($post->post_type) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3520
-        $join .= " INNER JOIN " . $plugin_prefix . $post->post_type . "_detail AS gd ON gd.post_id = p.ID";
3521
-    }
3519
+	if ( !empty($post->post_type) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3520
+		$join .= " INNER JOIN " . $plugin_prefix . $post->post_type . "_detail AS gd ON gd.post_id = p.ID";
3521
+	}
3522 3522
     
3523
-    return $join;
3523
+	return $join;
3524 3524
 }
3525 3525
 add_filter( 'get_previous_post_join', 'geodir_previous_next_post_join', 10, 5 );
3526 3526
 add_filter( 'get_next_post_join', 'geodir_previous_next_post_join', 10, 5 );
@@ -3542,31 +3542,31 @@  discard block
 block discarded – undo
3542 3542
  * @return string Filtered SQL WHERE clause.
3543 3543
  */
3544 3544
 function geodir_previous_next_post_where( $where, $in_same_term, $excluded_terms, $taxonomy, $post ) {
3545
-    global $wpdb, $plugin_prefix;
3545
+	global $wpdb, $plugin_prefix;
3546 3546
 
3547
-    if ( !empty($post->post_type) && ( !empty( $post->country_slug ) || !empty( $post->region_slug ) || !empty( $post->city_slug ) ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3548
-        $post_locations = '';
3549
-        $post_locations_var = array();
3547
+	if ( !empty($post->post_type) && ( !empty( $post->country_slug ) || !empty( $post->region_slug ) || !empty( $post->city_slug ) ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3548
+		$post_locations = '';
3549
+		$post_locations_var = array();
3550 3550
         
3551
-        if ( !empty( $post->country_slug ) ) {
3552
-            $post_locations .= " AND post_locations LIKE %s";
3553
-            $post_locations_var[] = "%,[" . $post->country_slug . "]";
3554
-        }
3555
-
3556
-        if ( !empty( $post->region_slug ) ) {
3557
-            $post_locations .= " AND post_locations LIKE %s";
3558
-            $post_locations_var[] = "%,[" . $post->region_slug . "],%";
3559
-        }
3560
-
3561
-        if ( !empty( $post->city_slug ) ) {
3562
-            $post_locations .= " AND post_locations LIKE %s";
3563
-            $post_locations_var[] = "[" . $post->city_slug . "],%";
3564
-        }
3551
+		if ( !empty( $post->country_slug ) ) {
3552
+			$post_locations .= " AND post_locations LIKE %s";
3553
+			$post_locations_var[] = "%,[" . $post->country_slug . "]";
3554
+		}
3555
+
3556
+		if ( !empty( $post->region_slug ) ) {
3557
+			$post_locations .= " AND post_locations LIKE %s";
3558
+			$post_locations_var[] = "%,[" . $post->region_slug . "],%";
3559
+		}
3560
+
3561
+		if ( !empty( $post->city_slug ) ) {
3562
+			$post_locations .= " AND post_locations LIKE %s";
3563
+			$post_locations_var[] = "[" . $post->city_slug . "],%";
3564
+		}
3565 3565
         
3566
-        $where .= $wpdb->prepare( $post_locations, $post_locations_var );
3567
-    }
3566
+		$where .= $wpdb->prepare( $post_locations, $post_locations_var );
3567
+	}
3568 3568
     
3569
-    return $where;
3569
+	return $where;
3570 3570
 }
3571 3571
 add_filter( 'get_previous_post_where', 'geodir_previous_next_post_where', 10, 5 );
3572 3572
 add_filter( 'get_next_post_where', 'geodir_previous_next_post_where', 10, 5 );
3573 3573
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
     //php
285 285
     if (!empty($tc['geodir_theme_compat_code'])) {
286
-        include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
286
+        include_once('geodirectory-functions/compatibility/'.$tc['geodir_theme_compat_code'].'.php');
287 287
     }
288 288
 
289 289
     //geodir_full_page_class
@@ -453,13 +453,13 @@  discard block
 block discarded – undo
453 453
 function geodir_action_wrapper_content_open($type = '', $id = '', $class = '')
454 454
 {
455 455
     if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
456
-        $width_css = 'style="width:' . $width . '%;"';
456
+        $width_css = 'style="width:'.$width.'%;"';
457 457
     } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
458
-        $width_css = 'style="width:' . $width . '%;"';
458
+        $width_css = 'style="width:'.$width.'%;"';
459 459
     } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
460
-        $width_css = 'style="width:' . $width . '%;"';
460
+        $width_css = 'style="width:'.$width.'%;"';
461 461
     } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
462
-        $width_css = 'style="width:' . $width . '%;"';
462
+        $width_css = 'style="width:'.$width.'%;"';
463 463
     } else {
464 464
         $width_css = '';
465 465
     }
@@ -573,13 +573,13 @@  discard block
 block discarded – undo
573 573
 function geodir_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')
574 574
 {
575 575
     if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
576
-        $width_css = 'style="width:' . $width . '%;"';
576
+        $width_css = 'style="width:'.$width.'%;"';
577 577
     } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
578
-        $width_css = 'style="width:' . $width . '%;"';
578
+        $width_css = 'style="width:'.$width.'%;"';
579 579
     } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
580
-        $width_css = 'style="width:' . $width . '%;"';
580
+        $width_css = 'style="width:'.$width.'%;"';
581 581
     } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
582
-        $width_css = 'style="width:' . $width . '%;"';
582
+        $width_css = 'style="width:'.$width.'%;"';
583 583
     } else {
584 584
         $width_css = '';
585 585
     }
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
         }
678 678
     }
679 679
 
680
-    $post = (object)$_REQUEST;
680
+    $post = (object) $_REQUEST;
681 681
 
682 682
 
683 683
     if (isset($post->video)) {
@@ -736,10 +736,10 @@  discard block
 block discarded – undo
736 736
 
737 737
     $json = '{';
738 738
     $json .= '"post_preview": "1",';
739
-    $json .= '"t": "' . $json_title . '",';
740
-    $json .= '"lt": "' . $post_latitude . '",';
741
-    $json .= '"ln": "' . $post_longitude . '",';
742
-    $json .= '"i":"' . $term_icon . '"';
739
+    $json .= '"t": "'.$json_title.'",';
740
+    $json .= '"lt": "'.$post_latitude.'",';
741
+    $json .= '"ln": "'.$post_longitude.'",';
742
+    $json .= '"i":"'.$term_icon.'"';
743 743
     $json .= '}';
744 744
 
745 745
     $post->marker_json = $json;
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
      * @param string $class The class to use. Default is 'entry-header'.
967 967
      */
968 968
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
969
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
969
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.stripslashes(get_the_title()).'</h1></header>';
970 970
 }
971 971
 
972 972
 
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
                     $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1021 1021
 
1022 1022
                     if ($image && $width && $height) {
1023
-                        $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1023
+                        $image = (object) array('src' => $image, 'width' => $width, 'height' => $height);
1024 1024
                     }
1025 1025
 
1026 1026
                     if (isset($image->src)) {
@@ -1032,9 +1032,9 @@  discard block
 block discarded – undo
1032 1032
 
1033 1033
                         $image_title = isset($image->title) ? $image->title : '';
1034 1034
 
1035
-                        $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;" />';
1036
-                        $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1037
-                        $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1035
+                        $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;" />';
1036
+                        $main_slides .= '<img src="'.$image->src.'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:400px;margin:0 auto;" /></li>';
1037
+                        $nav_slides .= '<li><img src="'.$image->src.'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:48px;margin:0 auto;" /></li>';
1038 1038
                         $slides++;
1039 1039
                     }
1040 1040
                 }
@@ -1060,10 +1060,10 @@  discard block
 block discarded – undo
1060 1060
                 } else {
1061 1061
                     $spacer_height = ((400 - $image->height) / 2);
1062 1062
                 }
1063
-                $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1064
-                $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;" />';
1065
-                $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1066
-                $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1063
+                $caption = ''; //(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1064
+                $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;" />';
1065
+                $main_slides .= '<img src="'.$image->src.'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1066
+                $nav_slides .= '<li><img src="'.$image->src.'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:48px;margin:0 auto;" /></li>';
1067 1067
                 $slides++;
1068 1068
             }
1069 1069
         }// endfore
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
  */
1099 1099
 function geodir_action_details_taxonomies()
1100 1100
 {
1101
-    global $preview, $post;?>
1101
+    global $preview, $post; ?>
1102 1102
     <p class="geodir_post_taxomomies clearfix">
1103 1103
     <?php
1104 1104
     $taxonomies = array();
@@ -1107,11 +1107,11 @@  discard block
 block discarded – undo
1107 1107
 
1108 1108
     if ($preview && !$is_backend_preview) {
1109 1109
         $post_type = $post->listing_type;
1110
-        $post_taxonomy = $post_type . 'category';
1110
+        $post_taxonomy = $post_type.'category';
1111 1111
         $post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1112 1112
     } else {
1113 1113
         $post_type = $post->post_type;
1114
-        $post_taxonomy = $post_type . 'category';
1114
+        $post_taxonomy = $post_type.'category';
1115 1115
     }
1116 1116
 //{	
1117 1117
     $post_type_info = get_post_type_object($post_type);
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
 
1120 1120
     if (!empty($post->post_tags)) {
1121 1121
 
1122
-        if (taxonomy_exists($post_type . '_tags')):
1122
+        if (taxonomy_exists($post_type.'_tags')):
1123 1123
             $links = array();
1124 1124
             $terms = array();
1125 1125
             // to limit post tags
@@ -1146,8 +1146,8 @@  discard block
 block discarded – undo
1146 1146
                 $post_term = trim($post_term);
1147 1147
 
1148 1148
                 $priority_location = false;
1149
-                if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1150
-                    $term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
1149
+                if ($insert_term = term_exists($post_term, $post_type.'_tags')) {
1150
+                    $term = get_term_by('id', $insert_term['term_id'], $post_type.'_tags');
1151 1151
                 } else {
1152 1152
                     $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1153 1153
                     $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
@@ -1157,10 +1157,10 @@  discard block
 block discarded – undo
1157 1157
                     $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1158 1158
                     if ($match_country || $match_region || $match_city) {
1159 1159
                         $priority_location = true;
1160
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1160
+                        $term = get_term_by('name', $post_term, $post_type.'_tags');
1161 1161
                     } else {
1162
-                        $insert_term = wp_insert_term($post_term, $post_type . '_tags');
1163
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1162
+                        $insert_term = wp_insert_term($post_term, $post_type.'_tags');
1163
+                        $term = get_term_by('name', $post_term, $post_type.'_tags');
1164 1164
                     }
1165 1165
                 }
1166 1166
 
@@ -1177,12 +1177,12 @@  discard block
 block discarded – undo
1177 1177
                          * @param string $tag_link The tag link html.
1178 1178
                          * @param object $term The tag term object.
1179 1179
                          */
1180
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1180
+                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
1181 1181
                         $links[] = $tag_link;
1182 1182
                     } else {
1183
-                        $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1183
+                        $tag_link = "<a href='".esc_attr(get_term_link($term->term_id, $term->taxonomy))."'>$term->name</a>";
1184 1184
                         /** This action is documented in geodirectory-template_actions.php */
1185
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1185
+                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
1186 1186
                         $links[] = $tag_link;
1187 1187
                     }
1188 1188
                     $terms[] = $term;
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
             if (!isset($listing_label)) {
1193 1193
                 $listing_label = '';
1194 1194
             }
1195
-            $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1195
+            $taxonomies[$post_type.'_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object) $terms);
1196 1196
         endif;
1197 1197
 
1198 1198
     }
@@ -1220,7 +1220,7 @@  discard block
 block discarded – undo
1220 1220
                     $term = get_term_by('id', $post_term, $post_taxonomy);
1221 1221
 
1222 1222
                     if (is_object($term)) {
1223
-                        $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1223
+                        $term_link = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>$term->name</a>";
1224 1224
                         /**
1225 1225
                          * Filter the category name on the details page.
1226 1226
                          *
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
                          * @param string $term_link The link html to the category.
1229 1229
                          * @param object $term The category term object.
1230 1230
                          */
1231
-                        $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1231
+                        $term_link = apply_filters('geodir_details_taxonomies_cat_link', $term_link, $term);
1232 1232
                         $links[] = $term_link;
1233 1233
                         $terms[] = $term;
1234 1234
                     }
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
         if (!isset($listing_label)) {
1247 1247
             $listing_label = '';
1248 1248
         }
1249
-        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1249
+        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object) $terms);
1250 1250
 
1251 1251
     }
1252 1252
 
@@ -1259,14 +1259,14 @@  discard block
 block discarded – undo
1259 1259
      * @param string $listing_label The post type label.
1260 1260
      * @param string $listing_label The post type label with ucwords function.
1261 1261
      */
1262
-    $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1262
+    $taxonomies = apply_filters('geodir_details_taxonomies_output', $taxonomies, $post_type, $listing_label, geodir_ucwords($listing_label));
1263 1263
 
1264 1264
     if (isset($taxonomies[$post_taxonomy])) {
1265
-        echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1265
+        echo '<span class="geodir-category">'.$taxonomies[$post_taxonomy].'</span>';
1266 1266
     }
1267 1267
 
1268
-    if (isset($taxonomies[$post_type . '_tags']))
1269
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1268
+    if (isset($taxonomies[$post_type.'_tags']))
1269
+        echo '<span class="geodir-tags">'.$taxonomies[$post_type.'_tags'].'</span>';
1270 1270
 
1271 1271
     ?>
1272 1272
     </p><?php
@@ -1287,11 +1287,11 @@  discard block
 block discarded – undo
1287 1287
  * @param object $post Optional. The post object or blank.
1288 1288
  * @package GeoDirectory
1289 1289
  */
1290
-function geodir_action_details_micordata($post='')
1290
+function geodir_action_details_micordata($post = '')
1291 1291
 {
1292 1292
 
1293 1293
     global $preview;
1294
-    if(empty($post)){global $post;}
1294
+    if (empty($post)) {global $post; }
1295 1295
     if ($preview || !geodir_is_page('detail')) {
1296 1296
         return;
1297 1297
     }
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
                 "description" => $review->comment_content,
1313 1313
                 "reviewRating" => array(
1314 1314
                     "@type" => "Rating",
1315
-                    "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1315
+                    "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1316 1316
                     "ratingValue" => geodir_get_commentoverall($review->comment_ID),
1317 1317
                     "worstRating" => "1"
1318 1318
                 )
@@ -1340,13 +1340,13 @@  discard block
 block discarded – undo
1340 1340
     }
1341 1341
     //print_r($post);
1342 1342
     // external links
1343
-    $external_links =  array();
1343
+    $external_links = array();
1344 1344
     $external_links[] = $post->geodir_website;
1345 1345
     $external_links[] = $post->geodir_twitter;
1346 1346
     $external_links[] = $post->geodir_facebook;
1347 1347
     $external_links = array_filter($external_links);
1348 1348
 
1349
-    if(!empty($external_links)){
1349
+    if (!empty($external_links)) {
1350 1350
         $external_links = array_values($external_links);
1351 1351
     }
1352 1352
 
@@ -1356,17 +1356,17 @@  discard block
 block discarded – undo
1356 1356
 
1357 1357
     // schema type
1358 1358
     $schema_type = 'LocalBusiness';
1359
-    if(isset($post->default_category) && $post->default_category){
1359
+    if (isset($post->default_category) && $post->default_category) {
1360 1360
         $cat_schema = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1361
-        if($cat_schema){$schema_type = $cat_schema;}
1362
-        if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1361
+        if ($cat_schema) {$schema_type = $cat_schema; }
1362
+        if (!$schema_type && $post->post_type == 'gd_event') {$schema_type = 'Event'; }
1363 1363
     }
1364 1364
 
1365 1365
     $schema = array();
1366 1366
     $schema['@context'] = "https://schema.org";
1367 1367
     $schema['@type'] = $schema_type;
1368 1368
     $schema['name'] = $post->post_title;
1369
-    $schema['description'] = wp_strip_all_tags( $post->post_content, true );
1369
+    $schema['description'] = wp_strip_all_tags($post->post_content, true);
1370 1370
     $schema['telephone'] = $post->geodir_contact;
1371 1371
     $schema['url'] = $c_url;
1372 1372
     $schema['sameAs'] = $external_links;
@@ -1380,7 +1380,7 @@  discard block
 block discarded – undo
1380 1380
         "postalCode" => $post->post_zip
1381 1381
     );
1382 1382
 
1383
-    if($post->post_latitude && $post->post_longitude) {
1383
+    if ($post->post_latitude && $post->post_longitude) {
1384 1384
         $schema['geo'] = array(
1385 1385
             "@type" => "GeoCoordinates",
1386 1386
             "latitude" => $post->post_latitude,
@@ -1388,7 +1388,7 @@  discard block
 block discarded – undo
1388 1388
         );
1389 1389
     }
1390 1390
 
1391
-    if($post_avgratings) {
1391
+    if ($post_avgratings) {
1392 1392
         $schema['aggregateRating'] = array(
1393 1393
             "@type" => "AggregateRating",
1394 1394
             "ratingValue" => $post_avgratings,
@@ -1407,10 +1407,10 @@  discard block
 block discarded – undo
1407 1407
      * @param array $schema The array of schema data to be filtered.
1408 1408
      * @param object $post The post object.
1409 1409
      */
1410
-    $schema = apply_filters('geodir_details_schema', $schema,$post);
1410
+    $schema = apply_filters('geodir_details_schema', $schema, $post);
1411 1411
 
1412 1412
 
1413
-    echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1413
+    echo '<script type="application/ld+json">'.json_encode($schema).'</script>';
1414 1414
 
1415 1415
 
1416 1416
     $uploads = wp_upload_dir();
@@ -1423,7 +1423,7 @@  discard block
 block discarded – undo
1423 1423
      * @param string $facebook_og The open graph html to be filtered.
1424 1424
      * @param object $post The post object.
1425 1425
      */
1426
-    echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
1426
+    echo apply_filters('geodir_details_facebook_og', $facebook_og, $post);
1427 1427
 
1428 1428
 
1429 1429
 
@@ -1446,9 +1446,9 @@  discard block
 block discarded – undo
1446 1446
     ?>
1447 1447
     <div class="geodir-pos_navigation clearfix">
1448 1448
     <div
1449
-        class="geodir-post_left"><?php previous_post_link('%link', '' . __('Previous', 'geodirectory'), false) ?></div>
1449
+        class="geodir-post_left"><?php previous_post_link('%link', ''.__('Previous', 'geodirectory'), false) ?></div>
1450 1450
     <div
1451
-        class="geodir-post_right"><?php next_post_link('%link', __('Next', 'geodirectory') . '', false) ?></div>
1451
+        class="geodir-post_right"><?php next_post_link('%link', __('Next', 'geodirectory').'', false) ?></div>
1452 1452
     </div><?php
1453 1453
 }
1454 1454
 
@@ -1517,12 +1517,12 @@  discard block
 block discarded – undo
1517 1517
     $gd_post_type = geodir_get_current_posttype();
1518 1518
     $post_type_info = get_post_type_object($gd_post_type);
1519 1519
 
1520
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
1520
+    $add_string_in_title = __('All', 'geodirectory').' ';
1521 1521
     if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1522
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1522
+        $add_string_in_title = __('My Favorite', 'geodirectory').' ';
1523 1523
     }
1524 1524
 
1525
-    $list_title = $add_string_in_title . __($post_type_info->labels->name, 'geodirectory');
1525
+    $list_title = $add_string_in_title.__($post_type_info->labels->name, 'geodirectory');
1526 1526
     $single_name = $post_type_info->labels->singular_name;
1527 1527
 
1528 1528
     $taxonomy = geodir_get_taxonomies($gd_post_type, true);
@@ -1550,12 +1550,12 @@  discard block
 block discarded – undo
1550 1550
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
1551 1551
         if (!empty($current_term)) {
1552 1552
             $current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1553
-            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1553
+            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type.'category') {
1554 1554
                 $location_last_char = substr($location_name, -1);
1555 1555
                 $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1556
-                $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1556
+                $list_title .= __(' in', 'geodirectory').' '.$location_name.$location_name_attach.' '.$current_term_name;
1557 1557
             } else {
1558
-                $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1558
+                $list_title .= __(' in', 'geodirectory')." '".$current_term_name."'";
1559 1559
             }
1560 1560
         } else {
1561 1561
             if (count($taxonomy) > 1) {
@@ -1563,12 +1563,12 @@  discard block
 block discarded – undo
1563 1563
 
1564 1564
                 if (!empty($current_term)) {
1565 1565
                     $current_term_name = __(ucfirst($current_term->name), 'geodirectory');
1566
-                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1566
+                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type.'category') {
1567 1567
                         $location_last_char = substr($location_name, -1);
1568 1568
                         $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1569
-                        $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1569
+                        $list_title .= __(' in', 'geodirectory').' '.$location_name.$location_name_attach.' '.$current_term_name;
1570 1570
                     } else {
1571
-                        $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1571
+                        $list_title .= __(' in', 'geodirectory')." '".$current_term_name."'";
1572 1572
                     }
1573 1573
                 }
1574 1574
             }
@@ -1596,7 +1596,7 @@  discard block
 block discarded – undo
1596 1596
                 $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1597 1597
             }
1598 1598
 
1599
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1599
+            $list_title .= __(' in', 'geodirectory')." '".$gd_city."'";
1600 1600
         } else if ($gd_region != '') {
1601 1601
             if ($gd_region_actual != '') {
1602 1602
                 $gd_region = $gd_region_actual;
@@ -1606,7 +1606,7 @@  discard block
 block discarded – undo
1606 1606
                 $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1607 1607
             }
1608 1608
 
1609
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1609
+            $list_title .= __(' in', 'geodirectory')." '".$gd_region."'";
1610 1610
         } else if ($gd_country != '') {
1611 1611
             if ($gd_country_actual != '') {
1612 1612
                 $gd_country = $gd_country_actual;
@@ -1616,12 +1616,12 @@  discard block
 block discarded – undo
1616 1616
                 $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1617 1617
             }
1618 1618
 
1619
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1619
+            $list_title .= __(' in', 'geodirectory')." '".$gd_country."'";
1620 1620
         }
1621 1621
     }
1622 1622
 
1623 1623
     if (is_search()) {
1624
-        $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1624
+        $list_title = __('Search', 'geodirectory').' '.__(ucfirst($post_type_info->labels->name), 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
1625 1625
     }
1626 1626
     /** This action is documented in geodirectory_template_actions.php */
1627 1627
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
@@ -1631,26 +1631,26 @@  discard block
 block discarded – undo
1631 1631
 
1632 1632
     $title = $list_title;
1633 1633
     $gd_page = '';
1634
-    if(geodir_is_page('pt')){
1634
+    if (geodir_is_page('pt')) {
1635 1635
         $gd_page = 'pt';
1636
-        $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1636
+        $title = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1637 1637
     }
1638
-    elseif(geodir_is_page('listing')){
1638
+    elseif (geodir_is_page('listing')) {
1639 1639
         $gd_page = 'listing';
1640 1640
         global $wp_query;
1641 1641
         $current_term = $wp_query->get_queried_object();
1642
-        if (strpos($current_term->taxonomy,'_tags') !== false) {
1642
+        if (strpos($current_term->taxonomy, '_tags') !== false) {
1643 1643
             $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1644
-        }else{
1644
+        } else {
1645 1645
             $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1646 1646
         }
1647 1647
 
1648 1648
     }
1649
-    elseif(geodir_is_page('author')){
1649
+    elseif (geodir_is_page('author')) {
1650 1650
         $gd_page = 'author';
1651
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1651
+        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1652 1652
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1653
-        }else{
1653
+        } else {
1654 1654
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1655 1655
         }
1656 1656
 
@@ -1664,16 +1664,16 @@  discard block
 block discarded – undo
1664 1664
      * @param string $title The page title including variables.
1665 1665
      * @param string $gd_page The GeoDirectory page type if any.
1666 1666
      */
1667
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1667
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1668 1668
 
1669
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1669
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.
1670 1670
         /**
1671 1671
          * Filter the listing page title.
1672 1672
          *
1673 1673
          * @since 1.0.0
1674 1674
          * @param string $list_title The title for the category page.
1675 1675
          */
1676
-        apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1676
+        apply_filters('geodir_listing_page_title', $title).'</h1></header>';
1677 1677
 }
1678 1678
 
1679 1679
 add_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
@@ -1692,16 +1692,16 @@  discard block
 block discarded – undo
1692 1692
     $gd_post_type = geodir_get_current_posttype();
1693 1693
     if (isset($current_term->term_id) && $current_term->term_id != '') {
1694 1694
 
1695
-        $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1695
+        $term_desc = term_description($current_term->term_id, $gd_post_type.'_tags');
1696 1696
         $saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1697 1697
         if ($term_desc && !$saved_data) {
1698 1698
             $saved_data = $term_desc;
1699 1699
         }
1700 1700
 
1701 1701
         // stop payment manager filtering content length
1702
-        $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1703
-        if ( false !== $filter_priority ) {
1704
-            remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1702
+        $filter_priority = has_filter('the_content', 'geodir_payments_the_content');
1703
+        if (false !== $filter_priority) {
1704
+            remove_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1705 1705
         }
1706 1706
 
1707 1707
         /**
@@ -1715,14 +1715,14 @@  discard block
 block discarded – undo
1715 1715
         $cat_description = apply_filters('the_content', $saved_data);
1716 1716
 
1717 1717
 
1718
-        if ( false !== $filter_priority ) {
1719
-            add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1718
+        if (false !== $filter_priority) {
1719
+            add_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1720 1720
         }
1721 1721
 
1722 1722
         if ($cat_description) {
1723 1723
             ?>
1724 1724
 
1725
-            <div class="term_description"><?php echo $cat_description;?></div> <?php
1725
+            <div class="term_description"><?php echo $cat_description; ?></div> <?php
1726 1726
         }
1727 1727
 
1728 1728
     }
@@ -1772,13 +1772,13 @@  discard block
 block discarded – undo
1772 1772
 function geodir_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')
1773 1773
 {
1774 1774
     if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1775
-        $width_css = 'style="width:' . $width . '%;"';
1775
+        $width_css = 'style="width:'.$width.'%;"';
1776 1776
     } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1777
-        $width_css = 'style="width:' . $width . '%;"';
1777
+        $width_css = 'style="width:'.$width.'%;"';
1778 1778
     } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1779
-        $width_css = 'style="width:' . $width . '%;"';
1779
+        $width_css = 'style="width:'.$width.'%;"';
1780 1780
     } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1781
-        $width_css = 'style="width:' . $width . '%;"';
1781
+        $width_css = 'style="width:'.$width.'%;"';
1782 1782
     } else {
1783 1783
         $width_css = '';
1784 1784
     }
@@ -2083,11 +2083,11 @@  discard block
 block discarded – undo
2083 2083
 
2084 2084
     $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2085 2085
 
2086
-    if(geodir_is_page('add-listing')){
2086
+    if (geodir_is_page('add-listing')) {
2087 2087
         $gd_page = 'add-listing';
2088
-        if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2088
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2089 2089
             $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2090
-        }elseif(isset($listing_type)){
2090
+        }elseif (isset($listing_type)) {
2091 2091
             $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2092 2092
         }
2093 2093
 
@@ -2101,9 +2101,9 @@  discard block
 block discarded – undo
2101 2101
      * @param string $title The page title including variables.
2102 2102
      * @param string $gd_page The GeoDirectory page type if any.
2103 2103
      */
2104
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2104
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2105 2105
 
2106
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2106
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">';
2107 2107
     echo $title;
2108 2108
     echo '</h1></header>';
2109 2109
 }
@@ -2117,7 +2117,7 @@  discard block
 block discarded – undo
2117 2117
  */
2118 2118
 function geodir_action_add_listing_page_mandatory()
2119 2119
 {?>
2120
-    <p class="geodir-note "><span class="geodir-required">*</span>&nbsp;<?php echo INDICATES_MANDATORY_FIELDS_TEXT;?></p>
2120
+    <p class="geodir-note "><span class="geodir-required">*</span>&nbsp;<?php echo INDICATES_MANDATORY_FIELDS_TEXT; ?></p>
2121 2121
 <?php
2122 2122
 }
2123 2123
 
@@ -2152,7 +2152,7 @@  discard block
 block discarded – undo
2152 2152
 
2153 2153
     if (isset($_REQUEST['backandedit'])) {
2154 2154
         global $post;
2155
-        $post = (object)$gd_session->get('listing');
2155
+        $post = (object) $gd_session->get('listing');
2156 2156
         $listing_type = $post->listing_type;
2157 2157
         $title = $post->post_title;
2158 2158
         $desc = $post->post_desc;
@@ -2167,7 +2167,7 @@  discard block
 block discarded – undo
2167 2167
         $thumb_img_arr = geodir_get_images($post->ID);
2168 2168
         if ($thumb_img_arr) {
2169 2169
             foreach ($thumb_img_arr as $post_img) {
2170
-                $curImages .= $post_img->src . ',';
2170
+                $curImages .= $post_img->src.',';
2171 2171
             }
2172 2172
         }
2173 2173
 
@@ -2175,7 +2175,7 @@  discard block
 block discarded – undo
2175 2175
         $title = $post->post_title;
2176 2176
         $desc = $post->post_content;
2177 2177
         $kw_tags = $post->post_tags;
2178
-        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2178
+        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type.'_tags', array('fields' => 'names')));
2179 2179
     } else {
2180 2180
         $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2181 2181
     }
@@ -2186,20 +2186,20 @@  discard block
 block discarded – undo
2186 2186
 
2187 2187
     $post_type_info = geodir_get_posttype_info($listing_type);
2188 2188
 
2189
-    $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing','geodirectory');
2189
+    $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing', 'geodirectory');
2190 2190
     
2191 2191
     $package_info = array();
2192 2192
     $package_info = geodir_post_package_info($package_info, $post);
2193 2193
     ?>
2194
-    <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data">
2195
-        <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/>
2196
-        <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/>
2194
+    <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id()); ?>" method="post" enctype="multipart/form-data">
2195
+        <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type); ?>"/>
2196
+        <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type); ?>"/>
2197 2197
         <?php if ($page_id) { ?>
2198
-        <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id;?>"/>
2198
+        <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id; ?>"/>
2199 2199
         <?php } if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { ?>
2200
-            <input type="hidden" name="pid" value="<?php echo sanitize_text_field($_REQUEST['pid']);?>"/>
2200
+            <input type="hidden" name="pid" value="<?php echo sanitize_text_field($_REQUEST['pid']); ?>"/>
2201 2201
         <?php } if (isset($_REQUEST['backandedit'])) { ?>
2202
-            <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/>
2202
+            <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']); ?>"/>
2203 2203
         <?php
2204 2204
         } 
2205 2205
         /**
@@ -2211,7 +2211,7 @@  discard block
 block discarded – undo
2211 2211
          */
2212 2212
         do_action('geodir_before_detail_fields');
2213 2213
         ?>
2214
-        <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5>
2214
+        <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT; ?></h5>
2215 2215
         <?php
2216 2216
         /**
2217 2217
          * Called at the top of the add listing page form for frontend.
@@ -2232,10 +2232,10 @@  discard block
 block discarded – undo
2232 2232
                  * @param string $cpt_singular_name The singular title of the curent CPT.
2233 2233
                  * @param string $listing_type The CPT being requested. ie: gd_place.
2234 2234
                  */
2235
-                echo apply_filters('geodir_add_listing_title_label', sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span>*</span> </label>
2235
+                echo apply_filters('geodir_add_listing_title_label', sprintf(__('%s Title', 'geodirectory'), $cpt_singular_name), $cpt_singular_name, $listing_type); ?><span>*</span> </label>
2236 2236
             <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield"
2237 2237
                    value="<?php echo esc_attr(stripslashes($title)); ?>"/>
2238
-            <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span>
2238
+            <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
2239 2239
         </div>
2240 2240
         <?php
2241 2241
         $show_editor = get_option('geodir_tiny_editor_on_add_listing');
@@ -2281,7 +2281,7 @@  discard block
 block discarded – undo
2281 2281
         $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2282 2282
         
2283 2283
         $desc_class = '';
2284
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2284
+        if ($desc_limit === '' || (int) $desc_limit > 0) {
2285 2285
             /**
2286 2286
              * Called on the add listing page form for frontend just before the description field.
2287 2287
              *
@@ -2294,7 +2294,7 @@  discard block
 block discarded – undo
2294 2294
             $desc_class = ' hidden';
2295 2295
         }
2296 2296
         ?>
2297
-        <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>">
2297
+        <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class; ?>">
2298 2298
             <label><?php
2299 2299
                 /**
2300 2300
                  * Filter the add listing page description input label.
@@ -2304,7 +2304,7 @@  discard block
 block discarded – undo
2304 2304
                  * @param string $cpt_singular_name The singular title of the curent CPT.
2305 2305
                  * @param string $listing_type The CPT being requested. ie: gd_place.
2306 2306
                  */
2307
-                echo apply_filters('geodir_add_listing_description_label',sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2307
+                echo apply_filters('geodir_add_listing_description_label', sprintf(__('%s Description', 'geodirectory'), $cpt_singular_name), $cpt_singular_name, $listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2308 2308
             <?php
2309 2309
             if ($show_editor) {
2310 2310
                 $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
@@ -2313,16 +2313,16 @@  discard block
 block discarded – undo
2313 2313
                     <?php wp_editor($desc, "post_desc", $editor_settings); ?>
2314 2314
                 </div>
2315 2315
             <?php if ($desc_limit != '') { ?>
2316
-                <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit;?>");</script>
2316
+                <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit; ?>");</script>
2317 2317
             <?php } } else { ?>
2318 2318
                 <textarea field_type="textarea" name="post_desc" id="post_desc" class="geodir_textarea" maxlength="<?php echo $desc_limit; ?>"><?php echo $desc; ?></textarea>
2319 2319
             <?php } if ($desc_limit_msg != '') { ?>
2320 2320
                 <span class="geodir_message_note"><?php echo $desc_limit_msg; ?></span>
2321 2321
             <?php } ?>
2322
-            <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span>
2322
+            <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory'); ?></span>
2323 2323
         </div>
2324 2324
         <?php
2325
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2325
+        if ($desc_limit === '' || (int) $desc_limit > 0) {
2326 2326
             /**
2327 2327
              * Called on the add listing page form for frontend just after the description field.
2328 2328
              *
@@ -2361,7 +2361,7 @@  discard block
 block discarded – undo
2361 2361
         $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2362 2362
         
2363 2363
         $tags_class = '';
2364
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2364
+        if ($kw_tags_count === '' || (int) $kw_tags_count > 0) {
2365 2365
             /**
2366 2366
              * Called on the add listing page form for frontend just before the tags field.
2367 2367
              *
@@ -2372,14 +2372,14 @@  discard block
 block discarded – undo
2372 2372
             $tags_class = ' hidden';
2373 2373
         }
2374 2374
         ?>
2375
-        <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>">
2375
+        <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class; ?>">
2376 2376
             <label><?php echo TAGKW_TEXT; ?></label>
2377 2377
             <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield"
2378
-                   maxlength="<?php echo $kw_tags_count;?>"/>
2379
-            <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span>
2378
+                   maxlength="<?php echo $kw_tags_count; ?>"/>
2379
+            <span class="geodir_message_note"><?php echo $kw_tags_msg; ?></span>
2380 2380
         </div>
2381 2381
         <?php
2382
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2382
+        if ($kw_tags_count === '' || (int) $kw_tags_count > 0) {
2383 2383
             /**
2384 2384
              * Called on the add listing page form for frontend just after the tags field.
2385 2385
              *
@@ -2405,7 +2405,7 @@  discard block
 block discarded – undo
2405 2405
         $thumb_img_arr = array();
2406 2406
         $totImg = 0;
2407 2407
         if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2408
-            $post = (object)$gd_session->get('listing');
2408
+            $post = (object) $gd_session->get('listing');
2409 2409
             if (isset($post->post_images))
2410 2410
                 $curImages = trim($post->post_images, ",");
2411 2411
 
@@ -2418,7 +2418,7 @@  discard block
 block discarded – undo
2418 2418
             $listing_type = $post->listing_type;
2419 2419
 
2420 2420
         } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2421
-            $post = geodir_get_post_info((int)$_REQUEST['pid']);
2421
+            $post = geodir_get_post_info((int) $_REQUEST['pid']);
2422 2422
             $listing_type = $post->post_type;
2423 2423
             $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2424 2424
 
@@ -2432,7 +2432,7 @@  discard block
 block discarded – undo
2432 2432
                 //$curImages = $img->src.",";
2433 2433
             }
2434 2434
 
2435
-            $totImg = count((array)$thumb_img_arr);
2435
+            $totImg = count((array) $thumb_img_arr);
2436 2436
         }
2437 2437
 
2438 2438
         if ($curImages != '')
@@ -2453,15 +2453,15 @@  discard block
 block discarded – undo
2453 2453
         if ($show_image_input_box) {
2454 2454
             ?>
2455 2455
 
2456
-            <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?>
2456
+            <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT; ?>
2457 2457
                 <?php if ($image_limit == 1) {
2458
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2458
+                    echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('image with this package', 'geodirectory').')</small>';
2459 2459
                 } ?>
2460 2460
                 <?php if ($image_limit > 1) {
2461
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2461
+                    echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('images with this package', 'geodirectory').')</small>';
2462 2462
                 } ?>
2463 2463
                 <?php if ($image_limit == '') {
2464
-                    echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2464
+                    echo '<br /><small>('.__('You can upload unlimited images with this package', 'geodirectory').')</small>';
2465 2465
                 } ?>
2466 2466
             </h5>
2467 2467
 
@@ -2476,11 +2476,11 @@  discard block
 block discarded – undo
2476 2476
                 <div
2477 2477
                     class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
2478 2478
                     id="<?php echo $id; ?>plupload-upload-ui">
2479
-                    <h4><?php _e('Drop files to upload', 'geodirectory');?></h4><br/>
2479
+                    <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4><br/>
2480 2480
                     <input id="<?php echo $id; ?>plupload-browse-button" type="button"
2481 2481
                            value="<?php esc_attr_e('Select Files', 'geodirectory'); ?>" class="geodir_button"/>
2482 2482
                     <span class="ajaxnonceplu"
2483
-                          id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span>
2483
+                          id="ajaxnonceplu<?php echo wp_create_nonce($id.'pluploadan'); ?>"></span>
2484 2484
                     <?php if ($width && $height): ?>
2485 2485
                         <span class="plupload-resize"></span>
2486 2486
                         <span class="plupload-width" id="plupload-width<?php echo $width; ?>"></span>
@@ -2493,7 +2493,7 @@  discard block
 block discarded – undo
2493 2493
                      id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;">
2494 2494
                 </div>
2495 2495
                 <span
2496
-                    id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory');?></span>
2496
+                    id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory'); ?></span>
2497 2497
                 <span id="<?php echo $id; ?>upload-error" style="display:none"></span>
2498 2498
             </div>
2499 2499
 
@@ -2505,7 +2505,7 @@  discard block
 block discarded – undo
2505 2505
          *
2506 2506
          * @since 1.0.0
2507 2507
          */
2508
-        do_action('geodir_after_main_form_fields');?>
2508
+        do_action('geodir_after_main_form_fields'); ?>
2509 2509
 
2510 2510
 
2511 2511
         <!-- add captcha code -->
@@ -2516,7 +2516,7 @@  discard block
 block discarded – undo
2516 2516
         </script>
2517 2517
         <noscript>
2518 2518
             <div>
2519
-                <label><?php _e('Type 64 into this box', 'geodirectory');?></label>
2519
+                <label><?php _e('Type 64 into this box', 'geodirectory'); ?></label>
2520 2520
                 <input type="text" id="geodir_spamblocker_top_form" name="geodir_spamblocker" value="" maxlength="10"/>
2521 2521
             </div>
2522 2522
         </noscript>
@@ -2526,10 +2526,10 @@  discard block
 block discarded – undo
2526 2526
         <!-- end captcha code -->
2527 2527
 
2528 2528
         <div id="geodir-add-listing-submit" class="geodir_form_row clear_both" style="padding:2px;text-align:center;">
2529
-            <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON;?>"
2530
-                   class="geodir_button" <?php echo $submit_button;?>/>
2529
+            <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON; ?>"
2530
+                   class="geodir_button" <?php echo $submit_button; ?>/>
2531 2531
             <span class="geodir_message_note"
2532
-                  style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory');?></span>
2532
+                  style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory'); ?></span>
2533 2533
         </div>
2534 2534
 
2535 2535
     </form>
@@ -2591,7 +2591,7 @@  discard block
 block discarded – undo
2591 2591
         class="<?php
2592 2592
         /** This action is documented in geodirectory_template_actions.php */
2593 2593
         echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2594
-        <?php dynamic_sidebar('Reg/Login Top Section');?>
2594
+        <?php dynamic_sidebar('Reg/Login Top Section'); ?>
2595 2595
     </div><!-- clearfix ends here-->
2596 2596
 <?php
2597 2597
 }
@@ -2611,11 +2611,11 @@  discard block
 block discarded – undo
2611 2611
 
2612 2612
     global $user_login;
2613 2613
     
2614
-    $is_enable_signup = get_option( 'users_can_register' );
2614
+    $is_enable_signup = get_option('users_can_register');
2615 2615
     
2616 2616
     ?>
2617 2617
     <script type="text/javascript">
2618
-        <?php if ( $user_login ) { ?>
2618
+        <?php if ($user_login) { ?>
2619 2619
         setTimeout(function () {
2620 2620
             try {
2621 2621
                 d = document.getElementById('user_pass');
@@ -2632,7 +2632,7 @@  discard block
 block discarded – undo
2632 2632
         <?php } ?>
2633 2633
     </script>
2634 2634
     <script type="text/javascript">
2635
-        <?php if ( $user_login ) { ?>
2635
+        <?php if ($user_login) { ?>
2636 2636
         setTimeout(function () {
2637 2637
             try {
2638 2638
                 d = document.getElementById('user_pass');
@@ -2657,7 +2657,7 @@  discard block
 block discarded – undo
2657 2657
         foreach ($errors as $errorsObj) {
2658 2658
             foreach ($errorsObj as $key => $val) {
2659 2659
                 for ($i = 0; $i < count($val); $i++) {
2660
-                    echo "<div class=error_msg_fix>" . $val[$i] . '</div>';
2660
+                    echo "<div class=error_msg_fix>".$val[$i].'</div>';
2661 2661
                     $registration_error_msg = 1;
2662 2662
                 }
2663 2663
             }
@@ -2674,10 +2674,10 @@  discard block
 block discarded – undo
2674 2674
              *
2675 2675
              * @since 1.0.0
2676 2676
              */
2677
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2677
+            include(geodir_plugin_path()."/geodirectory-templates/login_frm.php"); ?>
2678 2678
         </div>
2679 2679
 
2680
-    <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up' && $is_enable_signup ) { ?>
2680
+    <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up' && $is_enable_signup) { ?>
2681 2681
 
2682 2682
         <div class="registration_form">
2683 2683
             <?php
@@ -2686,7 +2686,7 @@  discard block
 block discarded – undo
2686 2686
              *
2687 2687
              * @since 1.0.0
2688 2688
              */
2689
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2689
+            include(geodir_plugin_path()."/geodirectory-templates/reg_frm.php"); ?>
2690 2690
         </div>
2691 2691
 
2692 2692
     <?php } else { ?>
@@ -2698,10 +2698,10 @@  discard block
 block discarded – undo
2698 2698
              *
2699 2699
              * @since 1.0.0
2700 2700
              */
2701
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2701
+            include(geodir_plugin_path()."/geodirectory-templates/login_frm.php"); ?>
2702 2702
         </div>
2703 2703
         
2704
-        <?php if ( $is_enable_signup ) { ?>
2704
+        <?php if ($is_enable_signup) { ?>
2705 2705
             <div class="registration_form_r">
2706 2706
                 <?php
2707 2707
                 /**
@@ -2709,7 +2709,7 @@  discard block
 block discarded – undo
2709 2709
                  *
2710 2710
                  * @since 1.0.0
2711 2711
                  */
2712
-                include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2712
+                include(geodir_plugin_path()."/geodirectory-templates/reg_frm.php"); ?>
2713 2713
             </div>
2714 2714
         <?php } ?>
2715 2715
 
@@ -2746,12 +2746,12 @@  discard block
 block discarded – undo
2746 2746
     $gd_post_type = geodir_get_current_posttype();
2747 2747
     $post_type_info = get_post_type_object($gd_post_type);
2748 2748
 
2749
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
2749
+    $add_string_in_title = __('All', 'geodirectory').' ';
2750 2750
     if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2751
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2751
+        $add_string_in_title = __('My Favorite', 'geodirectory').' ';
2752 2752
     }
2753 2753
 
2754
-    $list_title = $add_string_in_title . $post_type_info->labels->name;
2754
+    $list_title = $add_string_in_title.$post_type_info->labels->name;
2755 2755
     $single_name = $post_type_info->labels->singular_name;
2756 2756
 
2757 2757
     $taxonomy = geodir_get_taxonomies($gd_post_type);
@@ -2759,12 +2759,12 @@  discard block
 block discarded – undo
2759 2759
     if (!empty($term)) {
2760 2760
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
2761 2761
         if (!empty($current_term))
2762
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2762
+            $list_title .= __(' in', 'geodirectory')." '".geodir_ucwords($current_term->name)."'";
2763 2763
     }
2764 2764
 
2765 2765
 
2766 2766
     if (is_search()) {
2767
-        $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2767
+        $list_title = __('Search', 'geodirectory').' '.__($post_type_info->labels->name, 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
2768 2768
 
2769 2769
     }
2770 2770
     /** This action is documented in geodirectory_template_actions.php */
@@ -2773,11 +2773,11 @@  discard block
 block discarded – undo
2773 2773
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2774 2774
 
2775 2775
     $title = $list_title;
2776
-    if(geodir_is_page('author')){
2776
+    if (geodir_is_page('author')) {
2777 2777
         $gd_page = 'author';
2778
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2778
+        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2779 2779
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2780
-        }else{
2780
+        } else {
2781 2781
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2782 2782
         }
2783 2783
 
@@ -2791,16 +2791,16 @@  discard block
 block discarded – undo
2791 2791
      * @param string $title The page title including variables.
2792 2792
      * @param string $gd_page The GeoDirectory page type if any.
2793 2793
      */
2794
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2794
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2795 2795
 
2796
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2796
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.
2797 2797
         /**
2798 2798
          * Filter the author page title text.
2799 2799
          *
2800 2800
          * @since 1.0.0
2801 2801
          * @param string $list_title The title for the page.
2802 2802
          */
2803
-        apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2803
+        apply_filters('geodir_author_page_title_text', $title).'</h1></header>';
2804 2804
 }
2805 2805
 
2806 2806
 
@@ -3005,19 +3005,19 @@  discard block
 block discarded – undo
3005 3005
     $post_type_info = get_post_type_object($gd_post_type);
3006 3006
 
3007 3007
     $pt_name = '';
3008
-    if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
3008
+    if (isset($post_type_info->labels->name)) {$pt_name = $post_type_info->labels->name; }
3009 3009
 
3010 3010
     if (is_search()) {
3011
-        $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
3011
+        $list_title = __('Search', 'geodirectory').' '.__($pt_name, 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
3012 3012
 
3013 3013
     }
3014 3014
     /** This action is documented in geodirectory_template_actions.php */
3015 3015
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
3016 3016
     /** This action is documented in geodirectory_template_actions.php */
3017 3017
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
3018
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
3018
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.
3019 3019
         /** This action is documented in geodirectory_template_actions.php */
3020
-        apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
3020
+        apply_filters('geodir_listing_page_title', wptexturize($list_title)).'</h1></header>';
3021 3021
 }
3022 3022
 
3023 3023
 // action for adding the listings page top widget area
@@ -3421,7 +3421,7 @@  discard block
 block discarded – undo
3421 3421
         $gd_post_type = geodir_get_current_posttype();
3422 3422
         $post_type_info = get_post_type_object($gd_post_type);
3423 3423
 
3424
-        $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3424
+        $list_title = __('Search', 'geodirectory').' '.__(ucfirst($post_type_info->labels->name), 'geodirectory').__(' :', 'geodirectory');
3425 3425
     }
3426 3426
     return $list_title;
3427 3427
 }
@@ -3437,7 +3437,7 @@  discard block
 block discarded – undo
3437 3437
  * @param string $position Position to add the post content. 'before' or 'after'. Default 'before'.
3438 3438
  * @param string $gd_page The geodirectory page type. Default null.
3439 3439
  */
3440
-function geodir_add_page_content( $position = 'before', $gd_page = '' ) {
3440
+function geodir_add_page_content($position = 'before', $gd_page = '') {
3441 3441
     global $post;
3442 3442
 
3443 3443
     $gd_page_id = NULL;
@@ -3513,17 +3513,17 @@  discard block
 block discarded – undo
3513 3513
  * @param WP_Post $post           WP_Post object.
3514 3514
  * @return string Filtered SQL JOIN clause.
3515 3515
  */
3516
-function geodir_previous_next_post_join( $join, $in_same_term, $excluded_terms, $taxonomy, $post ) {
3516
+function geodir_previous_next_post_join($join, $in_same_term, $excluded_terms, $taxonomy, $post) {
3517 3517
     global $plugin_prefix;
3518 3518
 
3519
-    if ( !empty($post->post_type) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3520
-        $join .= " INNER JOIN " . $plugin_prefix . $post->post_type . "_detail AS gd ON gd.post_id = p.ID";
3519
+    if (!empty($post->post_type) && in_array($post->post_type, geodir_get_posttypes())) {
3520
+        $join .= " INNER JOIN ".$plugin_prefix.$post->post_type."_detail AS gd ON gd.post_id = p.ID";
3521 3521
     }
3522 3522
     
3523 3523
     return $join;
3524 3524
 }
3525
-add_filter( 'get_previous_post_join', 'geodir_previous_next_post_join', 10, 5 );
3526
-add_filter( 'get_next_post_join', 'geodir_previous_next_post_join', 10, 5 );
3525
+add_filter('get_previous_post_join', 'geodir_previous_next_post_join', 10, 5);
3526
+add_filter('get_next_post_join', 'geodir_previous_next_post_join', 10, 5);
3527 3527
 
3528 3528
 /**
3529 3529
  * Filters the WHERE clause in the SQL for an adjacent post query.
@@ -3541,32 +3541,32 @@  discard block
 block discarded – undo
3541 3541
  * @param WP_Post $post          WP_Post object.
3542 3542
  * @return string Filtered SQL WHERE clause.
3543 3543
  */
3544
-function geodir_previous_next_post_where( $where, $in_same_term, $excluded_terms, $taxonomy, $post ) {
3544
+function geodir_previous_next_post_where($where, $in_same_term, $excluded_terms, $taxonomy, $post) {
3545 3545
     global $wpdb, $plugin_prefix;
3546 3546
 
3547
-    if ( !empty($post->post_type) && ( !empty( $post->country_slug ) || !empty( $post->region_slug ) || !empty( $post->city_slug ) ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3547
+    if (!empty($post->post_type) && (!empty($post->country_slug) || !empty($post->region_slug) || !empty($post->city_slug)) && in_array($post->post_type, geodir_get_posttypes())) {
3548 3548
         $post_locations = '';
3549 3549
         $post_locations_var = array();
3550 3550
         
3551
-        if ( !empty( $post->country_slug ) ) {
3551
+        if (!empty($post->country_slug)) {
3552 3552
             $post_locations .= " AND post_locations LIKE %s";
3553
-            $post_locations_var[] = "%,[" . $post->country_slug . "]";
3553
+            $post_locations_var[] = "%,[".$post->country_slug."]";
3554 3554
         }
3555 3555
 
3556
-        if ( !empty( $post->region_slug ) ) {
3556
+        if (!empty($post->region_slug)) {
3557 3557
             $post_locations .= " AND post_locations LIKE %s";
3558
-            $post_locations_var[] = "%,[" . $post->region_slug . "],%";
3558
+            $post_locations_var[] = "%,[".$post->region_slug."],%";
3559 3559
         }
3560 3560
 
3561
-        if ( !empty( $post->city_slug ) ) {
3561
+        if (!empty($post->city_slug)) {
3562 3562
             $post_locations .= " AND post_locations LIKE %s";
3563
-            $post_locations_var[] = "[" . $post->city_slug . "],%";
3563
+            $post_locations_var[] = "[".$post->city_slug."],%";
3564 3564
         }
3565 3565
         
3566
-        $where .= $wpdb->prepare( $post_locations, $post_locations_var );
3566
+        $where .= $wpdb->prepare($post_locations, $post_locations_var);
3567 3567
     }
3568 3568
     
3569 3569
     return $where;
3570 3570
 }
3571
-add_filter( 'get_previous_post_where', 'geodir_previous_next_post_where', 10, 5 );
3572
-add_filter( 'get_next_post_where', 'geodir_previous_next_post_where', 10, 5 );
3573 3571
\ No newline at end of file
3572
+add_filter('get_previous_post_where', 'geodir_previous_next_post_where', 10, 5);
3573
+add_filter('get_next_post_where', 'geodir_previous_next_post_where', 10, 5);
3574 3574
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_output_functions.php 3 patches
Braces   +25 added lines, -38 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
 function geodir_cf_checkbox($html,$location,$cf,$p=''){
23 23
 
24 24
     // check we have the post value
25
-    if(is_int($p)){$post = geodir_get_post_info($p);}
26
-    else{ global $post;}
25
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
27 26
 
28 27
     if(!is_array($cf) && $cf!=''){
29 28
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -77,8 +76,10 @@  discard block
 block discarded – undo
77 76
 
78 77
             if ( $post->{$html_var} == '1' ):
79 78
                 $html_val = __( 'Yes', 'geodirectory' );
80
-            else:
79
+            else {
80
+            	:
81 81
                 $html_val = __( 'No', 'geodirectory' );
82
+            }
82 83
             endif;
83 84
 
84 85
             $field_icon = geodir_field_icon_proccess($cf);
@@ -116,8 +117,7 @@  discard block
 block discarded – undo
116 117
 function geodir_cf_fieldset($html,$location,$cf,$p=''){
117 118
 
118 119
     // check we have the post value
119
-    if(is_int($p)){$post = geodir_get_post_info($p);}
120
-    else{ global $post;}
120
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
121 121
 
122 122
     if(!is_array($cf) && $cf!=''){
123 123
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -197,8 +197,7 @@  discard block
 block discarded – undo
197 197
 function geodir_cf_url($html,$location,$cf,$p=''){
198 198
 
199 199
     // check we have the post value
200
-    if(is_int($p)){$post = geodir_get_post_info($p);}
201
-    else{ global $post;}
200
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
202 201
 
203 202
     if(!is_array($cf) && $cf!=''){
204 203
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -313,8 +312,7 @@  discard block
 block discarded – undo
313 312
 function geodir_cf_phone($html,$location,$cf,$p=''){
314 313
 
315 314
     // check we have the post value
316
-    if(is_int($p)){$post = geodir_get_post_info($p);}
317
-    else{ global $post;}
315
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
318 316
 
319 317
     if(!is_array($cf) && $cf!=''){
320 318
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -403,8 +401,7 @@  discard block
 block discarded – undo
403 401
 function geodir_cf_time($html,$location,$cf,$p=''){
404 402
 
405 403
     // check we have the post value
406
-    if(is_int($p)){$post = geodir_get_post_info($p);}
407
-    else{ global $post;}
404
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
408 405
 
409 406
     if(!is_array($cf) && $cf!=''){
410 407
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -457,9 +454,10 @@  discard block
 block discarded – undo
457 454
         if ($post->{$cf['htmlvar_name']}):
458 455
 
459 456
             $value = '';
460
-            if ($post->{$cf['htmlvar_name']} != '')
461
-                //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
457
+            if ($post->{$cf['htmlvar_name']} != '') {
458
+                            //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
462 459
                 $value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
460
+            }
463 461
 
464 462
             $field_icon = geodir_field_icon_proccess($cf);
465 463
             if (strpos($field_icon, 'http') !== false) {
@@ -498,8 +496,7 @@  discard block
 block discarded – undo
498 496
 function geodir_cf_datepicker($html,$location,$cf,$p=''){
499 497
     global $preview;
500 498
     // check we have the post value
501
-    if(is_int($p)){$post = geodir_get_post_info($p);}
502
-    else{ global $post;}
499
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
503 500
 
504 501
     if(!is_array($cf) && $cf!=''){
505 502
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -566,7 +563,7 @@  discard block
 block discarded – undo
566 563
                 $date_format = str_replace($search, $replace, $date_format);
567 564
 
568 565
                 $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
-            }else{
566
+            } else{
570 567
                 $post_htmlvar_value = $post->{$cf['htmlvar_name']};
571 568
             }
572 569
 
@@ -575,7 +572,7 @@  discard block
 block discarded – undo
575 572
                 $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576 573
                 //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577 574
                 //$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
-            }else{
575
+            } else{
579 576
                 return '';
580 577
             }
581 578
 
@@ -618,8 +615,7 @@  discard block
 block discarded – undo
618 615
 function geodir_cf_text($html,$location,$cf,$p=''){
619 616
 
620 617
     // check we have the post value
621
-    if(is_int($p)){$post = geodir_get_post_info($p);}
622
-    else{ global $post;}
618
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
623 619
 
624 620
     if(!is_array($cf) && $cf!=''){
625 621
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -725,8 +721,7 @@  discard block
 block discarded – undo
725 721
 function geodir_cf_radio($html,$location,$cf,$p=''){
726 722
 
727 723
     // check we have the post value
728
-    if(is_int($p)){$post = geodir_get_post_info($p);}
729
-    else{ global $post;}
724
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
730 725
 
731 726
     if(!is_array($cf) && $cf!=''){
732 727
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -833,8 +828,7 @@  discard block
 block discarded – undo
833 828
 function geodir_cf_select($html,$location,$cf,$p=''){
834 829
 
835 830
     // check we have the post value
836
-    if(is_int($p)){$post = geodir_get_post_info($p);}
837
-    else{ global $post;}
831
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
838 832
 
839 833
     if(!is_array($cf) && $cf!=''){
840 834
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -935,8 +929,7 @@  discard block
 block discarded – undo
935 929
 function geodir_cf_multiselect($html,$location,$cf,$p=''){
936 930
 
937 931
     // check we have the post value
938
-    if(is_int($p)){$post = geodir_get_post_info($p);}
939
-    else{ global $post;}
932
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
940 933
 
941 934
     if(!is_array($cf) && $cf!=''){
942 935
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1062,8 +1055,7 @@  discard block
 block discarded – undo
1062 1055
 function geodir_cf_email($html,$location,$cf,$p=''){
1063 1056
 
1064 1057
     // check we have the post value
1065
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1066
-    else{ global $post;}
1058
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1067 1059
 
1068 1060
     if(!is_array($cf) && $cf!=''){
1069 1061
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1197,7 +1189,7 @@  discard block
 block discarded – undo
1197 1189
                      */
1198 1190
                     $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1199 1191
                     $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1200
-                }else{
1192
+                } else{
1201 1193
                     $html .=  $email;
1202 1194
                 }
1203 1195
                 $html .= '</span></div>';
@@ -1225,8 +1217,7 @@  discard block
 block discarded – undo
1225 1217
 function geodir_cf_file($html,$location,$cf,$p=''){
1226 1218
 
1227 1219
     // check we have the post value
1228
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1229
-    else{ global $post;}
1220
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1230 1221
 
1231 1222
     if(!is_array($cf) && $cf!=''){
1232 1223
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1366,8 +1357,7 @@  discard block
 block discarded – undo
1366 1357
 function geodir_cf_textarea($html,$location,$cf,$p=''){
1367 1358
 
1368 1359
     // check we have the post value
1369
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1370
-    else{ global $post;}
1360
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1371 1361
 
1372 1362
     if(!is_array($cf) && $cf!=''){
1373 1363
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1457,8 +1447,7 @@  discard block
 block discarded – undo
1457 1447
 function geodir_cf_html($html,$location,$cf,$p=''){
1458 1448
 
1459 1449
     // check we have the post value
1460
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1461
-    else{ global $post;}
1450
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1462 1451
 
1463 1452
     if(!is_array($cf) && $cf!=''){
1464 1453
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1547,8 +1536,7 @@  discard block
 block discarded – undo
1547 1536
 function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1548 1537
 
1549 1538
     // check we have the post value
1550
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1551
-    else{ global $post;}
1539
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1552 1540
 
1553 1541
     if(!is_array($cf) && $cf!=''){
1554 1542
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1670,8 +1658,7 @@  discard block
 block discarded – undo
1670 1658
 function geodir_cf_address($html,$location,$cf,$p=''){
1671 1659
 
1672 1660
     // check we have the post value
1673
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1674
-    else{ global $post;}
1661
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1675 1662
 
1676 1663
     if(!is_array($cf) && $cf!=''){
1677 1664
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
Please login to merge, or discard this patch.
Indentation   +1542 added lines, -1542 removed lines patch added patch discarded remove patch
@@ -21,84 +21,84 @@  discard block
 block discarded – undo
21 21
  */
22 22
 function geodir_cf_checkbox($html,$location,$cf,$p=''){
23 23
 
24
-    // check we have the post value
25
-    if(is_int($p)){$post = geodir_get_post_info($p);}
26
-    else{ global $post;}
27
-
28
-    if(!is_array($cf) && $cf!=''){
29
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
-        if(!$cf){return NULL;}
31
-    }
32
-
33
-    $html_var = $cf['htmlvar_name'];
34
-
35
-    // Check if there is a location specific filter.
36
-    if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
37
-        /**
38
-         * Filter the checkbox html by location.
39
-         *
40
-         * @param string $html The html to filter.
41
-         * @param array $cf The custom field array.
42
-         * @since 1.6.6
43
-         */
44
-        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
45
-    }
46
-
47
-    // Check if there is a custom field specific filter.
48
-    if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
49
-        /**
50
-         * Filter the checkbox html by individual custom field.
51
-         *
52
-         * @param string $html The html to filter.
53
-         * @param string $location The location to output the html.
54
-         * @param array $cf The custom field array.
55
-         * @since 1.6.6
56
-         */
57
-        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
58
-    }
59
-
60
-    // Check if there is a custom field key specific filter.
61
-    if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
62
-        /**
63
-         * Filter the checkbox html by field type key.
64
-         *
65
-         * @param string $html The html to filter.
66
-         * @param string $location The location to output the html.
67
-         * @param array $cf The custom field array.
68
-         * @since 1.6.6
69
-         */
70
-        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
71
-    }
72
-
73
-    // If not html then we run the standard output.
74
-    if(empty($html)){
75
-
76
-        if ( (int) $post->{$html_var} == 1 ):
77
-
78
-            if ( $post->{$html_var} == '1' ):
79
-                $html_val = __( 'Yes', 'geodirectory' );
80
-            else:
81
-                $html_val = __( 'No', 'geodirectory' );
82
-            endif;
83
-
84
-            $field_icon = geodir_field_icon_proccess($cf);
85
-            if (strpos($field_icon, 'http') !== false) {
86
-                $field_icon_af = '';
87
-            } elseif ($field_icon == '') {
88
-                $field_icon_af = '';
89
-            } else {
90
-                $field_icon_af = $field_icon;
91
-                $field_icon = '';
92
-            }
93
-
94
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
-            $html .= '</span>' . $html_val . '</div>';
97
-        endif;
98
-
99
-    }
100
-
101
-    return $html;
24
+	// check we have the post value
25
+	if(is_int($p)){$post = geodir_get_post_info($p);}
26
+	else{ global $post;}
27
+
28
+	if(!is_array($cf) && $cf!=''){
29
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
+		if(!$cf){return NULL;}
31
+	}
32
+
33
+	$html_var = $cf['htmlvar_name'];
34
+
35
+	// Check if there is a location specific filter.
36
+	if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
37
+		/**
38
+		 * Filter the checkbox html by location.
39
+		 *
40
+		 * @param string $html The html to filter.
41
+		 * @param array $cf The custom field array.
42
+		 * @since 1.6.6
43
+		 */
44
+		$html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
45
+	}
46
+
47
+	// Check if there is a custom field specific filter.
48
+	if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
49
+		/**
50
+		 * Filter the checkbox html by individual custom field.
51
+		 *
52
+		 * @param string $html The html to filter.
53
+		 * @param string $location The location to output the html.
54
+		 * @param array $cf The custom field array.
55
+		 * @since 1.6.6
56
+		 */
57
+		$html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
58
+	}
59
+
60
+	// Check if there is a custom field key specific filter.
61
+	if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
62
+		/**
63
+		 * Filter the checkbox html by field type key.
64
+		 *
65
+		 * @param string $html The html to filter.
66
+		 * @param string $location The location to output the html.
67
+		 * @param array $cf The custom field array.
68
+		 * @since 1.6.6
69
+		 */
70
+		$html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
71
+	}
72
+
73
+	// If not html then we run the standard output.
74
+	if(empty($html)){
75
+
76
+		if ( (int) $post->{$html_var} == 1 ):
77
+
78
+			if ( $post->{$html_var} == '1' ):
79
+				$html_val = __( 'Yes', 'geodirectory' );
80
+			else:
81
+				$html_val = __( 'No', 'geodirectory' );
82
+			endif;
83
+
84
+			$field_icon = geodir_field_icon_proccess($cf);
85
+			if (strpos($field_icon, 'http') !== false) {
86
+				$field_icon_af = '';
87
+			} elseif ($field_icon == '') {
88
+				$field_icon_af = '';
89
+			} else {
90
+				$field_icon_af = $field_icon;
91
+				$field_icon = '';
92
+			}
93
+
94
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
+			$html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
+			$html .= '</span>' . $html_val . '</div>';
97
+		endif;
98
+
99
+	}
100
+
101
+	return $html;
102 102
 }
103 103
 add_filter('geodir_custom_field_output_checkbox','geodir_cf_checkbox',10,3);
104 104
 
@@ -115,71 +115,71 @@  discard block
 block discarded – undo
115 115
  */
116 116
 function geodir_cf_fieldset($html,$location,$cf,$p=''){
117 117
 
118
-    // check we have the post value
119
-    if(is_int($p)){$post = geodir_get_post_info($p);}
120
-    else{ global $post;}
121
-
122
-    if(!is_array($cf) && $cf!=''){
123
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
-        if(!$cf){return NULL;}
125
-    }
126
-
127
-    $html_var = $cf['htmlvar_name'];
128
-
129
-    // Check if there is a location specific filter.
130
-    if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
131
-        /**
132
-         * Filter the fieldset html by location.
133
-         *
134
-         * @param string $html The html to filter.
135
-         * @param array $cf The custom field array.
136
-         * @since 1.6.6
137
-         */
138
-        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
139
-    }
140
-
141
-    // Check if there is a custom field specific filter.
142
-    if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
143
-        /**
144
-         * Filter the fieldset html by individual custom field.
145
-         *
146
-         * @param string $html The html to filter.
147
-         * @param string $location The location to output the html.
148
-         * @param array $cf The custom field array.
149
-         * @since 1.6.6
150
-         */
151
-        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
152
-    }
153
-
154
-    // Check if there is a custom field key specific filter.
155
-    if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
156
-        /**
157
-         * Filter the fieldset html by field type key.
158
-         *
159
-         * @param string $html The html to filter.
160
-         * @param string $location The location to output the html.
161
-         * @param array $cf The custom field array.
162
-         * @since 1.6.6
163
-         */
164
-        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
165
-    }
166
-
167
-    // If not html then we run the standard output.
168
-    if(empty($html)){
169
-
170
-        global $field_set_start;
171
-        $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
172
-
173
-        if ($field_set_start == 1) {
174
-            $html = '';
175
-        } else {
176
-            $html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
177
-            //$field_set_start = 1;
178
-        }
179
-
180
-    }
181
-
182
-    return $html;
118
+	// check we have the post value
119
+	if(is_int($p)){$post = geodir_get_post_info($p);}
120
+	else{ global $post;}
121
+
122
+	if(!is_array($cf) && $cf!=''){
123
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
+		if(!$cf){return NULL;}
125
+	}
126
+
127
+	$html_var = $cf['htmlvar_name'];
128
+
129
+	// Check if there is a location specific filter.
130
+	if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
131
+		/**
132
+		 * Filter the fieldset html by location.
133
+		 *
134
+		 * @param string $html The html to filter.
135
+		 * @param array $cf The custom field array.
136
+		 * @since 1.6.6
137
+		 */
138
+		$html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
139
+	}
140
+
141
+	// Check if there is a custom field specific filter.
142
+	if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
143
+		/**
144
+		 * Filter the fieldset html by individual custom field.
145
+		 *
146
+		 * @param string $html The html to filter.
147
+		 * @param string $location The location to output the html.
148
+		 * @param array $cf The custom field array.
149
+		 * @since 1.6.6
150
+		 */
151
+		$html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
152
+	}
153
+
154
+	// Check if there is a custom field key specific filter.
155
+	if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
156
+		/**
157
+		 * Filter the fieldset html by field type key.
158
+		 *
159
+		 * @param string $html The html to filter.
160
+		 * @param string $location The location to output the html.
161
+		 * @param array $cf The custom field array.
162
+		 * @since 1.6.6
163
+		 */
164
+		$html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
165
+	}
166
+
167
+	// If not html then we run the standard output.
168
+	if(empty($html)){
169
+
170
+		global $field_set_start;
171
+		$fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
172
+
173
+		if ($field_set_start == 1) {
174
+			$html = '';
175
+		} else {
176
+			$html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
177
+			//$field_set_start = 1;
178
+		}
179
+
180
+	}
181
+
182
+	return $html;
183 183
 }
184 184
 add_filter('geodir_custom_field_output_fieldset','geodir_cf_fieldset',10,3);
185 185
 
@@ -196,106 +196,106 @@  discard block
 block discarded – undo
196 196
  */
197 197
 function geodir_cf_url($html,$location,$cf,$p=''){
198 198
 
199
-    // check we have the post value
200
-    if(is_int($p)){$post = geodir_get_post_info($p);}
201
-    else{ global $post;}
202
-
203
-    if(!is_array($cf) && $cf!=''){
204
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
205
-        if(!$cf){return NULL;}
206
-    }
207
-
208
-    $html_var = $cf['htmlvar_name'];
209
-
210
-    // Check if there is a location specific filter.
211
-    if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
212
-        /**
213
-         * Filter the url html by location.
214
-         *
215
-         * @param string $html The html to filter.
216
-         * @param array $cf The custom field array.
217
-         * @since 1.6.6
218
-         */
219
-        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
220
-    }
221
-
222
-    // Check if there is a custom field specific filter.
223
-    if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
224
-        /**
225
-         * Filter the url html by individual custom field.
226
-         *
227
-         * @param string $html The html to filter.
228
-         * @param string $location The location to output the html.
229
-         * @param array $cf The custom field array.
230
-         * @since 1.6.6
231
-         */
232
-        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
233
-    }
234
-
235
-    // Check if there is a custom field key specific filter.
236
-    if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
237
-        /**
238
-         * Filter the url html by field type key.
239
-         *
240
-         * @param string $html The html to filter.
241
-         * @param string $location The location to output the html.
242
-         * @param array $cf The custom field array.
243
-         * @since 1.6.6
244
-         */
245
-        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
246
-    }
247
-
248
-    // If not html then we run the standard output.
249
-    if(empty($html)){
250
-
251
-        if ($post->{$cf['htmlvar_name']}):
252
-
253
-            $field_icon = geodir_field_icon_proccess($cf);
254
-            if (strpos($field_icon, 'http') !== false) {
255
-                $field_icon_af = '';
256
-            } elseif ($field_icon == '') {
257
-
258
-                if ($cf['name'] == 'geodir_facebook') {
259
-                    $field_icon_af = '<i class="fa fa-facebook-square"></i>';
260
-                } elseif ($cf['name'] == 'geodir_twitter') {
261
-                    $field_icon_af = '<i class="fa fa-twitter-square"></i>';
262
-                } else {
263
-                    $field_icon_af = '<i class="fa fa-link"></i>';
264
-                }
265
-
266
-            } else {
267
-                $field_icon_af = $field_icon;
268
-                $field_icon = '';
269
-            }
270
-
271
-            $a_url = geodir_parse_custom_field_url($post->{$cf['htmlvar_name']});
272
-
273
-
274
-            $website = !empty($a_url['url']) ? $a_url['url'] : '';
275
-            $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
276
-            if(!empty($cf['default_value'])){$title = $cf['default_value'];}
277
-            $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
278
-
279
-
280
-
281
-            // all search engines that use the nofollow value exclude links that use it from their ranking calculation
282
-            $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
283
-            /**
284
-             * Filter custom field website name.
285
-             *
286
-             * @since 1.0.0
287
-             *
288
-             * @param string $title Website Title.
289
-             * @param string $website Website URL.
290
-             * @param int $post->ID Post ID.
291
-             */
292
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
293
-
294
-        endif;
295
-
296
-    }
297
-
298
-    return $html;
199
+	// check we have the post value
200
+	if(is_int($p)){$post = geodir_get_post_info($p);}
201
+	else{ global $post;}
202
+
203
+	if(!is_array($cf) && $cf!=''){
204
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
205
+		if(!$cf){return NULL;}
206
+	}
207
+
208
+	$html_var = $cf['htmlvar_name'];
209
+
210
+	// Check if there is a location specific filter.
211
+	if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
212
+		/**
213
+		 * Filter the url html by location.
214
+		 *
215
+		 * @param string $html The html to filter.
216
+		 * @param array $cf The custom field array.
217
+		 * @since 1.6.6
218
+		 */
219
+		$html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
220
+	}
221
+
222
+	// Check if there is a custom field specific filter.
223
+	if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
224
+		/**
225
+		 * Filter the url html by individual custom field.
226
+		 *
227
+		 * @param string $html The html to filter.
228
+		 * @param string $location The location to output the html.
229
+		 * @param array $cf The custom field array.
230
+		 * @since 1.6.6
231
+		 */
232
+		$html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
233
+	}
234
+
235
+	// Check if there is a custom field key specific filter.
236
+	if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
237
+		/**
238
+		 * Filter the url html by field type key.
239
+		 *
240
+		 * @param string $html The html to filter.
241
+		 * @param string $location The location to output the html.
242
+		 * @param array $cf The custom field array.
243
+		 * @since 1.6.6
244
+		 */
245
+		$html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
246
+	}
247
+
248
+	// If not html then we run the standard output.
249
+	if(empty($html)){
250
+
251
+		if ($post->{$cf['htmlvar_name']}):
252
+
253
+			$field_icon = geodir_field_icon_proccess($cf);
254
+			if (strpos($field_icon, 'http') !== false) {
255
+				$field_icon_af = '';
256
+			} elseif ($field_icon == '') {
257
+
258
+				if ($cf['name'] == 'geodir_facebook') {
259
+					$field_icon_af = '<i class="fa fa-facebook-square"></i>';
260
+				} elseif ($cf['name'] == 'geodir_twitter') {
261
+					$field_icon_af = '<i class="fa fa-twitter-square"></i>';
262
+				} else {
263
+					$field_icon_af = '<i class="fa fa-link"></i>';
264
+				}
265
+
266
+			} else {
267
+				$field_icon_af = $field_icon;
268
+				$field_icon = '';
269
+			}
270
+
271
+			$a_url = geodir_parse_custom_field_url($post->{$cf['htmlvar_name']});
272
+
273
+
274
+			$website = !empty($a_url['url']) ? $a_url['url'] : '';
275
+			$title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
276
+			if(!empty($cf['default_value'])){$title = $cf['default_value'];}
277
+			$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
278
+
279
+
280
+
281
+			// all search engines that use the nofollow value exclude links that use it from their ranking calculation
282
+			$rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
283
+			/**
284
+			 * Filter custom field website name.
285
+			 *
286
+			 * @since 1.0.0
287
+			 *
288
+			 * @param string $title Website Title.
289
+			 * @param string $website Website URL.
290
+			 * @param int $post->ID Post ID.
291
+			 */
292
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
293
+
294
+		endif;
295
+
296
+	}
297
+
298
+	return $html;
299 299
 }
300 300
 add_filter('geodir_custom_field_output_url','geodir_cf_url',10,3);
301 301
 
@@ -312,80 +312,80 @@  discard block
 block discarded – undo
312 312
  */
313 313
 function geodir_cf_phone($html,$location,$cf,$p=''){
314 314
 
315
-    // check we have the post value
316
-    if(is_int($p)){$post = geodir_get_post_info($p);}
317
-    else{ global $post;}
318
-
319
-    if(!is_array($cf) && $cf!=''){
320
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
321
-        if(!$cf){return NULL;}
322
-    }
323
-
324
-    $html_var = $cf['htmlvar_name'];
325
-
326
-    // Check if there is a location specific filter.
327
-    if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
328
-        /**
329
-         * Filter the phone html by location.
330
-         *
331
-         * @param string $html The html to filter.
332
-         * @param array $cf The custom field array.
333
-         * @since 1.6.6
334
-         */
335
-        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
336
-    }
337
-
338
-    // Check if there is a custom field specific filter.
339
-    if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
340
-        /**
341
-         * Filter the phone html by individual custom field.
342
-         *
343
-         * @param string $html The html to filter.
344
-         * @param string $location The location to output the html.
345
-         * @param array $cf The custom field array.
346
-         * @since 1.6.6
347
-         */
348
-        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
349
-    }
350
-
351
-    // Check if there is a custom field key specific filter.
352
-    if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
353
-        /**
354
-         * Filter the phone html by field type key.
355
-         *
356
-         * @param string $html The html to filter.
357
-         * @param string $location The location to output the html.
358
-         * @param array $cf The custom field array.
359
-         * @since 1.6.6
360
-         */
361
-        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
362
-    }
363
-
364
-    // If not html then we run the standard output.
365
-    if(empty($html)){
366
-
367
-        if ($post->{$cf['htmlvar_name']}):
368
-
369
-            $field_icon = geodir_field_icon_proccess($cf);
370
-            if (strpos($field_icon, 'http') !== false) {
371
-                $field_icon_af = '';
372
-            } elseif ($field_icon == '') {
373
-                $field_icon_af = '<i class="fa fa-phone"></i>';
374
-            } else {
375
-                $field_icon_af = $field_icon;
376
-                $field_icon = '';
377
-            }
378
-
379
-
380
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
381
-                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
382
-            $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
383
-
384
-        endif;
385
-
386
-    }
387
-
388
-    return $html;
315
+	// check we have the post value
316
+	if(is_int($p)){$post = geodir_get_post_info($p);}
317
+	else{ global $post;}
318
+
319
+	if(!is_array($cf) && $cf!=''){
320
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
321
+		if(!$cf){return NULL;}
322
+	}
323
+
324
+	$html_var = $cf['htmlvar_name'];
325
+
326
+	// Check if there is a location specific filter.
327
+	if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
328
+		/**
329
+		 * Filter the phone html by location.
330
+		 *
331
+		 * @param string $html The html to filter.
332
+		 * @param array $cf The custom field array.
333
+		 * @since 1.6.6
334
+		 */
335
+		$html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
336
+	}
337
+
338
+	// Check if there is a custom field specific filter.
339
+	if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
340
+		/**
341
+		 * Filter the phone html by individual custom field.
342
+		 *
343
+		 * @param string $html The html to filter.
344
+		 * @param string $location The location to output the html.
345
+		 * @param array $cf The custom field array.
346
+		 * @since 1.6.6
347
+		 */
348
+		$html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
349
+	}
350
+
351
+	// Check if there is a custom field key specific filter.
352
+	if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
353
+		/**
354
+		 * Filter the phone html by field type key.
355
+		 *
356
+		 * @param string $html The html to filter.
357
+		 * @param string $location The location to output the html.
358
+		 * @param array $cf The custom field array.
359
+		 * @since 1.6.6
360
+		 */
361
+		$html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
362
+	}
363
+
364
+	// If not html then we run the standard output.
365
+	if(empty($html)){
366
+
367
+		if ($post->{$cf['htmlvar_name']}):
368
+
369
+			$field_icon = geodir_field_icon_proccess($cf);
370
+			if (strpos($field_icon, 'http') !== false) {
371
+				$field_icon_af = '';
372
+			} elseif ($field_icon == '') {
373
+				$field_icon_af = '<i class="fa fa-phone"></i>';
374
+			} else {
375
+				$field_icon_af = $field_icon;
376
+				$field_icon = '';
377
+			}
378
+
379
+
380
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
381
+					$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
382
+			$html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
383
+
384
+		endif;
385
+
386
+	}
387
+
388
+	return $html;
389 389
 }
390 390
 add_filter('geodir_custom_field_output_phone','geodir_cf_phone',10,3);
391 391
 
@@ -402,85 +402,85 @@  discard block
 block discarded – undo
402 402
  */
403 403
 function geodir_cf_time($html,$location,$cf,$p=''){
404 404
 
405
-    // check we have the post value
406
-    if(is_int($p)){$post = geodir_get_post_info($p);}
407
-    else{ global $post;}
408
-
409
-    if(!is_array($cf) && $cf!=''){
410
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
411
-        if(!$cf){return NULL;}
412
-    }
413
-
414
-    $html_var = $cf['htmlvar_name'];
415
-
416
-    // Check if there is a location specific filter.
417
-    if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
418
-        /**
419
-         * Filter the time html by location.
420
-         *
421
-         * @param string $html The html to filter.
422
-         * @param array $cf The custom field array.
423
-         * @since 1.6.6
424
-         */
425
-        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
426
-    }
427
-
428
-    // Check if there is a custom field specific filter.
429
-    if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
430
-        /**
431
-         * Filter the time html by individual custom field.
432
-         *
433
-         * @param string $html The html to filter.
434
-         * @param string $location The location to output the html.
435
-         * @param array $cf The custom field array.
436
-         * @since 1.6.6
437
-         */
438
-        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
439
-    }
440
-
441
-    // Check if there is a custom field key specific filter.
442
-    if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
443
-        /**
444
-         * Filter the time html by field type key.
445
-         *
446
-         * @param string $html The html to filter.
447
-         * @param string $location The location to output the html.
448
-         * @param array $cf The custom field array.
449
-         * @since 1.6.6
450
-         */
451
-        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
452
-    }
453
-
454
-    // If not html then we run the standard output.
455
-    if(empty($html)){
456
-
457
-        if ($post->{$cf['htmlvar_name']}):
458
-
459
-            $value = '';
460
-            if ($post->{$cf['htmlvar_name']} != '')
461
-                //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
462
-                $value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
463
-
464
-            $field_icon = geodir_field_icon_proccess($cf);
465
-            if (strpos($field_icon, 'http') !== false) {
466
-                $field_icon_af = '';
467
-            } elseif ($field_icon == '') {
468
-                $field_icon_af = '<i class="fa fa-clock-o"></i>';
469
-            } else {
470
-                $field_icon_af = $field_icon;
471
-                $field_icon = '';
472
-            }
473
-
474
-
475
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
476
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
477
-            $html .= '</span>' . $value . '</div>';
478
-
479
-        endif;
480
-
481
-    }
482
-
483
-    return $html;
405
+	// check we have the post value
406
+	if(is_int($p)){$post = geodir_get_post_info($p);}
407
+	else{ global $post;}
408
+
409
+	if(!is_array($cf) && $cf!=''){
410
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
411
+		if(!$cf){return NULL;}
412
+	}
413
+
414
+	$html_var = $cf['htmlvar_name'];
415
+
416
+	// Check if there is a location specific filter.
417
+	if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
418
+		/**
419
+		 * Filter the time html by location.
420
+		 *
421
+		 * @param string $html The html to filter.
422
+		 * @param array $cf The custom field array.
423
+		 * @since 1.6.6
424
+		 */
425
+		$html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
426
+	}
427
+
428
+	// Check if there is a custom field specific filter.
429
+	if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
430
+		/**
431
+		 * Filter the time html by individual custom field.
432
+		 *
433
+		 * @param string $html The html to filter.
434
+		 * @param string $location The location to output the html.
435
+		 * @param array $cf The custom field array.
436
+		 * @since 1.6.6
437
+		 */
438
+		$html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
439
+	}
440
+
441
+	// Check if there is a custom field key specific filter.
442
+	if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
443
+		/**
444
+		 * Filter the time html by field type key.
445
+		 *
446
+		 * @param string $html The html to filter.
447
+		 * @param string $location The location to output the html.
448
+		 * @param array $cf The custom field array.
449
+		 * @since 1.6.6
450
+		 */
451
+		$html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
452
+	}
453
+
454
+	// If not html then we run the standard output.
455
+	if(empty($html)){
456
+
457
+		if ($post->{$cf['htmlvar_name']}):
458
+
459
+			$value = '';
460
+			if ($post->{$cf['htmlvar_name']} != '')
461
+				//$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
462
+				$value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
463
+
464
+			$field_icon = geodir_field_icon_proccess($cf);
465
+			if (strpos($field_icon, 'http') !== false) {
466
+				$field_icon_af = '';
467
+			} elseif ($field_icon == '') {
468
+				$field_icon_af = '<i class="fa fa-clock-o"></i>';
469
+			} else {
470
+				$field_icon_af = $field_icon;
471
+				$field_icon = '';
472
+			}
473
+
474
+
475
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
476
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
477
+			$html .= '</span>' . $value . '</div>';
478
+
479
+		endif;
480
+
481
+	}
482
+
483
+	return $html;
484 484
 }
485 485
 add_filter('geodir_custom_field_output_time','geodir_cf_time',10,3);
486 486
 
@@ -496,111 +496,111 @@  discard block
 block discarded – undo
496 496
  * @return string The html to output for the custom field.
497 497
  */
498 498
 function geodir_cf_datepicker($html,$location,$cf,$p=''){
499
-    global $preview;
500
-    // check we have the post value
501
-    if(is_int($p)){$post = geodir_get_post_info($p);}
502
-    else{ global $post;}
503
-
504
-    if(!is_array($cf) && $cf!=''){
505
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
506
-        if(!$cf){return NULL;}
507
-    }
508
-
509
-    $html_var = $cf['htmlvar_name'];
510
-
511
-    // Check if there is a location specific filter.
512
-    if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
513
-        /**
514
-         * Filter the datepicker html by location.
515
-         *
516
-         * @param string $html The html to filter.
517
-         * @param array $cf The custom field array.
518
-         * @since 1.6.6
519
-         */
520
-        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
521
-    }
522
-
523
-    // Check if there is a custom field specific filter.
524
-    if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
525
-        /**
526
-         * Filter the datepicker html by individual custom field.
527
-         *
528
-         * @param string $html The html to filter.
529
-         * @param string $location The location to output the html.
530
-         * @param array $cf The custom field array.
531
-         * @since 1.6.6
532
-         */
533
-        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
534
-    }
535
-
536
-    // Check if there is a custom field key specific filter.
537
-    if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
538
-        /**
539
-         * Filter the datepicker html by field type key.
540
-         *
541
-         * @param string $html The html to filter.
542
-         * @param string $location The location to output the html.
543
-         * @param array $cf The custom field array.
544
-         * @since 1.6.6
545
-         */
546
-        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
547
-    }
548
-
549
-    // If not html then we run the standard output.
550
-    if(empty($html)){
551
-
552
-        if ($post->{$cf['htmlvar_name']}):
553
-
554
-            $date_format = geodir_default_date_format();
555
-            if ($cf['extra_fields'] != '') {
556
-                $date_format = stripslashes_deep(unserialize($cf['extra_fields']));
557
-                $date_format = $date_format['date_format'];
558
-            }
559
-            // check if we need to change the format or not
560
-            $date_format_len = strlen(str_replace(' ', '', $date_format));
561
-            if($date_format_len>5){// if greater then 4 then it's the old style format.
562
-
563
-                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
564
-                $replace = array('d','j','l','m','n','F','Y');//PHP date format
565
-
566
-                $date_format = str_replace($search, $replace, $date_format);
567
-
568
-                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
-            }else{
570
-                $post_htmlvar_value = $post->{$cf['htmlvar_name']};
571
-            }
572
-
573
-            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
574
-                $date_format_from = $preview ? $date_format : 'Y-m-d';
575
-                $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576
-                //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577
-                //$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
-            }else{
579
-                return '';
580
-            }
581
-
582
-            $field_icon = geodir_field_icon_proccess($cf);
583
-
584
-            if (strpos($field_icon, 'http') !== false) {
585
-                $field_icon_af = '';
586
-            } elseif ($field_icon == '') {
587
-                $field_icon_af = '<i class="fa fa-calendar"></i>';
588
-            } else {
589
-                $field_icon_af = $field_icon;
590
-                $field_icon = '';
591
-            }
592
-
593
-
594
-
595
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
596
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
597
-            $html .= '</span>' . $value . '</div>';
598
-
599
-        endif;
600
-
601
-    }
602
-
603
-    return $html;
499
+	global $preview;
500
+	// check we have the post value
501
+	if(is_int($p)){$post = geodir_get_post_info($p);}
502
+	else{ global $post;}
503
+
504
+	if(!is_array($cf) && $cf!=''){
505
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
506
+		if(!$cf){return NULL;}
507
+	}
508
+
509
+	$html_var = $cf['htmlvar_name'];
510
+
511
+	// Check if there is a location specific filter.
512
+	if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
513
+		/**
514
+		 * Filter the datepicker html by location.
515
+		 *
516
+		 * @param string $html The html to filter.
517
+		 * @param array $cf The custom field array.
518
+		 * @since 1.6.6
519
+		 */
520
+		$html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
521
+	}
522
+
523
+	// Check if there is a custom field specific filter.
524
+	if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
525
+		/**
526
+		 * Filter the datepicker html by individual custom field.
527
+		 *
528
+		 * @param string $html The html to filter.
529
+		 * @param string $location The location to output the html.
530
+		 * @param array $cf The custom field array.
531
+		 * @since 1.6.6
532
+		 */
533
+		$html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
534
+	}
535
+
536
+	// Check if there is a custom field key specific filter.
537
+	if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
538
+		/**
539
+		 * Filter the datepicker html by field type key.
540
+		 *
541
+		 * @param string $html The html to filter.
542
+		 * @param string $location The location to output the html.
543
+		 * @param array $cf The custom field array.
544
+		 * @since 1.6.6
545
+		 */
546
+		$html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
547
+	}
548
+
549
+	// If not html then we run the standard output.
550
+	if(empty($html)){
551
+
552
+		if ($post->{$cf['htmlvar_name']}):
553
+
554
+			$date_format = geodir_default_date_format();
555
+			if ($cf['extra_fields'] != '') {
556
+				$date_format = stripslashes_deep(unserialize($cf['extra_fields']));
557
+				$date_format = $date_format['date_format'];
558
+			}
559
+			// check if we need to change the format or not
560
+			$date_format_len = strlen(str_replace(' ', '', $date_format));
561
+			if($date_format_len>5){// if greater then 4 then it's the old style format.
562
+
563
+				$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
564
+				$replace = array('d','j','l','m','n','F','Y');//PHP date format
565
+
566
+				$date_format = str_replace($search, $replace, $date_format);
567
+
568
+				$post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
+			}else{
570
+				$post_htmlvar_value = $post->{$cf['htmlvar_name']};
571
+			}
572
+
573
+			if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
574
+				$date_format_from = $preview ? $date_format : 'Y-m-d';
575
+				$value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576
+				//$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577
+				//$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
+			}else{
579
+				return '';
580
+			}
581
+
582
+			$field_icon = geodir_field_icon_proccess($cf);
583
+
584
+			if (strpos($field_icon, 'http') !== false) {
585
+				$field_icon_af = '';
586
+			} elseif ($field_icon == '') {
587
+				$field_icon_af = '<i class="fa fa-calendar"></i>';
588
+			} else {
589
+				$field_icon_af = $field_icon;
590
+				$field_icon = '';
591
+			}
592
+
593
+
594
+
595
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
596
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
597
+			$html .= '</span>' . $value . '</div>';
598
+
599
+		endif;
600
+
601
+	}
602
+
603
+	return $html;
604 604
 }
605 605
 add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3);
606 606
 
@@ -617,97 +617,97 @@  discard block
 block discarded – undo
617 617
  */
618 618
 function geodir_cf_text($html,$location,$cf,$p=''){
619 619
 
620
-    // check we have the post value
621
-    if(is_int($p)){$post = geodir_get_post_info($p);}
622
-    else{ global $post;}
623
-
624
-    if(!is_array($cf) && $cf!=''){
625
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
626
-        if(!$cf){return NULL;}
627
-    }
628
-
629
-    $html_var = $cf['htmlvar_name'];
630
-
631
-    // Check if there is a location specific filter.
632
-    if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
633
-        /**
634
-         * Filter the text html by location.
635
-         *
636
-         * @param string $html The html to filter.
637
-         * @param array $cf The custom field array.
638
-         * @since 1.6.6
639
-         */
640
-        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
641
-    }
642
-
643
-    // Check if there is a custom field specific filter.
644
-    if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
645
-        /**
646
-         * Filter the text html by individual custom field.
647
-         *
648
-         * @param string $html The html to filter.
649
-         * @param string $location The location to output the html.
650
-         * @param array $cf The custom field array.
651
-         * @since 1.6.6
652
-         */
653
-        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
654
-    }
655
-
656
-    // Check if there is a custom field key specific filter.
657
-    if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
658
-        /**
659
-         * Filter the text html by field type key.
660
-         *
661
-         * @param string $html The html to filter.
662
-         * @param string $location The location to output the html.
663
-         * @param array $cf The custom field array.
664
-         * @since 1.6.6
665
-         */
666
-        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
667
-    }
620
+	// check we have the post value
621
+	if(is_int($p)){$post = geodir_get_post_info($p);}
622
+	else{ global $post;}
623
+
624
+	if(!is_array($cf) && $cf!=''){
625
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
626
+		if(!$cf){return NULL;}
627
+	}
628
+
629
+	$html_var = $cf['htmlvar_name'];
630
+
631
+	// Check if there is a location specific filter.
632
+	if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
633
+		/**
634
+		 * Filter the text html by location.
635
+		 *
636
+		 * @param string $html The html to filter.
637
+		 * @param array $cf The custom field array.
638
+		 * @since 1.6.6
639
+		 */
640
+		$html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
641
+	}
642
+
643
+	// Check if there is a custom field specific filter.
644
+	if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
645
+		/**
646
+		 * Filter the text html by individual custom field.
647
+		 *
648
+		 * @param string $html The html to filter.
649
+		 * @param string $location The location to output the html.
650
+		 * @param array $cf The custom field array.
651
+		 * @since 1.6.6
652
+		 */
653
+		$html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
654
+	}
655
+
656
+	// Check if there is a custom field key specific filter.
657
+	if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
658
+		/**
659
+		 * Filter the text html by field type key.
660
+		 *
661
+		 * @param string $html The html to filter.
662
+		 * @param string $location The location to output the html.
663
+		 * @param array $cf The custom field array.
664
+		 * @since 1.6.6
665
+		 */
666
+		$html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
667
+	}
668 668
 
669 669
     
670 670
 
671
-    // If not html then we run the standard output.
672
-    if(empty($html)){
671
+	// If not html then we run the standard output.
672
+	if(empty($html)){
673 673
 
674
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
674
+		if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
675 675
 
676
-            $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
676
+			$class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
677 677
 
678
-            $field_icon = geodir_field_icon_proccess($cf);
679
-            if (strpos($field_icon, 'http') !== false) {
680
-                $field_icon_af = '';
681
-            } elseif ($field_icon == '') {
682
-                $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
683
-            } else {
684
-                $field_icon_af = $field_icon;
685
-                $field_icon = '';
686
-            }
678
+			$field_icon = geodir_field_icon_proccess($cf);
679
+			if (strpos($field_icon, 'http') !== false) {
680
+				$field_icon_af = '';
681
+			} elseif ($field_icon == '') {
682
+				$field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
683
+			} else {
684
+				$field_icon_af = $field_icon;
685
+				$field_icon = '';
686
+			}
687 687
 
688 688
 
689
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
690
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
691
-            $html .= '</span>';
689
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
690
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
691
+			$html .= '</span>';
692 692
 
693
-            $value = $post->{$cf['htmlvar_name']};
694
-            if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){
695
-                $extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields']));
696
-                if(isset($extra_fields['is_price']) && $extra_fields['is_price']){
697
-                    if(!ceil($value) > 0){return '';}// dont output blank prices
698
-                    $value = geodir_currency_format_number($value,$cf);
699
-                }
700
-            }
693
+			$value = $post->{$cf['htmlvar_name']};
694
+			if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){
695
+				$extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields']));
696
+				if(isset($extra_fields['is_price']) && $extra_fields['is_price']){
697
+					if(!ceil($value) > 0){return '';}// dont output blank prices
698
+					$value = geodir_currency_format_number($value,$cf);
699
+				}
700
+			}
701 701
 
702 702
 
703
-            $html .= $value;
704
-            $html .= '</div>';
703
+			$html .= $value;
704
+			$html .= '</div>';
705 705
 
706
-        endif;
706
+		endif;
707 707
 
708
-    }
708
+	}
709 709
 
710
-    return $html;
710
+	return $html;
711 711
 }
712 712
 add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3);
713 713
 
@@ -724,98 +724,98 @@  discard block
 block discarded – undo
724 724
  */
725 725
 function geodir_cf_radio($html,$location,$cf,$p=''){
726 726
 
727
-    // check we have the post value
728
-    if(is_int($p)){$post = geodir_get_post_info($p);}
729
-    else{ global $post;}
730
-
731
-    if(!is_array($cf) && $cf!=''){
732
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
733
-        if(!$cf){return NULL;}
734
-    }
735
-
736
-    $html_var = $cf['htmlvar_name'];
737
-
738
-    // Check if there is a location specific filter.
739
-    if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
740
-        /**
741
-         * Filter the radio html by location.
742
-         *
743
-         * @param string $html The html to filter.
744
-         * @param array $cf The custom field array.
745
-         * @since 1.6.6
746
-         */
747
-        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
748
-    }
749
-
750
-    // Check if there is a custom field specific filter.
751
-    if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
752
-        /**
753
-         * Filter the radio html by individual custom field.
754
-         *
755
-         * @param string $html The html to filter.
756
-         * @param string $location The location to output the html.
757
-         * @param array $cf The custom field array.
758
-         * @since 1.6.6
759
-         */
760
-        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
761
-    }
762
-
763
-    // Check if there is a custom field key specific filter.
764
-    if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
765
-        /**
766
-         * Filter the radio html by field type key.
767
-         *
768
-         * @param string $html The html to filter.
769
-         * @param string $location The location to output the html.
770
-         * @param array $cf The custom field array.
771
-         * @since 1.6.6
772
-         */
773
-        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
774
-    }
775
-
776
-    // If not html then we run the standard output.
777
-    if(empty($html)){
778
-
779
-        $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
780
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
781
-
782
-            if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') {
783
-                $html_val = __('No', 'geodirectory');
784
-            } else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') {
785
-                $html_val = __('Yes', 'geodirectory');
786
-            } else {
787
-                if (!empty($cf['option_values'])) {
788
-                    $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
789
-
790
-                    if (!empty($cf_option_values)) {
791
-                        foreach ($cf_option_values as $cf_option_value) {
792
-                            if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
793
-                                $html_val = $cf_option_value['label'];
794
-                            }
795
-                        }
796
-                    }
797
-                }
798
-            }
799
-
800
-            $field_icon = geodir_field_icon_proccess($cf);
801
-            if (strpos($field_icon, 'http') !== false) {
802
-                $field_icon_af = '';
803
-            } elseif ($field_icon == '') {
804
-                $field_icon_af = '';
805
-            } else {
806
-                $field_icon_af = $field_icon;
807
-                $field_icon = '';
808
-            }
809
-
810
-
811
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
812
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
813
-            $html .= '</span>' . $html_val . '</div>';
814
-        endif;
815
-
816
-    }
817
-
818
-    return $html;
727
+	// check we have the post value
728
+	if(is_int($p)){$post = geodir_get_post_info($p);}
729
+	else{ global $post;}
730
+
731
+	if(!is_array($cf) && $cf!=''){
732
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
733
+		if(!$cf){return NULL;}
734
+	}
735
+
736
+	$html_var = $cf['htmlvar_name'];
737
+
738
+	// Check if there is a location specific filter.
739
+	if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
740
+		/**
741
+		 * Filter the radio html by location.
742
+		 *
743
+		 * @param string $html The html to filter.
744
+		 * @param array $cf The custom field array.
745
+		 * @since 1.6.6
746
+		 */
747
+		$html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
748
+	}
749
+
750
+	// Check if there is a custom field specific filter.
751
+	if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
752
+		/**
753
+		 * Filter the radio html by individual custom field.
754
+		 *
755
+		 * @param string $html The html to filter.
756
+		 * @param string $location The location to output the html.
757
+		 * @param array $cf The custom field array.
758
+		 * @since 1.6.6
759
+		 */
760
+		$html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
761
+	}
762
+
763
+	// Check if there is a custom field key specific filter.
764
+	if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
765
+		/**
766
+		 * Filter the radio html by field type key.
767
+		 *
768
+		 * @param string $html The html to filter.
769
+		 * @param string $location The location to output the html.
770
+		 * @param array $cf The custom field array.
771
+		 * @since 1.6.6
772
+		 */
773
+		$html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
774
+	}
775
+
776
+	// If not html then we run the standard output.
777
+	if(empty($html)){
778
+
779
+		$html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
780
+		if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
781
+
782
+			if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') {
783
+				$html_val = __('No', 'geodirectory');
784
+			} else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') {
785
+				$html_val = __('Yes', 'geodirectory');
786
+			} else {
787
+				if (!empty($cf['option_values'])) {
788
+					$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
789
+
790
+					if (!empty($cf_option_values)) {
791
+						foreach ($cf_option_values as $cf_option_value) {
792
+							if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
793
+								$html_val = $cf_option_value['label'];
794
+							}
795
+						}
796
+					}
797
+				}
798
+			}
799
+
800
+			$field_icon = geodir_field_icon_proccess($cf);
801
+			if (strpos($field_icon, 'http') !== false) {
802
+				$field_icon_af = '';
803
+			} elseif ($field_icon == '') {
804
+				$field_icon_af = '';
805
+			} else {
806
+				$field_icon_af = $field_icon;
807
+				$field_icon = '';
808
+			}
809
+
810
+
811
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
812
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
813
+			$html .= '</span>' . $html_val . '</div>';
814
+		endif;
815
+
816
+	}
817
+
818
+	return $html;
819 819
 }
820 820
 add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3);
821 821
 
@@ -833,92 +833,92 @@  discard block
 block discarded – undo
833 833
  */
834 834
 function geodir_cf_select($html,$location,$cf,$p=''){
835 835
 
836
-    // check we have the post value
837
-    if(is_int($p)){$post = geodir_get_post_info($p);}
838
-    else{ global $post;}
839
-
840
-    if(!is_array($cf) && $cf!=''){
841
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
842
-        if(!$cf){return NULL;}
843
-    }
844
-
845
-    $html_var = $cf['htmlvar_name'];
846
-
847
-    // Check if there is a location specific filter.
848
-    if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
849
-        /**
850
-         * Filter the select html by location.
851
-         *
852
-         * @param string $html The html to filter.
853
-         * @param array $cf The custom field array.
854
-         * @since 1.6.6
855
-         */
856
-        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
857
-    }
858
-
859
-    // Check if there is a custom field specific filter.
860
-    if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
861
-        /**
862
-         * Filter the select html by individual custom field.
863
-         *
864
-         * @param string $html The html to filter.
865
-         * @param string $location The location to output the html.
866
-         * @param array $cf The custom field array.
867
-         * @since 1.6.6
868
-         */
869
-        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
870
-    }
871
-
872
-    // Check if there is a custom field key specific filter.
873
-    if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
874
-        /**
875
-         * Filter the select html by field type key.
876
-         *
877
-         * @param string $html The html to filter.
878
-         * @param string $location The location to output the html.
879
-         * @param array $cf The custom field array.
880
-         * @since 1.6.6
881
-         */
882
-        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
883
-    }
884
-
885
-    // If not html then we run the standard output.
886
-    if(empty($html)){
887
-
888
-        if ($post->{$cf['htmlvar_name']}):
889
-            $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
890
-
891
-            if (!empty($cf['option_values'])) {
892
-                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
893
-
894
-                if (!empty($cf_option_values)) {
895
-                    foreach ($cf_option_values as $cf_option_value) {
896
-                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
897
-                            $field_value = $cf_option_value['label']; // no longer needed here. Removed comment because it displays number instead of label if option vales set like "Good/1,Fair/2".
898
-                        }
899
-                    }
900
-                }
901
-            }
902
-
903
-            $field_icon = geodir_field_icon_proccess($cf);
904
-            if (strpos($field_icon, 'http') !== false) {
905
-                $field_icon_af = '';
906
-            } elseif ($field_icon == '') {
907
-                $field_icon_af = '';
908
-            } else {
909
-                $field_icon_af = $field_icon;
910
-                $field_icon = '';
911
-            }
912
-
913
-
914
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
915
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
916
-            $html .= '</span>' . $field_value . '</div>';
917
-        endif;
918
-
919
-    }
920
-
921
-    return $html;
836
+	// check we have the post value
837
+	if(is_int($p)){$post = geodir_get_post_info($p);}
838
+	else{ global $post;}
839
+
840
+	if(!is_array($cf) && $cf!=''){
841
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
842
+		if(!$cf){return NULL;}
843
+	}
844
+
845
+	$html_var = $cf['htmlvar_name'];
846
+
847
+	// Check if there is a location specific filter.
848
+	if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
849
+		/**
850
+		 * Filter the select html by location.
851
+		 *
852
+		 * @param string $html The html to filter.
853
+		 * @param array $cf The custom field array.
854
+		 * @since 1.6.6
855
+		 */
856
+		$html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
857
+	}
858
+
859
+	// Check if there is a custom field specific filter.
860
+	if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
861
+		/**
862
+		 * Filter the select html by individual custom field.
863
+		 *
864
+		 * @param string $html The html to filter.
865
+		 * @param string $location The location to output the html.
866
+		 * @param array $cf The custom field array.
867
+		 * @since 1.6.6
868
+		 */
869
+		$html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
870
+	}
871
+
872
+	// Check if there is a custom field key specific filter.
873
+	if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
874
+		/**
875
+		 * Filter the select html by field type key.
876
+		 *
877
+		 * @param string $html The html to filter.
878
+		 * @param string $location The location to output the html.
879
+		 * @param array $cf The custom field array.
880
+		 * @since 1.6.6
881
+		 */
882
+		$html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
883
+	}
884
+
885
+	// If not html then we run the standard output.
886
+	if(empty($html)){
887
+
888
+		if ($post->{$cf['htmlvar_name']}):
889
+			$field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
890
+
891
+			if (!empty($cf['option_values'])) {
892
+				$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
893
+
894
+				if (!empty($cf_option_values)) {
895
+					foreach ($cf_option_values as $cf_option_value) {
896
+						if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
897
+							$field_value = $cf_option_value['label']; // no longer needed here. Removed comment because it displays number instead of label if option vales set like "Good/1,Fair/2".
898
+						}
899
+					}
900
+				}
901
+			}
902
+
903
+			$field_icon = geodir_field_icon_proccess($cf);
904
+			if (strpos($field_icon, 'http') !== false) {
905
+				$field_icon_af = '';
906
+			} elseif ($field_icon == '') {
907
+				$field_icon_af = '';
908
+			} else {
909
+				$field_icon_af = $field_icon;
910
+				$field_icon = '';
911
+			}
912
+
913
+
914
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
915
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
916
+			$html .= '</span>' . $field_value . '</div>';
917
+		endif;
918
+
919
+	}
920
+
921
+	return $html;
922 922
 }
923 923
 add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3);
924 924
 
@@ -935,117 +935,117 @@  discard block
 block discarded – undo
935 935
  */
936 936
 function geodir_cf_multiselect($html,$location,$cf,$p=''){
937 937
 
938
-    // check we have the post value
939
-    if(is_int($p)){$post = geodir_get_post_info($p);}
940
-    else{ global $post;}
941
-
942
-    if(!is_array($cf) && $cf!=''){
943
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
944
-        if(!$cf){return NULL;}
945
-    }
946
-
947
-    $html_var = $cf['htmlvar_name'];
948
-
949
-    // Check if there is a location specific filter.
950
-    if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
951
-        /**
952
-         * Filter the multiselect html by location.
953
-         *
954
-         * @param string $html The html to filter.
955
-         * @param array $cf The custom field array.
956
-         * @since 1.6.6
957
-         */
958
-        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
959
-    }
960
-
961
-    // Check if there is a custom field specific filter.
962
-    if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
963
-        /**
964
-         * Filter the multiselect html by individual custom field.
965
-         *
966
-         * @param string $html The html to filter.
967
-         * @param string $location The location to output the html.
968
-         * @param array $cf The custom field array.
969
-         * @since 1.6.6
970
-         */
971
-        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
972
-    }
973
-
974
-    // Check if there is a custom field key specific filter.
975
-    if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
976
-        /**
977
-         * Filter the multiselect html by field type key.
978
-         *
979
-         * @param string $html The html to filter.
980
-         * @param string $location The location to output the html.
981
-         * @param array $cf The custom field array.
982
-         * @since 1.6.6
983
-         */
984
-        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
985
-    }
986
-
987
-    // If not html then we run the standard output.
988
-    if(empty($html)){
989
-
990
-
991
-        if (!empty($post->{$cf['htmlvar_name']})):
992
-
993
-            if (is_array($post->{$cf['htmlvar_name']})) {
994
-                $post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']});
995
-            }
996
-
997
-            $field_icon = geodir_field_icon_proccess($cf);
998
-            if (strpos($field_icon, 'http') !== false) {
999
-                $field_icon_af = '';
1000
-            } elseif ($field_icon == '') {
1001
-                $field_icon_af = '';
1002
-            } else {
1003
-                $field_icon_af = $field_icon;
1004
-                $field_icon = '';
1005
-            }
1006
-
1007
-            $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
1008
-
1009
-            if(is_array($field_values)){
1010
-                $field_values = array_map('trim', $field_values);
1011
-            }
1012
-
1013
-            $option_values = array();
1014
-            if (!empty($cf['option_values'])) {
1015
-                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
1016
-
1017
-                if (!empty($cf_option_values)) {
1018
-                    foreach ($cf_option_values as $cf_option_value) {
1019
-                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
1020
-                            $option_values[] = $cf_option_value['label'];
1021
-                        }
1022
-                    }
1023
-                }
1024
-            }
1025
-
1026
-
1027
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1028
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1029
-            $html .= '</span>';
1030
-
1031
-            if (count($option_values) > 1) {
1032
-                $html .= '<ul>';
1033
-
1034
-                foreach ($option_values as $val) {
1035
-                    $html .= '<li>' . $val . '</li>';
1036
-                }
1037
-
1038
-                $html .= '</ul>';
1039
-            } else {
1040
-                $html .= __($post->{$cf['htmlvar_name']}, 'geodirectory');
1041
-            }
1042
-
1043
-            $html .= '</div>';
1044
-        endif;
1045
-
1046
-    }
1047
-
1048
-    return $html;
938
+	// check we have the post value
939
+	if(is_int($p)){$post = geodir_get_post_info($p);}
940
+	else{ global $post;}
941
+
942
+	if(!is_array($cf) && $cf!=''){
943
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
944
+		if(!$cf){return NULL;}
945
+	}
946
+
947
+	$html_var = $cf['htmlvar_name'];
948
+
949
+	// Check if there is a location specific filter.
950
+	if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
951
+		/**
952
+		 * Filter the multiselect html by location.
953
+		 *
954
+		 * @param string $html The html to filter.
955
+		 * @param array $cf The custom field array.
956
+		 * @since 1.6.6
957
+		 */
958
+		$html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
959
+	}
960
+
961
+	// Check if there is a custom field specific filter.
962
+	if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
963
+		/**
964
+		 * Filter the multiselect html by individual custom field.
965
+		 *
966
+		 * @param string $html The html to filter.
967
+		 * @param string $location The location to output the html.
968
+		 * @param array $cf The custom field array.
969
+		 * @since 1.6.6
970
+		 */
971
+		$html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
972
+	}
973
+
974
+	// Check if there is a custom field key specific filter.
975
+	if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
976
+		/**
977
+		 * Filter the multiselect html by field type key.
978
+		 *
979
+		 * @param string $html The html to filter.
980
+		 * @param string $location The location to output the html.
981
+		 * @param array $cf The custom field array.
982
+		 * @since 1.6.6
983
+		 */
984
+		$html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
985
+	}
986
+
987
+	// If not html then we run the standard output.
988
+	if(empty($html)){
989
+
990
+
991
+		if (!empty($post->{$cf['htmlvar_name']})):
992
+
993
+			if (is_array($post->{$cf['htmlvar_name']})) {
994
+				$post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']});
995
+			}
996
+
997
+			$field_icon = geodir_field_icon_proccess($cf);
998
+			if (strpos($field_icon, 'http') !== false) {
999
+				$field_icon_af = '';
1000
+			} elseif ($field_icon == '') {
1001
+				$field_icon_af = '';
1002
+			} else {
1003
+				$field_icon_af = $field_icon;
1004
+				$field_icon = '';
1005
+			}
1006
+
1007
+			$field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
1008
+
1009
+			if(is_array($field_values)){
1010
+				$field_values = array_map('trim', $field_values);
1011
+			}
1012
+
1013
+			$option_values = array();
1014
+			if (!empty($cf['option_values'])) {
1015
+				$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
1016
+
1017
+				if (!empty($cf_option_values)) {
1018
+					foreach ($cf_option_values as $cf_option_value) {
1019
+						if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
1020
+							$option_values[] = $cf_option_value['label'];
1021
+						}
1022
+					}
1023
+				}
1024
+			}
1025
+
1026
+
1027
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1028
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1029
+			$html .= '</span>';
1030
+
1031
+			if (count($option_values) > 1) {
1032
+				$html .= '<ul>';
1033
+
1034
+				foreach ($option_values as $val) {
1035
+					$html .= '<li>' . $val . '</li>';
1036
+				}
1037
+
1038
+				$html .= '</ul>';
1039
+			} else {
1040
+				$html .= __($post->{$cf['htmlvar_name']}, 'geodirectory');
1041
+			}
1042
+
1043
+			$html .= '</div>';
1044
+		endif;
1045
+
1046
+	}
1047
+
1048
+	return $html;
1049 1049
 }
1050 1050
 add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3);
1051 1051
 
@@ -1062,155 +1062,155 @@  discard block
 block discarded – undo
1062 1062
  */
1063 1063
 function geodir_cf_email($html,$location,$cf,$p=''){
1064 1064
 
1065
-    // check we have the post value
1066
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1067
-    else{ global $post;}
1068
-
1069
-    if(!is_array($cf) && $cf!=''){
1070
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1071
-        if(!$cf){return NULL;}
1072
-    }
1073
-
1074
-    $html_var = $cf['htmlvar_name'];
1075
-
1076
-    // Check if there is a location specific filter.
1077
-    if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1078
-        /**
1079
-         * Filter the email html by location.
1080
-         *
1081
-         * @param string $html The html to filter.
1082
-         * @param array $cf The custom field array.
1083
-         * @since 1.6.6
1084
-         */
1085
-        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1086
-    }
1087
-
1088
-    // Check if there is a custom field specific filter.
1089
-    if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1090
-        /**
1091
-         * Filter the email html by individual custom field.
1092
-         *
1093
-         * @param string $html The html to filter.
1094
-         * @param string $location The location to output the html.
1095
-         * @param array $cf The custom field array.
1096
-         * @since 1.6.6
1097
-         */
1098
-        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1099
-    }
1100
-
1101
-    // Check if there is a custom field key specific filter.
1102
-    if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1103
-        /**
1104
-         * Filter the email html by field type key.
1105
-         *
1106
-         * @param string $html The html to filter.
1107
-         * @param string $location The location to output the html.
1108
-         * @param array $cf The custom field array.
1109
-         * @since 1.6.6
1110
-         */
1111
-        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1112
-    }
1113
-
1114
-    // If not html then we run the standard output.
1115
-    if(empty($html)){
1116
-
1117
-        global $preview;
1118
-        if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1119
-            return ''; // Remove Send Enquiry | Send To Friend from listings page
1120
-        }
1121
-
1122
-        $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1123
-
1124
-        if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) {
1125
-            global $send_to_friend;
1126
-            $send_to_friend = true;
1127
-            $b_send_inquiry = '';
1128
-            $b_sendtofriend = '';
1129
-
1130
-            $html = '';
1131
-            if (!$preview) {
1132
-                $b_send_inquiry = 'b_send_inquiry';
1133
-                $b_sendtofriend = 'b_sendtofriend';
1134
-                $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1135
-            }
1136
-
1137
-            $field_icon = geodir_field_icon_proccess($cf);
1138
-            if (strpos($field_icon, 'http') !== false) {
1139
-                $field_icon_af = '';
1140
-            } elseif ($field_icon == '') {
1141
-                $field_icon_af = '<i class="fa fa-envelope"></i>';
1142
-            } else {
1143
-                $field_icon_af = $field_icon;
1144
-                $field_icon = '';
1145
-            }
1146
-
1147
-            $html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1148
-            $seperator = '';
1149
-            if ($post->{$cf['htmlvar_name']}) {
1150
-                $b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);');
1151
-                $html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1152
-                $seperator = ' | ';
1153
-            }
1154
-
1155
-            if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) {
1156
-                $b_sendtofriend_url = apply_filters('b_sendtofriend_url', 'javascript:void(0);');
1157
-                $html .= $seperator . '<a href="'.$b_sendtofriend_url.'" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1158
-            }
1159
-
1160
-            $html .= '</span></div>';
1161
-
1162
-
1163
-            if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1164
-                $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1165
-            } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1166
-                $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1167
-            } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1168
-                $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1169
-            }
1170
-
1171
-            /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
1172
-
1173
-        } else {
1174
-
1175
-            if ($post->{$cf['htmlvar_name']}) {
1176
-
1177
-                $field_icon = geodir_field_icon_proccess($cf);
1178
-                if (strpos($field_icon, 'http') !== false) {
1179
-                    $field_icon_af = '';
1180
-                } elseif ($field_icon == '') {
1181
-                    $field_icon_af = '<i class="fa fa-envelope"></i>';
1182
-                } else {
1183
-                    $field_icon_af = $field_icon;
1184
-                    $field_icon = '';
1185
-                }
1186
-
1187
-
1188
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1189
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1190
-                $html .= '</span><span class="geodir-email-address-output">';
1191
-                $email = $post->{$cf['htmlvar_name']} ;
1192
-                if($e_split = explode('@',$email)){
1193
-                    /**
1194
-                     * Filter email custom field name output.
1195
-                     *
1196
-                     * @since 1.5.3
1197
-                     *
1198
-                     * @param string $email The email string being output.
1199
-                     * @param array $cf Custom field variables array.
1200
-                     */
1201
-                    $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1202
-                    $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1203
-                }else{
1204
-                    $html .=  $email;
1205
-                }
1206
-                $html .= '</span></div>';
1207
-            }
1208
-
1209
-        }
1210
-
1211
-    }
1212
-
1213
-    return $html;
1065
+	// check we have the post value
1066
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1067
+	else{ global $post;}
1068
+
1069
+	if(!is_array($cf) && $cf!=''){
1070
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1071
+		if(!$cf){return NULL;}
1072
+	}
1073
+
1074
+	$html_var = $cf['htmlvar_name'];
1075
+
1076
+	// Check if there is a location specific filter.
1077
+	if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1078
+		/**
1079
+		 * Filter the email html by location.
1080
+		 *
1081
+		 * @param string $html The html to filter.
1082
+		 * @param array $cf The custom field array.
1083
+		 * @since 1.6.6
1084
+		 */
1085
+		$html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1086
+	}
1087
+
1088
+	// Check if there is a custom field specific filter.
1089
+	if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1090
+		/**
1091
+		 * Filter the email html by individual custom field.
1092
+		 *
1093
+		 * @param string $html The html to filter.
1094
+		 * @param string $location The location to output the html.
1095
+		 * @param array $cf The custom field array.
1096
+		 * @since 1.6.6
1097
+		 */
1098
+		$html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1099
+	}
1100
+
1101
+	// Check if there is a custom field key specific filter.
1102
+	if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1103
+		/**
1104
+		 * Filter the email html by field type key.
1105
+		 *
1106
+		 * @param string $html The html to filter.
1107
+		 * @param string $location The location to output the html.
1108
+		 * @param array $cf The custom field array.
1109
+		 * @since 1.6.6
1110
+		 */
1111
+		$html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1112
+	}
1113
+
1114
+	// If not html then we run the standard output.
1115
+	if(empty($html)){
1116
+
1117
+		global $preview;
1118
+		if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1119
+			return ''; // Remove Send Enquiry | Send To Friend from listings page
1120
+		}
1121
+
1122
+		$package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1123
+
1124
+		if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) {
1125
+			global $send_to_friend;
1126
+			$send_to_friend = true;
1127
+			$b_send_inquiry = '';
1128
+			$b_sendtofriend = '';
1129
+
1130
+			$html = '';
1131
+			if (!$preview) {
1132
+				$b_send_inquiry = 'b_send_inquiry';
1133
+				$b_sendtofriend = 'b_sendtofriend';
1134
+				$html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1135
+			}
1136
+
1137
+			$field_icon = geodir_field_icon_proccess($cf);
1138
+			if (strpos($field_icon, 'http') !== false) {
1139
+				$field_icon_af = '';
1140
+			} elseif ($field_icon == '') {
1141
+				$field_icon_af = '<i class="fa fa-envelope"></i>';
1142
+			} else {
1143
+				$field_icon_af = $field_icon;
1144
+				$field_icon = '';
1145
+			}
1146
+
1147
+			$html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1148
+			$seperator = '';
1149
+			if ($post->{$cf['htmlvar_name']}) {
1150
+				$b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);');
1151
+				$html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1152
+				$seperator = ' | ';
1153
+			}
1154
+
1155
+			if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) {
1156
+				$b_sendtofriend_url = apply_filters('b_sendtofriend_url', 'javascript:void(0);');
1157
+				$html .= $seperator . '<a href="'.$b_sendtofriend_url.'" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1158
+			}
1159
+
1160
+			$html .= '</span></div>';
1161
+
1162
+
1163
+			if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1164
+				$html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1165
+			} elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1166
+				$html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1167
+			} elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1168
+				$html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1169
+			}
1170
+
1171
+			/*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
1172
+
1173
+		} else {
1174
+
1175
+			if ($post->{$cf['htmlvar_name']}) {
1176
+
1177
+				$field_icon = geodir_field_icon_proccess($cf);
1178
+				if (strpos($field_icon, 'http') !== false) {
1179
+					$field_icon_af = '';
1180
+				} elseif ($field_icon == '') {
1181
+					$field_icon_af = '<i class="fa fa-envelope"></i>';
1182
+				} else {
1183
+					$field_icon_af = $field_icon;
1184
+					$field_icon = '';
1185
+				}
1186
+
1187
+
1188
+				$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1189
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1190
+				$html .= '</span><span class="geodir-email-address-output">';
1191
+				$email = $post->{$cf['htmlvar_name']} ;
1192
+				if($e_split = explode('@',$email)){
1193
+					/**
1194
+					 * Filter email custom field name output.
1195
+					 *
1196
+					 * @since 1.5.3
1197
+					 *
1198
+					 * @param string $email The email string being output.
1199
+					 * @param array $cf Custom field variables array.
1200
+					 */
1201
+					$email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1202
+					$html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1203
+				}else{
1204
+					$html .=  $email;
1205
+				}
1206
+				$html .= '</span></div>';
1207
+			}
1208
+
1209
+		}
1210
+
1211
+	}
1212
+
1213
+	return $html;
1214 1214
 }
1215 1215
 add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3);
1216 1216
 
@@ -1227,130 +1227,130 @@  discard block
 block discarded – undo
1227 1227
  */
1228 1228
 function geodir_cf_file($html,$location,$cf,$p=''){
1229 1229
 
1230
-    // check we have the post value
1231
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1232
-    else{ global $post;}
1233
-
1234
-    if(!is_array($cf) && $cf!=''){
1235
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1236
-        if(!$cf){return NULL;}
1237
-    }
1238
-
1239
-    $html_var = $cf['htmlvar_name'];
1240
-
1241
-    // Check if there is a location specific filter.
1242
-    if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1243
-        /**
1244
-         * Filter the file html by location.
1245
-         *
1246
-         * @param string $html The html to filter.
1247
-         * @param array $cf The custom field array.
1248
-         * @since 1.6.6
1249
-         */
1250
-        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1251
-    }
1252
-
1253
-    // Check if there is a custom field specific filter.
1254
-    if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1255
-        /**
1256
-         * Filter the file html by individual custom field.
1257
-         *
1258
-         * @param string $html The html to filter.
1259
-         * @param string $location The location to output the html.
1260
-         * @param array $cf The custom field array.
1261
-         * @since 1.6.6
1262
-         */
1263
-        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1264
-    }
1265
-
1266
-    // Check if there is a custom field key specific filter.
1267
-    if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1268
-        /**
1269
-         * Filter the file html by field type key.
1270
-         *
1271
-         * @param string $html The html to filter.
1272
-         * @param string $location The location to output the html.
1273
-         * @param array $cf The custom field array.
1274
-         * @since 1.6.6
1275
-         */
1276
-        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1277
-    }
1278
-
1279
-    // If not html then we run the standard output.
1280
-    if(empty($html)){
1281
-
1282
-        if (!empty($post->{$cf['htmlvar_name']})):
1283
-
1284
-            $files = explode(",", $post->{$cf['htmlvar_name']});
1285
-            if (!empty($files)):
1286
-
1287
-                $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL;
1288
-                $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1289
-
1290
-                $file_paths = '';
1291
-                foreach ($files as $file) {
1292
-                    if (!empty($file)) {
1293
-
1294
-                        // $filetype = wp_check_filetype($file);
1295
-
1296
-                        $image_name_arr = explode('/', $file);
1297
-                        $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1298
-                        $filename = end($image_name_arr);
1299
-                        $img_name_arr = explode('.', $filename);
1300
-
1301
-                        $arr_file_type = wp_check_filetype($filename);
1302
-                        if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1303
-                            continue;
1304
-                        }
1305
-
1306
-                        $uploaded_file_type = $arr_file_type['type'];
1307
-                        $uploaded_file_ext = $arr_file_type['ext'];
1308
-
1309
-                        if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1310
-                            continue; // Invalid file type.
1311
-                        }
1312
-
1313
-                        //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1314
-                        $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
1315
-
1316
-                        // If the uploaded file is image
1317
-                        if (in_array($uploaded_file_type, $image_file_types)) {
1318
-                            $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
1319
-                            $file_paths .= '<a href="'.$file.'">';
1320
-                            $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
1321
-                            $file_paths .= '</a>';
1322
-                            //$file_paths .= '<img src="'.$file.'"  />';	
1323
-                            $file_paths .= '</div>';
1324
-                        } else {
1325
-                            $ext_path = '_' . $html_var . '_';
1326
-                            $filename = explode($ext_path, $filename);
1327
-                            $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1328
-                        }
1329
-                    }
1330
-                }
1331
-
1332
-                $field_icon = geodir_field_icon_proccess($cf);
1333
-                if (strpos($field_icon, 'http') !== false) {
1334
-                    $field_icon_af = '';
1335
-                } elseif ($field_icon == '') {
1336
-                    $field_icon_af = '';
1337
-                } else {
1338
-                    $field_icon_af = $field_icon;
1339
-                    $field_icon = '';
1340
-                }
1341
-
1342
-                $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1343
-                $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1344
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1345
-                $html .= '</span>';
1346
-                $html .= $file_paths . '</div></div>';
1347
-
1348
-            endif;
1349
-        endif;
1350
-
1351
-    }
1352
-
1353
-    return $html;
1230
+	// check we have the post value
1231
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1232
+	else{ global $post;}
1233
+
1234
+	if(!is_array($cf) && $cf!=''){
1235
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1236
+		if(!$cf){return NULL;}
1237
+	}
1238
+
1239
+	$html_var = $cf['htmlvar_name'];
1240
+
1241
+	// Check if there is a location specific filter.
1242
+	if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1243
+		/**
1244
+		 * Filter the file html by location.
1245
+		 *
1246
+		 * @param string $html The html to filter.
1247
+		 * @param array $cf The custom field array.
1248
+		 * @since 1.6.6
1249
+		 */
1250
+		$html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1251
+	}
1252
+
1253
+	// Check if there is a custom field specific filter.
1254
+	if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1255
+		/**
1256
+		 * Filter the file html by individual custom field.
1257
+		 *
1258
+		 * @param string $html The html to filter.
1259
+		 * @param string $location The location to output the html.
1260
+		 * @param array $cf The custom field array.
1261
+		 * @since 1.6.6
1262
+		 */
1263
+		$html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1264
+	}
1265
+
1266
+	// Check if there is a custom field key specific filter.
1267
+	if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1268
+		/**
1269
+		 * Filter the file html by field type key.
1270
+		 *
1271
+		 * @param string $html The html to filter.
1272
+		 * @param string $location The location to output the html.
1273
+		 * @param array $cf The custom field array.
1274
+		 * @since 1.6.6
1275
+		 */
1276
+		$html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1277
+	}
1278
+
1279
+	// If not html then we run the standard output.
1280
+	if(empty($html)){
1281
+
1282
+		if (!empty($post->{$cf['htmlvar_name']})):
1283
+
1284
+			$files = explode(",", $post->{$cf['htmlvar_name']});
1285
+			if (!empty($files)):
1286
+
1287
+				$extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL;
1288
+				$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1289
+
1290
+				$file_paths = '';
1291
+				foreach ($files as $file) {
1292
+					if (!empty($file)) {
1293
+
1294
+						// $filetype = wp_check_filetype($file);
1295
+
1296
+						$image_name_arr = explode('/', $file);
1297
+						$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1298
+						$filename = end($image_name_arr);
1299
+						$img_name_arr = explode('.', $filename);
1300
+
1301
+						$arr_file_type = wp_check_filetype($filename);
1302
+						if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1303
+							continue;
1304
+						}
1305
+
1306
+						$uploaded_file_type = $arr_file_type['type'];
1307
+						$uploaded_file_ext = $arr_file_type['ext'];
1308
+
1309
+						if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1310
+							continue; // Invalid file type.
1311
+						}
1312
+
1313
+						//$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1314
+						$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
1315
+
1316
+						// If the uploaded file is image
1317
+						if (in_array($uploaded_file_type, $image_file_types)) {
1318
+							$file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
1319
+							$file_paths .= '<a href="'.$file.'">';
1320
+							$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
1321
+							$file_paths .= '</a>';
1322
+							//$file_paths .= '<img src="'.$file.'"  />';	
1323
+							$file_paths .= '</div>';
1324
+						} else {
1325
+							$ext_path = '_' . $html_var . '_';
1326
+							$filename = explode($ext_path, $filename);
1327
+							$file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1328
+						}
1329
+					}
1330
+				}
1331
+
1332
+				$field_icon = geodir_field_icon_proccess($cf);
1333
+				if (strpos($field_icon, 'http') !== false) {
1334
+					$field_icon_af = '';
1335
+				} elseif ($field_icon == '') {
1336
+					$field_icon_af = '';
1337
+				} else {
1338
+					$field_icon_af = $field_icon;
1339
+					$field_icon = '';
1340
+				}
1341
+
1342
+				$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1343
+				$html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1344
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1345
+				$html .= '</span>';
1346
+				$html .= $file_paths . '</div></div>';
1347
+
1348
+			endif;
1349
+		endif;
1350
+
1351
+	}
1352
+
1353
+	return $html;
1354 1354
 }
1355 1355
 add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3);
1356 1356
 
@@ -1368,80 +1368,80 @@  discard block
 block discarded – undo
1368 1368
  */
1369 1369
 function geodir_cf_textarea($html,$location,$cf,$p=''){
1370 1370
 
1371
-    // check we have the post value
1372
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1373
-    else{ global $post;}
1374
-
1375
-    if(!is_array($cf) && $cf!=''){
1376
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1377
-        if(!$cf){return NULL;}
1378
-    }
1379
-
1380
-    $html_var = $cf['htmlvar_name'];
1381
-
1382
-    // Check if there is a location specific filter.
1383
-    if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1384
-        /**
1385
-         * Filter the textarea html by location.
1386
-         *
1387
-         * @param string $html The html to filter.
1388
-         * @param array $cf The custom field array.
1389
-         * @since 1.6.6
1390
-         */
1391
-        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1392
-    }
1393
-
1394
-    // Check if there is a custom field specific filter.
1395
-    if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1396
-        /**
1397
-         * Filter the textarea html by individual custom field.
1398
-         *
1399
-         * @param string $html The html to filter.
1400
-         * @param string $location The location to output the html.
1401
-         * @param array $cf The custom field array.
1402
-         * @since 1.6.6
1403
-         */
1404
-        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1405
-    }
1406
-
1407
-    // Check if there is a custom field key specific filter.
1408
-    if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1409
-        /**
1410
-         * Filter the textarea html by field type key.
1411
-         *
1412
-         * @param string $html The html to filter.
1413
-         * @param string $location The location to output the html.
1414
-         * @param array $cf The custom field array.
1415
-         * @since 1.6.6
1416
-         */
1417
-        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1418
-    }
1419
-
1420
-    // If not html then we run the standard output.
1421
-    if(empty($html)){
1422
-
1423
-        if (!empty($post->{$cf['htmlvar_name']})) {
1424
-
1425
-            $field_icon = geodir_field_icon_proccess($cf);
1426
-            if (strpos($field_icon, 'http') !== false) {
1427
-                $field_icon_af = '';
1428
-            } elseif ($field_icon == '') {
1429
-                $field_icon_af = '';
1430
-            } else {
1431
-                $field_icon_af = $field_icon;
1432
-                $field_icon = '';
1433
-            }
1434
-
1435
-
1436
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1437
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1438
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1439
-
1440
-        }
1441
-
1442
-    }
1443
-
1444
-    return $html;
1371
+	// check we have the post value
1372
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1373
+	else{ global $post;}
1374
+
1375
+	if(!is_array($cf) && $cf!=''){
1376
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1377
+		if(!$cf){return NULL;}
1378
+	}
1379
+
1380
+	$html_var = $cf['htmlvar_name'];
1381
+
1382
+	// Check if there is a location specific filter.
1383
+	if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1384
+		/**
1385
+		 * Filter the textarea html by location.
1386
+		 *
1387
+		 * @param string $html The html to filter.
1388
+		 * @param array $cf The custom field array.
1389
+		 * @since 1.6.6
1390
+		 */
1391
+		$html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1392
+	}
1393
+
1394
+	// Check if there is a custom field specific filter.
1395
+	if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1396
+		/**
1397
+		 * Filter the textarea html by individual custom field.
1398
+		 *
1399
+		 * @param string $html The html to filter.
1400
+		 * @param string $location The location to output the html.
1401
+		 * @param array $cf The custom field array.
1402
+		 * @since 1.6.6
1403
+		 */
1404
+		$html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1405
+	}
1406
+
1407
+	// Check if there is a custom field key specific filter.
1408
+	if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1409
+		/**
1410
+		 * Filter the textarea html by field type key.
1411
+		 *
1412
+		 * @param string $html The html to filter.
1413
+		 * @param string $location The location to output the html.
1414
+		 * @param array $cf The custom field array.
1415
+		 * @since 1.6.6
1416
+		 */
1417
+		$html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1418
+	}
1419
+
1420
+	// If not html then we run the standard output.
1421
+	if(empty($html)){
1422
+
1423
+		if (!empty($post->{$cf['htmlvar_name']})) {
1424
+
1425
+			$field_icon = geodir_field_icon_proccess($cf);
1426
+			if (strpos($field_icon, 'http') !== false) {
1427
+				$field_icon_af = '';
1428
+			} elseif ($field_icon == '') {
1429
+				$field_icon_af = '';
1430
+			} else {
1431
+				$field_icon_af = $field_icon;
1432
+				$field_icon = '';
1433
+			}
1434
+
1435
+
1436
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1437
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1438
+			$html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1439
+
1440
+		}
1441
+
1442
+	}
1443
+
1444
+	return $html;
1445 1445
 }
1446 1446
 add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3);
1447 1447
 
@@ -1459,79 +1459,79 @@  discard block
 block discarded – undo
1459 1459
  */
1460 1460
 function geodir_cf_html($html,$location,$cf,$p=''){
1461 1461
 
1462
-    // check we have the post value
1463
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1464
-    else{ global $post;}
1465
-
1466
-    if(!is_array($cf) && $cf!=''){
1467
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1468
-        if(!$cf){return NULL;}
1469
-    }
1470
-
1471
-    $html_var = $cf['htmlvar_name'];
1472
-
1473
-    // Check if there is a location specific filter.
1474
-    if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1475
-        /**
1476
-         * Filter the html html by location.
1477
-         *
1478
-         * @param string $html The html to filter.
1479
-         * @param array $cf The custom field array.
1480
-         * @since 1.6.6
1481
-         */
1482
-        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1483
-    }
1484
-
1485
-    // Check if there is a custom field specific filter.
1486
-    if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1487
-        /**
1488
-         * Filter the html html by individual custom field.
1489
-         *
1490
-         * @param string $html The html to filter.
1491
-         * @param string $location The location to output the html.
1492
-         * @param array $cf The custom field array.
1493
-         * @since 1.6.6
1494
-         */
1495
-        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1496
-    }
1497
-
1498
-    // Check if there is a custom field key specific filter.
1499
-    if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1500
-        /**
1501
-         * Filter the html html by field type key.
1502
-         *
1503
-         * @param string $html The html to filter.
1504
-         * @param string $location The location to output the html.
1505
-         * @param array $cf The custom field array.
1506
-         * @since 1.6.6
1507
-         */
1508
-        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1509
-    }
1510
-
1511
-    // If not html then we run the standard output.
1512
-    if(empty($html)){
1513
-
1514
-        if (!empty($post->{$cf['htmlvar_name']})) {
1515
-
1516
-            $field_icon = geodir_field_icon_proccess($cf);
1517
-            if (strpos($field_icon, 'http') !== false) {
1518
-                $field_icon_af = '';
1519
-            } elseif ($field_icon == '') {
1520
-                $field_icon_af = '';
1521
-            } else {
1522
-                $field_icon_af = $field_icon;
1523
-                $field_icon = '';
1524
-            }
1525
-
1526
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1527
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1528
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1529
-
1530
-        }
1531
-
1532
-    }
1533
-
1534
-    return $html;
1462
+	// check we have the post value
1463
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1464
+	else{ global $post;}
1465
+
1466
+	if(!is_array($cf) && $cf!=''){
1467
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1468
+		if(!$cf){return NULL;}
1469
+	}
1470
+
1471
+	$html_var = $cf['htmlvar_name'];
1472
+
1473
+	// Check if there is a location specific filter.
1474
+	if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1475
+		/**
1476
+		 * Filter the html html by location.
1477
+		 *
1478
+		 * @param string $html The html to filter.
1479
+		 * @param array $cf The custom field array.
1480
+		 * @since 1.6.6
1481
+		 */
1482
+		$html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1483
+	}
1484
+
1485
+	// Check if there is a custom field specific filter.
1486
+	if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1487
+		/**
1488
+		 * Filter the html html by individual custom field.
1489
+		 *
1490
+		 * @param string $html The html to filter.
1491
+		 * @param string $location The location to output the html.
1492
+		 * @param array $cf The custom field array.
1493
+		 * @since 1.6.6
1494
+		 */
1495
+		$html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1496
+	}
1497
+
1498
+	// Check if there is a custom field key specific filter.
1499
+	if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1500
+		/**
1501
+		 * Filter the html html by field type key.
1502
+		 *
1503
+		 * @param string $html The html to filter.
1504
+		 * @param string $location The location to output the html.
1505
+		 * @param array $cf The custom field array.
1506
+		 * @since 1.6.6
1507
+		 */
1508
+		$html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1509
+	}
1510
+
1511
+	// If not html then we run the standard output.
1512
+	if(empty($html)){
1513
+
1514
+		if (!empty($post->{$cf['htmlvar_name']})) {
1515
+
1516
+			$field_icon = geodir_field_icon_proccess($cf);
1517
+			if (strpos($field_icon, 'http') !== false) {
1518
+				$field_icon_af = '';
1519
+			} elseif ($field_icon == '') {
1520
+				$field_icon_af = '';
1521
+			} else {
1522
+				$field_icon_af = $field_icon;
1523
+				$field_icon = '';
1524
+			}
1525
+
1526
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1527
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1528
+			$html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1529
+
1530
+		}
1531
+
1532
+	}
1533
+
1534
+	return $html;
1535 1535
 }
1536 1536
 add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3);
1537 1537
 
@@ -1549,113 +1549,113 @@  discard block
 block discarded – undo
1549 1549
  */
1550 1550
 function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1551 1551
 
1552
-    // check we have the post value
1553
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1554
-    else{ global $post;}
1555
-
1556
-    if(!is_array($cf) && $cf!=''){
1557
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1558
-        if(!$cf){return NULL;}
1559
-    }
1560
-
1561
-    $html_var = $cf['htmlvar_name'];
1562
-
1563
-    // Check if there is a location specific filter.
1564
-    if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1565
-        /**
1566
-         * Filter the taxonomy html by location.
1567
-         *
1568
-         * @param string $html The html to filter.
1569
-         * @param array $cf The custom field array.
1570
-         * @since 1.6.6
1571
-         */
1572
-        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1573
-    }
1574
-
1575
-    // Check if there is a custom field specific filter.
1576
-    if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1577
-        /**
1578
-         * Filter the taxonomy html by individual custom field.
1579
-         *
1580
-         * @param string $html The html to filter.
1581
-         * @param string $location The location to output the html.
1582
-         * @param array $cf The custom field array.
1583
-         * @since 1.6.6
1584
-         */
1585
-        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1586
-    }
1587
-
1588
-    // Check if there is a custom field key specific filter.
1589
-    if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1590
-        /**
1591
-         * Filter the taxonomy html by field type key.
1592
-         *
1593
-         * @param string $html The html to filter.
1594
-         * @param string $location The location to output the html.
1595
-         * @param array $cf The custom field array.
1596
-         * @since 1.6.6
1597
-         */
1598
-        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1599
-    }
1600
-
1601
-    // If not html then we run the standard output.
1602
-    if(empty($html)){
1603
-
1604
-        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1605
-            $post_taxonomy = $post->post_type . 'category';
1606
-            $field_value = $post->{$html_var};
1607
-            $links = array();
1608
-            $terms = array();
1609
-            $termsOrdered = array();
1610
-            if (!is_array($field_value)) {
1611
-                $field_value = explode(",", trim($field_value, ","));
1612
-            }
1613
-
1614
-            $field_value = array_unique($field_value);
1615
-
1616
-            if (!empty($field_value)) {
1617
-                foreach ($field_value as $term) {
1618
-                    $term = trim($term);
1619
-
1620
-                    if ($term != '') {
1621
-                        $term = get_term_by('id', $term, $html_var);
1622
-                        if (is_object($term)) {
1623
-                            $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1624
-                            $terms[] = $term;
1625
-                        }
1626
-                    }
1627
-                }
1628
-                if (!empty($links)) {
1629
-                    // order alphabetically
1630
-                    asort($links);
1631
-                    foreach (array_keys($links) as $key) {
1632
-                        $termsOrdered[$key] = $terms[$key];
1633
-                    }
1634
-                    $terms = $termsOrdered;
1635
-                }
1636
-            }
1637
-            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1638
-
1639
-            if ($html_value != '') {
1640
-                $field_icon = geodir_field_icon_proccess($cf);
1641
-                if (strpos($field_icon, 'http') !== false) {
1642
-                    $field_icon_af = '';
1643
-                } else if ($field_icon == '') {
1644
-                    $field_icon_af = '';
1645
-                } else {
1646
-                    $field_icon_af = $field_icon;
1647
-                    $field_icon = '';
1648
-                }
1649
-
1650
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1651
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1652
-                $html .= '</span> ' . $html_value . '</div>';
1653
-            }
1654
-        }
1655
-
1656
-    }
1657
-
1658
-    return $html;
1552
+	// check we have the post value
1553
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1554
+	else{ global $post;}
1555
+
1556
+	if(!is_array($cf) && $cf!=''){
1557
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1558
+		if(!$cf){return NULL;}
1559
+	}
1560
+
1561
+	$html_var = $cf['htmlvar_name'];
1562
+
1563
+	// Check if there is a location specific filter.
1564
+	if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1565
+		/**
1566
+		 * Filter the taxonomy html by location.
1567
+		 *
1568
+		 * @param string $html The html to filter.
1569
+		 * @param array $cf The custom field array.
1570
+		 * @since 1.6.6
1571
+		 */
1572
+		$html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1573
+	}
1574
+
1575
+	// Check if there is a custom field specific filter.
1576
+	if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1577
+		/**
1578
+		 * Filter the taxonomy html by individual custom field.
1579
+		 *
1580
+		 * @param string $html The html to filter.
1581
+		 * @param string $location The location to output the html.
1582
+		 * @param array $cf The custom field array.
1583
+		 * @since 1.6.6
1584
+		 */
1585
+		$html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1586
+	}
1587
+
1588
+	// Check if there is a custom field key specific filter.
1589
+	if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1590
+		/**
1591
+		 * Filter the taxonomy html by field type key.
1592
+		 *
1593
+		 * @param string $html The html to filter.
1594
+		 * @param string $location The location to output the html.
1595
+		 * @param array $cf The custom field array.
1596
+		 * @since 1.6.6
1597
+		 */
1598
+		$html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1599
+	}
1600
+
1601
+	// If not html then we run the standard output.
1602
+	if(empty($html)){
1603
+
1604
+		if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1605
+			$post_taxonomy = $post->post_type . 'category';
1606
+			$field_value = $post->{$html_var};
1607
+			$links = array();
1608
+			$terms = array();
1609
+			$termsOrdered = array();
1610
+			if (!is_array($field_value)) {
1611
+				$field_value = explode(",", trim($field_value, ","));
1612
+			}
1613
+
1614
+			$field_value = array_unique($field_value);
1615
+
1616
+			if (!empty($field_value)) {
1617
+				foreach ($field_value as $term) {
1618
+					$term = trim($term);
1619
+
1620
+					if ($term != '') {
1621
+						$term = get_term_by('id', $term, $html_var);
1622
+						if (is_object($term)) {
1623
+							$links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1624
+							$terms[] = $term;
1625
+						}
1626
+					}
1627
+				}
1628
+				if (!empty($links)) {
1629
+					// order alphabetically
1630
+					asort($links);
1631
+					foreach (array_keys($links) as $key) {
1632
+						$termsOrdered[$key] = $terms[$key];
1633
+					}
1634
+					$terms = $termsOrdered;
1635
+				}
1636
+			}
1637
+			$html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1638
+
1639
+			if ($html_value != '') {
1640
+				$field_icon = geodir_field_icon_proccess($cf);
1641
+				if (strpos($field_icon, 'http') !== false) {
1642
+					$field_icon_af = '';
1643
+				} else if ($field_icon == '') {
1644
+					$field_icon_af = '';
1645
+				} else {
1646
+					$field_icon_af = $field_icon;
1647
+					$field_icon = '';
1648
+				}
1649
+
1650
+				$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1651
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1652
+				$html .= '</span> ' . $html_value . '</div>';
1653
+			}
1654
+		}
1655
+
1656
+	}
1657
+
1658
+	return $html;
1659 1659
 }
1660 1660
 add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3);
1661 1661
 
@@ -1672,161 +1672,161 @@  discard block
 block discarded – undo
1672 1672
  */
1673 1673
 function geodir_cf_address($html,$location,$cf,$p=''){
1674 1674
 
1675
-    // check we have the post value
1676
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1677
-    else{ global $post;}
1678
-
1679
-    if(!is_array($cf) && $cf!=''){
1680
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1681
-        if(!$cf){return NULL;}
1682
-    }
1683
-
1684
-    $html_var = $cf['htmlvar_name'];
1685
-
1686
-    // Check if there is a location specific filter.
1687
-    if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1688
-        /**
1689
-         * Filter the address html by location.
1690
-         *
1691
-         * @param string $html The html to filter.
1692
-         * @param array $cf The custom field array.
1693
-         * @since 1.6.6
1694
-         */
1695
-        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1696
-    }
1697
-
1698
-    // Check if there is a custom field specific filter.
1699
-    if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1700
-        /**
1701
-         * Filter the address html by individual custom field.
1702
-         *
1703
-         * @param string $html The html to filter.
1704
-         * @param string $location The location to output the html.
1705
-         * @param array $cf The custom field array.
1706
-         * @since 1.6.6
1707
-         */
1708
-        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1709
-    }
1710
-
1711
-    // Check if there is a custom field key specific filter.
1712
-    if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1713
-        /**
1714
-         * Filter the address html by field type key.
1715
-         *
1716
-         * @param string $html The html to filter.
1717
-         * @param string $location The location to output the html.
1718
-         * @param array $cf The custom field array.
1719
-         * @since 1.6.6
1720
-         */
1721
-        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1722
-    }
1723
-
1724
-    // If not html then we run the standard output.
1725
-    if(empty($html)){
1726
-
1727
-        global $preview;
1728
-        $html_var = $cf['htmlvar_name'] . '_address';
1729
-
1730
-        if ($cf['extra_fields']) {
1731
-
1732
-            $extra_fields = stripslashes_deep(unserialize($cf['extra_fields']));
1733
-
1734
-            $addition_fields = '';
1735
-
1736
-            if (!empty($extra_fields)) {
1737
-
1738
-                $show_city_in_address = false;
1739
-                if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
1740
-                    $show_city_in_address = true;
1741
-                }
1742
-                /**
1743
-                 * Filter "show city in address" value.
1744
-                 *
1745
-                 * @since 1.0.0
1746
-                 */
1747
-                $show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address);
1748
-
1749
-
1750
-                $show_region_in_address = false;
1751
-                if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
1752
-                    $show_region_in_address = true;
1753
-                }
1754
-                /**
1755
-                 * Filter "show region in address" value.
1756
-                 *
1757
-                 * @since 1.6.6
1758
-                 */
1759
-                $show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address);
1760
-
1761
-                $show_country_in_address = false;
1762
-                if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
1763
-                    $show_country_in_address = true;
1764
-                }
1765
-                /**
1766
-                 * Filter "show country in address" value.
1767
-                 *
1768
-                 * @since 1.6.6
1769
-                 */
1770
-                $show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address);
1771
-
1772
-                $show_zip_in_address = false;
1773
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
1774
-                    $show_zip_in_address = true;
1775
-                }
1776
-                /**
1777
-                 * Filter "show zip in address" value.
1778
-                 *
1779
-                 * @since 1.6.6
1780
-                 */
1781
-                $show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address);
1782
-
1783
-
1784
-            }
1785
-
1786
-        }
1787
-
1788
-
1789
-        if ($post->{$html_var}) {
1790
-
1791
-            $field_icon = geodir_field_icon_proccess( $cf );
1792
-            if ( strpos( $field_icon, 'http' ) !== false ) {
1793
-                $field_icon_af = '';
1794
-            } elseif ( $field_icon == '' ) {
1795
-                $field_icon_af = '<i class="fa fa-home"></i>';
1796
-            } else {
1797
-                $field_icon_af = $field_icon;
1798
-                $field_icon    = '';
1799
-            }
1675
+	// check we have the post value
1676
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1677
+	else{ global $post;}
1678
+
1679
+	if(!is_array($cf) && $cf!=''){
1680
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1681
+		if(!$cf){return NULL;}
1682
+	}
1683
+
1684
+	$html_var = $cf['htmlvar_name'];
1685
+
1686
+	// Check if there is a location specific filter.
1687
+	if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1688
+		/**
1689
+		 * Filter the address html by location.
1690
+		 *
1691
+		 * @param string $html The html to filter.
1692
+		 * @param array $cf The custom field array.
1693
+		 * @since 1.6.6
1694
+		 */
1695
+		$html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1696
+	}
1697
+
1698
+	// Check if there is a custom field specific filter.
1699
+	if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1700
+		/**
1701
+		 * Filter the address html by individual custom field.
1702
+		 *
1703
+		 * @param string $html The html to filter.
1704
+		 * @param string $location The location to output the html.
1705
+		 * @param array $cf The custom field array.
1706
+		 * @since 1.6.6
1707
+		 */
1708
+		$html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1709
+	}
1710
+
1711
+	// Check if there is a custom field key specific filter.
1712
+	if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1713
+		/**
1714
+		 * Filter the address html by field type key.
1715
+		 *
1716
+		 * @param string $html The html to filter.
1717
+		 * @param string $location The location to output the html.
1718
+		 * @param array $cf The custom field array.
1719
+		 * @since 1.6.6
1720
+		 */
1721
+		$html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1722
+	}
1723
+
1724
+	// If not html then we run the standard output.
1725
+	if(empty($html)){
1726
+
1727
+		global $preview;
1728
+		$html_var = $cf['htmlvar_name'] . '_address';
1729
+
1730
+		if ($cf['extra_fields']) {
1731
+
1732
+			$extra_fields = stripslashes_deep(unserialize($cf['extra_fields']));
1733
+
1734
+			$addition_fields = '';
1735
+
1736
+			if (!empty($extra_fields)) {
1737
+
1738
+				$show_city_in_address = false;
1739
+				if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
1740
+					$show_city_in_address = true;
1741
+				}
1742
+				/**
1743
+				 * Filter "show city in address" value.
1744
+				 *
1745
+				 * @since 1.0.0
1746
+				 */
1747
+				$show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address);
1748
+
1749
+
1750
+				$show_region_in_address = false;
1751
+				if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
1752
+					$show_region_in_address = true;
1753
+				}
1754
+				/**
1755
+				 * Filter "show region in address" value.
1756
+				 *
1757
+				 * @since 1.6.6
1758
+				 */
1759
+				$show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address);
1760
+
1761
+				$show_country_in_address = false;
1762
+				if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
1763
+					$show_country_in_address = true;
1764
+				}
1765
+				/**
1766
+				 * Filter "show country in address" value.
1767
+				 *
1768
+				 * @since 1.6.6
1769
+				 */
1770
+				$show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address);
1771
+
1772
+				$show_zip_in_address = false;
1773
+				if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
1774
+					$show_zip_in_address = true;
1775
+				}
1776
+				/**
1777
+				 * Filter "show zip in address" value.
1778
+				 *
1779
+				 * @since 1.6.6
1780
+				 */
1781
+				$show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address);
1782
+
1783
+
1784
+			}
1785
+
1786
+		}
1787
+
1788
+
1789
+		if ($post->{$html_var}) {
1790
+
1791
+			$field_icon = geodir_field_icon_proccess( $cf );
1792
+			if ( strpos( $field_icon, 'http' ) !== false ) {
1793
+				$field_icon_af = '';
1794
+			} elseif ( $field_icon == '' ) {
1795
+				$field_icon_af = '<i class="fa fa-home"></i>';
1796
+			} else {
1797
+				$field_icon_af = $field_icon;
1798
+				$field_icon    = '';
1799
+			}
1800 1800
             
1801 1801
 
1802 1802
 
1803
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="https://schema.org/PostalAddress">';
1804
-            $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1805
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1806
-            $html .= '</span>';
1803
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="https://schema.org/PostalAddress">';
1804
+			$html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1805
+			$html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1806
+			$html .= '</span>';
1807 1807
 
1808
-            if ( isset($post->post_address) ) {
1809
-                $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1810
-            }
1811
-            if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) {
1812
-                $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1813
-            }
1814
-            if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) {
1815
-                $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1816
-            }
1817
-            if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) {
1818
-                $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1819
-            }
1820
-            if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) {
1821
-                $html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1822
-            }
1823
-            $html .= '</div>';
1808
+			if ( isset($post->post_address) ) {
1809
+				$html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1810
+			}
1811
+			if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) {
1812
+				$html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1813
+			}
1814
+			if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) {
1815
+				$html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1816
+			}
1817
+			if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) {
1818
+				$html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1819
+			}
1820
+			if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) {
1821
+				$html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1822
+			}
1823
+			$html .= '</div>';
1824 1824
 
1825
-        }
1825
+		}
1826 1826
 
1827
-    }
1827
+	}
1828 1828
 
1829 1829
 
1830
-    return $html;
1830
+	return $html;
1831 1831
 }
1832 1832
 add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3);
1833 1833
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +302 added lines, -302 removed lines patch added patch discarded remove patch
@@ -19,21 +19,21 @@  discard block
 block discarded – undo
19 19
  *
20 20
  * @return string The html to output for the custom field.
21 21
  */
22
-function geodir_cf_checkbox($html,$location,$cf,$p=''){
22
+function geodir_cf_checkbox($html, $location, $cf, $p = '') {
23 23
 
24 24
     // check we have the post value
25
-    if(is_int($p)){$post = geodir_get_post_info($p);}
26
-    else{ global $post;}
25
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
26
+    else { global $post; }
27 27
 
28
-    if(!is_array($cf) && $cf!=''){
28
+    if (!is_array($cf) && $cf != '') {
29 29
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
-        if(!$cf){return NULL;}
30
+        if (!$cf) {return NULL; }
31 31
     }
32 32
 
33 33
     $html_var = $cf['htmlvar_name'];
34 34
 
35 35
     // Check if there is a location specific filter.
36
-    if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
36
+    if (has_filter("geodir_custom_field_output_checkbox_loc_{$location}")) {
37 37
         /**
38 38
          * Filter the checkbox html by location.
39 39
          *
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
          * @param array $cf The custom field array.
42 42
          * @since 1.6.6
43 43
          */
44
-        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
44
+        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}", $html, $cf);
45 45
     }
46 46
 
47 47
     // Check if there is a custom field specific filter.
48
-    if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
48
+    if (has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")) {
49 49
         /**
50 50
          * Filter the checkbox html by individual custom field.
51 51
          *
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
          * @param array $cf The custom field array.
55 55
          * @since 1.6.6
56 56
          */
57
-        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
57
+        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}", $html, $location, $cf);
58 58
     }
59 59
 
60 60
     // Check if there is a custom field key specific filter.
61
-    if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
61
+    if (has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")) {
62 62
         /**
63 63
          * Filter the checkbox html by field type key.
64 64
          *
@@ -67,18 +67,18 @@  discard block
 block discarded – undo
67 67
          * @param array $cf The custom field array.
68 68
          * @since 1.6.6
69 69
          */
70
-        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
70
+        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}", $html, $location, $cf);
71 71
     }
72 72
 
73 73
     // If not html then we run the standard output.
74
-    if(empty($html)){
74
+    if (empty($html)) {
75 75
 
76
-        if ( (int) $post->{$html_var} == 1 ):
76
+        if ((int) $post->{$html_var} == 1):
77 77
 
78
-            if ( $post->{$html_var} == '1' ):
79
-                $html_val = __( 'Yes', 'geodirectory' );
78
+            if ($post->{$html_var} == '1'):
79
+                $html_val = __('Yes', 'geodirectory');
80 80
             else:
81
-                $html_val = __( 'No', 'geodirectory' );
81
+                $html_val = __('No', 'geodirectory');
82 82
             endif;
83 83
 
84 84
             $field_icon = geodir_field_icon_proccess($cf);
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
                 $field_icon = '';
92 92
             }
93 93
 
94
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
-            $html .= '</span>' . $html_val . '</div>';
94
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-checkbox" style="'.$field_icon.'">'.$field_icon_af;
95
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
96
+            $html .= '</span>'.$html_val.'</div>';
97 97
         endif;
98 98
 
99 99
     }
100 100
 
101 101
     return $html;
102 102
 }
103
-add_filter('geodir_custom_field_output_checkbox','geodir_cf_checkbox',10,3);
103
+add_filter('geodir_custom_field_output_checkbox', 'geodir_cf_checkbox', 10, 3);
104 104
 
105 105
 
106 106
 /**
@@ -113,21 +113,21 @@  discard block
 block discarded – undo
113 113
  *
114 114
  * @return string The html to output for the custom field.
115 115
  */
116
-function geodir_cf_fieldset($html,$location,$cf,$p=''){
116
+function geodir_cf_fieldset($html, $location, $cf, $p = '') {
117 117
 
118 118
     // check we have the post value
119
-    if(is_int($p)){$post = geodir_get_post_info($p);}
120
-    else{ global $post;}
119
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
120
+    else { global $post; }
121 121
 
122
-    if(!is_array($cf) && $cf!=''){
122
+    if (!is_array($cf) && $cf != '') {
123 123
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
-        if(!$cf){return NULL;}
124
+        if (!$cf) {return NULL; }
125 125
     }
126 126
 
127 127
     $html_var = $cf['htmlvar_name'];
128 128
 
129 129
     // Check if there is a location specific filter.
130
-    if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
130
+    if (has_filter("geodir_custom_field_output_fieldset_loc_{$location}")) {
131 131
         /**
132 132
          * Filter the fieldset html by location.
133 133
          *
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
          * @param array $cf The custom field array.
136 136
          * @since 1.6.6
137 137
          */
138
-        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
138
+        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}", $html, $cf);
139 139
     }
140 140
 
141 141
     // Check if there is a custom field specific filter.
142
-    if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
142
+    if (has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")) {
143 143
         /**
144 144
          * Filter the fieldset html by individual custom field.
145 145
          *
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
          * @param array $cf The custom field array.
149 149
          * @since 1.6.6
150 150
          */
151
-        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
151
+        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}", $html, $location, $cf);
152 152
     }
153 153
 
154 154
     // Check if there is a custom field key specific filter.
155
-    if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
155
+    if (has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")) {
156 156
         /**
157 157
          * Filter the fieldset html by field type key.
158 158
          *
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
          * @param array $cf The custom field array.
162 162
          * @since 1.6.6
163 163
          */
164
-        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
164
+        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}", $html, $location, $cf);
165 165
     }
166 166
 
167 167
     // If not html then we run the standard output.
168
-    if(empty($html)){
168
+    if (empty($html)) {
169 169
 
170 170
         global $field_set_start;
171 171
         $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         if ($field_set_start == 1) {
174 174
             $html = '';
175 175
         } else {
176
-            $html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
176
+            $html = '<h2 class="'.$fieldset_class.'">'.__($cf['site_title'], 'geodirectory').'</h2>';
177 177
             //$field_set_start = 1;
178 178
         }
179 179
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
     return $html;
183 183
 }
184
-add_filter('geodir_custom_field_output_fieldset','geodir_cf_fieldset',10,3);
184
+add_filter('geodir_custom_field_output_fieldset', 'geodir_cf_fieldset', 10, 3);
185 185
 
186 186
 
187 187
 /**
@@ -194,21 +194,21 @@  discard block
 block discarded – undo
194 194
  *
195 195
  * @return string The html to output for the custom field.
196 196
  */
197
-function geodir_cf_url($html,$location,$cf,$p=''){
197
+function geodir_cf_url($html, $location, $cf, $p = '') {
198 198
 
199 199
     // check we have the post value
200
-    if(is_int($p)){$post = geodir_get_post_info($p);}
201
-    else{ global $post;}
200
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
201
+    else { global $post; }
202 202
 
203
-    if(!is_array($cf) && $cf!=''){
203
+    if (!is_array($cf) && $cf != '') {
204 204
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
205
-        if(!$cf){return NULL;}
205
+        if (!$cf) {return NULL; }
206 206
     }
207 207
 
208 208
     $html_var = $cf['htmlvar_name'];
209 209
 
210 210
     // Check if there is a location specific filter.
211
-    if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
211
+    if (has_filter("geodir_custom_field_output_url_loc_{$location}")) {
212 212
         /**
213 213
          * Filter the url html by location.
214 214
          *
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
          * @param array $cf The custom field array.
217 217
          * @since 1.6.6
218 218
          */
219
-        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
219
+        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}", $html, $cf);
220 220
     }
221 221
 
222 222
     // Check if there is a custom field specific filter.
223
-    if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
223
+    if (has_filter("geodir_custom_field_output_url_var_{$html_var}")) {
224 224
         /**
225 225
          * Filter the url html by individual custom field.
226 226
          *
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
          * @param array $cf The custom field array.
230 230
          * @since 1.6.6
231 231
          */
232
-        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
232
+        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}", $html, $location, $cf);
233 233
     }
234 234
 
235 235
     // Check if there is a custom field key specific filter.
236
-    if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
236
+    if (has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")) {
237 237
         /**
238 238
          * Filter the url html by field type key.
239 239
          *
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
          * @param array $cf The custom field array.
243 243
          * @since 1.6.6
244 244
          */
245
-        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
245
+        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}", $html, $location, $cf);
246 246
     }
247 247
 
248 248
     // If not html then we run the standard output.
249
-    if(empty($html)){
249
+    if (empty($html)) {
250 250
 
251 251
         if ($post->{$cf['htmlvar_name']}):
252 252
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 
274 274
             $website = !empty($a_url['url']) ? $a_url['url'] : '';
275 275
             $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
276
-            if(!empty($cf['default_value'])){$title = $cf['default_value'];}
276
+            if (!empty($cf['default_value'])) {$title = $cf['default_value']; }
277 277
             $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
278 278
 
279 279
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
              * @param string $website Website URL.
290 290
              * @param int $post->ID Post ID.
291 291
              */
292
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
292
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'"><span class="geodir-i-website" style="'.$field_icon.'">'.$field_icon_af.'<a href="'.$website.'" target="_blank" '.$rel.' ><strong>'.apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID).'</strong></a></span></div>';
293 293
 
294 294
         endif;
295 295
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 
298 298
     return $html;
299 299
 }
300
-add_filter('geodir_custom_field_output_url','geodir_cf_url',10,3);
300
+add_filter('geodir_custom_field_output_url', 'geodir_cf_url', 10, 3);
301 301
 
302 302
 
303 303
 /**
@@ -310,21 +310,21 @@  discard block
 block discarded – undo
310 310
  *
311 311
  * @return string The html to output for the custom field.
312 312
  */
313
-function geodir_cf_phone($html,$location,$cf,$p=''){
313
+function geodir_cf_phone($html, $location, $cf, $p = '') {
314 314
 
315 315
     // check we have the post value
316
-    if(is_int($p)){$post = geodir_get_post_info($p);}
317
-    else{ global $post;}
316
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
317
+    else { global $post; }
318 318
 
319
-    if(!is_array($cf) && $cf!=''){
319
+    if (!is_array($cf) && $cf != '') {
320 320
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
321
-        if(!$cf){return NULL;}
321
+        if (!$cf) {return NULL; }
322 322
     }
323 323
 
324 324
     $html_var = $cf['htmlvar_name'];
325 325
 
326 326
     // Check if there is a location specific filter.
327
-    if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
327
+    if (has_filter("geodir_custom_field_output_phone_loc_{$location}")) {
328 328
         /**
329 329
          * Filter the phone html by location.
330 330
          *
@@ -332,11 +332,11 @@  discard block
 block discarded – undo
332 332
          * @param array $cf The custom field array.
333 333
          * @since 1.6.6
334 334
          */
335
-        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
335
+        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}", $html, $cf);
336 336
     }
337 337
 
338 338
     // Check if there is a custom field specific filter.
339
-    if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
339
+    if (has_filter("geodir_custom_field_output_phone_var_{$html_var}")) {
340 340
         /**
341 341
          * Filter the phone html by individual custom field.
342 342
          *
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
          * @param array $cf The custom field array.
346 346
          * @since 1.6.6
347 347
          */
348
-        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
348
+        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}", $html, $location, $cf);
349 349
     }
350 350
 
351 351
     // Check if there is a custom field key specific filter.
352
-    if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
352
+    if (has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")) {
353 353
         /**
354 354
          * Filter the phone html by field type key.
355 355
          *
@@ -358,11 +358,11 @@  discard block
 block discarded – undo
358 358
          * @param array $cf The custom field array.
359 359
          * @since 1.6.6
360 360
          */
361
-        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
361
+        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}", $html, $location, $cf);
362 362
     }
363 363
 
364 364
     // If not html then we run the standard output.
365
-    if(empty($html)){
365
+    if (empty($html)) {
366 366
 
367 367
         if ($post->{$cf['htmlvar_name']}):
368 368
 
@@ -377,9 +377,9 @@  discard block
 block discarded – undo
377 377
             }
378 378
 
379 379
 
380
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
381
-                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
382
-            $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
380
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-contact" style="'.$field_icon.'">'.$field_icon_af.
381
+                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
382
+            $html .= '</span><a href="tel:'.preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}).'">'.$post->{$cf['htmlvar_name']}.'</a></div>';
383 383
 
384 384
         endif;
385 385
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 
388 388
     return $html;
389 389
 }
390
-add_filter('geodir_custom_field_output_phone','geodir_cf_phone',10,3);
390
+add_filter('geodir_custom_field_output_phone', 'geodir_cf_phone', 10, 3);
391 391
 
392 392
 
393 393
 /**
@@ -400,21 +400,21 @@  discard block
 block discarded – undo
400 400
  *
401 401
  * @return string The html to output for the custom field.
402 402
  */
403
-function geodir_cf_time($html,$location,$cf,$p=''){
403
+function geodir_cf_time($html, $location, $cf, $p = '') {
404 404
 
405 405
     // check we have the post value
406
-    if(is_int($p)){$post = geodir_get_post_info($p);}
407
-    else{ global $post;}
406
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
407
+    else { global $post; }
408 408
 
409
-    if(!is_array($cf) && $cf!=''){
409
+    if (!is_array($cf) && $cf != '') {
410 410
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
411
-        if(!$cf){return NULL;}
411
+        if (!$cf) {return NULL; }
412 412
     }
413 413
 
414 414
     $html_var = $cf['htmlvar_name'];
415 415
 
416 416
     // Check if there is a location specific filter.
417
-    if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
417
+    if (has_filter("geodir_custom_field_output_time_loc_{$location}")) {
418 418
         /**
419 419
          * Filter the time html by location.
420 420
          *
@@ -422,11 +422,11 @@  discard block
 block discarded – undo
422 422
          * @param array $cf The custom field array.
423 423
          * @since 1.6.6
424 424
          */
425
-        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
425
+        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}", $html, $cf);
426 426
     }
427 427
 
428 428
     // Check if there is a custom field specific filter.
429
-    if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
429
+    if (has_filter("geodir_custom_field_output_time_var_{$html_var}")) {
430 430
         /**
431 431
          * Filter the time html by individual custom field.
432 432
          *
@@ -435,11 +435,11 @@  discard block
 block discarded – undo
435 435
          * @param array $cf The custom field array.
436 436
          * @since 1.6.6
437 437
          */
438
-        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
438
+        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}", $html, $location, $cf);
439 439
     }
440 440
 
441 441
     // Check if there is a custom field key specific filter.
442
-    if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
442
+    if (has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")) {
443 443
         /**
444 444
          * Filter the time html by field type key.
445 445
          *
@@ -448,11 +448,11 @@  discard block
 block discarded – undo
448 448
          * @param array $cf The custom field array.
449 449
          * @since 1.6.6
450 450
          */
451
-        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
451
+        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}", $html, $location, $cf);
452 452
     }
453 453
 
454 454
     // If not html then we run the standard output.
455
-    if(empty($html)){
455
+    if (empty($html)) {
456 456
 
457 457
         if ($post->{$cf['htmlvar_name']}):
458 458
 
@@ -472,9 +472,9 @@  discard block
 block discarded – undo
472 472
             }
473 473
 
474 474
 
475
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
476
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
477
-            $html .= '</span>' . $value . '</div>';
475
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-time" style="'.$field_icon.'">'.$field_icon_af;
476
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
477
+            $html .= '</span>'.$value.'</div>';
478 478
 
479 479
         endif;
480 480
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 
483 483
     return $html;
484 484
 }
485
-add_filter('geodir_custom_field_output_time','geodir_cf_time',10,3);
485
+add_filter('geodir_custom_field_output_time', 'geodir_cf_time', 10, 3);
486 486
 
487 487
 
488 488
 /**
@@ -495,21 +495,21 @@  discard block
 block discarded – undo
495 495
  *
496 496
  * @return string The html to output for the custom field.
497 497
  */
498
-function geodir_cf_datepicker($html,$location,$cf,$p=''){
498
+function geodir_cf_datepicker($html, $location, $cf, $p = '') {
499 499
     global $preview;
500 500
     // check we have the post value
501
-    if(is_int($p)){$post = geodir_get_post_info($p);}
502
-    else{ global $post;}
501
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
502
+    else { global $post; }
503 503
 
504
-    if(!is_array($cf) && $cf!=''){
504
+    if (!is_array($cf) && $cf != '') {
505 505
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
506
-        if(!$cf){return NULL;}
506
+        if (!$cf) {return NULL; }
507 507
     }
508 508
 
509 509
     $html_var = $cf['htmlvar_name'];
510 510
 
511 511
     // Check if there is a location specific filter.
512
-    if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
512
+    if (has_filter("geodir_custom_field_output_datepicker_loc_{$location}")) {
513 513
         /**
514 514
          * Filter the datepicker html by location.
515 515
          *
@@ -517,11 +517,11 @@  discard block
 block discarded – undo
517 517
          * @param array $cf The custom field array.
518 518
          * @since 1.6.6
519 519
          */
520
-        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
520
+        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}", $html, $cf);
521 521
     }
522 522
 
523 523
     // Check if there is a custom field specific filter.
524
-    if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
524
+    if (has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")) {
525 525
         /**
526 526
          * Filter the datepicker html by individual custom field.
527 527
          *
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
          * @param array $cf The custom field array.
531 531
          * @since 1.6.6
532 532
          */
533
-        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
533
+        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}", $html, $location, $cf);
534 534
     }
535 535
 
536 536
     // Check if there is a custom field key specific filter.
537
-    if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
537
+    if (has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")) {
538 538
         /**
539 539
          * Filter the datepicker html by field type key.
540 540
          *
@@ -543,11 +543,11 @@  discard block
 block discarded – undo
543 543
          * @param array $cf The custom field array.
544 544
          * @since 1.6.6
545 545
          */
546
-        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
546
+        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}", $html, $location, $cf);
547 547
     }
548 548
 
549 549
     // If not html then we run the standard output.
550
-    if(empty($html)){
550
+    if (empty($html)) {
551 551
 
552 552
         if ($post->{$cf['htmlvar_name']}):
553 553
 
@@ -558,24 +558,24 @@  discard block
 block discarded – undo
558 558
             }
559 559
             // check if we need to change the format or not
560 560
             $date_format_len = strlen(str_replace(' ', '', $date_format));
561
-            if($date_format_len>5){// if greater then 4 then it's the old style format.
561
+            if ($date_format_len > 5) {// if greater then 4 then it's the old style format.
562 562
 
563
-                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
564
-                $replace = array('d','j','l','m','n','F','Y');//PHP date format
563
+                $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
564
+                $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
565 565
 
566 566
                 $date_format = str_replace($search, $replace, $date_format);
567 567
 
568
-                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
-            }else{
568
+                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y') ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
+            } else {
570 570
                 $post_htmlvar_value = $post->{$cf['htmlvar_name']};
571 571
             }
572 572
 
573
-            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
573
+            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']} != "0000-00-00") {
574 574
                 $date_format_from = $preview ? $date_format : 'Y-m-d';
575 575
                 $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576 576
                 //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577 577
                 //$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
-            }else{
578
+            } else {
579 579
                 return '';
580 580
             }
581 581
 
@@ -592,9 +592,9 @@  discard block
 block discarded – undo
592 592
 
593 593
 
594 594
 
595
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
596
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
597
-            $html .= '</span>' . $value . '</div>';
595
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-datepicker" style="'.$field_icon.'">'.$field_icon_af;
596
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
597
+            $html .= '</span>'.$value.'</div>';
598 598
 
599 599
         endif;
600 600
 
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 
603 603
     return $html;
604 604
 }
605
-add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3);
605
+add_filter('geodir_custom_field_output_datepicker', 'geodir_cf_datepicker', 10, 3);
606 606
 
607 607
 
608 608
 /**
@@ -615,21 +615,21 @@  discard block
 block discarded – undo
615 615
  *
616 616
  * @return string The html to output for the custom field.
617 617
  */
618
-function geodir_cf_text($html,$location,$cf,$p=''){
618
+function geodir_cf_text($html, $location, $cf, $p = '') {
619 619
 
620 620
     // check we have the post value
621
-    if(is_int($p)){$post = geodir_get_post_info($p);}
622
-    else{ global $post;}
621
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
622
+    else { global $post; }
623 623
 
624
-    if(!is_array($cf) && $cf!=''){
624
+    if (!is_array($cf) && $cf != '') {
625 625
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
626
-        if(!$cf){return NULL;}
626
+        if (!$cf) {return NULL; }
627 627
     }
628 628
 
629 629
     $html_var = $cf['htmlvar_name'];
630 630
 
631 631
     // Check if there is a location specific filter.
632
-    if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
632
+    if (has_filter("geodir_custom_field_output_text_loc_{$location}")) {
633 633
         /**
634 634
          * Filter the text html by location.
635 635
          *
@@ -637,11 +637,11 @@  discard block
 block discarded – undo
637 637
          * @param array $cf The custom field array.
638 638
          * @since 1.6.6
639 639
          */
640
-        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
640
+        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}", $html, $cf);
641 641
     }
642 642
 
643 643
     // Check if there is a custom field specific filter.
644
-    if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
644
+    if (has_filter("geodir_custom_field_output_text_var_{$html_var}")) {
645 645
         /**
646 646
          * Filter the text html by individual custom field.
647 647
          *
@@ -650,11 +650,11 @@  discard block
 block discarded – undo
650 650
          * @param array $cf The custom field array.
651 651
          * @since 1.6.6
652 652
          */
653
-        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
653
+        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}", $html, $location, $cf);
654 654
     }
655 655
 
656 656
     // Check if there is a custom field key specific filter.
657
-    if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
657
+    if (has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")) {
658 658
         /**
659 659
          * Filter the text html by field type key.
660 660
          *
@@ -663,15 +663,15 @@  discard block
 block discarded – undo
663 663
          * @param array $cf The custom field array.
664 664
          * @since 1.6.6
665 665
          */
666
-        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
666
+        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}", $html, $location, $cf);
667 667
     }
668 668
 
669 669
     
670 670
 
671 671
     // If not html then we run the standard output.
672
-    if(empty($html)){
672
+    if (empty($html)) {
673 673
 
674
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
674
+        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
675 675
 
676 676
             $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
677 677
 
@@ -686,16 +686,16 @@  discard block
 block discarded – undo
686 686
             }
687 687
 
688 688
 
689
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
690
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
689
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="'.$class.'" style="'.$field_icon.'">'.$field_icon_af;
690
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
691 691
             $html .= '</span>';
692 692
 
693 693
             $value = $post->{$cf['htmlvar_name']};
694
-            if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){
694
+            if (isset($cf['data_type']) && ($cf['data_type'] == 'INT' || $cf['data_type'] == 'FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']) {
695 695
                 $extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields']));
696
-                if(isset($extra_fields['is_price']) && $extra_fields['is_price']){
697
-                    if(!ceil($value) > 0){return '';}// dont output blank prices
698
-                    $value = geodir_currency_format_number($value,$cf);
696
+                if (isset($extra_fields['is_price']) && $extra_fields['is_price']) {
697
+                    if (!ceil($value) > 0) {return ''; }// dont output blank prices
698
+                    $value = geodir_currency_format_number($value, $cf);
699 699
                 }
700 700
             }
701 701
 
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 
710 710
     return $html;
711 711
 }
712
-add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3);
712
+add_filter('geodir_custom_field_output_text', 'geodir_cf_text', 10, 3);
713 713
 
714 714
 
715 715
 /**
@@ -722,21 +722,21 @@  discard block
 block discarded – undo
722 722
  *
723 723
  * @return string The html to output for the custom field.
724 724
  */
725
-function geodir_cf_radio($html,$location,$cf,$p=''){
725
+function geodir_cf_radio($html, $location, $cf, $p = '') {
726 726
 
727 727
     // check we have the post value
728
-    if(is_int($p)){$post = geodir_get_post_info($p);}
729
-    else{ global $post;}
728
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
729
+    else { global $post; }
730 730
 
731
-    if(!is_array($cf) && $cf!=''){
731
+    if (!is_array($cf) && $cf != '') {
732 732
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
733
-        if(!$cf){return NULL;}
733
+        if (!$cf) {return NULL; }
734 734
     }
735 735
 
736 736
     $html_var = $cf['htmlvar_name'];
737 737
 
738 738
     // Check if there is a location specific filter.
739
-    if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
739
+    if (has_filter("geodir_custom_field_output_radio_loc_{$location}")) {
740 740
         /**
741 741
          * Filter the radio html by location.
742 742
          *
@@ -744,11 +744,11 @@  discard block
 block discarded – undo
744 744
          * @param array $cf The custom field array.
745 745
          * @since 1.6.6
746 746
          */
747
-        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
747
+        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}", $html, $cf);
748 748
     }
749 749
 
750 750
     // Check if there is a custom field specific filter.
751
-    if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
751
+    if (has_filter("geodir_custom_field_output_radio_var_{$html_var}")) {
752 752
         /**
753 753
          * Filter the radio html by individual custom field.
754 754
          *
@@ -757,11 +757,11 @@  discard block
 block discarded – undo
757 757
          * @param array $cf The custom field array.
758 758
          * @since 1.6.6
759 759
          */
760
-        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
760
+        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}", $html, $location, $cf);
761 761
     }
762 762
 
763 763
     // Check if there is a custom field key specific filter.
764
-    if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
764
+    if (has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")) {
765 765
         /**
766 766
          * Filter the radio html by field type key.
767 767
          *
@@ -770,11 +770,11 @@  discard block
 block discarded – undo
770 770
          * @param array $cf The custom field array.
771 771
          * @since 1.6.6
772 772
          */
773
-        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
773
+        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}", $html, $location, $cf);
774 774
     }
775 775
 
776 776
     // If not html then we run the standard output.
777
-    if(empty($html)){
777
+    if (empty($html)) {
778 778
 
779 779
         $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
780 780
         if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
@@ -808,16 +808,16 @@  discard block
 block discarded – undo
808 808
             }
809 809
 
810 810
 
811
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
812
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
813
-            $html .= '</span>' . $html_val . '</div>';
811
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-radio" style="'.$field_icon.'">'.$field_icon_af;
812
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
813
+            $html .= '</span>'.$html_val.'</div>';
814 814
         endif;
815 815
 
816 816
     }
817 817
 
818 818
     return $html;
819 819
 }
820
-add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3);
820
+add_filter('geodir_custom_field_output_radio', 'geodir_cf_radio', 10, 3);
821 821
 
822 822
 
823 823
 /**
@@ -831,21 +831,21 @@  discard block
 block discarded – undo
831 831
  *
832 832
  * @return string The html to output for the custom field.
833 833
  */
834
-function geodir_cf_select($html,$location,$cf,$p=''){
834
+function geodir_cf_select($html, $location, $cf, $p = '') {
835 835
 
836 836
     // check we have the post value
837
-    if(is_int($p)){$post = geodir_get_post_info($p);}
838
-    else{ global $post;}
837
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
838
+    else { global $post; }
839 839
 
840
-    if(!is_array($cf) && $cf!=''){
840
+    if (!is_array($cf) && $cf != '') {
841 841
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
842
-        if(!$cf){return NULL;}
842
+        if (!$cf) {return NULL; }
843 843
     }
844 844
 
845 845
     $html_var = $cf['htmlvar_name'];
846 846
 
847 847
     // Check if there is a location specific filter.
848
-    if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
848
+    if (has_filter("geodir_custom_field_output_select_loc_{$location}")) {
849 849
         /**
850 850
          * Filter the select html by location.
851 851
          *
@@ -853,11 +853,11 @@  discard block
 block discarded – undo
853 853
          * @param array $cf The custom field array.
854 854
          * @since 1.6.6
855 855
          */
856
-        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
856
+        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}", $html, $cf);
857 857
     }
858 858
 
859 859
     // Check if there is a custom field specific filter.
860
-    if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
860
+    if (has_filter("geodir_custom_field_output_select_var_{$html_var}")) {
861 861
         /**
862 862
          * Filter the select html by individual custom field.
863 863
          *
@@ -866,11 +866,11 @@  discard block
 block discarded – undo
866 866
          * @param array $cf The custom field array.
867 867
          * @since 1.6.6
868 868
          */
869
-        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
869
+        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}", $html, $location, $cf);
870 870
     }
871 871
 
872 872
     // Check if there is a custom field key specific filter.
873
-    if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
873
+    if (has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")) {
874 874
         /**
875 875
          * Filter the select html by field type key.
876 876
          *
@@ -879,11 +879,11 @@  discard block
 block discarded – undo
879 879
          * @param array $cf The custom field array.
880 880
          * @since 1.6.6
881 881
          */
882
-        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
882
+        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}", $html, $location, $cf);
883 883
     }
884 884
 
885 885
     // If not html then we run the standard output.
886
-    if(empty($html)){
886
+    if (empty($html)) {
887 887
 
888 888
         if ($post->{$cf['htmlvar_name']}):
889 889
             $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
@@ -911,16 +911,16 @@  discard block
 block discarded – undo
911 911
             }
912 912
 
913 913
 
914
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
915
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
916
-            $html .= '</span>' . $field_value . '</div>';
914
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
915
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
916
+            $html .= '</span>'.$field_value.'</div>';
917 917
         endif;
918 918
 
919 919
     }
920 920
 
921 921
     return $html;
922 922
 }
923
-add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3);
923
+add_filter('geodir_custom_field_output_select', 'geodir_cf_select', 10, 3);
924 924
 
925 925
 
926 926
 /**
@@ -933,21 +933,21 @@  discard block
 block discarded – undo
933 933
  *
934 934
  * @return string The html to output for the custom field.
935 935
  */
936
-function geodir_cf_multiselect($html,$location,$cf,$p=''){
936
+function geodir_cf_multiselect($html, $location, $cf, $p = '') {
937 937
 
938 938
     // check we have the post value
939
-    if(is_int($p)){$post = geodir_get_post_info($p);}
940
-    else{ global $post;}
939
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
940
+    else { global $post; }
941 941
 
942
-    if(!is_array($cf) && $cf!=''){
942
+    if (!is_array($cf) && $cf != '') {
943 943
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
944
-        if(!$cf){return NULL;}
944
+        if (!$cf) {return NULL; }
945 945
     }
946 946
 
947 947
     $html_var = $cf['htmlvar_name'];
948 948
 
949 949
     // Check if there is a location specific filter.
950
-    if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
950
+    if (has_filter("geodir_custom_field_output_multiselect_loc_{$location}")) {
951 951
         /**
952 952
          * Filter the multiselect html by location.
953 953
          *
@@ -955,11 +955,11 @@  discard block
 block discarded – undo
955 955
          * @param array $cf The custom field array.
956 956
          * @since 1.6.6
957 957
          */
958
-        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
958
+        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}", $html, $cf);
959 959
     }
960 960
 
961 961
     // Check if there is a custom field specific filter.
962
-    if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
962
+    if (has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")) {
963 963
         /**
964 964
          * Filter the multiselect html by individual custom field.
965 965
          *
@@ -968,11 +968,11 @@  discard block
 block discarded – undo
968 968
          * @param array $cf The custom field array.
969 969
          * @since 1.6.6
970 970
          */
971
-        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
971
+        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}", $html, $location, $cf);
972 972
     }
973 973
 
974 974
     // Check if there is a custom field key specific filter.
975
-    if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
975
+    if (has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")) {
976 976
         /**
977 977
          * Filter the multiselect html by field type key.
978 978
          *
@@ -981,11 +981,11 @@  discard block
 block discarded – undo
981 981
          * @param array $cf The custom field array.
982 982
          * @since 1.6.6
983 983
          */
984
-        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
984
+        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}", $html, $location, $cf);
985 985
     }
986 986
 
987 987
     // If not html then we run the standard output.
988
-    if(empty($html)){
988
+    if (empty($html)) {
989 989
 
990 990
 
991 991
         if (!empty($post->{$cf['htmlvar_name']})):
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
 
1007 1007
             $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
1008 1008
 
1009
-            if(is_array($field_values)){
1009
+            if (is_array($field_values)) {
1010 1010
                 $field_values = array_map('trim', $field_values);
1011 1011
             }
1012 1012
 
@@ -1024,15 +1024,15 @@  discard block
 block discarded – undo
1024 1024
             }
1025 1025
 
1026 1026
 
1027
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1028
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1027
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
1028
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1029 1029
             $html .= '</span>';
1030 1030
 
1031 1031
             if (count($option_values) > 1) {
1032 1032
                 $html .= '<ul>';
1033 1033
 
1034 1034
                 foreach ($option_values as $val) {
1035
-                    $html .= '<li>' . $val . '</li>';
1035
+                    $html .= '<li>'.$val.'</li>';
1036 1036
                 }
1037 1037
 
1038 1038
                 $html .= '</ul>';
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 
1048 1048
     return $html;
1049 1049
 }
1050
-add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3);
1050
+add_filter('geodir_custom_field_output_multiselect', 'geodir_cf_multiselect', 10, 3);
1051 1051
 
1052 1052
 
1053 1053
 /**
@@ -1060,21 +1060,21 @@  discard block
 block discarded – undo
1060 1060
  *
1061 1061
  * @return string The html to output for the custom field.
1062 1062
  */
1063
-function geodir_cf_email($html,$location,$cf,$p=''){
1063
+function geodir_cf_email($html, $location, $cf, $p = '') {
1064 1064
 
1065 1065
     // check we have the post value
1066
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1067
-    else{ global $post;}
1066
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1067
+    else { global $post; }
1068 1068
 
1069
-    if(!is_array($cf) && $cf!=''){
1069
+    if (!is_array($cf) && $cf != '') {
1070 1070
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1071
-        if(!$cf){return NULL;}
1071
+        if (!$cf) {return NULL; }
1072 1072
     }
1073 1073
 
1074 1074
     $html_var = $cf['htmlvar_name'];
1075 1075
 
1076 1076
     // Check if there is a location specific filter.
1077
-    if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1077
+    if (has_filter("geodir_custom_field_output_email_loc_{$location}")) {
1078 1078
         /**
1079 1079
          * Filter the email html by location.
1080 1080
          *
@@ -1082,11 +1082,11 @@  discard block
 block discarded – undo
1082 1082
          * @param array $cf The custom field array.
1083 1083
          * @since 1.6.6
1084 1084
          */
1085
-        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1085
+        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}", $html, $cf);
1086 1086
     }
1087 1087
 
1088 1088
     // Check if there is a custom field specific filter.
1089
-    if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1089
+    if (has_filter("geodir_custom_field_output_email_var_{$html_var}")) {
1090 1090
         /**
1091 1091
          * Filter the email html by individual custom field.
1092 1092
          *
@@ -1095,11 +1095,11 @@  discard block
 block discarded – undo
1095 1095
          * @param array $cf The custom field array.
1096 1096
          * @since 1.6.6
1097 1097
          */
1098
-        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1098
+        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}", $html, $location, $cf);
1099 1099
     }
1100 1100
 
1101 1101
     // Check if there is a custom field key specific filter.
1102
-    if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1102
+    if (has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")) {
1103 1103
         /**
1104 1104
          * Filter the email html by field type key.
1105 1105
          *
@@ -1108,18 +1108,18 @@  discard block
 block discarded – undo
1108 1108
          * @param array $cf The custom field array.
1109 1109
          * @since 1.6.6
1110 1110
          */
1111
-        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1111
+        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}", $html, $location, $cf);
1112 1112
     }
1113 1113
 
1114 1114
     // If not html then we run the standard output.
1115
-    if(empty($html)){
1115
+    if (empty($html)) {
1116 1116
 
1117 1117
         global $preview;
1118 1118
         if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1119 1119
             return ''; // Remove Send Enquiry | Send To Friend from listings page
1120 1120
         }
1121 1121
 
1122
-        $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1122
+        $package_info = (array) geodir_post_package_info(array(), $post, $post->post_type);
1123 1123
 
1124 1124
         if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) {
1125 1125
             global $send_to_friend;
@@ -1131,7 +1131,7 @@  discard block
 block discarded – undo
1131 1131
             if (!$preview) {
1132 1132
                 $b_send_inquiry = 'b_send_inquiry';
1133 1133
                 $b_sendtofriend = 'b_sendtofriend';
1134
-                $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1134
+                $html = '<input type="hidden" name="geodir_popup_post_id" value="'.$post->ID.'" /><div class="geodir_display_popup_forms"></div>';
1135 1135
             }
1136 1136
 
1137 1137
             $field_icon = geodir_field_icon_proccess($cf);
@@ -1144,28 +1144,28 @@  discard block
 block discarded – undo
1144 1144
                 $field_icon = '';
1145 1145
             }
1146 1146
 
1147
-            $html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1147
+            $html .= '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af;
1148 1148
             $seperator = '';
1149 1149
             if ($post->{$cf['htmlvar_name']}) {
1150 1150
                 $b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);');
1151
-                $html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1151
+                $html .= '<a href="'.$b_send_inquiry_url.'" class="'.$b_send_inquiry.'" >'.SEND_INQUIRY.'</a>';
1152 1152
                 $seperator = ' | ';
1153 1153
             }
1154 1154
 
1155 1155
             if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) {
1156 1156
                 $b_sendtofriend_url = apply_filters('b_sendtofriend_url', 'javascript:void(0);');
1157
-                $html .= $seperator . '<a href="'.$b_sendtofriend_url.'" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1157
+                $html .= $seperator.'<a href="'.$b_sendtofriend_url.'" class="'.$b_sendtofriend.'">'.SEND_TO_FRIEND.'</a>';
1158 1158
             }
1159 1159
 
1160 1160
             $html .= '</span></div>';
1161 1161
 
1162 1162
 
1163 1163
             if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1164
-                $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1164
+                $html .= '<p class="sucess_msg">'.SEND_INQUIRY_SUCCESS.'</p>';
1165 1165
             } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1166
-                $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1166
+                $html .= '<p class="sucess_msg">'.SEND_FRIEND_SUCCESS.'</p>';
1167 1167
             } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1168
-                $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1168
+                $html .= '<p class="error_msg_fix">'.WRONG_CAPTCH_MSG.'</p>';
1169 1169
             }
1170 1170
 
1171 1171
             /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
@@ -1185,11 +1185,11 @@  discard block
 block discarded – undo
1185 1185
                 }
1186 1186
 
1187 1187
 
1188
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1189
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1188
+                $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af;
1189
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1190 1190
                 $html .= '</span><span class="geodir-email-address-output">';
1191 1191
                 $email = $post->{$cf['htmlvar_name']} ;
1192
-                if($e_split = explode('@',$email)){
1192
+                if ($e_split = explode('@', $email)) {
1193 1193
                     /**
1194 1194
                      * Filter email custom field name output.
1195 1195
                      *
@@ -1198,10 +1198,10 @@  discard block
 block discarded – undo
1198 1198
                      * @param string $email The email string being output.
1199 1199
                      * @param array $cf Custom field variables array.
1200 1200
                      */
1201
-                    $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1202
-                    $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1203
-                }else{
1204
-                    $html .=  $email;
1201
+                    $email_name = apply_filters('geodir_email_field_name_output', $email, $cf);
1202
+                    $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1203
+                } else {
1204
+                    $html .= $email;
1205 1205
                 }
1206 1206
                 $html .= '</span></div>';
1207 1207
             }
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
 
1213 1213
     return $html;
1214 1214
 }
1215
-add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3);
1215
+add_filter('geodir_custom_field_output_email', 'geodir_cf_email', 10, 3);
1216 1216
 
1217 1217
 
1218 1218
 /**
@@ -1225,21 +1225,21 @@  discard block
 block discarded – undo
1225 1225
  *
1226 1226
  * @return string The html to output for the custom field.
1227 1227
  */
1228
-function geodir_cf_file($html,$location,$cf,$p=''){
1228
+function geodir_cf_file($html, $location, $cf, $p = '') {
1229 1229
 
1230 1230
     // check we have the post value
1231
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1232
-    else{ global $post;}
1231
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1232
+    else { global $post; }
1233 1233
 
1234
-    if(!is_array($cf) && $cf!=''){
1234
+    if (!is_array($cf) && $cf != '') {
1235 1235
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1236
-        if(!$cf){return NULL;}
1236
+        if (!$cf) {return NULL; }
1237 1237
     }
1238 1238
 
1239 1239
     $html_var = $cf['htmlvar_name'];
1240 1240
 
1241 1241
     // Check if there is a location specific filter.
1242
-    if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1242
+    if (has_filter("geodir_custom_field_output_file_loc_{$location}")) {
1243 1243
         /**
1244 1244
          * Filter the file html by location.
1245 1245
          *
@@ -1247,11 +1247,11 @@  discard block
 block discarded – undo
1247 1247
          * @param array $cf The custom field array.
1248 1248
          * @since 1.6.6
1249 1249
          */
1250
-        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1250
+        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}", $html, $cf);
1251 1251
     }
1252 1252
 
1253 1253
     // Check if there is a custom field specific filter.
1254
-    if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1254
+    if (has_filter("geodir_custom_field_output_file_var_{$html_var}")) {
1255 1255
         /**
1256 1256
          * Filter the file html by individual custom field.
1257 1257
          *
@@ -1260,11 +1260,11 @@  discard block
 block discarded – undo
1260 1260
          * @param array $cf The custom field array.
1261 1261
          * @since 1.6.6
1262 1262
          */
1263
-        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1263
+        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}", $html, $location, $cf);
1264 1264
     }
1265 1265
 
1266 1266
     // Check if there is a custom field key specific filter.
1267
-    if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1267
+    if (has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")) {
1268 1268
         /**
1269 1269
          * Filter the file html by field type key.
1270 1270
          *
@@ -1273,11 +1273,11 @@  discard block
 block discarded – undo
1273 1273
          * @param array $cf The custom field array.
1274 1274
          * @since 1.6.6
1275 1275
          */
1276
-        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1276
+        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}", $html, $location, $cf);
1277 1277
     }
1278 1278
 
1279 1279
     // If not html then we run the standard output.
1280
-    if(empty($html)){
1280
+    if (empty($html)) {
1281 1281
 
1282 1282
         if (!empty($post->{$cf['htmlvar_name']})):
1283 1283
 
@@ -1285,7 +1285,7 @@  discard block
 block discarded – undo
1285 1285
             if (!empty($files)):
1286 1286
 
1287 1287
                 $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL;
1288
-                $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1288
+                $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
1289 1289
 
1290 1290
                 $file_paths = '';
1291 1291
                 foreach ($files as $file) {
@@ -1322,9 +1322,9 @@  discard block
 block discarded – undo
1322 1322
                             //$file_paths .= '<img src="'.$file.'"  />';	
1323 1323
                             $file_paths .= '</div>';
1324 1324
                         } else {
1325
-                            $ext_path = '_' . $html_var . '_';
1325
+                            $ext_path = '_'.$html_var.'_';
1326 1326
                             $filename = explode($ext_path, $filename);
1327
-                            $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1327
+                            $file_paths .= '<a href="'.$file.'" target="_blank">'.$filename[count($filename) - 1].'</a>';
1328 1328
                         }
1329 1329
                     }
1330 1330
                 }
@@ -1339,11 +1339,11 @@  discard block
 block discarded – undo
1339 1339
                     $field_icon = '';
1340 1340
                 }
1341 1341
 
1342
-                $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1342
+                $html = '<div class="geodir_more_info  '.$cf['css_class'].' geodir-custom-file-box '.$cf['htmlvar_name'].'"><div class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
1343 1343
                 $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1344
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1344
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1345 1345
                 $html .= '</span>';
1346
-                $html .= $file_paths . '</div></div>';
1346
+                $html .= $file_paths.'</div></div>';
1347 1347
 
1348 1348
             endif;
1349 1349
         endif;
@@ -1352,7 +1352,7 @@  discard block
 block discarded – undo
1352 1352
 
1353 1353
     return $html;
1354 1354
 }
1355
-add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3);
1355
+add_filter('geodir_custom_field_output_file', 'geodir_cf_file', 10, 3);
1356 1356
 
1357 1357
 
1358 1358
 
@@ -1366,21 +1366,21 @@  discard block
 block discarded – undo
1366 1366
  *
1367 1367
  * @return string The html to output for the custom field.
1368 1368
  */
1369
-function geodir_cf_textarea($html,$location,$cf,$p=''){
1369
+function geodir_cf_textarea($html, $location, $cf, $p = '') {
1370 1370
 
1371 1371
     // check we have the post value
1372
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1373
-    else{ global $post;}
1372
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1373
+    else { global $post; }
1374 1374
 
1375
-    if(!is_array($cf) && $cf!=''){
1375
+    if (!is_array($cf) && $cf != '') {
1376 1376
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1377
-        if(!$cf){return NULL;}
1377
+        if (!$cf) {return NULL; }
1378 1378
     }
1379 1379
 
1380 1380
     $html_var = $cf['htmlvar_name'];
1381 1381
 
1382 1382
     // Check if there is a location specific filter.
1383
-    if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1383
+    if (has_filter("geodir_custom_field_output_textarea_loc_{$location}")) {
1384 1384
         /**
1385 1385
          * Filter the textarea html by location.
1386 1386
          *
@@ -1388,11 +1388,11 @@  discard block
 block discarded – undo
1388 1388
          * @param array $cf The custom field array.
1389 1389
          * @since 1.6.6
1390 1390
          */
1391
-        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1391
+        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}", $html, $cf);
1392 1392
     }
1393 1393
 
1394 1394
     // Check if there is a custom field specific filter.
1395
-    if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1395
+    if (has_filter("geodir_custom_field_output_textarea_var_{$html_var}")) {
1396 1396
         /**
1397 1397
          * Filter the textarea html by individual custom field.
1398 1398
          *
@@ -1401,11 +1401,11 @@  discard block
 block discarded – undo
1401 1401
          * @param array $cf The custom field array.
1402 1402
          * @since 1.6.6
1403 1403
          */
1404
-        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1404
+        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}", $html, $location, $cf);
1405 1405
     }
1406 1406
 
1407 1407
     // Check if there is a custom field key specific filter.
1408
-    if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1408
+    if (has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")) {
1409 1409
         /**
1410 1410
          * Filter the textarea html by field type key.
1411 1411
          *
@@ -1414,11 +1414,11 @@  discard block
 block discarded – undo
1414 1414
          * @param array $cf The custom field array.
1415 1415
          * @since 1.6.6
1416 1416
          */
1417
-        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1417
+        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}", $html, $location, $cf);
1418 1418
     }
1419 1419
 
1420 1420
     // If not html then we run the standard output.
1421
-    if(empty($html)){
1421
+    if (empty($html)) {
1422 1422
 
1423 1423
         if (!empty($post->{$cf['htmlvar_name']})) {
1424 1424
 
@@ -1433,9 +1433,9 @@  discard block
 block discarded – undo
1433 1433
             }
1434 1434
 
1435 1435
 
1436
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1437
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1438
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1436
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;
1437
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1438
+            $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>';
1439 1439
 
1440 1440
         }
1441 1441
 
@@ -1443,7 +1443,7 @@  discard block
 block discarded – undo
1443 1443
 
1444 1444
     return $html;
1445 1445
 }
1446
-add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3);
1446
+add_filter('geodir_custom_field_output_textarea', 'geodir_cf_textarea', 10, 3);
1447 1447
 
1448 1448
 
1449 1449
 
@@ -1457,21 +1457,21 @@  discard block
 block discarded – undo
1457 1457
  *
1458 1458
  * @return string The html to output for the custom field.
1459 1459
  */
1460
-function geodir_cf_html($html,$location,$cf,$p=''){
1460
+function geodir_cf_html($html, $location, $cf, $p = '') {
1461 1461
 
1462 1462
     // check we have the post value
1463
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1464
-    else{ global $post;}
1463
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1464
+    else { global $post; }
1465 1465
 
1466
-    if(!is_array($cf) && $cf!=''){
1466
+    if (!is_array($cf) && $cf != '') {
1467 1467
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1468
-        if(!$cf){return NULL;}
1468
+        if (!$cf) {return NULL; }
1469 1469
     }
1470 1470
 
1471 1471
     $html_var = $cf['htmlvar_name'];
1472 1472
 
1473 1473
     // Check if there is a location specific filter.
1474
-    if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1474
+    if (has_filter("geodir_custom_field_output_html_loc_{$location}")) {
1475 1475
         /**
1476 1476
          * Filter the html html by location.
1477 1477
          *
@@ -1479,11 +1479,11 @@  discard block
 block discarded – undo
1479 1479
          * @param array $cf The custom field array.
1480 1480
          * @since 1.6.6
1481 1481
          */
1482
-        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1482
+        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}", $html, $cf);
1483 1483
     }
1484 1484
 
1485 1485
     // Check if there is a custom field specific filter.
1486
-    if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1486
+    if (has_filter("geodir_custom_field_output_html_var_{$html_var}")) {
1487 1487
         /**
1488 1488
          * Filter the html html by individual custom field.
1489 1489
          *
@@ -1492,11 +1492,11 @@  discard block
 block discarded – undo
1492 1492
          * @param array $cf The custom field array.
1493 1493
          * @since 1.6.6
1494 1494
          */
1495
-        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1495
+        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}", $html, $location, $cf);
1496 1496
     }
1497 1497
 
1498 1498
     // Check if there is a custom field key specific filter.
1499
-    if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1499
+    if (has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")) {
1500 1500
         /**
1501 1501
          * Filter the html html by field type key.
1502 1502
          *
@@ -1505,11 +1505,11 @@  discard block
 block discarded – undo
1505 1505
          * @param array $cf The custom field array.
1506 1506
          * @since 1.6.6
1507 1507
          */
1508
-        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1508
+        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}", $html, $location, $cf);
1509 1509
     }
1510 1510
 
1511 1511
     // If not html then we run the standard output.
1512
-    if(empty($html)){
1512
+    if (empty($html)) {
1513 1513
 
1514 1514
         if (!empty($post->{$cf['htmlvar_name']})) {
1515 1515
 
@@ -1523,9 +1523,9 @@  discard block
 block discarded – undo
1523 1523
                 $field_icon = '';
1524 1524
             }
1525 1525
 
1526
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1527
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1528
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1526
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;
1527
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1528
+            $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>';
1529 1529
 
1530 1530
         }
1531 1531
 
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
 
1534 1534
     return $html;
1535 1535
 }
1536
-add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3);
1536
+add_filter('geodir_custom_field_output_html', 'geodir_cf_html', 10, 3);
1537 1537
 
1538 1538
 
1539 1539
 
@@ -1547,21 +1547,21 @@  discard block
 block discarded – undo
1547 1547
  *
1548 1548
  * @return string The html to output for the custom field.
1549 1549
  */
1550
-function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1550
+function geodir_cf_taxonomy($html, $location, $cf, $p = '') {
1551 1551
 
1552 1552
     // check we have the post value
1553
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1554
-    else{ global $post;}
1553
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1554
+    else { global $post; }
1555 1555
 
1556
-    if(!is_array($cf) && $cf!=''){
1556
+    if (!is_array($cf) && $cf != '') {
1557 1557
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1558
-        if(!$cf){return NULL;}
1558
+        if (!$cf) {return NULL; }
1559 1559
     }
1560 1560
 
1561 1561
     $html_var = $cf['htmlvar_name'];
1562 1562
 
1563 1563
     // Check if there is a location specific filter.
1564
-    if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1564
+    if (has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")) {
1565 1565
         /**
1566 1566
          * Filter the taxonomy html by location.
1567 1567
          *
@@ -1569,11 +1569,11 @@  discard block
 block discarded – undo
1569 1569
          * @param array $cf The custom field array.
1570 1570
          * @since 1.6.6
1571 1571
          */
1572
-        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1572
+        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}", $html, $cf);
1573 1573
     }
1574 1574
 
1575 1575
     // Check if there is a custom field specific filter.
1576
-    if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1576
+    if (has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")) {
1577 1577
         /**
1578 1578
          * Filter the taxonomy html by individual custom field.
1579 1579
          *
@@ -1582,11 +1582,11 @@  discard block
 block discarded – undo
1582 1582
          * @param array $cf The custom field array.
1583 1583
          * @since 1.6.6
1584 1584
          */
1585
-        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1585
+        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}", $html, $location, $cf);
1586 1586
     }
1587 1587
 
1588 1588
     // Check if there is a custom field key specific filter.
1589
-    if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1589
+    if (has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")) {
1590 1590
         /**
1591 1591
          * Filter the taxonomy html by field type key.
1592 1592
          *
@@ -1595,14 +1595,14 @@  discard block
 block discarded – undo
1595 1595
          * @param array $cf The custom field array.
1596 1596
          * @since 1.6.6
1597 1597
          */
1598
-        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1598
+        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}", $html, $location, $cf);
1599 1599
     }
1600 1600
 
1601 1601
     // If not html then we run the standard output.
1602
-    if(empty($html)){
1602
+    if (empty($html)) {
1603 1603
 
1604
-        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1605
-            $post_taxonomy = $post->post_type . 'category';
1604
+        if ($html_var == $post->post_type.'category' && !empty($post->{$html_var})) {
1605
+            $post_taxonomy = $post->post_type.'category';
1606 1606
             $field_value = $post->{$html_var};
1607 1607
             $links = array();
1608 1608
             $terms = array();
@@ -1620,7 +1620,7 @@  discard block
 block discarded – undo
1620 1620
                     if ($term != '') {
1621 1621
                         $term = get_term_by('id', $term, $html_var);
1622 1622
                         if (is_object($term)) {
1623
-                            $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1623
+                            $links[] = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>".$term->name."</a>";
1624 1624
                             $terms[] = $term;
1625 1625
                         }
1626 1626
                     }
@@ -1634,7 +1634,7 @@  discard block
 block discarded – undo
1634 1634
                     $terms = $termsOrdered;
1635 1635
                 }
1636 1636
             }
1637
-            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1637
+            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object) $terms) : '';
1638 1638
 
1639 1639
             if ($html_value != '') {
1640 1640
                 $field_icon = geodir_field_icon_proccess($cf);
@@ -1647,9 +1647,9 @@  discard block
 block discarded – undo
1647 1647
                     $field_icon = '';
1648 1648
                 }
1649 1649
 
1650
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1651
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1652
-                $html .= '</span> ' . $html_value . '</div>';
1650
+                $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$html_var.'" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="'.$field_icon.'">'.$field_icon_af;
1651
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1652
+                $html .= '</span> '.$html_value.'</div>';
1653 1653
             }
1654 1654
         }
1655 1655
 
@@ -1657,7 +1657,7 @@  discard block
 block discarded – undo
1657 1657
 
1658 1658
     return $html;
1659 1659
 }
1660
-add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3);
1660
+add_filter('geodir_custom_field_output_taxonomy', 'geodir_cf_taxonomy', 10, 3);
1661 1661
 
1662 1662
 
1663 1663
 /**
@@ -1670,21 +1670,21 @@  discard block
 block discarded – undo
1670 1670
  *
1671 1671
  * @return string The html to output for the custom field.
1672 1672
  */
1673
-function geodir_cf_address($html,$location,$cf,$p=''){
1673
+function geodir_cf_address($html, $location, $cf, $p = '') {
1674 1674
 
1675 1675
     // check we have the post value
1676
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1677
-    else{ global $post;}
1676
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1677
+    else { global $post; }
1678 1678
 
1679
-    if(!is_array($cf) && $cf!=''){
1679
+    if (!is_array($cf) && $cf != '') {
1680 1680
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1681
-        if(!$cf){return NULL;}
1681
+        if (!$cf) {return NULL; }
1682 1682
     }
1683 1683
 
1684 1684
     $html_var = $cf['htmlvar_name'];
1685 1685
 
1686 1686
     // Check if there is a location specific filter.
1687
-    if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1687
+    if (has_filter("geodir_custom_field_output_address_loc_{$location}")) {
1688 1688
         /**
1689 1689
          * Filter the address html by location.
1690 1690
          *
@@ -1692,11 +1692,11 @@  discard block
 block discarded – undo
1692 1692
          * @param array $cf The custom field array.
1693 1693
          * @since 1.6.6
1694 1694
          */
1695
-        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1695
+        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}", $html, $cf);
1696 1696
     }
1697 1697
 
1698 1698
     // Check if there is a custom field specific filter.
1699
-    if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1699
+    if (has_filter("geodir_custom_field_output_address_var_{$html_var}")) {
1700 1700
         /**
1701 1701
          * Filter the address html by individual custom field.
1702 1702
          *
@@ -1705,11 +1705,11 @@  discard block
 block discarded – undo
1705 1705
          * @param array $cf The custom field array.
1706 1706
          * @since 1.6.6
1707 1707
          */
1708
-        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1708
+        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}", $html, $location, $cf);
1709 1709
     }
1710 1710
 
1711 1711
     // Check if there is a custom field key specific filter.
1712
-    if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1712
+    if (has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")) {
1713 1713
         /**
1714 1714
          * Filter the address html by field type key.
1715 1715
          *
@@ -1718,14 +1718,14 @@  discard block
 block discarded – undo
1718 1718
          * @param array $cf The custom field array.
1719 1719
          * @since 1.6.6
1720 1720
          */
1721
-        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1721
+        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}", $html, $location, $cf);
1722 1722
     }
1723 1723
 
1724 1724
     // If not html then we run the standard output.
1725
-    if(empty($html)){
1725
+    if (empty($html)) {
1726 1726
 
1727 1727
         global $preview;
1728
-        $html_var = $cf['htmlvar_name'] . '_address';
1728
+        $html_var = $cf['htmlvar_name'].'_address';
1729 1729
 
1730 1730
         if ($cf['extra_fields']) {
1731 1731
 
@@ -1788,10 +1788,10 @@  discard block
 block discarded – undo
1788 1788
 
1789 1789
         if ($post->{$html_var}) {
1790 1790
 
1791
-            $field_icon = geodir_field_icon_proccess( $cf );
1792
-            if ( strpos( $field_icon, 'http' ) !== false ) {
1791
+            $field_icon = geodir_field_icon_proccess($cf);
1792
+            if (strpos($field_icon, 'http') !== false) {
1793 1793
                 $field_icon_af = '';
1794
-            } elseif ( $field_icon == '' ) {
1794
+            } elseif ($field_icon == '') {
1795 1795
                 $field_icon_af = '<i class="fa fa-home"></i>';
1796 1796
             } else {
1797 1797
                 $field_icon_af = $field_icon;
@@ -1800,25 +1800,25 @@  discard block
 block discarded – undo
1800 1800
             
1801 1801
 
1802 1802
 
1803
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="https://schema.org/PostalAddress">';
1804
-            $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1805
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1803
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$html_var.'" style="clear:both;"  itemscope itemtype="https://schema.org/PostalAddress">';
1804
+            $html .= '<span class="geodir-i-location" style="'.$field_icon.'">'.$field_icon_af;
1805
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
1806 1806
             $html .= '</span>';
1807 1807
 
1808
-            if ( isset($post->post_address) ) {
1809
-                $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1808
+            if (isset($post->post_address)) {
1809
+                $html .= '<span itemprop="streetAddress">'.$post->post_address.'</span><br>';
1810 1810
             }
1811
-            if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) {
1812
-                $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1811
+            if ($show_city_in_address && isset($post->post_city) && $post->post_city) {
1812
+                $html .= '<span itemprop="addressLocality">'.$post->post_city.'</span><br>';
1813 1813
             }
1814
-            if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) {
1815
-                $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1814
+            if ($show_region_in_address && isset($post->post_region) && $post->post_region) {
1815
+                $html .= '<span itemprop="addressRegion">'.$post->post_region.'</span><br>';
1816 1816
             }
1817
-            if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) {
1818
-                $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1817
+            if ($show_zip_in_address && isset($post->post_zip) && $post->post_zip) {
1818
+                $html .= '<span itemprop="postalCode">'.$post->post_zip.'</span><br>';
1819 1819
             }
1820
-            if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) {
1821
-                $html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1820
+            if ($show_country_in_address && isset($post->post_country) && $post->post_country) {
1821
+                $html .= '<span itemprop="addressCountry">'.__($post->post_country, 'geodirectory').'</span><br>';
1822 1822
             }
1823 1823
             $html .= '</div>';
1824 1824
 
@@ -1829,4 +1829,4 @@  discard block
 block discarded – undo
1829 1829
 
1830 1830
     return $html;
1831 1831
 }
1832
-add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3);
1833 1832
\ No newline at end of file
1833
+add_filter('geodir_custom_field_output_address', 'geodir_cf_address', 10, 3);
1834 1834
\ No newline at end of file
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;
@@ -349,8 +354,9 @@  discard block
 block discarded – undo
349 354
     $sort_by = '';
350 355
     $orderby = ' ';
351 356
 
352
-    if (get_query_var('order_by'))
353
-        $sort_by = get_query_var('order_by');
357
+    if (get_query_var('order_by')) {
358
+            $sort_by = get_query_var('order_by');
359
+    }
354 360
 
355 361
     /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
356 362
         $current_term = $wp_query->get_queried_object();
@@ -370,14 +376,16 @@  discard block
 block discarded – undo
370 376
         $orderby .= " distance,";
371 377
     }
372 378
 
373
-    if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query())
374
-        $sort_by = esc_attr($_REQUEST['sort_by']);
379
+    if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) {
380
+            $sort_by = esc_attr($_REQUEST['sort_by']);
381
+    }
375 382
 
376 383
 
377 384
     if ($sort_by == '') {
378 385
         $default_sort = geodir_get_posts_default_sort($geodir_post_type);
379
-        if (!empty($default_sort))
380
-            $sort_by = $default_sort;
386
+        if (!empty($default_sort)) {
387
+                    $sort_by = $default_sort;
388
+        }
381 389
     }
382 390
 
383 391
     /*
@@ -572,8 +580,9 @@  discard block
 block discarded – undo
572 580
 
573 581
             add_filter('posts_where', 'searching_filter_where', 1);
574 582
 
575
-            if ($snear != '')
576
-                add_filter('posts_where', 'searching_filter_where', 1);
583
+            if ($snear != '') {
584
+                            add_filter('posts_where', 'searching_filter_where', 1);
585
+            }
577 586
 
578 587
             add_filter('posts_orderby', 'geodir_posts_orderby', 1);
579 588
 
@@ -727,10 +736,11 @@  discard block
 block discarded – undo
727 736
 
728 737
     $where = '';
729 738
     $better_search_terms = '';
730
-    if (isset($_REQUEST['stype']))
731
-        $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
732
-    else
733
-        $post_types = 'gd_place';
739
+    if (isset($_REQUEST['stype'])) {
740
+            $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
741
+    } else {
742
+            $post_types = 'gd_place';
743
+    }
734 744
 
735 745
     if ($s != '') {
736 746
         $keywords = explode(" ", $s);
@@ -767,7 +777,7 @@  discard block
 block discarded – undo
767 777
     if($taxonomies) {
768 778
         $taxonomies = implode("','", $taxonomies);
769 779
         $taxonomies = "'" . $taxonomies . "'";
770
-    }else{$taxonomies='';}
780
+    } else{$taxonomies='';}
771 781
 
772 782
     $content_where = $terms_where = '';
773 783
 	if ($s != '') {
@@ -887,8 +897,9 @@  discard block
 block discarded – undo
887 897
             $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
888 898
             $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
889 899
             $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
890
-        } else
891
-            $where .= " AND $wpdb->posts.post_author = $user_id";
900
+        } else {
901
+                    $where .= " AND $wpdb->posts.post_author = $user_id";
902
+        }
892 903
 
893 904
         if ($user_id == (int)get_current_user_id()) {
894 905
             $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
Please login to merge, or discard this patch.
Indentation   +528 added lines, -528 removed lines patch added patch discarded remove patch
@@ -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($query )
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,133 +366,133 @@  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 != '' &&  $sort_by!='farthest') {
395
-            $sort_by = 'nearest';
396
-        }
397
-    }
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':
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
-        // sort by rating
436
-        case 'overall_rating_desc':
437
-            $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
438
-            break;
439
-        case 'overall_rating_asc':
440
-            $orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, ";
441
-            break;
442
-        default:
443
-
444
-            break;
445
-    endswitch;
446
-
447
-    if ($sort_by != '' && geodir_cpt_has_rating_disabled($geodir_post_type)) {
448
-        if (in_array($sort_by, array('high_review', 'rating_count_desc', 'high_rating', 'overall_rating_desc'))) {
449
-            $orderby = "$wpdb->posts.comment_count DESC, ";
450
-            $sort_by = 'comment_count_desc';
451
-        } else if (in_array($sort_by, array('low_review', 'rating_count_asc', 'low_rating', 'overall_rating_asc'))) {
452
-            $orderby = "$wpdb->posts.comment_count ASC, ";
453
-            $sort_by = 'comment_count_asc';
454
-        }
455
-    }
394
+		if ($snear != '' &&  $sort_by!='farthest') {
395
+			$sort_by = 'nearest';
396
+		}
397
+	}
456 398
 
457
-    global $s;
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
+			$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
+		// sort by rating
436
+		case 'overall_rating_desc':
437
+			$orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
438
+			break;
439
+		case 'overall_rating_asc':
440
+			$orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, ";
441
+			break;
442
+		default:
443
+
444
+			break;
445
+	endswitch;
446
+
447
+	if ($sort_by != '' && geodir_cpt_has_rating_disabled($geodir_post_type)) {
448
+		if (in_array($sort_by, array('high_review', 'rating_count_desc', 'high_rating', 'overall_rating_desc'))) {
449
+			$orderby = "$wpdb->posts.comment_count DESC, ";
450
+			$sort_by = 'comment_count_desc';
451
+		} else if (in_array($sort_by, array('low_review', 'rating_count_asc', 'low_rating', 'overall_rating_asc'))) {
452
+			$orderby = "$wpdb->posts.comment_count ASC, ";
453
+			$sort_by = 'comment_count_asc';
454
+		}
455
+	}
458 456
 
459
-    if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
460
-        $keywords = explode(" ", $s);
461
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
462
-            foreach($keywords as $kkey=>$kword){
463
-                if(mb_strlen($kword, 'UTF-8')<=$klimit){
464
-                    unset($keywords[$kkey]);
465
-                }
466
-            }
467
-        }
468
-        if ($sort_by == 'nearest' || $sort_by == 'farthest') {
469
-            if (count($keywords) > 1) {
470
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
471
-            } else {
472
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
473
-            }
474
-        } else {
475
-            if (count($keywords) > 1) {
476
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby;
477
-            } else {
478
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby;
479
-            }
480
-        }
481
-    }
457
+	global $s;
458
+
459
+	if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
460
+		$keywords = explode(" ", $s);
461
+		if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
462
+			foreach($keywords as $kkey=>$kword){
463
+				if(mb_strlen($kword, 'UTF-8')<=$klimit){
464
+					unset($keywords[$kkey]);
465
+				}
466
+			}
467
+		}
468
+		if ($sort_by == 'nearest' || $sort_by == 'farthest') {
469
+			if (count($keywords) > 1) {
470
+				$orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
471
+			} else {
472
+				$orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
473
+			}
474
+		} else {
475
+			if (count($keywords) > 1) {
476
+				$orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby;
477
+			} else {
478
+				$orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby;
479
+			}
480
+		}
481
+	}
482 482
 
483
-    /**
484
-     * Filter order by SQL.
485
-     *
486
-     * @since 1.0.0
487
-     * @param string $orderby The orderby query string.
488
-     * @param string $sort_by Sortby query string.
489
-     * @param string $table Listing table name.
490
-     */
491
-    $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
483
+	/**
484
+	 * Filter order by SQL.
485
+	 *
486
+	 * @since 1.0.0
487
+	 * @param string $orderby The orderby query string.
488
+	 * @param string $sort_by Sortby query string.
489
+	 * @param string $table Listing table name.
490
+	 */
491
+	$orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
492 492
 
493
-    $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
493
+	$orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
494 494
 
495
-    return $orderby;
495
+	return $orderby;
496 496
 }
497 497
 
498 498
 
@@ -510,53 +510,53 @@  discard block
 block discarded – undo
510 510
 function geodir_posts_order_by_custom_sort($orderby, $sort_by, $table)
511 511
 {
512 512
 
513
-    global $wpdb;
513
+	global $wpdb;
514 514
 
515
-    if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' ||  $_REQUEST['s']==' ') ) )) {
515
+	if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' ||  $_REQUEST['s']==' ') ) )) {
516 516
 
517
-        $sort_array = explode('_', $sort_by);
517
+		$sort_array = explode('_', $sort_by);
518 518
 
519
-        $sort_by_count = count($sort_array);
519
+		$sort_by_count = count($sort_array);
520 520
 
521
-        $order = $sort_array[$sort_by_count - 1];
521
+		$order = $sort_array[$sort_by_count - 1];
522 522
 
523
-        if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
523
+		if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
524 524
 
525
-            $sort_by = str_replace('_' . $order, '', $sort_by);
525
+			$sort_by = str_replace('_' . $order, '', $sort_by);
526 526
 
527
-            switch ($sort_by):
527
+			switch ($sort_by):
528 528
 
529
-                case 'post_date':
530
-                case 'comment_count':
529
+				case 'post_date':
530
+				case 'comment_count':
531 531
 
532
-                    $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", ";
533
-                    break;
532
+					$orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", ";
533
+					break;
534 534
 
535
-                case 'distance':
536
-                    $orderby = $sort_by . " " . $order . ", ";
537
-                    break;
535
+				case 'distance':
536
+					$orderby = $sort_by . " " . $order . ", ";
537
+					break;
538 538
 
539 539
 
540
-                // sort by rating
541
-                case 'overall_rating':
542
-                    $orderby = " " . $table . "." . $sort_by . "  " . $order . ", " . $table . ".rating_count " . $order . ", ";
540
+				// sort by rating
541
+				case 'overall_rating':
542
+					$orderby = " " . $table . "." . $sort_by . "  " . $order . ", " . $table . ".rating_count " . $order . ", ";
543 543
 
544
-                    break;
544
+					break;
545 545
 
546 546
 
547
-                default:
548
-                    if (geodir_column_exist($table, $sort_by)) {
547
+				default:
548
+					if (geodir_column_exist($table, $sort_by)) {
549 549
 						$orderby = $table . "." . $sort_by . " " . $order . ", ";
550 550
 					}
551
-                    break;
551
+					break;
552 552
 
553
-            endswitch;
553
+			endswitch;
554 554
 
555
-        }
555
+		}
556 556
 
557
-    }
557
+	}
558 558
 
559
-    return $orderby;
559
+	return $orderby;
560 560
 }
561 561
 
562 562
 /**
@@ -571,34 +571,34 @@  discard block
 block discarded – undo
571 571
 {
572 572
 
573 573
 
574
-    global $wpdb, $geodir_post_type, $table, $s, $snear;
574
+	global $wpdb, $geodir_post_type, $table, $s, $snear;
575 575
 
576
-    if (!is_admin()) {
576
+	if (!is_admin()) {
577 577
 
578
-        if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
579
-            add_filter('posts_where', 'geodir_edit_listing_where', 1);
578
+		if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
579
+			add_filter('posts_where', 'geodir_edit_listing_where', 1);
580 580
 
581
-        } elseif ((is_search() && $_REQUEST['geodir_search'])) {
581
+		} elseif ((is_search() && $_REQUEST['geodir_search'])) {
582 582
 
583
-            add_filter('posts_where', 'searching_filter_where', 1);
583
+			add_filter('posts_where', 'searching_filter_where', 1);
584 584
 
585
-            if ($snear != '')
586
-                add_filter('posts_where', 'searching_filter_where', 1);
585
+			if ($snear != '')
586
+				add_filter('posts_where', 'searching_filter_where', 1);
587 587
 
588
-            add_filter('posts_orderby', 'geodir_posts_orderby', 1);
588
+			add_filter('posts_orderby', 'geodir_posts_orderby', 1);
589 589
 
590
-        } elseif (geodir_is_page('author')) {
590
+		} elseif (geodir_is_page('author')) {
591 591
 
592
-            add_filter('posts_where', 'author_filter_where', 1);
592
+			add_filter('posts_where', 'author_filter_where', 1);
593 593
 
594
-        }
594
+		}
595 595
 
596
-        //if (!geodir_is_page('detail'))
597
-            add_filter('posts_where', 'geodir_default_where', 1);/**/
596
+		//if (!geodir_is_page('detail'))
597
+			add_filter('posts_where', 'geodir_default_where', 1);/**/
598 598
 
599
-        //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts
599
+		//add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts
600 600
 
601
-    }
601
+	}
602 602
 }
603 603
 
604 604
 /**
@@ -613,13 +613,13 @@  discard block
 block discarded – undo
613 613
  */
614 614
 function geodir_preview_post_cap($allcaps, $caps, $args)
615 615
 {
616
-    $user_id = get_current_user_id();
617
-    if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) {
616
+	$user_id = get_current_user_id();
617
+	if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) {
618 618
 
619
-        $allcaps['edit_posts'] = true;
620
-    }
621
-    //print_r($allcaps);
622
-    return $allcaps;
619
+		$allcaps['edit_posts'] = true;
620
+	}
621
+	//print_r($allcaps);
622
+	return $allcaps;
623 623
 }
624 624
 
625 625
 
@@ -634,9 +634,9 @@  discard block
 block discarded – undo
634 634
  */
635 635
 function geodir_edit_listing_where($where)
636 636
 {
637
-    global $wpdb;
638
-    $where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']);
639
-    return $where;
637
+	global $wpdb;
638
+	$where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']);
639
+	return $where;
640 640
 }
641 641
 
642 642
 
@@ -653,29 +653,29 @@  discard block
 block discarded – undo
653 653
  */
654 654
 function geodir_default_where($where)
655 655
 {
656
-    global $wp_query, $wpdb;
657
-
658
-    //print_r($wp_query);
659
-    ########### WPML ###########
660
-
661
-    if (function_exists('icl_object_id')) {
662
-        global $sitepress, $table_prefix;
663
-        $lang_code = ICL_LANGUAGE_CODE;
664
-        $default_lang_code = $sitepress->get_default_language();
665
-        $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : '';
666
-        //echo '##########'.$q_post_type;
667
-        if ($lang_code && $q_post_type) {
668
-            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
669
-            //$where .= " AND icl_t.language_code = '$lang_code' ";
670
-        }
656
+	global $wp_query, $wpdb;
671 657
 
672
-    }
673
-    ########### WPML ###########
658
+	//print_r($wp_query);
659
+	########### WPML ###########
660
+
661
+	if (function_exists('icl_object_id')) {
662
+		global $sitepress, $table_prefix;
663
+		$lang_code = ICL_LANGUAGE_CODE;
664
+		$default_lang_code = $sitepress->get_default_language();
665
+		$q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : '';
666
+		//echo '##########'.$q_post_type;
667
+		if ($lang_code && $q_post_type) {
668
+			$where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
669
+			//$where .= " AND icl_t.language_code = '$lang_code' ";
670
+		}
671
+
672
+	}
673
+	########### WPML ###########
674 674
 
675 675
 
676
-    return $where = str_replace("0 = 1", "1=1", $where);
676
+	return $where = str_replace("0 = 1", "1=1", $where);
677 677
 
678
-    /* ====== old code start ===
678
+	/* ====== old code start ===
679 679
     $where = str_replace("0 = 1", "1=1", $where);
680 680
     $country = get_query_var('gd_country');
681 681
     $region = get_query_var('gd_region');
@@ -716,108 +716,108 @@  discard block
 block discarded – undo
716 716
  * @return string Modified where query string.
717 717
  */
718 718
 function searching_filter_where($where) {
719
-    global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session;
719
+	global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session;
720 720
 
721
-    $search_term = 'OR';
722
-    $search_term = 'AND';
723
-    $geodir_custom_search = '';
724
-    $category_search_range = '';
721
+	$search_term = 'OR';
722
+	$search_term = 'AND';
723
+	$geodir_custom_search = '';
724
+	$category_search_range = '';
725 725
 
726
-    if (is_single() && get_query_var('post_type')) {
726
+	if (is_single() && get_query_var('post_type')) {
727 727
 		return $where;
728 728
 	}
729 729
 
730
-    if (is_tax()) {
730
+	if (is_tax()) {
731 731
 		return $where;
732 732
 	}
733 733
 
734 734
 	$s = trim($s);
735
-    $s  = wp_specialchars_decode($s ,ENT_QUOTES);
736
-    $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES);
737
-
738
-    $where = '';
739
-    $better_search_terms = '';
740
-    if (isset($_REQUEST['stype']))
741
-        $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
742
-    else
743
-        $post_types = 'gd_place';
744
-
745
-    if ($s != '') {
746
-        $keywords = explode(" ", $s);
747
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
748
-            foreach($keywords as $kkey=>$kword){
749
-                if(mb_strlen($kword, 'UTF-8')<=$klimit){
750
-                    unset($keywords[$kkey]);
751
-                }
752
-            }
753
-        }
735
+	$s  = wp_specialchars_decode($s ,ENT_QUOTES);
736
+	$s_A = wp_specialchars_decode($s_A ,ENT_QUOTES);
754 737
 
755
-        if (!empty($keywords)) {
756
-            foreach ($keywords as $keyword) {
757
-                $keyword = trim($keyword);
758
-                $keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
759
-                if ($keyword != '') {
760
-                    /**
761
-                     * Filter the search query keywords SQL.
762
-                     *
763
-                     * @since 1.5.9
764
-                     * @package GeoDirectory
765
-                     * @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 . '%" )'`.
766
-                     * @param array $keywords The array of keywords for the query.
767
-                     * @param string $keyword The single keyword being searched.
768
-                     */
738
+	$where = '';
739
+	$better_search_terms = '';
740
+	if (isset($_REQUEST['stype']))
741
+		$post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
742
+	else
743
+		$post_types = 'gd_place';
744
+
745
+	if ($s != '') {
746
+		$keywords = explode(" ", $s);
747
+		if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
748
+			foreach($keywords as $kkey=>$kword){
749
+				if(mb_strlen($kword, 'UTF-8')<=$klimit){
750
+					unset($keywords[$kkey]);
751
+				}
752
+			}
753
+		}
754
+
755
+		if (!empty($keywords)) {
756
+			foreach ($keywords as $keyword) {
757
+				$keyword = trim($keyword);
758
+				$keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
759
+				if ($keyword != '') {
760
+					/**
761
+					 * Filter the search query keywords SQL.
762
+					 *
763
+					 * @since 1.5.9
764
+					 * @package GeoDirectory
765
+					 * @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 . '%" )'`.
766
+					 * @param array $keywords The array of keywords for the query.
767
+					 * @param string $keyword The single keyword being searched.
768
+					 */
769 769
 					$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);
770
-                }
771
-            }
772
-        }
773
-    }
770
+				}
771
+			}
772
+		}
773
+	}
774 774
 
775
-    /* get taxonomy */
776
-    $taxonomies = geodir_get_taxonomies($post_types, true);
777
-    if($taxonomies) {
778
-        $taxonomies = implode("','", $taxonomies);
779
-        $taxonomies = "'" . $taxonomies . "'";
780
-    }else{$taxonomies='';}
775
+	/* get taxonomy */
776
+	$taxonomies = geodir_get_taxonomies($post_types, true);
777
+	if($taxonomies) {
778
+		$taxonomies = implode("','", $taxonomies);
779
+		$taxonomies = "'" . $taxonomies . "'";
780
+	}else{$taxonomies='';}
781 781
 
782
-    $content_where = $terms_where = '';
782
+	$content_where = $terms_where = '';
783 783
 	if ($s != '') {
784
-        /**
785
-         * Filter the search query content where values.
786
-         *
787
-         * @since 1.5.0
788
-         * @package GeoDirectory
789
-         * @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%\") ") "`.
790
-         */
784
+		/**
785
+		 * Filter the search query content where values.
786
+		 *
787
+		 * @since 1.5.0
788
+		 * @package GeoDirectory
789
+		 * @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%\") ") "`.
790
+		 */
791 791
 		$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%\") ");
792
-        /**
793
-         * Filter the search query term values.
794
-         *
795
-         * @since 1.5.0
796
-         * @package GeoDirectory
797
-         * @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)) "`.
798
-         */
799
-        $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)) ");
792
+		/**
793
+		 * Filter the search query term values.
794
+		 *
795
+		 * @since 1.5.0
796
+		 * @package GeoDirectory
797
+		 * @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)) "`.
798
+		 */
799
+		$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)) ");
800 800
 	}
801 801
 
802
-    if ($snear != '') {
802
+	if ($snear != '') {
803 803
 
804 804
 
805
-        if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) {
806
-            $dist = $gd_session->get('near_me_range');
807
-        }
808
-        $lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69);
809
-        $lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69);
810
-        $lat1 = $mylat - ($dist / 69);
811
-        $lat2 = $mylat + ($dist / 69);
805
+		if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) {
806
+			$dist = $gd_session->get('near_me_range');
807
+		}
808
+		$lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69);
809
+		$lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69);
810
+		$lat1 = $mylat - ($dist / 69);
811
+		$lat2 = $mylat + ($dist / 69);
812 812
 
813
-        $rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : '';
814
-        $rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : '';
815
-        $rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : '';
816
-        $rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : '';
813
+		$rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : '';
814
+		$rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : '';
815
+		$rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : '';
816
+		$rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : '';
817 817
 
818 818
 
819 819
 
820
-	    $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
820
+		$where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
821 821
 			                    $content_where 
822 822
 								OR ($wpdb->posts.ID IN( 
823 823
 										SELECT $wpdb->term_relationships.object_id as post_id 
@@ -834,13 +834,13 @@  discard block
 block discarded – undo
834 834
 						AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 )
835 835
 						AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) ";
836 836
 
837
-        if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
838
-            $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
839
-            $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;
840
-        }
837
+		if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
838
+			$DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
839
+			$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;
840
+		}
841 841
 
842
-    } else {
843
-        $where .= " AND (	( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
842
+	} else {
843
+		$where .= " AND (	( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
844 844
                             $content_where  
845 845
 							OR ( $wpdb->posts.ID IN(	
846 846
 									SELECT $wpdb->term_relationships.object_id as post_id                     
@@ -854,19 +854,19 @@  discard block
 block discarded – undo
854 854
 					) 
855 855
 				AND $wpdb->posts.post_type in ('$post_types')
856 856
 				AND ($wpdb->posts.post_status = 'publish') ";
857
-    }
857
+	}
858 858
 
859 859
 	########### WPML ###########
860
-    if ( function_exists( 'icl_object_id' ) ) {
860
+	if ( function_exists( 'icl_object_id' ) ) {
861 861
 		$lang_code = ICL_LANGUAGE_CODE;
862 862
 
863 863
 		if ($lang_code && $post_types) {
864
-            $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
865
-        }
866
-    }
867
-    ########### WPML ###########
864
+			$where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
865
+		}
866
+	}
867
+	########### WPML ###########
868 868
 
869
-    return $where;
869
+	return $where;
870 870
 }
871 871
 
872 872
 
@@ -881,45 +881,45 @@  discard block
 block discarded – undo
881 881
  * @return string Modified where query string.
882 882
  */
883 883
 function author_filter_where($where) {
884
-    global $wpdb, $geodir_post_type, $table, $curr;
884
+	global $wpdb, $geodir_post_type, $table, $curr;
885 885
 
886
-    $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
887
-    $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0;
886
+	$curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
887
+	$user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0;
888 888
 
889
-    if (isset($_REQUEST['stype'])) {
890
-        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
891
-    } else {
892
-        $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
893
-    }
889
+	if (isset($_REQUEST['stype'])) {
890
+		$where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
891
+	} else {
892
+		$where = " AND $wpdb->posts.post_type IN ('gd_place') ";
893
+	}
894 894
 
895
-    if ($user_id > 0) {
896
-        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
897
-            $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
898
-            $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
899
-            $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
900
-        } else
901
-            $where .= " AND $wpdb->posts.post_author = $user_id";
902
-
903
-        if ($user_id == (int)get_current_user_id()) {
904
-            $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
905
-        } else {
906
-            $where .= " AND $wpdb->posts.post_status = 'publish' ";
907
-        }
908
-    } else {
909
-        $where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' ";
910
-    }
895
+	if ($user_id > 0) {
896
+		if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
897
+			$user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
898
+			$user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
899
+			$where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
900
+		} else
901
+			$where .= " AND $wpdb->posts.post_author = $user_id";
902
+
903
+		if ($user_id == (int)get_current_user_id()) {
904
+			$where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
905
+		} else {
906
+			$where .= " AND $wpdb->posts.post_status = 'publish' ";
907
+		}
908
+	} else {
909
+		$where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' ";
910
+	}
911 911
 
912
-    ########### WPML ###########
913
-    if (function_exists('icl_object_id')) {
914
-        $lang_code = ICL_LANGUAGE_CODE;
915
-        if ($lang_code) {
916
-            $where .= " AND icl_t.language_code='" . $lang_code . "' ";
917
-        }
912
+	########### WPML ###########
913
+	if (function_exists('icl_object_id')) {
914
+		$lang_code = ICL_LANGUAGE_CODE;
915
+		if ($lang_code) {
916
+			$where .= " AND icl_t.language_code='" . $lang_code . "' ";
917
+		}
918 918
 
919
-    }
920
-    ########### WPML ###########
919
+	}
920
+	########### WPML ###########
921 921
 
922
-    return $where;
922
+	return $where;
923 923
 }
924 924
 
925 925
 /**
@@ -934,11 +934,11 @@  discard block
 block discarded – undo
934 934
  */
935 935
 function geodir_filter_widget_join($join)
936 936
 {
937
-    global $wp_query, $table;
938
-    if (!empty($wp_query->query['with_pics_only'])) {
939
-        $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
940
-    }
941
-    return $join;
937
+	global $wp_query, $table;
938
+	if (!empty($wp_query->query['with_pics_only'])) {
939
+		$join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
940
+	}
941
+	return $join;
942 942
 }
943 943
 
944 944
 /**
@@ -953,42 +953,42 @@  discard block
 block discarded – undo
953 953
  */
954 954
 function geodir_filter_widget_where($where)
955 955
 {
956
-    global $wp_query, $table;
957
-    if (!empty($wp_query->query['show_featured_only'])) {
958
-        $where .= " AND " . $table . ".is_featured = '1'";
959
-    }
960
-    if (!empty($wp_query->query['show_special_only'])) {
961
-        $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
962
-    }
963
-    if (!empty($wp_query->query['with_pics_only'])) {
964
-        $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id";
965
-    }
966
-    if (!empty($wp_query->query['with_videos_only'])) {
967
-        $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
968
-    }
969
-    return $where;
956
+	global $wp_query, $table;
957
+	if (!empty($wp_query->query['show_featured_only'])) {
958
+		$where .= " AND " . $table . ".is_featured = '1'";
959
+	}
960
+	if (!empty($wp_query->query['show_special_only'])) {
961
+		$where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
962
+	}
963
+	if (!empty($wp_query->query['with_pics_only'])) {
964
+		$where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id";
965
+	}
966
+	if (!empty($wp_query->query['with_videos_only'])) {
967
+		$where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
968
+	}
969
+	return $where;
970 970
 }
971 971
 
972 972
 
973 973
 function geodir_related_posts_fields($fields) {
974
-    global $wp_query, $wpdb, $table, $post;
974
+	global $wp_query, $wpdb, $table, $post;
975 975
 
976
-    $fields .= ", " . $table . ".* ";
976
+	$fields .= ", " . $table . ".* ";
977 977
 
978
-    $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
978
+	$DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
979 979
 
980
-    $mylat = $post->post_latitude;
981
-    $mylon = $post->post_longitude;
980
+	$mylat = $post->post_latitude;
981
+	$mylon = $post->post_longitude;
982 982
 
983
-    $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 ";
984
-    return $fields;
983
+	$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 ";
984
+	return $fields;
985 985
 }
986 986
 function geodir_related_posts_fields_filter($query) {
987
-    if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']
988
-        && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest'
989
-        && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings']
990
-    ) {
991
-        add_filter('posts_fields', 'geodir_related_posts_fields', 1);
992
-    }
987
+	if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']
988
+		&& isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest'
989
+		&& isset($query->query_vars['related_listings']) && $query->query_vars['related_listings']
990
+	) {
991
+		add_filter('posts_fields', 'geodir_related_posts_fields', 1);
992
+	}
993 993
 }
994 994
 add_action('pre_get_posts', 'geodir_related_posts_fields_filter', 1);
995 995
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
  * @global string $s_A Extra parameters.
66 66
  * @global string $s_SA Extra parameters.
67 67
  */
68
-function set_listing_request($query )
68
+function set_listing_request($query)
69 69
 {
70 70
     global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA;
71 71
 
@@ -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'])) {
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
         if ($snear == 'NEAR ME') {
122 122
             $ip = $_SERVER['REMOTE_ADDR'];
123
-            $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip));
123
+            $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$ip));
124 124
             $mylat = stripslashes(ucfirst($addr_details[geoplugin_latitude]));
125 125
             $mylon = stripslashes(ucfirst($addr_details[geoplugin_longitude]));
126 126
         }
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
             $s_AA = str_replace(" ", "", $s);
131 131
             $s_A = explode(",", $s_AA);
132 132
             $s_A = implode('","', $s_A);
133
-            $s_A = '"' . $s_A . '"';
133
+            $s_A = '"'.$s_A.'"';
134 134
         } else {
135
-            $s_A = '"' . $s . '"';
135
+            $s_A = '"'.$s.'"';
136 136
         }
137 137
 
138 138
         if (strstr($s, ' ')) {
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     }
194 194
     if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
195 195
 
196
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
196
+        $table = $plugin_prefix.$geodir_post_type.'_detail';
197 197
 
198 198
         add_filter('posts_fields', 'geodir_posts_fields', 1);
199 199
         add_filter('posts_join', 'geodir_posts_join', 1);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
     global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session;
234 234
 
235 235
     // Filter-Location-Manager to add location table.
236
-    $fields .= ", " . $table . ".* ";
236
+    $fields .= ", ".$table.".* ";
237 237
 
238 238
 	if ($snear != '' || $gd_session->get('all_near_me')) {
239 239
         $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
@@ -243,16 +243,16 @@  discard block
 block discarded – undo
243 243
             $mylon = $gd_session->get('user_lon');
244 244
         }
245 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 ";
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 247
     }
248 248
 
249 249
     global $s;
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,24 +270,24 @@  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 . " ";
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 . " ";
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 278
                     } else {
279 279
                         //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' ";
280
-						$gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) ";
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 281
                     }
282 282
                 }
283
-                $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ",";
283
+                $gd_titlematch_part .= "THEN 1 ELSE 0 END AS ".$part.",";
284 284
             }
285 285
         } else {
286 286
             $gd_titlematch_part = "";
287 287
         }
288
-        $s = stripslashes_deep( $s );
289
-        $s = wp_specialchars_decode($s,ENT_QUOTES);
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));
288
+        $s = stripslashes_deep($s);
289
+        $s = wp_specialchars_decode($s, ENT_QUOTES);
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 293
     return $fields;
@@ -316,13 +316,13 @@  discard block
 block discarded – undo
316 316
         $lang_code = ICL_LANGUAGE_CODE;
317 317
         $default_lang_code = $sitepress->get_default_language();
318 318
         if ($lang_code) {
319
-            $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
319
+            $join .= "JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID";
320 320
         }
321 321
 
322 322
     }
323 323
     ########### WPML ###########
324 324
 
325
-    $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID)  ";
325
+    $join .= " INNER JOIN ".$table." ON (".$table.".post_id = $wpdb->posts.ID)  ";
326 326
     //===old code start
327 327
     //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id)  " ;//===old code end
328 328
 
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
             $sort_by = 'az';
392 392
         }
393 393
 
394
-        if ($snear != '' &&  $sort_by!='farthest') {
394
+        if ($snear != '' && $sort_by != 'farthest') {
395 395
             $sort_by = 'nearest';
396 396
         }
397 397
     }
@@ -405,20 +405,20 @@  discard block
 block discarded – undo
405 405
             break;
406 406
         case 'low_review':
407 407
         case 'rating_count_asc':
408
-            $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, ";
408
+            $orderby = $table.".rating_count ASC, ".$table.".overall_rating ASC, ";
409 409
             break;
410 410
         case 'high_review':
411 411
         case 'rating_count_desc':
412
-            $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
412
+            $orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, ";
413 413
             break;
414 414
         case 'low_rating':
415
-            $orderby = "( " . $table . ".overall_rating  ) ASC, " . $table . ".rating_count ASC,  ";
415
+            $orderby = "( ".$table.".overall_rating  ) ASC, ".$table.".rating_count ASC,  ";
416 416
             break;
417 417
         case 'high_rating':
418
-            $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
418
+            $orderby = " ".$table.".overall_rating DESC, ".$table.".rating_count DESC, ";
419 419
             break;
420 420
         case 'featured':
421
-            $orderby = $table . ".is_featured asc, ";
421
+            $orderby = $table.".is_featured asc, ";
422 422
             break;
423 423
         case 'nearest':
424 424
             $orderby = " distance asc, ";
@@ -434,10 +434,10 @@  discard block
 block discarded – undo
434 434
             break;
435 435
         // sort by rating
436 436
         case 'overall_rating_desc':
437
-            $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
437
+            $orderby = " ".$table.".overall_rating DESC, ".$table.".rating_count DESC, ";
438 438
             break;
439 439
         case 'overall_rating_asc':
440
-            $orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, ";
440
+            $orderby = " ".$table.".overall_rating ASC, ".$table.".rating_count ASC, ";
441 441
             break;
442 442
         default:
443 443
 
@@ -458,24 +458,24 @@  discard block
 block discarded – undo
458 458
 
459 459
     if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
460 460
         $keywords = explode(" ", $s);
461
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
462
-            foreach($keywords as $kkey=>$kword){
463
-                if(mb_strlen($kword, 'UTF-8')<=$klimit){
461
+        if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
462
+            foreach ($keywords as $kkey=>$kword) {
463
+                if (mb_strlen($kword, 'UTF-8') <= $klimit) {
464 464
                     unset($keywords[$kkey]);
465 465
                 }
466 466
             }
467 467
         }
468 468
         if ($sort_by == 'nearest' || $sort_by == 'farthest') {
469 469
             if (count($keywords) > 1) {
470
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
470
+                $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
471 471
             } else {
472
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
472
+                $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
473 473
             }
474 474
         } else {
475 475
             if (count($keywords) > 1) {
476
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby;
476
+                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ".$orderby;
477 477
             } else {
478
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby;
478
+                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ".$orderby;
479 479
             }
480 480
         }
481 481
     }
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
      */
491 491
     $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
492 492
 
493
-    $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
493
+    $orderby .= $table.".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
494 494
 
495 495
     return $orderby;
496 496
 }
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 
513 513
     global $wpdb;
514 514
 
515
-    if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' ||  $_REQUEST['s']==' ') ) )) {
515
+    if ($sort_by != '' && (!is_search() || (isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear'] == '' && ($_REQUEST['s'] == '' || $_REQUEST['s'] == ' ')))) {
516 516
 
517 517
         $sort_array = explode('_', $sort_by);
518 518
 
@@ -522,31 +522,31 @@  discard block
 block discarded – undo
522 522
 
523 523
         if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
524 524
 
525
-            $sort_by = str_replace('_' . $order, '', $sort_by);
525
+            $sort_by = str_replace('_'.$order, '', $sort_by);
526 526
 
527 527
             switch ($sort_by):
528 528
 
529 529
                 case 'post_date':
530 530
                 case 'comment_count':
531 531
 
532
-                    $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", ";
532
+                    $orderby = "$wpdb->posts.".$sort_by." ".$order.", ".$table.".overall_rating ".$order.", ";
533 533
                     break;
534 534
 
535 535
                 case 'distance':
536
-                    $orderby = $sort_by . " " . $order . ", ";
536
+                    $orderby = $sort_by." ".$order.", ";
537 537
                     break;
538 538
 
539 539
 
540 540
                 // sort by rating
541 541
                 case 'overall_rating':
542
-                    $orderby = " " . $table . "." . $sort_by . "  " . $order . ", " . $table . ".rating_count " . $order . ", ";
542
+                    $orderby = " ".$table.".".$sort_by."  ".$order.", ".$table.".rating_count ".$order.", ";
543 543
 
544 544
                     break;
545 545
 
546 546
 
547 547
                 default:
548 548
                     if (geodir_column_exist($table, $sort_by)) {
549
-						$orderby = $table . "." . $sort_by . " " . $order . ", ";
549
+						$orderby = $table.".".$sort_by." ".$order.", ";
550 550
 					}
551 551
                     break;
552 552
 
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
         }
595 595
 
596 596
         //if (!geodir_is_page('detail'))
597
-            add_filter('posts_where', 'geodir_default_where', 1);/**/
597
+            add_filter('posts_where', 'geodir_default_where', 1); /**/
598 598
 
599 599
         //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts
600 600
 
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
         $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : '';
666 666
         //echo '##########'.$q_post_type;
667 667
         if ($lang_code && $q_post_type) {
668
-            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
668
+            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_".$q_post_type."') ";
669 669
             //$where .= " AND icl_t.language_code = '$lang_code' ";
670 670
         }
671 671
 
@@ -732,8 +732,8 @@  discard block
 block discarded – undo
732 732
 	}
733 733
 
734 734
 	$s = trim($s);
735
-    $s  = wp_specialchars_decode($s ,ENT_QUOTES);
736
-    $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES);
735
+    $s = wp_specialchars_decode($s, ENT_QUOTES);
736
+    $s_A = wp_specialchars_decode($s_A, ENT_QUOTES);
737 737
 
738 738
     $where = '';
739 739
     $better_search_terms = '';
@@ -744,9 +744,9 @@  discard block
 block discarded – undo
744 744
 
745 745
     if ($s != '') {
746 746
         $keywords = explode(" ", $s);
747
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
748
-            foreach($keywords as $kkey=>$kword){
749
-                if(mb_strlen($kword, 'UTF-8')<=$klimit){
747
+        if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
748
+            foreach ($keywords as $kkey=>$kword) {
749
+                if (mb_strlen($kword, 'UTF-8') <= $klimit) {
750 750
                     unset($keywords[$kkey]);
751 751
                 }
752 752
             }
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
         if (!empty($keywords)) {
756 756
             foreach ($keywords as $keyword) {
757 757
                 $keyword = trim($keyword);
758
-                $keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
758
+                $keyword = wp_specialchars_decode($keyword, ENT_QUOTES);
759 759
                 if ($keyword != '') {
760 760
                     /**
761 761
                      * Filter the search query keywords SQL.
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
                      * @param array $keywords The array of keywords for the query.
767 767
                      * @param string $keyword The single keyword being searched.
768 768
                      */
769
-					$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);
769
+					$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);
770 770
                 }
771 771
             }
772 772
         }
@@ -774,10 +774,10 @@  discard block
 block discarded – undo
774 774
 
775 775
     /* get taxonomy */
776 776
     $taxonomies = geodir_get_taxonomies($post_types, true);
777
-    if($taxonomies) {
777
+    if ($taxonomies) {
778 778
         $taxonomies = implode("','", $taxonomies);
779
-        $taxonomies = "'" . $taxonomies . "'";
780
-    }else{$taxonomies='';}
779
+        $taxonomies = "'".$taxonomies."'";
780
+    } else {$taxonomies = ''; }
781 781
 
782 782
     $content_where = $terms_where = '';
783 783
 	if ($s != '') {
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
          * @package GeoDirectory
789 789
          * @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%\") ") "`.
790 790
          */
791
-		$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%\") ");
791
+		$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%\") ");
792 792
         /**
793 793
          * Filter the search query term values.
794 794
          *
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
          * @package GeoDirectory
797 797
          * @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)) "`.
798 798
          */
799
-        $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)) ");
799
+        $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)) ");
800 800
 	}
801 801
 
802 802
     if ($snear != '') {
@@ -831,12 +831,12 @@  discard block
 block discarded – undo
831 831
 							)
832 832
 						AND $wpdb->posts.post_type in ('{$post_types}')
833 833
 						AND ($wpdb->posts.post_status = 'publish')
834
-						AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 )
835
-						AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) ";
834
+						AND ( ".$table.".post_latitude between $rlat1 and $rlat2 )
835
+						AND ( ".$table.".post_longitude between $rlon1 and $rlon2 ) ";
836 836
 
837 837
         if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
838 838
             $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
839
-            $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;
839
+            $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;
840 840
         }
841 841
 
842 842
     } else {
@@ -857,11 +857,11 @@  discard block
 block discarded – undo
857 857
     }
858 858
 
859 859
 	########### WPML ###########
860
-    if ( function_exists( 'icl_object_id' ) ) {
860
+    if (function_exists('icl_object_id')) {
861 861
 		$lang_code = ICL_LANGUAGE_CODE;
862 862
 
863 863
 		if ($lang_code && $post_types) {
864
-            $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
864
+            $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_".$post_types."') ";
865 865
         }
866 866
     }
867 867
     ########### WPML ###########
@@ -884,10 +884,10 @@  discard block
 block discarded – undo
884 884
     global $wpdb, $geodir_post_type, $table, $curr;
885 885
 
886 886
     $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
887
-    $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0;
887
+    $user_id = !empty($curauth->ID) ? (int) $curauth->ID : 0;
888 888
 
889 889
     if (isset($_REQUEST['stype'])) {
890
-        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
890
+        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ", $_REQUEST['stype']);
891 891
     } else {
892 892
         $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
893 893
     }
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
         } else
901 901
             $where .= " AND $wpdb->posts.post_author = $user_id";
902 902
 
903
-        if ($user_id == (int)get_current_user_id()) {
903
+        if ($user_id == (int) get_current_user_id()) {
904 904
             $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
905 905
         } else {
906 906
             $where .= " AND $wpdb->posts.post_status = 'publish' ";
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
     if (function_exists('icl_object_id')) {
914 914
         $lang_code = ICL_LANGUAGE_CODE;
915 915
         if ($lang_code) {
916
-            $where .= " AND icl_t.language_code='" . $lang_code . "' ";
916
+            $where .= " AND icl_t.language_code='".$lang_code."' ";
917 917
         }
918 918
 
919 919
     }
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 {
937 937
     global $wp_query, $table;
938 938
     if (!empty($wp_query->query['with_pics_only'])) {
939
-        $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
939
+        $join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )";
940 940
     }
941 941
     return $join;
942 942
 }
@@ -955,16 +955,16 @@  discard block
 block discarded – undo
955 955
 {
956 956
     global $wp_query, $table;
957 957
     if (!empty($wp_query->query['show_featured_only'])) {
958
-        $where .= " AND " . $table . ".is_featured = '1'";
958
+        $where .= " AND ".$table.".is_featured = '1'";
959 959
     }
960 960
     if (!empty($wp_query->query['show_special_only'])) {
961
-        $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
961
+        $where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )";
962 962
     }
963 963
     if (!empty($wp_query->query['with_pics_only'])) {
964
-        $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id";
964
+        $where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL GROUP BY ".$table.".post_id";
965 965
     }
966 966
     if (!empty($wp_query->query['with_videos_only'])) {
967
-        $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
967
+        $where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )";
968 968
     }
969 969
     return $where;
970 970
 }
@@ -973,18 +973,18 @@  discard block
 block discarded – undo
973 973
 function geodir_related_posts_fields($fields) {
974 974
     global $wp_query, $wpdb, $table, $post;
975 975
 
976
-    $fields .= ", " . $table . ".* ";
976
+    $fields .= ", ".$table.".* ";
977 977
 
978 978
     $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
979 979
 
980 980
     $mylat = $post->post_latitude;
981 981
     $mylon = $post->post_longitude;
982 982
 
983
-    $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 ";
983
+    $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 ";
984 984
     return $fields;
985 985
 }
986 986
 function geodir_related_posts_fields_filter($query) {
987
-    if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']
987
+    if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']
988 988
         && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest'
989 989
         && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings']
990 990
     ) {
Please login to merge, or discard this patch.
geodirectory-functions/location_functions.php 4 patches
Braces   +31 added lines, -22 removed lines patch added patch discarded remove patch
@@ -61,11 +61,12 @@  discard block
 block discarded – undo
61 61
 function geodir_is_default_location_set()
62 62
 {
63 63
     $default_location = geodir_get_default_location();
64
-    if (!empty($default_location))
65
-        return true;
66
-    else
67
-        return false;
68
-}
64
+    if (!empty($default_location)) {
65
+            return true;
66
+    } else {
67
+            return false;
68
+    }
69
+    }
69 70
 
70 71
 /**
71 72
  * Returns location slug using location string.
@@ -259,8 +260,9 @@  discard block
 block discarded – undo
259 260
         }
260 261
         */
261 262
 
262
-        if ($geodir_location->is_default)
263
-            update_option('geodir_default_location', $geodir_location);
263
+        if ($geodir_location->is_default) {
264
+                    update_option('geodir_default_location', $geodir_location);
265
+        }
264 266
 
265 267
         return $geodir_location->location_id;
266 268
 
@@ -308,9 +310,10 @@  discard block
 block discarded – undo
308 310
     $status = $data->status;
309 311
     if ($status == "OK") {
310 312
         return $data->results[0]->address_components;
311
-    } else
312
-        return false;
313
-}
313
+    } else {
314
+            return false;
315
+    }
316
+    }
314 317
 
315 318
 /**
316 319
  * Returns current location terms.
@@ -334,16 +337,19 @@  discard block
 block discarded – undo
334 337
         }
335 338
 
336 339
         $country = $gd_session->get('gd_country');
337
-        if ($country != '' && $country)
338
-            $location_array['gd_country'] = urldecode($country);
340
+        if ($country != '' && $country) {
341
+                    $location_array['gd_country'] = urldecode($country);
342
+        }
339 343
 
340 344
         $region = $gd_session->get('gd_region');
341
-        if ($region != '' && $region)
342
-            $location_array['gd_region'] = urldecode($region);
345
+        if ($region != '' && $region) {
346
+                    $location_array['gd_region'] = urldecode($region);
347
+        }
343 348
 
344 349
         $city = $gd_session->get('gd_city');
345
-        if ($city != '' && $city)
346
-            $location_array['gd_city'] = urldecode($city);
350
+        if ($city != '' && $city) {
351
+                    $location_array['gd_city'] = urldecode($city);
352
+        }
347 353
     } else {
348 354
         if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) {
349 355
             return $location_array;
@@ -355,14 +361,17 @@  discard block
 block discarded – undo
355 361
 
356 362
         $city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
357 363
 
358
-        if ($country != '')
359
-            $location_array['gd_country'] = urldecode($country);
364
+        if ($country != '') {
365
+                    $location_array['gd_country'] = urldecode($country);
366
+        }
360 367
 
361
-        if ($region != '')
362
-            $location_array['gd_region'] = urldecode($region);
368
+        if ($region != '') {
369
+                    $location_array['gd_region'] = urldecode($region);
370
+        }
363 371
 
364
-        if ($city != '')
365
-            $location_array['gd_city'] = urldecode($city);
372
+        if ($city != '') {
373
+                    $location_array['gd_city'] = urldecode($city);
374
+        }
366 375
 			
367 376
 		// Fix category link in ajax popular category widget on change post type
368 377
 		if (empty($location_array) && defined('DOING_AJAX') && DOING_AJAX) {
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
  *
37 37
  * @since 1.0.0
38 38
  * @package GeoDirectory
39
- * @return object
39
+ * @return string
40 40
  */
41 41
 function geodir_get_default_location()
42 42
 {
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
  * @package GeoDirectory
277 277
  * @param int $min The minimum number. Default: 0.
278 278
  * @param int $max The maximum number. Default: 1.
279
- * @return float
279
+ * @return integer
280 280
  */
281 281
 function geodir_random_float($min = 0, $max = 1)
282 282
 {
@@ -594,6 +594,9 @@  discard block
 block discarded – undo
594 594
 add_filter('geodir_replace_location_variables', 'geodir_replace_location_variables');
595 595
 
596 596
 
597
+/**
598
+ * @param string $sep
599
+ */
597 600
 function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = ''){
598 601
 
599 602
     global $wp;
Please login to merge, or discard this patch.
Indentation   +378 added lines, -378 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@  discard block
 block discarded – undo
9 9
  */
10 10
 function geodir_get_current_city_lat()
11 11
 {
12
-    $location = geodir_get_default_location();
13
-    $lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '39.952484';
12
+	$location = geodir_get_default_location();
13
+	$lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '39.952484';
14 14
 
15
-    return $lat;
15
+	return $lat;
16 16
 }
17 17
 
18 18
 /**
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function geodir_get_current_city_lng()
27 27
 {
28
-    $location = geodir_get_default_location();
29
-    $lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '-75.163786';
30
-    return $lng;
28
+	$location = geodir_get_default_location();
29
+	$lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '-75.163786';
30
+	return $lng;
31 31
 }
32 32
 
33 33
 
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
  */
41 41
 function geodir_get_default_location()
42 42
 {
43
-    /**
44
-     * Filter the default location.
45
-     *
46
-     * @since 1.0.0
47
-     * @package GeoDirectory
48
-     *
49
-     * @param string $location_result The default location object.
50
-     */
51
-    return $location_result = apply_filters('geodir_get_default_location', get_option('geodir_default_location'));
43
+	/**
44
+	 * Filter the default location.
45
+	 *
46
+	 * @since 1.0.0
47
+	 * @package GeoDirectory
48
+	 *
49
+	 * @param string $location_result The default location object.
50
+	 */
51
+	return $location_result = apply_filters('geodir_get_default_location', get_option('geodir_default_location'));
52 52
 }
53 53
 
54 54
 /**
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
  */
61 61
 function geodir_is_default_location_set()
62 62
 {
63
-    $default_location = geodir_get_default_location();
64
-    if (!empty($default_location))
65
-        return true;
66
-    else
67
-        return false;
63
+	$default_location = geodir_get_default_location();
64
+	if (!empty($default_location))
65
+		return true;
66
+	else
67
+		return false;
68 68
 }
69 69
 
70 70
 /**
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
 function create_location_slug($location_string)
79 79
 {
80 80
 
81
-    /**
82
-     * Filter the location slug.
83
-     *
84
-     * @since 1.0.0
85
-     * @package GeoDirectory
86
-     *
87
-     * @param string $location_string Sanitized location string.
88
-     */
89
-    return urldecode(apply_filters('geodir_location_slug_check', sanitize_title($location_string)));
81
+	/**
82
+	 * Filter the location slug.
83
+	 *
84
+	 * @since 1.0.0
85
+	 * @package GeoDirectory
86
+	 *
87
+	 * @param string $location_string Sanitized location string.
88
+	 */
89
+	return urldecode(apply_filters('geodir_location_slug_check', sanitize_title($location_string)));
90 90
 
91 91
 }
92 92
 
@@ -100,15 +100,15 @@  discard block
 block discarded – undo
100 100
  */
101 101
 function geodir_get_location($id = '')
102 102
 {
103
-    /**
104
-     * Filter the location information.
105
-     *
106
-     * @since 1.0.0
107
-     * @package GeoDirectory
108
-     *
109
-     * @param string $id The location ID.
110
-     */
111
-    return $location_result = apply_filters('geodir_get_location_by_id', get_option('geodir_default_location'), $id);
103
+	/**
104
+	 * Filter the location information.
105
+	 *
106
+	 * @since 1.0.0
107
+	 * @package GeoDirectory
108
+	 *
109
+	 * @param string $id The location ID.
110
+	 */
111
+	return $location_result = apply_filters('geodir_get_location_by_id', get_option('geodir_default_location'), $id);
112 112
 }
113 113
 
114 114
 /**
@@ -122,28 +122,28 @@  discard block
 block discarded – undo
122 122
  */
123 123
 function geodir_get_country_dl($post_country = '', $prefix = '')
124 124
 {
125
-    global $wpdb;
125
+	global $wpdb;
126 126
 
127
-    $rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC");
127
+	$rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC");
128 128
     
129
-    $ISO2 = array();
130
-    $countries = array();
129
+	$ISO2 = array();
130
+	$countries = array();
131 131
     
132
-    foreach ($rows as $row) {
133
-        $ISO2[$row->Country] = $row->ISO2;
134
-        $countries[$row->Country] = __($row->Country, 'geodirectory');
135
-    }
132
+	foreach ($rows as $row) {
133
+		$ISO2[$row->Country] = $row->ISO2;
134
+		$countries[$row->Country] = __($row->Country, 'geodirectory');
135
+	}
136 136
     
137
-    asort($countries);
137
+	asort($countries);
138 138
     
139
-    $out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
140
-    foreach ($countries as $country => $name) {
141
-        $ccode = $ISO2[$country];
139
+	$out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
140
+	foreach ($countries as $country => $name) {
141
+		$ccode = $ISO2[$country];
142 142
 
143
-        $out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>';
144
-    }
143
+		$out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>';
144
+	}
145 145
 
146
-    echo $out_put;
146
+	echo $out_put;
147 147
 }
148 148
 
149 149
 
@@ -158,40 +158,40 @@  discard block
 block discarded – undo
158 158
 function geodir_location_form_submit()
159 159
 {
160 160
 
161
-    global $wpdb, $plugin_prefix;
162
-    if (isset($_REQUEST['add_location'])) {
161
+	global $wpdb, $plugin_prefix;
162
+	if (isset($_REQUEST['add_location'])) {
163 163
 
164
-        $location_info = array(
165
-            'city' => $_REQUEST['city'],
166
-            'region' => $_REQUEST['region'],
167
-            'country' => $_REQUEST['country'],
168
-            'geo_lat' => $_REQUEST['latitude'],
169
-            'geo_lng' => $_REQUEST['longitude'],
170
-            'is_default' => $_REQUEST['is_default'],
171
-            'update_city' => $_REQUEST['update_city']
172
-        );
164
+		$location_info = array(
165
+			'city' => $_REQUEST['city'],
166
+			'region' => $_REQUEST['region'],
167
+			'country' => $_REQUEST['country'],
168
+			'geo_lat' => $_REQUEST['latitude'],
169
+			'geo_lng' => $_REQUEST['longitude'],
170
+			'is_default' => $_REQUEST['is_default'],
171
+			'update_city' => $_REQUEST['update_city']
172
+		);
173 173
 
174
-        $old_location = geodir_get_default_location();
174
+		$old_location = geodir_get_default_location();
175 175
 
176
-        $locationid = geodir_add_new_location($location_info);
176
+		$locationid = geodir_add_new_location($location_info);
177 177
 
178
-        $default_location = geodir_get_location($locationid);
178
+		$default_location = geodir_get_location($locationid);
179 179
 
180
-        //UPDATE AND DELETE LISTING
181
-        $posttype = geodir_get_posttypes();
182
-        if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
180
+		//UPDATE AND DELETE LISTING
181
+		$posttype = geodir_get_posttypes();
182
+		if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
183 183
 
184
-            foreach ($posttype as $posttypeobj) {
185
-                $post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location
184
+			foreach ($posttype as $posttypeobj) {
185
+				$post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location
186 186
 
187
-                $sql = $wpdb->prepare(
188
-                    "UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
189
-                    array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations)
190
-                );
191
-                $wpdb->query($sql);
192
-            }
193
-        }
194
-    }
187
+				$sql = $wpdb->prepare(
188
+					"UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
189
+					array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations)
190
+				);
191
+				$wpdb->query($sql);
192
+			}
193
+		}
194
+	}
195 195
 }
196 196
 
197 197
 /**
@@ -215,37 +215,37 @@  discard block
 block discarded – undo
215 215
  */
216 216
 function geodir_add_new_location($location_info = array())
217 217
 {
218
-    global $wpdb;
219
-
220
-    if (!empty($location_info)) {
221
-        $location_city = ($location_info['city'] != '') ? $location_info['city'] : 'all';
222
-        $location_region = ($location_info['region'] != '') ? $location_info['region'] : 'all';
223
-        $location_country = ($location_info['country'] != '') ? geodir_get_normal_country($location_info['country']) : 'all';
224
-        $location_lat = ($location_info['geo_lat'] != '') ? $location_info['geo_lat'] : '';
225
-        $location_lng = ($location_info['geo_lng'] != '') ? $location_info['geo_lng'] : '';
226
-        $is_default = isset($location_info['is_default']) ? $location_info['is_default'] : '';
227
-        $country_slug = create_location_slug(__($location_country, 'geodirectory'));
228
-        $region_slug = create_location_slug($location_region);
229
-        $city_slug = create_location_slug($location_city);
218
+	global $wpdb;
219
+
220
+	if (!empty($location_info)) {
221
+		$location_city = ($location_info['city'] != '') ? $location_info['city'] : 'all';
222
+		$location_region = ($location_info['region'] != '') ? $location_info['region'] : 'all';
223
+		$location_country = ($location_info['country'] != '') ? geodir_get_normal_country($location_info['country']) : 'all';
224
+		$location_lat = ($location_info['geo_lat'] != '') ? $location_info['geo_lat'] : '';
225
+		$location_lng = ($location_info['geo_lng'] != '') ? $location_info['geo_lng'] : '';
226
+		$is_default = isset($location_info['is_default']) ? $location_info['is_default'] : '';
227
+		$country_slug = create_location_slug(__($location_country, 'geodirectory'));
228
+		$region_slug = create_location_slug($location_region);
229
+		$city_slug = create_location_slug($location_city);
230 230
         
231
-        /**
232
-         * Filter add new location data.
233
-         *
234
-         * @since 1.0.0
235
-         */
236
-        $geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
237
-            'country' => $location_country,
238
-            'region' => $location_region,
239
-            'city' => $location_city,
240
-            'country_slug' => $country_slug,
241
-            'region_slug' => $region_slug,
242
-            'city_slug' => $city_slug,
243
-            'city_latitude' => $location_lat,
244
-            'city_longitude' => $location_lng,
245
-            'is_default' => $is_default
246
-        ));
247
-
248
-        /* // Not allowed to create country in DB : 2016-12-09
231
+		/**
232
+		 * Filter add new location data.
233
+		 *
234
+		 * @since 1.0.0
235
+		 */
236
+		$geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
237
+			'country' => $location_country,
238
+			'region' => $location_region,
239
+			'city' => $location_city,
240
+			'country_slug' => $country_slug,
241
+			'region_slug' => $region_slug,
242
+			'city_slug' => $city_slug,
243
+			'city_latitude' => $location_lat,
244
+			'city_longitude' => $location_lng,
245
+			'is_default' => $is_default
246
+		));
247
+
248
+		/* // Not allowed to create country in DB : 2016-12-09
249 249
         if ($geodir_location->country) {
250 250
 
251 251
             $get_country = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s", array($geodir_location->country)));
@@ -259,14 +259,14 @@  discard block
 block discarded – undo
259 259
         }
260 260
         */
261 261
 
262
-        if ($geodir_location->is_default)
263
-            update_option('geodir_default_location', $geodir_location);
262
+		if ($geodir_location->is_default)
263
+			update_option('geodir_default_location', $geodir_location);
264 264
 
265
-        return $geodir_location->location_id;
265
+		return $geodir_location->location_id;
266 266
 
267
-    } else {
268
-        return false;
269
-    }
267
+	} else {
268
+		return false;
269
+	}
270 270
 }
271 271
 
272 272
 /**
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
  */
281 281
 function geodir_random_float($min = 0, $max = 1)
282 282
 {
283
-    return $min + mt_rand() / mt_getrandmax() * ($max - $min);
283
+	return $min + mt_rand() / mt_getrandmax() * ($max - $min);
284 284
 }
285 285
 
286 286
 /**
@@ -294,22 +294,22 @@  discard block
 block discarded – undo
294 294
  */
295 295
 function geodir_get_address_by_lat_lan($lat, $lng)
296 296
 {
297
-    $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ;
298
-
299
-    $ch = curl_init();
300
-    curl_setopt($ch, CURLOPT_URL, $url);
301
-    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
302
-    curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
303
-    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
304
-    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
305
-    $response = curl_exec($ch);
306
-    curl_close($ch);
307
-    $data = json_decode($response);
308
-    $status = $data->status;
309
-    if ($status == "OK") {
310
-        return $data->results[0]->address_components;
311
-    } else
312
-        return false;
297
+	$url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ;
298
+
299
+	$ch = curl_init();
300
+	curl_setopt($ch, CURLOPT_URL, $url);
301
+	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
302
+	curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
303
+	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
304
+	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
305
+	$response = curl_exec($ch);
306
+	curl_close($ch);
307
+	$data = json_decode($response);
308
+	$status = $data->status;
309
+	if ($status == "OK") {
310
+		return $data->results[0]->address_components;
311
+	} else
312
+		return false;
313 313
 }
314 314
 
315 315
 /**
@@ -326,70 +326,70 @@  discard block
 block discarded – undo
326 326
  */
327 327
 function geodir_get_current_location_terms($location_array_from = 'session', $gd_post_type = '')
328 328
 {
329
-    global $wp, $gd_session;
330
-    $location_array = array();
331
-    if ($location_array_from == 'session') {
332
-        if ($gd_session->get('gd_country') == 'me' || $gd_session->get('gd_region') == 'me' || $gd_session->get('gd_city') == 'me') {
333
-            return $location_array;
334
-        }
329
+	global $wp, $gd_session;
330
+	$location_array = array();
331
+	if ($location_array_from == 'session') {
332
+		if ($gd_session->get('gd_country') == 'me' || $gd_session->get('gd_region') == 'me' || $gd_session->get('gd_city') == 'me') {
333
+			return $location_array;
334
+		}
335 335
 
336
-        $country = $gd_session->get('gd_country');
337
-        if ($country != '' && $country)
338
-            $location_array['gd_country'] = urldecode($country);
336
+		$country = $gd_session->get('gd_country');
337
+		if ($country != '' && $country)
338
+			$location_array['gd_country'] = urldecode($country);
339 339
 
340
-        $region = $gd_session->get('gd_region');
341
-        if ($region != '' && $region)
342
-            $location_array['gd_region'] = urldecode($region);
340
+		$region = $gd_session->get('gd_region');
341
+		if ($region != '' && $region)
342
+			$location_array['gd_region'] = urldecode($region);
343 343
 
344
-        $city = $gd_session->get('gd_city');
345
-        if ($city != '' && $city)
346
-            $location_array['gd_city'] = urldecode($city);
347
-    } else {
348
-        if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) {
349
-            return $location_array;
350
-        }
344
+		$city = $gd_session->get('gd_city');
345
+		if ($city != '' && $city)
346
+			$location_array['gd_city'] = urldecode($city);
347
+	} else {
348
+		if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) {
349
+			return $location_array;
350
+		}
351 351
 
352
-        $country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
352
+		$country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
353 353
 
354
-        $region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
354
+		$region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
355 355
 
356
-        $city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
356
+		$city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
357 357
 
358
-        if ($country != '')
359
-            $location_array['gd_country'] = urldecode($country);
358
+		if ($country != '')
359
+			$location_array['gd_country'] = urldecode($country);
360 360
 
361
-        if ($region != '')
362
-            $location_array['gd_region'] = urldecode($region);
361
+		if ($region != '')
362
+			$location_array['gd_region'] = urldecode($region);
363 363
 
364
-        if ($city != '')
365
-            $location_array['gd_city'] = urldecode($city);
364
+		if ($city != '')
365
+			$location_array['gd_city'] = urldecode($city);
366 366
 			
367 367
 		// Fix category link in ajax popular category widget on change post type
368 368
 		if (empty($location_array) && defined('DOING_AJAX') && DOING_AJAX) {
369 369
 			$location_array = geodir_get_current_location_terms('session');
370 370
 		}
371
-    }
371
+	}
372 372
 
373 373
 	/**
374 374
 	 * Filter the location terms.
375 375
 	 *
376 376
 	 * @since 1.4.6
377
-     * @package GeoDirectory
377
+	 * @package GeoDirectory
378
+	 *
379
+	 * @param array $location_array {
380
+	 *    Attributes of the location_array.
381
+	 *
382
+	 *    @type string $gd_country The country slug.
383
+	 *    @type string $gd_region The region slug.
384
+	 *    @type string $gd_city The city slug.
378 385
 	 *
379
-     * @param array $location_array {
380
-     *    Attributes of the location_array.
381
-     *
382
-     *    @type string $gd_country The country slug.
383
-     *    @type string $gd_region The region slug.
384
-     *    @type string $gd_city The city slug.
385
-     *
386
-     * }
386
+	 * }
387 387
 	 * @param string $location_array_from Source type of location terms. Default session.
388 388
 	 * @param string $gd_post_type WP post type.
389 389
 	 */
390 390
 	$location_array = apply_filters( 'geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type );
391 391
 
392
-    return $location_array;
392
+	return $location_array;
393 393
 
394 394
 }
395 395
 
@@ -402,24 +402,24 @@  discard block
 block discarded – undo
402 402
  * @return bool|string
403 403
  */
404 404
 function geodir_get_location_link($which_location = 'current') {
405
-    $location_link = get_permalink(geodir_location_page_id());
406
-
407
-    if ($which_location == 'base') {
408
-        return $location_link;
409
-    } else {
410
-        $location_terms = geodir_get_current_location_terms();
411
-
412
-        if (!empty($location_terms)) {
413
-            if (get_option('permalink_structure') != '') {
414
-                $location_terms = implode("/", $location_terms);
415
-                $location_terms = rtrim($location_terms, '/');
416
-                $location_link .= $location_terms;
417
-            } else {
418
-                $location_link = geodir_getlink($location_link, $location_terms);
419
-            }
420
-        }
421
-    }
422
-    return $location_link;
405
+	$location_link = get_permalink(geodir_location_page_id());
406
+
407
+	if ($which_location == 'base') {
408
+		return $location_link;
409
+	} else {
410
+		$location_terms = geodir_get_current_location_terms();
411
+
412
+		if (!empty($location_terms)) {
413
+			if (get_option('permalink_structure') != '') {
414
+				$location_terms = implode("/", $location_terms);
415
+				$location_terms = rtrim($location_terms, '/');
416
+				$location_link .= $location_terms;
417
+			} else {
418
+				$location_link = geodir_getlink($location_link, $location_terms);
419
+			}
420
+		}
421
+	}
422
+	return $location_link;
423 423
 }
424 424
 
425 425
 /**
@@ -432,34 +432,34 @@  discard block
 block discarded – undo
432 432
  * @return array|bool Returns address on success.
433 433
  */
434 434
 function geodir_get_osm_address_by_lat_lan($lat, $lng) {
435
-    $url = is_ssl() ? 'https:' : 'http:';
436
-    $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
437
-
438
-    $ch = curl_init();
439
-    curl_setopt($ch, CURLOPT_URL, $url);
440
-    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
441
-    curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
442
-    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
443
-    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
444
-    $response = curl_exec($ch);
445
-    curl_close($ch);
446
-    $data = json_decode($response);
435
+	$url = is_ssl() ? 'https:' : 'http:';
436
+	$url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
437
+
438
+	$ch = curl_init();
439
+	curl_setopt($ch, CURLOPT_URL, $url);
440
+	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
441
+	curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
442
+	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
443
+	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
444
+	$response = curl_exec($ch);
445
+	curl_close($ch);
446
+	$data = json_decode($response);
447 447
     
448
-    if (!empty($data) && !empty($data->address)) {
449
-        $address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
450
-        $formatted_address = (array)$data->address;
448
+	if (!empty($data) && !empty($data->address)) {
449
+		$address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
450
+		$formatted_address = (array)$data->address;
451 451
         
452
-        foreach ( $data->address as $key => $value ) {
453
-            if (!in_array($key, $address_fields)) {
454
-                unset($formatted_address[$key]);
455
-            }
456
-        }
457
-        $data->formatted_address = !empty($formatted_address) ? implode(', ', $formatted_address) : '';
452
+		foreach ( $data->address as $key => $value ) {
453
+			if (!in_array($key, $address_fields)) {
454
+				unset($formatted_address[$key]);
455
+			}
456
+		}
457
+		$data->formatted_address = !empty($formatted_address) ? implode(', ', $formatted_address) : '';
458 458
         
459
-        return $data;
460
-    } else {
461
-        return false;
462
-    }
459
+		return $data;
460
+	} else {
461
+		return false;
462
+	}
463 463
 }
464 464
 
465 465
 /**
@@ -471,47 +471,47 @@  discard block
 block discarded – undo
471 471
  * @return string Returns the country.
472 472
  */
473 473
 function geodir_get_normal_country($country) {
474
-    global $wpdb;
475
-    if ($result = geodir_get_country_by_name($country)) {
476
-        return $result;
477
-    }
474
+	global $wpdb;
475
+	if ($result = geodir_get_country_by_name($country)) {
476
+		return $result;
477
+	}
478 478
     
479
-    if (defined('POST_LOCATION_TABLE')) {
480
-        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
481
-        if (!empty($rows)) {
482
-            foreach ($rows as $row) {
483
-                $translated = __($row->country, 'geodirectory');
484
-                if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
485
-                    return $result;
486
-                }
487
-            }
488
-        }
479
+	if (defined('POST_LOCATION_TABLE')) {
480
+		$rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
481
+		if (!empty($rows)) {
482
+			foreach ($rows as $row) {
483
+				$translated = __($row->country, 'geodirectory');
484
+				if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
485
+					return $result;
486
+				}
487
+			}
488
+		}
489 489
         
490
-        $rows = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country ) );
491
-        if (!empty($rows)) {
492
-            foreach ($rows as $row) {
493
-                $translated = __($row->country, 'geodirectory');
494
-                if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
495
-                    return $result;
496
-                }
497
-            }
498
-        }
499
-    }
490
+		$rows = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country ) );
491
+		if (!empty($rows)) {
492
+			foreach ($rows as $row) {
493
+				$translated = __($row->country, 'geodirectory');
494
+				if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
495
+					return $result;
496
+				}
497
+			}
498
+		}
499
+	}
500 500
     
501
-    $default_location = geodir_get_default_location();
502
-    if (!empty($default_location->country) && $result = geodir_get_country_by_name($default_location->country)) {
503
-        return $result;
504
-    }
501
+	$default_location = geodir_get_default_location();
502
+	if (!empty($default_location->country) && $result = geodir_get_country_by_name($default_location->country)) {
503
+		return $result;
504
+	}
505 505
     
506
-    if (!empty($default_location->country_slug) && $result = geodir_get_country_by_name($default_location->country_slug)) {
507
-        return $result;
508
-    }
506
+	if (!empty($default_location->country_slug) && $result = geodir_get_country_by_name($default_location->country_slug)) {
507
+		return $result;
508
+	}
509 509
     
510
-    if (!empty($default_location->country_ISO2) && $result = geodir_get_country_by_name($default_location->country_ISO2, true)) {
511
-        return $result;
512
-    }
510
+	if (!empty($default_location->country_ISO2) && $result = geodir_get_country_by_name($default_location->country_ISO2, true)) {
511
+		return $result;
512
+	}
513 513
     
514
-    return $country;
514
+	return $country;
515 515
 }
516 516
 
517 517
 /**
@@ -523,16 +523,16 @@  discard block
 block discarded – undo
523 523
  * @return string Country ISO2 code.
524 524
  */
525 525
 function geodir_get_country_iso2($country) {
526
-    global $wpdb;
526
+	global $wpdb;
527 527
     
528
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
529
-        return $result;
530
-    }
531
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
532
-        return $result;
533
-    }
528
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
529
+		return $result;
530
+	}
531
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
532
+		return $result;
533
+	}
534 534
     
535
-    return $country;
535
+	return $country;
536 536
 }
537 537
 
538 538
 /**
@@ -545,16 +545,16 @@  discard block
 block discarded – undo
545 545
  * @return string|null Country ISO2 code.
546 546
  */
547 547
 function geodir_get_country_by_name($country, $iso2 = false) {
548
-    global $wpdb;
548
+	global $wpdb;
549 549
     
550
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
551
-        return $result;
552
-    }
553
-    if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
554
-        return $result;
555
-    }
550
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
551
+		return $result;
552
+	}
553
+	if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
554
+		return $result;
555
+	}
556 556
     
557
-    return NULL;
557
+	return NULL;
558 558
 }
559 559
 
560 560
 
@@ -574,130 +574,130 @@  discard block
 block discarded – undo
574 574
  */
575 575
 function geodir_replace_location_variables($content, $location_array = array(), $sep = NULL, $gd_page = '') {
576 576
 
577
-    if (empty($content)) {
578
-        return $content;
579
-    }
577
+	if (empty($content)) {
578
+		return $content;
579
+	}
580 580
 
581 581
 
582
-    $location_replace_vars = geodir_location_replace_vars($location_array, $sep, $gd_page);
582
+	$location_replace_vars = geodir_location_replace_vars($location_array, $sep, $gd_page);
583 583
 
584
-    if (!empty($location_replace_vars)) {
585
-        foreach ($location_replace_vars as $search => $replace) {
586
-            if (!empty($search) && strpos($content, $search) !== false) {
587
-                $content = str_replace($search, $replace, $content);
588
-            }
589
-        }
590
-    }
584
+	if (!empty($location_replace_vars)) {
585
+		foreach ($location_replace_vars as $search => $replace) {
586
+			if (!empty($search) && strpos($content, $search) !== false) {
587
+				$content = str_replace($search, $replace, $content);
588
+			}
589
+		}
590
+	}
591 591
 
592
-    return $content;
592
+	return $content;
593 593
 }
594 594
 add_filter('geodir_replace_location_variables', 'geodir_replace_location_variables');
595 595
 
596 596
 
597 597
 function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = ''){
598 598
 
599
-    global $wp;
599
+	global $wp;
600 600
     
601
-    $location_manager = defined('GEODIRLOCATION_VERSION') ? true : false;
602
-
603
-    if (empty($location_array)) {
604
-        $location_array = geodir_get_current_location_terms('query_vars');
605
-    }
606
-
607
-    $location_terms = array();
608
-    $location_terms['gd_neighbourhood'] = !empty($wp->query_vars['gd_neighbourhood']) ? $wp->query_vars['gd_neighbourhood'] : '';
609
-    $location_terms['gd_city'] = !empty($wp->query_vars['gd_city']) ? $wp->query_vars['gd_city'] : '';
610
-    $location_terms['gd_region'] = !empty($wp->query_vars['gd_region']) ? $wp->query_vars['gd_region'] : '';
611
-    $location_terms['gd_country'] = !empty($wp->query_vars['gd_country']) ? $wp->query_vars['gd_country'] : '';
612
-
613
-    $location_names = array();
614
-    foreach ($location_terms as $type => $location) {
615
-        $location_name = $location;
616
-
617
-        if (!empty($location_name)) {
618
-            if ($location_manager) {
619
-                $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
620
-                $location_name = get_actual_location_name($location_type, $location, true);
621
-            } else {
622
-                $location_name = preg_replace( '/-(\d+)$/', '', $location_name);
623
-                $location_name = preg_replace( '/[_-]/', ' ', $location_name );
624
-                $location_name = __(geodir_ucwords($location_name), 'geodirectory');
625
-            }
626
-        }
601
+	$location_manager = defined('GEODIRLOCATION_VERSION') ? true : false;
602
+
603
+	if (empty($location_array)) {
604
+		$location_array = geodir_get_current_location_terms('query_vars');
605
+	}
606
+
607
+	$location_terms = array();
608
+	$location_terms['gd_neighbourhood'] = !empty($wp->query_vars['gd_neighbourhood']) ? $wp->query_vars['gd_neighbourhood'] : '';
609
+	$location_terms['gd_city'] = !empty($wp->query_vars['gd_city']) ? $wp->query_vars['gd_city'] : '';
610
+	$location_terms['gd_region'] = !empty($wp->query_vars['gd_region']) ? $wp->query_vars['gd_region'] : '';
611
+	$location_terms['gd_country'] = !empty($wp->query_vars['gd_country']) ? $wp->query_vars['gd_country'] : '';
612
+
613
+	$location_names = array();
614
+	foreach ($location_terms as $type => $location) {
615
+		$location_name = $location;
616
+
617
+		if (!empty($location_name)) {
618
+			if ($location_manager) {
619
+				$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
620
+				$location_name = get_actual_location_name($location_type, $location, true);
621
+			} else {
622
+				$location_name = preg_replace( '/-(\d+)$/', '', $location_name);
623
+				$location_name = preg_replace( '/[_-]/', ' ', $location_name );
624
+				$location_name = __(geodir_ucwords($location_name), 'geodirectory');
625
+			}
626
+		}
627 627
 
628
-        $location_names[$type] = $location_name;
629
-    }
630
-
631
-    $location_single = '';
632
-    foreach ($location_terms as $type => $location) {
633
-        if (!empty($location)) {
634
-            if (!empty($location_names[$type])) {
635
-                $location_single = $location_names[$type];
636
-            } else {
637
-                if ($location_manager) {
638
-                    $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
639
-                    $location_single = get_actual_location_name($location_type, $location, true);
640
-                } else {
641
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
642
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
643
-                    $location_single = __(geodir_ucwords($location_name), 'geodirectory');
644
-                }
645
-            }
646
-            break;
647
-        }
648
-    }
649
-
650
-    $full_location = array();
651
-    if (!empty($location_array)) {
652
-        $location_array = array_reverse($location_array);
653
-
654
-        foreach ($location_array as $type => $location) {
655
-            if (!empty($location_names[$type])) {
656
-                $location_name = $location_names[$type];
657
-            } else {
658
-                if ($location_manager) {
659
-                    $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
660
-                    $location_name = get_actual_location_name($location_type, $location, true);
661
-                } else {
662
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
663
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
664
-                    $location_name = __(geodir_ucwords($location_name), 'geodirectory');
665
-                }
666
-            }
628
+		$location_names[$type] = $location_name;
629
+	}
630
+
631
+	$location_single = '';
632
+	foreach ($location_terms as $type => $location) {
633
+		if (!empty($location)) {
634
+			if (!empty($location_names[$type])) {
635
+				$location_single = $location_names[$type];
636
+			} else {
637
+				if ($location_manager) {
638
+					$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
639
+					$location_single = get_actual_location_name($location_type, $location, true);
640
+				} else {
641
+					$location_name = preg_replace( '/-(\d+)$/', '', $location);
642
+					$location_name = preg_replace( '/[_-]/', ' ', $location_name );
643
+					$location_single = __(geodir_ucwords($location_name), 'geodirectory');
644
+				}
645
+			}
646
+			break;
647
+		}
648
+	}
649
+
650
+	$full_location = array();
651
+	if (!empty($location_array)) {
652
+		$location_array = array_reverse($location_array);
653
+
654
+		foreach ($location_array as $type => $location) {
655
+			if (!empty($location_names[$type])) {
656
+				$location_name = $location_names[$type];
657
+			} else {
658
+				if ($location_manager) {
659
+					$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
660
+					$location_name = get_actual_location_name($location_type, $location, true);
661
+				} else {
662
+					$location_name = preg_replace( '/-(\d+)$/', '', $location);
663
+					$location_name = preg_replace( '/[_-]/', ' ', $location_name );
664
+					$location_name = __(geodir_ucwords($location_name), 'geodirectory');
665
+				}
666
+			}
667
+
668
+			$full_location[] = $location_name;
669
+		}
667 670
 
668
-            $full_location[] = $location_name;
669
-        }
671
+		if (!empty($full_location)) {
672
+			$full_location = array_unique($full_location);
673
+		}
674
+	}
675
+	$full_location = !empty($full_location) ? implode(', ', $full_location): '';
670 676
 
671
-        if (!empty($full_location)) {
672
-            $full_location = array_unique($full_location);
673
-        }
674
-    }
675
-    $full_location = !empty($full_location) ? implode(', ', $full_location): '';
676
-
677
-    $location_replace_vars = array();
678
-    $location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|';
679
-    $location_replace_vars['%%location%%'] = $full_location;
680
-    $location_replace_vars['%%in_location%%'] = $full_location != '' ? __( 'in', 'geodirectory' ) . ' ' . $full_location : '';
681
-    $location_replace_vars['%%location_single%%'] = $location_single;
682
-    $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? __( 'in', 'geodirectory' ) . ' ' . $location_single : '';
683
-
684
-    foreach ($location_names as $type => $name) {
685
-        $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
686
-
687
-        $location_replace_vars['%%location_' . $location_type . '%%'] = $name;
688
-        $location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? __( 'in', 'geodirectory' ) . ' ' . $name : '';
689
-    }
690
-
691
-    /**
692
-     * Filter the location terms variables to search & replace.
693
-     *
694
-     * @since   1.6.16
695
-     * @package GeoDirectory
696
-     *
697
-     * @param array $location_replace_vars The array of search & replace variables.
698
-     * @param array $location_array The array of location variables.
699
-     * @param string $gd_page       The page being filtered.
700
-     * @param string $sep           The separator.
701
-     */
702
-    return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep );
677
+	$location_replace_vars = array();
678
+	$location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|';
679
+	$location_replace_vars['%%location%%'] = $full_location;
680
+	$location_replace_vars['%%in_location%%'] = $full_location != '' ? __( 'in', 'geodirectory' ) . ' ' . $full_location : '';
681
+	$location_replace_vars['%%location_single%%'] = $location_single;
682
+	$location_replace_vars['%%in_location_single%%'] = $location_single != '' ? __( 'in', 'geodirectory' ) . ' ' . $location_single : '';
683
+
684
+	foreach ($location_names as $type => $name) {
685
+		$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
686
+
687
+		$location_replace_vars['%%location_' . $location_type . '%%'] = $name;
688
+		$location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? __( 'in', 'geodirectory' ) . ' ' . $name : '';
689
+	}
690
+
691
+	/**
692
+	 * Filter the location terms variables to search & replace.
693
+	 *
694
+	 * @since   1.6.16
695
+	 * @package GeoDirectory
696
+	 *
697
+	 * @param array $location_replace_vars The array of search & replace variables.
698
+	 * @param array $location_array The array of location variables.
699
+	 * @param string $gd_page       The page being filtered.
700
+	 * @param string $sep           The separator.
701
+	 */
702
+	return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep );
703 703
 }
704 704
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 {
125 125
     global $wpdb;
126 126
 
127
-    $rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC");
127
+    $rows = $wpdb->get_results("SELECT Country,ISO2 FROM ".GEODIR_COUNTRIES_TABLE." ORDER BY Country ASC");
128 128
     
129 129
     $ISO2 = array();
130 130
     $countries = array();
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
     
137 137
     asort($countries);
138 138
     
139
-    $out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
139
+    $out_put = '<option '.selected('', $post_country, false).' value="">'.__('Select Country', 'geodirectory').'</option>';
140 140
     foreach ($countries as $country => $name) {
141 141
         $ccode = $ISO2[$country];
142 142
 
143
-        $out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>';
143
+        $out_put .= '<option '.selected($post_country, $country, false).' value="'.esc_attr($country).'" data-country_code="'.$ccode.'">'.$name.'</option>';
144 144
     }
145 145
 
146 146
     echo $out_put;
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
         if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
183 183
 
184 184
             foreach ($posttype as $posttypeobj) {
185
-                $post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location
185
+                $post_locations = '['.$default_location->city_slug.'],['.$default_location->region_slug.'],['.$default_location->country_slug.']'; // set all overall post location
186 186
 
187 187
                 $sql = $wpdb->prepare(
188
-                    "UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
188
+                    "UPDATE ".$plugin_prefix.$posttypeobj."_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
189 189
                     array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations)
190 190
                 );
191 191
                 $wpdb->query($sql);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
          *
234 234
          * @since 1.0.0
235 235
          */
236
-        $geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
236
+        $geodir_location = (object) apply_filters('geodir_add_new_location', array('location_id' => 0,
237 237
             'country' => $location_country,
238 238
             'region' => $location_region,
239 239
             'city' => $location_city,
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
  */
295 295
 function geodir_get_address_by_lat_lan($lat, $lng)
296 296
 {
297
-    $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ;
297
+    $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng='.trim($lat).','.trim($lng);
298 298
 
299 299
     $ch = curl_init();
300 300
     curl_setopt($ch, CURLOPT_URL, $url);
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 	 * @param string $location_array_from Source type of location terms. Default session.
388 388
 	 * @param string $gd_post_type WP post type.
389 389
 	 */
390
-	$location_array = apply_filters( 'geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type );
390
+	$location_array = apply_filters('geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type);
391 391
 
392 392
     return $location_array;
393 393
 
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
  */
434 434
 function geodir_get_osm_address_by_lat_lan($lat, $lng) {
435 435
     $url = is_ssl() ? 'https:' : 'http:';
436
-    $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
436
+    $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat='.trim($lat).'&lon='.trim($lng).'&zoom=16&addressdetails=1&email='.get_option('admin_email');
437 437
 
438 438
     $ch = curl_init();
439 439
     curl_setopt($ch, CURLOPT_URL, $url);
@@ -447,9 +447,9 @@  discard block
 block discarded – undo
447 447
     
448 448
     if (!empty($data) && !empty($data->address)) {
449 449
         $address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
450
-        $formatted_address = (array)$data->address;
450
+        $formatted_address = (array) $data->address;
451 451
         
452
-        foreach ( $data->address as $key => $value ) {
452
+        foreach ($data->address as $key => $value) {
453 453
             if (!in_array($key, $address_fields)) {
454 454
                 unset($formatted_address[$key]);
455 455
             }
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
     }
478 478
     
479 479
     if (defined('POST_LOCATION_TABLE')) {
480
-        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
480
+        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM ".POST_LOCATION_TABLE." WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
481 481
         if (!empty($rows)) {
482 482
             foreach ($rows as $row) {
483 483
                 $translated = __($row->country, 'geodirectory');
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
             }
488 488
         }
489 489
         
490
-        $rows = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country ) );
490
+        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM ".POST_LOCATION_TABLE." WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country));
491 491
         if (!empty($rows)) {
492 492
             foreach ($rows as $row) {
493 493
                 $translated = __($row->country, 'geodirectory');
@@ -525,10 +525,10 @@  discard block
 block discarded – undo
525 525
 function geodir_get_country_iso2($country) {
526 526
     global $wpdb;
527 527
     
528
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
528
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", $country))) {
529 529
         return $result;
530 530
     }
531
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
531
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
532 532
         return $result;
533 533
     }
534 534
     
@@ -547,10 +547,10 @@  discard block
 block discarded – undo
547 547
 function geodir_get_country_by_name($country, $iso2 = false) {
548 548
     global $wpdb;
549 549
     
550
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
550
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", $country))) {
551 551
         return $result;
552 552
     }
553
-    if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
553
+    if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM ".GEODIR_COUNTRIES_TABLE." WHERE ISO2 LIKE %s", $country))) {
554 554
         return $result;
555 555
     }
556 556
     
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 add_filter('geodir_replace_location_variables', 'geodir_replace_location_variables');
595 595
 
596 596
 
597
-function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = ''){
597
+function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = '') {
598 598
 
599 599
     global $wp;
600 600
     
@@ -619,8 +619,8 @@  discard block
 block discarded – undo
619 619
                 $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
620 620
                 $location_name = get_actual_location_name($location_type, $location, true);
621 621
             } else {
622
-                $location_name = preg_replace( '/-(\d+)$/', '', $location_name);
623
-                $location_name = preg_replace( '/[_-]/', ' ', $location_name );
622
+                $location_name = preg_replace('/-(\d+)$/', '', $location_name);
623
+                $location_name = preg_replace('/[_-]/', ' ', $location_name);
624 624
                 $location_name = __(geodir_ucwords($location_name), 'geodirectory');
625 625
             }
626 626
         }
@@ -638,8 +638,8 @@  discard block
 block discarded – undo
638 638
                     $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
639 639
                     $location_single = get_actual_location_name($location_type, $location, true);
640 640
                 } else {
641
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
642
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
641
+                    $location_name = preg_replace('/-(\d+)$/', '', $location);
642
+                    $location_name = preg_replace('/[_-]/', ' ', $location_name);
643 643
                     $location_single = __(geodir_ucwords($location_name), 'geodirectory');
644 644
                 }
645 645
             }
@@ -659,8 +659,8 @@  discard block
 block discarded – undo
659 659
                     $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
660 660
                     $location_name = get_actual_location_name($location_type, $location, true);
661 661
                 } else {
662
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
663
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
662
+                    $location_name = preg_replace('/-(\d+)$/', '', $location);
663
+                    $location_name = preg_replace('/[_-]/', ' ', $location_name);
664 664
                     $location_name = __(geodir_ucwords($location_name), 'geodirectory');
665 665
                 }
666 666
             }
@@ -672,20 +672,20 @@  discard block
 block discarded – undo
672 672
             $full_location = array_unique($full_location);
673 673
         }
674 674
     }
675
-    $full_location = !empty($full_location) ? implode(', ', $full_location): '';
675
+    $full_location = !empty($full_location) ? implode(', ', $full_location) : '';
676 676
 
677 677
     $location_replace_vars = array();
678 678
     $location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|';
679 679
     $location_replace_vars['%%location%%'] = $full_location;
680
-    $location_replace_vars['%%in_location%%'] = $full_location != '' ? __( 'in', 'geodirectory' ) . ' ' . $full_location : '';
680
+    $location_replace_vars['%%in_location%%'] = $full_location != '' ? __('in', 'geodirectory').' '.$full_location : '';
681 681
     $location_replace_vars['%%location_single%%'] = $location_single;
682
-    $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? __( 'in', 'geodirectory' ) . ' ' . $location_single : '';
682
+    $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? __('in', 'geodirectory').' '.$location_single : '';
683 683
 
684 684
     foreach ($location_names as $type => $name) {
685 685
         $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
686 686
 
687
-        $location_replace_vars['%%location_' . $location_type . '%%'] = $name;
688
-        $location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? __( 'in', 'geodirectory' ) . ' ' . $name : '';
687
+        $location_replace_vars['%%location_'.$location_type.'%%'] = $name;
688
+        $location_replace_vars['%%in_location_'.$location_type.'%%'] = !empty($name) ? __('in', 'geodirectory').' '.$name : '';
689 689
     }
690 690
 
691 691
     /**
@@ -699,5 +699,5 @@  discard block
 block discarded – undo
699 699
      * @param string $gd_page       The page being filtered.
700 700
      * @param string $sep           The separator.
701 701
      */
702
-    return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep );
702
+    return apply_filters('geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep);
703 703
 }
704 704
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/custom_functions.php 4 patches
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -2256,7 +2256,7 @@  discard block
 block discarded – undo
2256 2256
 
2257 2257
 	if ( $new_style ) {
2258 2258
 		$default_search_button_label = '<i class="fa fa-search" aria-hidden="true"></i>';
2259
-	}else{
2259
+	} else{
2260 2260
 		$default_search_button_label = 'Search';
2261 2261
 	}
2262 2262
 	if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) {
@@ -2283,7 +2283,7 @@  discard block
 block discarded – undo
2283 2283
 	if ( $new_style ) {
2284 2284
 	?>
2285 2285
 		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e( $default_search_button_label ,'geodirectory'); ?></button>
2286
-<?php }else{?>
2286
+<?php } else{?>
2287 2287
 		<input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>"
2288 2288
 	       class="geodir_submit_search <?php echo $fa_class; ?>"/>
2289 2289
 	<?php }
@@ -2333,17 +2333,17 @@  discard block
 block discarded – undo
2333 2333
 			if ( $new_style ) {
2334 2334
 				echo "</div>";
2335 2335
 			}
2336
-		}else{
2336
+		} else{
2337 2337
 			if(! empty( $post_types )){
2338 2338
 				$pt_arr = (array)$post_types;
2339 2339
 				echo '<input type="hidden" name="stype" value="' . key( $pt_arr  ) . '"  />';
2340
-			}else{
2340
+			} else{
2341 2341
 				echo '<input type="hidden" name="stype" value="gd_place"  />';
2342 2342
 			}
2343 2343
 
2344 2344
 		}
2345 2345
 
2346
-	}elseif ( ! empty( $post_types ) ) {
2346
+	} elseif ( ! empty( $post_types ) ) {
2347 2347
 		echo '<input type="hidden" name="stype" value="gd_place"  />';
2348 2348
 	}
2349 2349
 }
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
  * @param object|string $post The post object.
162 162
  * @param string $post_type   The post type.
163 163
  *
164
- * @return object Returns filtered package info as an object.
164
+ * @return string Returns filtered package info as an object.
165 165
  */
166 166
 function geodir_post_package_info( $package_info, $post = '', $post_type = '' ) {
167 167
 	$package_info['pid']              = 0;
@@ -2489,7 +2489,7 @@  discard block
 block discarded – undo
2489 2489
  *
2490 2490
  * @since 1.5.0
2491 2491
  *
2492
- * @return True if WPML is active else False.
2492
+ * @return boolean if WPML is active else False.
2493 2493
  */
2494 2494
 function geodir_is_wpml() {
2495 2495
     if (function_exists('icl_object_id')) {
@@ -2561,7 +2561,6 @@  discard block
 block discarded – undo
2561 2561
  * @since 1.6.16 Sync reviews if sync comments allowed.
2562 2562
  *
2563 2563
  * @param int $post_id The Post ID.
2564
- * @param string $lang Language code for translating post.
2565 2564
  * @param array $request_info The post details in an array.
2566 2565
  */
2567 2566
 function geodir_wpml_duplicate_listing($post_id, $request_info) {
@@ -2645,7 +2644,7 @@  discard block
 block discarded – undo
2645 2644
  * @param int $master_post_id Original Post ID.
2646 2645
  * @param int $tr_post_id Translation Post ID.
2647 2646
  * @param string $lang Language code for translating post.
2648
- * @return bool True for success, False for fail.
2647
+ * @return boolean|null True for success, False for fail.
2649 2648
  */
2650 2649
 function geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang) {
2651 2650
     global $sitepress, $wpdb;
@@ -2888,8 +2887,6 @@  discard block
 block discarded – undo
2888 2887
  *
2889 2888
  * @since 1.6.16
2890 2889
  *
2891
- * @param string $post_type WP post type or WP texonomy. Ex: gd_place.
2892
- * @param bool $taxonomy Whether $post_type is taxonomy or not.
2893 2890
  * @return bool True if review star disabled, otherwise false.
2894 2891
  */ 
2895 2892
 function geodir_rating_disabled_post_types() {
Please login to merge, or discard this patch.
Spacing   +668 added lines, -668 removed lines patch added patch discarded remove patch
@@ -52,31 +52,31 @@  discard block
 block discarded – undo
52 52
 				jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefourth', 'gridview_onefifth', 600);
53 53
 			}
54 54
 
55
-			jQuery.post("<?php echo geodir_get_ajax_url();?>&gd_listing_view=" + val, function (data) {
55
+			jQuery.post("<?php echo geodir_get_ajax_url(); ?>&gd_listing_view=" + val, function (data) {
56 56
 				//alert(data );
57 57
 			});
58 58
 		}
59 59
 	</script>
60 60
 	<div class="geodir-list-view-select">
61 61
 		<select name="gd_list_view" id="gd_list_view" onchange="geodir_list_view_select(this);">
62
-			<?php $listing_view = (int) $gd_session->get( 'gd_listing_view' ); ?>
63
-			<option value=""><?php _e( 'View:', 'geodirectory' ); ?></option>
62
+			<?php $listing_view = (int) $gd_session->get('gd_listing_view'); ?>
63
+			<option value=""><?php _e('View:', 'geodirectory'); ?></option>
64 64
 			<option
65
-				value="1" <?php selected( 1, $listing_view ); ?>><?php _e( 'View: List', 'geodirectory' ); ?></option>
65
+				value="1" <?php selected(1, $listing_view); ?>><?php _e('View: List', 'geodirectory'); ?></option>
66 66
 			<option
67
-				value="2" <?php selected( 2, $listing_view ); ?>><?php _e( 'View: Grid 2', 'geodirectory' ); ?></option>
67
+				value="2" <?php selected(2, $listing_view); ?>><?php _e('View: Grid 2', 'geodirectory'); ?></option>
68 68
 			<option
69
-				value="3" <?php selected( 3, $listing_view ); ?>><?php _e( 'View: Grid 3', 'geodirectory' ); ?></option>
69
+				value="3" <?php selected(3, $listing_view); ?>><?php _e('View: Grid 3', 'geodirectory'); ?></option>
70 70
 			<option
71
-				value="4" <?php selected( 4, $listing_view ); ?>><?php _e( 'View: Grid 4', 'geodirectory' ); ?></option>
71
+				value="4" <?php selected(4, $listing_view); ?>><?php _e('View: Grid 4', 'geodirectory'); ?></option>
72 72
 			<option
73
-				value="5" <?php selected( 5, $listing_view ); ?>><?php _e( 'View: Grid 5', 'geodirectory' ); ?></option>
73
+				value="5" <?php selected(5, $listing_view); ?>><?php _e('View: Grid 5', 'geodirectory'); ?></option>
74 74
 		</select>
75 75
 	</div>
76 76
 	<?php
77 77
 }
78 78
 
79
-add_action( 'geodir_before_listing', 'geodir_list_view_select', 100 );
79
+add_action('geodir_before_listing', 'geodir_list_view_select', 100);
80 80
 
81 81
 /**
82 82
  * Limit the listing excerpt.
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
  * @global object $post          The current post object.
92 92
  * @return string The modified excerpt.
93 93
  */
94
-function geodir_max_excerpt( $charlength ) {
94
+function geodir_max_excerpt($charlength) {
95 95
 	global $post;
96
-	if ( $charlength == '0' ) {
96
+	if ($charlength == '0') {
97 97
 		return;
98 98
 	}
99 99
 	$out = '';
@@ -101,46 +101,46 @@  discard block
 block discarded – undo
101 101
 	$temp_post = $post;
102 102
 	$excerpt   = get_the_excerpt();
103 103
 
104
-	$charlength ++;
105
-	$excerpt_more = function_exists( 'geodirf_excerpt_more' ) ? geodirf_excerpt_more( '' ) : geodir_excerpt_more( '' );
106
-	if ( mb_strlen( $excerpt ) > $charlength ) {
107
-		if ( mb_strlen( $excerpt_more ) > 0 && mb_strpos( $excerpt, $excerpt_more ) !== false ) {
108
-			$excut = - ( mb_strlen( $excerpt_more ) );
109
-			$subex = mb_substr( $excerpt, 0, $excut );
110
-			if ( $charlength > 0 && mb_strlen( $subex ) > $charlength ) {
111
-				$subex = mb_substr( $subex, 0, $charlength );
104
+	$charlength++;
105
+	$excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more('');
106
+	if (mb_strlen($excerpt) > $charlength) {
107
+		if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
108
+			$excut = - (mb_strlen($excerpt_more));
109
+			$subex = mb_substr($excerpt, 0, $excut);
110
+			if ($charlength > 0 && mb_strlen($subex) > $charlength) {
111
+				$subex = mb_substr($subex, 0, $charlength);
112 112
 			}
113 113
 			$out .= $subex;
114 114
 		} else {
115
-			$subex   = mb_substr( $excerpt, 0, $charlength - 5 );
116
-			$exwords = explode( ' ', $subex );
117
-			$excut   = - ( mb_strlen( $exwords[ count( $exwords ) - 1 ] ) );
118
-			if ( $excut < 0 ) {
119
-				$out .= mb_substr( $subex, 0, $excut );
115
+			$subex   = mb_substr($excerpt, 0, $charlength - 5);
116
+			$exwords = explode(' ', $subex);
117
+			$excut   = - (mb_strlen($exwords[count($exwords) - 1]));
118
+			if ($excut < 0) {
119
+				$out .= mb_substr($subex, 0, $excut);
120 120
 			} else {
121 121
 				$out .= $subex;
122 122
 			}
123 123
 		}
124
-		$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
124
+		$out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">';
125 125
 		/**
126 126
 		 * Filter excerpt read more text.
127 127
 		 *
128 128
 		 * @since 1.0.0
129 129
 		 */
130
-		$out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) );
130
+		$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
131 131
 		$out .= '</a>';
132 132
 
133 133
 	} else {
134
-		if ( mb_strlen( $excerpt_more ) > 0 && mb_strpos( $excerpt, $excerpt_more ) !== false ) {
135
-			$excut = - ( mb_strlen( $excerpt_more ) );
136
-			$out .= mb_substr( $excerpt, 0, $excut );
137
-			$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
134
+		if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
135
+			$excut = - (mb_strlen($excerpt_more));
136
+			$out .= mb_substr($excerpt, 0, $excut);
137
+			$out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">';
138 138
 			/**
139 139
 			 * Filter excerpt read more text.
140 140
 			 *
141 141
 			 * @since 1.0.0
142 142
 			 */
143
-			$out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) );
143
+			$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
144 144
 			$out .= '</a>';
145 145
 		} else {
146 146
 			$out .= $excerpt;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
  *
164 164
  * @return object Returns filtered package info as an object.
165 165
  */
166
-function geodir_post_package_info( $package_info, $post = '', $post_type = '' ) {
166
+function geodir_post_package_info($package_info, $post = '', $post_type = '') {
167 167
 	$package_info['pid']              = 0;
168 168
 	$package_info['days']             = 0;
169 169
 	$package_info['amount']           = 0;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 * @param object|string $post  The post object.
193 193
 	 * @param string $post_type    The post type.
194 194
 	 */
195
-	return (object) apply_filters( 'geodir_post_package_info', $package_info, $post, $post_type );
195
+	return (object) apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
196 196
 
197 197
 }
198 198
 
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
  *
221 221
  * }
222 222
  */
223
-function geodir_send_inquiry( $request ) {
223
+function geodir_send_inquiry($request) {
224 224
 	global $wpdb;
225 225
 
226 226
 	// strip slashes from text
227
-	$request = ! empty( $request ) ? stripslashes_deep( $request ) : $request;
227
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
228 228
 
229 229
 	$yourname      = $request['inq_name'];
230 230
 	$youremail     = $request['inq_email'];
@@ -235,26 +235,26 @@  discard block
 block discarded – undo
235 235
 	$author_id  = '';
236 236
 	$post_title = '';
237 237
 
238
-	if ( $request['pid'] ) {
238
+	if ($request['pid']) {
239 239
 
240 240
 		$productinfosql = $wpdb->prepare(
241 241
 			"select ID,post_author,post_title from $wpdb->posts where ID =%d",
242
-			array( $request['pid'] )
242
+			array($request['pid'])
243 243
 		);
244
-		$productinfo    = $wpdb->get_row( $productinfosql );
244
+		$productinfo = $wpdb->get_row($productinfosql);
245 245
 
246 246
 		$author_id  = $productinfo->post_author;
247 247
 		$post_title = $productinfo->post_title;
248 248
 	}
249 249
 
250
-	$post_title = '<a href="' . get_permalink( $pid ) . '">' . $post_title . '</a>';
250
+	$post_title = '<a href="'.get_permalink($pid).'">'.$post_title.'</a>';
251 251
 
252
-	$user_info = get_userdata( $author_id );
253
-	$to_email  = geodir_get_post_meta( $pid, 'geodir_email', true );
254
-	$to_name   = geodir_get_client_name( $author_id );
252
+	$user_info = get_userdata($author_id);
253
+	$to_email  = geodir_get_post_meta($pid, 'geodir_email', true);
254
+	$to_name   = geodir_get_client_name($author_id);
255 255
 
256
-	if ( $to_email == '' ) {
257
-		$to_email = get_option( 'admin_email' );
256
+	if ($to_email == '') {
257
+		$to_email = get_option('admin_email');
258 258
 	}
259 259
 
260 260
 	/**
@@ -275,10 +275,10 @@  discard block
 block discarded – undo
275 275
 	 * }
276 276
 	 * @param string $type     The form type, default: `Enquiry`.
277 277
 	 */
278
-	do_action( 'geodir_after_send_enquiry', $request, 'Enquiry' );
278
+	do_action('geodir_after_send_enquiry', $request, 'Enquiry');
279 279
 
280 280
 	$client_message = $frnd_comments;
281
-	$client_message .= '<br>' . __( 'From :', 'geodirectory' ) . ' ' . $yourname . '<br>' . __( 'Phone :', 'geodirectory' ) . ' ' . $inq_phone . '<br>' . __( 'Email :', 'geodirectory' ) . ' ' . $youremail . '<br><br>' . __( 'Sent from', 'geodirectory' ) . ' - <b><a href="' . trailingslashit( home_url() ) . '">' . get_option( 'blogname' ) . '</a></b>.';
281
+	$client_message .= '<br>'.__('From :', 'geodirectory').' '.$yourname.'<br>'.__('Phone :', 'geodirectory').' '.$inq_phone.'<br>'.__('Email :', 'geodirectory').' '.$youremail.'<br><br>'.__('Sent from', 'geodirectory').' - <b><a href="'.trailingslashit(home_url()).'">'.get_option('blogname').'</a></b>.';
282 282
 	/**
283 283
 	 * Filter client message text.
284 284
 	 *
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 *
287 287
 	 * @param string $client_message Client message text.
288 288
 	 */
289
-	$client_message = apply_filters( 'geodir_inquiry_email_msg', $client_message );
289
+	$client_message = apply_filters('geodir_inquiry_email_msg', $client_message);
290 290
 
291 291
 	/**
292 292
 	 * Called before the send enquiry email is sent.
@@ -305,12 +305,12 @@  discard block
 block discarded – undo
305 305
 	 *
306 306
 	 * }
307 307
 	 */
308
-	do_action( 'geodir_before_send_enquiry_email', $request );
309
-	if ( $to_email ) {
308
+	do_action('geodir_before_send_enquiry_email', $request);
309
+	if ($to_email) {
310 310
 		// strip slashes message
311
-		$client_message = stripslashes_deep( $client_message );
311
+		$client_message = stripslashes_deep($client_message);
312 312
 
313
-		geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid'] );//To client email
313
+		geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']); //To client email
314 314
 	}
315 315
 
316 316
 	/**
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
 	 *
331 331
 	 * }
332 332
 	 */
333
-	do_action( 'geodir_after_send_enquiry_email', $request );
334
-	$url = get_permalink( $pid );
335
-	if ( strstr( $url, '?' ) ) {
336
-		$url = $url . "&send_inquiry=success";
333
+	do_action('geodir_after_send_enquiry_email', $request);
334
+	$url = get_permalink($pid);
335
+	if (strstr($url, '?')) {
336
+		$url = $url."&send_inquiry=success";
337 337
 	} else {
338
-		$url = $url . "?send_inquiry=success";
338
+		$url = $url."?send_inquiry=success";
339 339
 	}
340 340
 	/**
341 341
 	 * Filter redirect url after the send enquiry email is sent.
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
 	 *
345 345
 	 * @param string $url Redirect url.
346 346
 	 */
347
-	$url = apply_filters( 'geodir_send_enquiry_after_submit_redirect', $url );
348
-	wp_redirect( $url );
347
+	$url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url);
348
+	wp_redirect($url);
349 349
 	gd_die();
350 350
 
351 351
 }
@@ -374,11 +374,11 @@  discard block
 block discarded – undo
374 374
  * }
375 375
  * @global object $wpdb        WordPress Database object.
376 376
  */
377
-function geodir_send_friend( $request ) {
377
+function geodir_send_friend($request) {
378 378
 	global $wpdb;
379 379
 
380 380
 	// strip slashes from text
381
-	$request = ! empty( $request ) ? stripslashes_deep( $request ) : $request;
381
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
382 382
 
383 383
 	$yourname      = $request['yourname'];
384 384
 	$youremail     = $request['youremail'];
@@ -387,13 +387,13 @@  discard block
 block discarded – undo
387 387
 	$pid           = $request['pid'];
388 388
 	$to_email      = $request['to_email'];
389 389
 	$to_name       = $request['to_name'];
390
-	if ( $request['pid'] ) {
390
+	if ($request['pid']) {
391 391
 		$productinfosql = $wpdb->prepare(
392 392
 			"select ID,post_title from $wpdb->posts where ID =%d",
393
-			array( $request['pid'] )
393
+			array($request['pid'])
394 394
 		);
395
-		$productinfo    = $wpdb->get_results( $productinfosql );
396
-		foreach ( $productinfo as $productinfoObj ) {
395
+		$productinfo = $wpdb->get_results($productinfosql);
396
+		foreach ($productinfo as $productinfoObj) {
397 397
 			$post_title = $productinfoObj->post_title;
398 398
 		}
399 399
 	}
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
 	 *
418 418
 	 * }
419 419
 	 */
420
-	do_action( 'geodir_before_send_to_friend_email', $request );
421
-	geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid'] );//To client email
420
+	do_action('geodir_before_send_to_friend_email', $request);
421
+	geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']); //To client email
422 422
 
423 423
 	/**
424 424
 	 * Called after the send to friend email is sent.
@@ -439,13 +439,13 @@  discard block
 block discarded – undo
439 439
 	 *
440 440
 	 * }
441 441
 	 */
442
-	do_action( 'geodir_after_send_to_friend_email', $request );
442
+	do_action('geodir_after_send_to_friend_email', $request);
443 443
 
444
-	$url = get_permalink( $pid );
445
-	if ( strstr( $url, '?' ) ) {
446
-		$url = $url . "&sendtofrnd=success";
444
+	$url = get_permalink($pid);
445
+	if (strstr($url, '?')) {
446
+		$url = $url."&sendtofrnd=success";
447 447
 	} else {
448
-		$url = $url . "?sendtofrnd=success";
448
+		$url = $url."?sendtofrnd=success";
449 449
 	}
450 450
 	/**
451 451
 	 * Filter redirect url after the send to friend email is sent.
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	 *
455 455
 	 * @param string $url Redirect url.
456 456
 	 */
457
-	$url = apply_filters( 'geodir_send_to_friend_after_submit_redirect', $url );
458
-	wp_redirect( $url );
457
+	$url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url);
458
+	wp_redirect($url);
459 459
 	gd_die();
460 460
 }
461 461
 
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
  *
470 470
  * @param string $hash_key
471 471
  */
472
-function geodir_before_tab_content( $hash_key ) {
473
-	switch ( $hash_key ) {
472
+function geodir_before_tab_content($hash_key) {
473
+	switch ($hash_key) {
474 474
 		case 'post_info' :
475 475
 			echo '<div class="geodir-company_info field-group">';
476 476
 			break;
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 			 *
481 481
 			 * @since 1.0.0
482 482
 			 */
483
-			echo ' <div id="' . apply_filters( 'geodir_post_gallery_id', 'geodir-post-gallery' ) . '" class="clearfix" >';
483
+			echo ' <div id="'.apply_filters('geodir_post_gallery_id', 'geodir-post-gallery').'" class="clearfix" >';
484 484
 			break;
485 485
 		case 'reviews' :
486 486
 			echo '<div id="reviews-wrap" class="clearfix"> ';
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
  *
505 505
  * @param string $hash_key
506 506
  */
507
-function geodir_after_tab_content( $hash_key ) {
508
-	switch ( $hash_key ) {
507
+function geodir_after_tab_content($hash_key) {
508
+	switch ($hash_key) {
509 509
 		case 'post_info' :
510 510
 			echo '</div>';
511 511
 			break;
@@ -536,25 +536,25 @@  discard block
 block discarded – undo
536 536
  * @global object $wpdb     WordPress Database object.
537 537
  * @return bool|null|string Returns default sort results, when the post type is valid. Otherwise returns false.
538 538
  */
539
-function geodir_get_posts_default_sort( $post_type ) {
539
+function geodir_get_posts_default_sort($post_type) {
540 540
 
541 541
 	global $wpdb;
542 542
 
543
-	if ( $post_type != '' ) {
543
+	if ($post_type != '') {
544 544
 
545 545
 		$all_postypes = geodir_get_posttypes();
546 546
 
547
-		if ( ! in_array( $post_type, $all_postypes ) ) {
547
+		if (!in_array($post_type, $all_postypes)) {
548 548
 			return false;
549 549
 		}
550 550
 
551
-		$sort_field_info = $wpdb->get_var( $wpdb->prepare( "select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where	post_type= %s and is_active=%d and is_default=%d", array(
551
+		$sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where	post_type= %s and is_active=%d and is_default=%d", array(
552 552
 			$post_type,
553 553
 			1,
554 554
 			1
555
-		) ) );
555
+		)));
556 556
 
557
-		if ( ! empty( $sort_field_info ) ) {
557
+		if (!empty($sort_field_info)) {
558 558
 			return $sort_field_info;
559 559
 		}
560 560
 
@@ -574,20 +574,20 @@  discard block
 block discarded – undo
574 574
  * @global object $wpdb     WordPress Database object.
575 575
  * @return bool|mixed|void Returns sort results, when the post type is valid. Otherwise returns false.
576 576
  */
577
-function geodir_get_sort_options( $post_type ) {
577
+function geodir_get_sort_options($post_type) {
578 578
 	global $wpdb;
579 579
 
580
-	if ( $post_type != '' ) {
580
+	if ($post_type != '') {
581 581
 		$all_postypes = geodir_get_posttypes();
582 582
 
583
-		if ( ! in_array( $post_type, $all_postypes ) ) {
583
+		if (!in_array($post_type, $all_postypes)) {
584 584
 			return false;
585 585
 		}
586 586
 
587
-		$sort_field_info = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array(
587
+		$sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array(
588 588
 			$post_type,
589 589
 			1
590
-		) ) );
590
+		)));
591 591
 
592 592
 		/**
593 593
 		 * Filter post sort options.
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 		 * @param array $sort_field_info Unfiltered sort field array.
598 598
 		 * @param string $post_type      Post type.
599 599
 		 */
600
-		return apply_filters( 'geodir_get_sort_options', $sort_field_info, $post_type );
600
+		return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type);
601 601
 	}
602 602
 
603 603
 }
@@ -618,63 +618,63 @@  discard block
 block discarded – undo
618 618
 	 *
619 619
 	 * @since 1.4.4
620 620
 	 */
621
-	if ( is_search() ) {
621
+	if (is_search()) {
622 622
 		return;
623 623
 	}
624 624
 
625 625
 	$sort_by = '';
626 626
 
627
-	if ( isset( $_REQUEST['sort_by'] ) ) {
627
+	if (isset($_REQUEST['sort_by'])) {
628 628
 		$sort_by = $_REQUEST['sort_by'];
629 629
 	}
630 630
 
631 631
 	$gd_post_type = geodir_get_current_posttype();
632 632
 
633
-	$sort_options = geodir_get_sort_options( $gd_post_type );
633
+	$sort_options = geodir_get_sort_options($gd_post_type);
634 634
 
635 635
 
636 636
 	$sort_field_options = '';
637 637
 
638
-	if ( ! empty( $sort_options ) ) {
639
-		foreach ( $sort_options as $sort ) {
640
-			$sort = stripslashes_deep( $sort ); // strip slashes
638
+	if (!empty($sort_options)) {
639
+		foreach ($sort_options as $sort) {
640
+			$sort = stripslashes_deep($sort); // strip slashes
641 641
 
642
-			$label = __( $sort->site_title, 'geodirectory' );
642
+			$label = __($sort->site_title, 'geodirectory');
643 643
 
644
-			if ( $sort->field_type == 'random' ) {
644
+			if ($sort->field_type == 'random') {
645 645
 				$key = $sort->field_type;
646
-				( $sort_by == $key || ( $sort->is_default == '1' && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
647
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
646
+				($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
647
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
648 648
 			}
649 649
 
650
-			if ( $sort->htmlvar_name == 'comment_count' ) {
650
+			if ($sort->htmlvar_name == 'comment_count') {
651 651
 				$sort->htmlvar_name = 'rating_count';
652 652
 			}
653 653
 
654
-			if ( $sort->sort_asc ) {
655
-				$key   = $sort->htmlvar_name . '_asc';
654
+			if ($sort->sort_asc) {
655
+				$key   = $sort->htmlvar_name.'_asc';
656 656
 				$label = $sort->site_title;
657
-				if ( $sort->asc_title ) {
657
+				if ($sort->asc_title) {
658 658
 					$label = $sort->asc_title;
659 659
 				}
660
-				( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
661
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
660
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
661
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
662 662
 			}
663 663
 
664
-			if ( $sort->sort_desc ) {
665
-				$key   = $sort->htmlvar_name . '_desc';
664
+			if ($sort->sort_desc) {
665
+				$key   = $sort->htmlvar_name.'_desc';
666 666
 				$label = $sort->site_title;
667
-				if ( $sort->desc_title ) {
667
+				if ($sort->desc_title) {
668 668
 					$label = $sort->desc_title;
669 669
 				}
670
-				( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
671
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
670
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
671
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
672 672
 			}
673 673
 
674 674
 		}
675 675
 	}
676 676
 
677
-	if ( $sort_field_options != '' ) {
677
+	if ($sort_field_options != '') {
678 678
 
679 679
 		?>
680 680
 
@@ -683,9 +683,9 @@  discard block
 block discarded – undo
683 683
 			<select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;">
684 684
 
685 685
 				<option
686
-					value="<?php echo esc_url( add_query_arg( 'sort_by', '' ) ); ?>" <?php if ( $sort_by == '' ) {
686
+					value="<?php echo esc_url(add_query_arg('sort_by', '')); ?>" <?php if ($sort_by == '') {
687 687
 					echo 'selected="selected"';
688
-				} ?>><?php _e( 'Sort By', 'geodirectory' ); ?></option><?php
688
+				} ?>><?php _e('Sort By', 'geodirectory'); ?></option><?php
689 689
 
690 690
 				echo $sort_field_options; ?>
691 691
 
@@ -713,9 +713,9 @@  discard block
 block discarded – undo
713 713
  *
714 714
  * @return string Returns the section title.
715 715
  */
716
-function geodir_advance_customfields_heading( $title, $field_type ) {
716
+function geodir_advance_customfields_heading($title, $field_type) {
717 717
 
718
-	if ( in_array( $field_type, array( 'multiselect', 'textarea', 'taxonomy' ) ) ) {
718
+	if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) {
719 719
 		$title = '';
720 720
 	}
721 721
 
@@ -737,19 +737,19 @@  discard block
 block discarded – undo
737 737
  * @global object $gd_session       GeoDirectory Session object.
738 738
  * @return string Returns related posts html.
739 739
  */
740
-function geodir_related_posts_display( $request ) {
741
-	if ( ! empty( $request ) ) {
742
-		$before_title = ( isset( $request['before_title'] ) && ! empty( $request['before_title'] ) ) ? $request['before_title'] : '';
743
-		$after_title  = ( isset( $request['after_title'] ) && ! empty( $request['after_title'] ) ) ? $request['after_title'] : '';
744
-
745
-		$title               = ( isset( $request['title'] ) && ! empty( $request['title'] ) ) ? $request['title'] : __( 'Related Listings', 'geodirectory' );
746
-		$post_number         = ( isset( $request['post_number'] ) && ! empty( $request['post_number'] ) ) ? $request['post_number'] : '5';
747
-		$relate_to           = ( isset( $request['relate_to'] ) && ! empty( $request['relate_to'] ) ) ? $request['relate_to'] : 'category';
748
-		$layout              = ( isset( $request['layout'] ) && ! empty( $request['layout'] ) ) ? $request['layout'] : 'gridview_onehalf';
749
-		$add_location_filter = ( isset( $request['add_location_filter'] ) && ! empty( $request['add_location_filter'] ) ) ? $request['add_location_filter'] : '0';
750
-		$listing_width       = ( isset( $request['listing_width'] ) && ! empty( $request['listing_width'] ) ) ? $request['listing_width'] : '';
751
-		$list_sort           = ( isset( $request['list_sort'] ) && ! empty( $request['list_sort'] ) ) ? $request['list_sort'] : 'latest';
752
-		$character_count     = ( isset( $request['character_count'] ) && ! empty( $request['character_count'] ) ) ? $request['character_count'] : '';
740
+function geodir_related_posts_display($request) {
741
+	if (!empty($request)) {
742
+		$before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : '';
743
+		$after_title  = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : '';
744
+
745
+		$title               = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory');
746
+		$post_number         = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5';
747
+		$relate_to           = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category';
748
+		$layout              = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf';
749
+		$add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0';
750
+		$listing_width       = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : '';
751
+		$list_sort           = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest';
752
+		$character_count     = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : '';
753 753
 
754 754
 		global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon;
755 755
 		$related_parent_lat   = !empty($post->post_latitude) ? $post->post_latitude : '';
@@ -757,10 +757,10 @@  discard block
 block discarded – undo
757 757
 		$arr_detail_page_tabs = geodir_detail_page_tabs_list();
758 758
 
759 759
 		$related_listing_array = array();
760
-		if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
761
-			$related_listing_array = get_option( 'geodir_add_related_listing_posttypes' );
760
+		if (get_option('geodir_add_related_listing_posttypes')) {
761
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
762 762
 		}
763
-		if ( isset($post->post_type) && in_array( $post->post_type, $related_listing_array ) ) {
763
+		if (isset($post->post_type) && in_array($post->post_type, $related_listing_array)) {
764 764
 			$arr_detail_page_tabs['related_listing']['is_display'] = true;
765 765
 		}
766 766
 
@@ -772,90 +772,90 @@  discard block
 block discarded – undo
772 772
 		$tax_field         = 'id';
773 773
 		$category          = array();
774 774
 
775
-		if ( isset( $_REQUEST['backandedit'] ) ) {
776
-			$post      = (object) $gd_session->get( 'listing' );
775
+		if (isset($_REQUEST['backandedit'])) {
776
+			$post      = (object) $gd_session->get('listing');
777 777
 			$post_type = $post->listing_type;
778
-			if ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
778
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
779 779
 				$post_id = $_REQUEST['pid'];
780 780
 			}
781
-		} elseif ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
782
-			$post      = geodir_get_post_info( $_REQUEST['pid'] );
781
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
782
+			$post      = geodir_get_post_info($_REQUEST['pid']);
783 783
 			$post_type = $post->post_type;
784 784
 			$post_id   = $_REQUEST['pid'];
785
-		} elseif ( isset( $post->post_type ) && $post->post_type != '' ) {
785
+		} elseif (isset($post->post_type) && $post->post_type != '') {
786 786
 			$post_type = $post->post_type;
787 787
 			$post_id   = $post->ID;
788 788
 		}
789 789
 
790
-		if ( $relate_to == 'category' ) {
790
+		if ($relate_to == 'category') {
791 791
 
792
-			$category_taxonomy = $post_type . $relate_to;
793
-			if ( isset( $post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '' ) {
794
-				$category = explode( ',', trim( $post->{$category_taxonomy}, ',' ) );
792
+			$category_taxonomy = $post_type.$relate_to;
793
+			if (isset($post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '') {
794
+				$category = explode(',', trim($post->{$category_taxonomy}, ','));
795 795
 			}
796 796
 
797
-		} elseif ( $relate_to == 'tags' ) {
797
+		} elseif ($relate_to == 'tags') {
798 798
 
799
-			$category_taxonomy = $post_type . '_' . $relate_to;
800
-			if ( $post->post_tags != '' ) {
801
-				$category = explode( ',', trim( $post->post_tags, ',' ) );
799
+			$category_taxonomy = $post_type.'_'.$relate_to;
800
+			if ($post->post_tags != '') {
801
+				$category = explode(',', trim($post->post_tags, ','));
802 802
 			}
803 803
 			$tax_field = 'name';
804 804
 		}
805 805
 
806 806
 		/* --- return false in invalid request --- */
807
-		if ( empty( $category ) ) {
807
+		if (empty($category)) {
808 808
 			return false;
809 809
 		}
810 810
 
811 811
 		$all_postypes = geodir_get_posttypes();
812 812
 
813
-		if ( ! in_array( $post_type, $all_postypes ) ) {
813
+		if (!in_array($post_type, $all_postypes)) {
814 814
 			return false;
815 815
 		}
816 816
 
817 817
 		/* --- return false in invalid request --- */
818 818
 
819 819
 		$location_url = '';
820
-		if ( $add_location_filter != '0' ) {
820
+		if ($add_location_filter != '0') {
821 821
 			$location_url             = array();
822
-			$geodir_show_location_url = get_option( 'geodir_show_location_url' );
822
+			$geodir_show_location_url = get_option('geodir_show_location_url');
823 823
 
824
-			$gd_city = get_query_var( 'gd_city' );
824
+			$gd_city = get_query_var('gd_city');
825 825
 
826
-			if ( $gd_city ) {
827
-				$gd_country = get_query_var( 'gd_country' );
828
-				$gd_region  = get_query_var( 'gd_region' );
826
+			if ($gd_city) {
827
+				$gd_country = get_query_var('gd_country');
828
+				$gd_region  = get_query_var('gd_region');
829 829
 			} else {
830 830
 				$location = geodir_get_default_location();
831 831
 
832
-				$gd_country = isset( $location->country_slug ) ? $location->country_slug : '';
833
-				$gd_region  = isset( $location->region_slug ) ? $location->region_slug : '';
834
-				$gd_city    = isset( $location->city_slug ) ? $location->city_slug : '';
832
+				$gd_country = isset($location->country_slug) ? $location->country_slug : '';
833
+				$gd_region  = isset($location->region_slug) ? $location->region_slug : '';
834
+				$gd_city    = isset($location->city_slug) ? $location->city_slug : '';
835 835
 			}
836 836
 
837
-			if ( $geodir_show_location_url == 'all' ) {
837
+			if ($geodir_show_location_url == 'all') {
838 838
 				$location_url[] = $gd_country;
839 839
 				$location_url[] = $gd_region;
840
-			} else if ( $geodir_show_location_url == 'country_city' ) {
840
+			} else if ($geodir_show_location_url == 'country_city') {
841 841
 				$location_url[] = $gd_country;
842
-			} else if ( $geodir_show_location_url == 'region_city' ) {
842
+			} else if ($geodir_show_location_url == 'region_city') {
843 843
 				$location_url[] = $gd_region;
844 844
 			}
845 845
 
846 846
 			$location_url[] = $gd_city;
847 847
 
848
-			$location_url = implode( '/', $location_url );
848
+			$location_url = implode('/', $location_url);
849 849
 		}
850 850
 
851 851
 
852
-		if ( ! empty( $category ) ) {
852
+		if (!empty($category)) {
853 853
 			global $geodir_add_location_url;
854 854
 			$geodir_add_location_url = '0';
855
-			if ( $add_location_filter != '0' ) {
855
+			if ($add_location_filter != '0') {
856 856
 				$geodir_add_location_url = '1';
857 857
 			}
858
-			$viewall_url             = get_term_link( (int) $category[0], $post_type . $category_taxonomy );
858
+			$viewall_url             = get_term_link((int) $category[0], $post_type.$category_taxonomy);
859 859
 			$geodir_add_location_url = null;
860 860
 		}
861 861
 		ob_start();
@@ -865,24 +865,24 @@  discard block
 block discarded – undo
865 865
 		<div class="geodir_locations geodir_location_listing">
866 866
 
867 867
 			<?php
868
-			if ( isset( $request['is_widget'] ) && $request['is_widget'] == '1' ) {
868
+			if (isset($request['is_widget']) && $request['is_widget'] == '1') {
869 869
 				/** geodir_before_title filter Documented in geodirectory_widgets.php */
870
-				$before_title = isset( $before_title ) ? $before_title : apply_filters( 'geodir_before_title', '<h3 class="widget-title">' );
870
+				$before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
871 871
 				/** geodir_after_title filter Documented in geodirectory_widgets.php */
872
-				$after_title = isset( $after_title ) ? $after_title : apply_filters( 'geodir_after_title', '</h3>' );
872
+				$after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
873 873
 				?>
874 874
 				<div class="location_list_heading clearfix">
875
-					<?php echo $before_title . $title . $after_title; ?>
875
+					<?php echo $before_title.$title.$after_title; ?>
876 876
 				</div>
877 877
 				<?php
878 878
 			}
879 879
 			$query_args = array(
880 880
 				'posts_per_page'   => $post_number,
881 881
 				'is_geodir_loop'   => true,
882
-				'gd_location'      => ( $add_location_filter ) ? true : false,
882
+				'gd_location'      => ($add_location_filter) ? true : false,
883 883
 				'post_type'        => $post_type,
884 884
 				'order_by'         => $list_sort,
885
-				'post__not_in'     => array( $post_id ),
885
+				'post__not_in'     => array($post_id),
886 886
 				'excerpt_length'   => $character_count,
887 887
 				'related_listings' => $is_display
888 888
 			);
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
 				'terms'    => $category
894 894
 			);
895 895
 
896
-			$query_args['tax_query'] = array( $tax_query );
896
+			$query_args['tax_query'] = array($tax_query);
897 897
 
898 898
 			global $gridview_columns, $post;
899 899
 
@@ -905,21 +905,21 @@  discard block
 block discarded – undo
905 905
 			 * @param array $query_args The query array.
906 906
 			 * @param array $request Related posts request array.
907 907
 			 */
908
-			$query_args = apply_filters( 'geodir_related_posts_widget_query_args', $query_args, $request );
908
+			$query_args = apply_filters('geodir_related_posts_widget_query_args', $query_args, $request);
909 909
 
910
-			query_posts( $query_args );
910
+			query_posts($query_args);
911 911
 
912
-			if ( strstr( $layout, 'gridview' ) ) {
913
-				$listing_view_exp = explode( '_', $layout );
912
+			if (strstr($layout, 'gridview')) {
913
+				$listing_view_exp = explode('_', $layout);
914 914
 				$gridview_columns = $layout;
915 915
 				$layout           = $listing_view_exp[0];
916
-			} else if ( $layout == 'list' ) {
916
+			} else if ($layout == 'list') {
917 917
 				$gridview_columns = '';
918 918
 			}
919 919
 			$related_posts = true;
920 920
 
921 921
 			$related_nearest = false;
922
-			if ( $list_sort == 'nearest' ) {
922
+			if ($list_sort == 'nearest') {
923 923
 				$related_nearest = true;
924 924
 			}
925 925
 
@@ -929,14 +929,14 @@  discard block
 block discarded – undo
929 929
 			 *
930 930
 			 * @since 1.0.0
931 931
 			 */
932
-			$template = apply_filters( "geodir_template_part-related-listing-listview", geodir_locate_template( 'listing-listview' ) );
932
+			$template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
933 933
 
934 934
 			/**
935 935
 			 * Includes related listing listview template.
936 936
 			 *
937 937
 			 * @since 1.0.0
938 938
 			 */
939
-			include( $template );
939
+			include($template);
940 940
 
941 941
 			wp_reset_query();
942 942
 			$post            = $origi_post;
@@ -964,12 +964,12 @@  discard block
 block discarded – undo
964 964
 function geodir_category_count_script() {
965 965
 	global $geodir_post_category_str;
966 966
 
967
-	if ( ! empty( $geodir_post_category_str ) ) {
968
-		$geodir_post_category_str = serialize( $geodir_post_category_str );
967
+	if (!empty($geodir_post_category_str)) {
968
+		$geodir_post_category_str = serialize($geodir_post_category_str);
969 969
 	}
970 970
 
971
-	$all_var['post_category_array'] = html_entity_decode( (string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8' );
972
-	$script                         = "var post_category_array = " . json_encode( $all_var ) . ';';
971
+	$all_var['post_category_array'] = html_entity_decode((string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8');
972
+	$script                         = "var post_category_array = ".json_encode($all_var).';';
973 973
 	echo '<script>';
974 974
 	echo $script;
975 975
 	echo '</script>';
@@ -984,8 +984,8 @@  discard block
 block discarded – undo
984 984
  * @return string Returns the default language.
985 985
  */
986 986
 function geodir_get_map_default_language() {
987
-	$geodir_default_map_language = get_option( 'geodir_default_map_language' );
988
-	if ( empty( $geodir_default_map_language ) ) {
987
+	$geodir_default_map_language = get_option('geodir_default_map_language');
988
+	if (empty($geodir_default_map_language)) {
989 989
 		$geodir_default_map_language = 'en';
990 990
 	}
991 991
 
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
 	 *
997 997
 	 * @param string $geodir_default_map_language Default map language.
998 998
 	 */
999
-	return apply_filters( 'geodir_default_map_language', $geodir_default_map_language );
999
+	return apply_filters('geodir_default_map_language', $geodir_default_map_language);
1000 1000
 }
1001 1001
 
1002 1002
 /**
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
  * @return string Returns the api key.
1008 1008
  */
1009 1009
 function geodir_get_map_api_key() {
1010
-	$key = get_option( 'geodir_google_api_key' );
1010
+	$key = get_option('geodir_google_api_key');
1011 1011
 
1012 1012
 	/**
1013 1013
 	 * Filter Google maps api key.
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
 	 *
1017 1017
 	 * @param string $key Google maps api key.
1018 1018
 	 */
1019
-	return apply_filters( 'geodir_google_api_key', $key );
1019
+	return apply_filters('geodir_google_api_key', $key);
1020 1020
 }
1021 1021
 
1022 1022
 
@@ -1035,20 +1035,20 @@  discard block
 block discarded – undo
1035 1035
 	global $wp, $post, $wp_query, $wpdb, $geodir_addon_list;
1036 1036
 
1037 1037
 	$is_geodir_page = geodir_is_geodir_page();
1038
-	if ( ! $is_geodir_page ) {
1038
+	if (!$is_geodir_page) {
1039 1039
 		return;
1040 1040
 	}// if non GD page, bail
1041 1041
 
1042 1042
 	$use_gd_meta = true;
1043
-	if ( class_exists( 'WPSEO_Frontend' ) || class_exists( 'All_in_One_SEO_Pack' ) ) {
1043
+	if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1044 1044
 		$use_gd_meta = false;
1045 1045
 
1046
-		if ( geodir_is_page( 'search' ) ) {
1046
+		if (geodir_is_page('search')) {
1047 1047
 			$use_gd_meta = true;
1048 1048
 		}
1049 1049
 	}
1050 1050
 
1051
-	if ( ! $use_gd_meta ) {
1051
+	if (!$use_gd_meta) {
1052 1052
 		return;
1053 1053
 	}// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active.
1054 1054
 
@@ -1056,170 +1056,170 @@  discard block
 block discarded – undo
1056 1056
 
1057 1057
 	$all_postypes = geodir_get_posttypes();
1058 1058
 
1059
-	$geodir_taxonomies = geodir_get_taxonomies( '', true );
1059
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1060 1060
 
1061 1061
 	$meta_desc = '';
1062 1062
 	$meta_key  = '';
1063
-	if ( isset( $current_term->ID ) && $current_term->ID == geodir_location_page_id() ) {
1063
+	if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
1064 1064
 		/**
1065 1065
 		 * Filter SEO meta location description.
1066 1066
 		 *
1067 1067
 		 * @since 1.0.0
1068 1068
 		 */
1069
-		$meta_desc = apply_filters( 'geodir_seo_meta_location_description', '' );
1069
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', '');
1070 1070
 		$meta_desc .= '';
1071 1071
 	}
1072
-	if ( have_posts() && is_single() OR is_page() ) {
1073
-		while ( have_posts() ) {
1072
+	if (have_posts() && is_single() OR is_page()) {
1073
+		while (have_posts()) {
1074 1074
 			the_post();
1075 1075
 
1076
-			if ( has_excerpt() ) {
1077
-				$out_excerpt = strip_tags( strip_shortcodes( get_the_excerpt() ) );
1078
-				if ( empty( $out_excerpt ) ) {
1079
-					$out_excerpt = strip_tags( do_shortcode( get_the_excerpt() ) );
1076
+			if (has_excerpt()) {
1077
+				$out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt()));
1078
+				if (empty($out_excerpt)) {
1079
+					$out_excerpt = strip_tags(do_shortcode(get_the_excerpt()));
1080 1080
 				}
1081
-				$out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $out_excerpt );
1081
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
1082 1082
 			} else {
1083
-				$out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $post->post_content );
1084
-				$out_excerpt = strip_tags( strip_shortcodes( $out_excerpt ) );
1085
-				if ( empty( $out_excerpt ) ) {
1086
-					$out_excerpt = strip_tags( do_shortcode( $out_excerpt ) ); // parse short code from content
1083
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
1084
+				$out_excerpt = strip_tags(strip_shortcodes($out_excerpt));
1085
+				if (empty($out_excerpt)) {
1086
+					$out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content
1087 1087
 				}
1088
-				$out_excerpt = trim( wp_trim_words( $out_excerpt, 35, '' ), '.!?,;:-' );
1088
+				$out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-');
1089 1089
 			}
1090 1090
 
1091 1091
 			$meta_desc .= $out_excerpt;
1092 1092
 		}
1093
-	} elseif ( ( is_category() || is_tag() ) && isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
1094
-		if ( is_category() ) {
1095
-			$meta_desc .= __( "Posts related to Category:", 'geodirectory' ) . " " . ucfirst( single_cat_title( "", false ) );
1096
-		} elseif ( is_tag() ) {
1097
-			$meta_desc .= __( "Posts related to Tag:", 'geodirectory' ) . " " . ucfirst( single_tag_title( "", false ) );
1093
+	} elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1094
+		if (is_category()) {
1095
+			$meta_desc .= __("Posts related to Category:", 'geodirectory')." ".ucfirst(single_cat_title("", false));
1096
+		} elseif (is_tag()) {
1097
+			$meta_desc .= __("Posts related to Tag:", 'geodirectory')." ".ucfirst(single_tag_title("", false));
1098 1098
 		}
1099
-	} elseif ( isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
1100
-		$meta_desc .= isset( $current_term->description ) ? $current_term->description : '';
1099
+	} elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1100
+		$meta_desc .= isset($current_term->description) ? $current_term->description : '';
1101 1101
 	}
1102 1102
 
1103 1103
 
1104 1104
 	$geodir_post_type       = geodir_get_current_posttype();
1105
-	$geodir_post_type_info  = get_post_type_object( $geodir_post_type );
1106
-	$geodir_is_page_listing = geodir_is_page( 'listing' ) ? true : false;
1107
-
1108
-	$category_taxonomy = geodir_get_taxonomies( $geodir_post_type );
1109
-	$tag_taxonomy      = geodir_get_taxonomies( $geodir_post_type, true );
1110
-
1111
-	$geodir_is_category = isset( $category_taxonomy[0] ) && get_query_var( $category_taxonomy[0] ) ? get_query_var( $category_taxonomy[0] ) : false;
1112
-	$geodir_is_tag      = isset( $tag_taxonomy[0] ) && get_query_var( $tag_taxonomy[0] ) ? true : false;
1113
-
1114
-	$geodir_is_search        = geodir_is_page( 'search' ) ? true : false;
1115
-	$geodir_is_location      = geodir_is_page( 'location' ) ? true : false;
1116
-	$geodir_location_manager = isset( $geodir_addon_list['geodir_location_manager'] ) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1117
-	$godir_location_terms    = geodir_get_current_location_terms( 'query_vars' );
1118
-	$gd_city                 = $geodir_location_manager && isset( $godir_location_terms['gd_city'] ) ? $godir_location_terms['gd_city'] : null;
1119
-	$gd_region               = $geodir_location_manager && isset( $godir_location_terms['gd_region'] ) ? $godir_location_terms['gd_region'] : null;
1120
-	$gd_country              = $geodir_location_manager && isset( $godir_location_terms['gd_country'] ) ? $godir_location_terms['gd_country'] : null;
1121
-	$replace_location        = __( 'Everywhere', 'geodirectory' );
1105
+	$geodir_post_type_info  = get_post_type_object($geodir_post_type);
1106
+	$geodir_is_page_listing = geodir_is_page('listing') ? true : false;
1107
+
1108
+	$category_taxonomy = geodir_get_taxonomies($geodir_post_type);
1109
+	$tag_taxonomy      = geodir_get_taxonomies($geodir_post_type, true);
1110
+
1111
+	$geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false;
1112
+	$geodir_is_tag      = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false;
1113
+
1114
+	$geodir_is_search        = geodir_is_page('search') ? true : false;
1115
+	$geodir_is_location      = geodir_is_page('location') ? true : false;
1116
+	$geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1117
+	$godir_location_terms    = geodir_get_current_location_terms('query_vars');
1118
+	$gd_city                 = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : null;
1119
+	$gd_region               = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : null;
1120
+	$gd_country              = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : null;
1121
+	$replace_location        = __('Everywhere', 'geodirectory');
1122 1122
 	$location_id             = null;
1123
-	if ( $geodir_location_manager ) {
1124
-		$sql           = $wpdb->prepare( "SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array( $gd_city ) );
1125
-		$location_id   = (int) $wpdb->get_var( $sql );
1123
+	if ($geodir_location_manager) {
1124
+		$sql           = $wpdb->prepare("SELECT location_id FROM ".POST_LOCATION_TABLE." WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
1125
+		$location_id   = (int) $wpdb->get_var($sql);
1126 1126
 		$location_type = geodir_what_is_current_location();
1127
-		if ( $location_type == 'city' ) {
1128
-			$replace_location = geodir_get_current_location( array( 'what' => 'city', 'echo' => false ) );
1129
-		} elseif ( $location_type == 'region' ) {
1130
-			$replace_location = geodir_get_current_location( array( 'what' => 'region', 'echo' => false ) );
1131
-		} elseif ( $location_type == 'country' ) {
1132
-			$replace_location = geodir_get_current_location( array( 'what' => 'country', 'echo' => false ) );
1133
-			$replace_location = __( $replace_location, 'geodirectory' );
1127
+		if ($location_type == 'city') {
1128
+			$replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
1129
+		} elseif ($location_type == 'region') {
1130
+			$replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
1131
+		} elseif ($location_type == 'country') {
1132
+			$replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
1133
+			$replace_location = __($replace_location, 'geodirectory');
1134 1134
 		}
1135
-		$country          = get_query_var( 'gd_country' );
1136
-		$region           = get_query_var( 'gd_region' );
1137
-		$city             = get_query_var( 'gd_city' );
1135
+		$country          = get_query_var('gd_country');
1136
+		$region           = get_query_var('gd_region');
1137
+		$city             = get_query_var('gd_city');
1138 1138
 		$current_location = '';
1139
-		if ( $country != '' ) {
1140
-			$current_location = get_actual_location_name( 'country', $country, true );
1139
+		if ($country != '') {
1140
+			$current_location = get_actual_location_name('country', $country, true);
1141 1141
 		}
1142
-		if ( $region != '' ) {
1143
-			$current_location = get_actual_location_name( 'region', $region );
1142
+		if ($region != '') {
1143
+			$current_location = get_actual_location_name('region', $region);
1144 1144
 		}
1145
-		if ( $city != '' ) {
1146
-			$current_location = get_actual_location_name( 'city', $city );
1145
+		if ($city != '') {
1146
+			$current_location = get_actual_location_name('city', $city);
1147 1147
 		}
1148 1148
 		$replace_location = $current_location != '' ? $current_location : $replace_location;
1149 1149
 	}
1150 1150
 
1151 1151
 	$geodir_meta_keys = '';
1152 1152
 	$geodir_meta_desc = '';
1153
-	if ( $is_geodir_page && ! empty( $geodir_post_type_info ) ) {
1154
-		if ( $geodir_is_page_listing || $geodir_is_search || geodir_is_page( 'add-listing' ) ) {
1155
-			$geodir_meta_keys = isset( $geodir_post_type_info->seo['meta_keyword'] ) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1153
+	if ($is_geodir_page && !empty($geodir_post_type_info)) {
1154
+		if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
1155
+			$geodir_meta_keys = isset($geodir_post_type_info->seo['meta_keyword']) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1156 1156
 
1157
-			$geodir_meta_desc = isset( $geodir_post_type_info->description ) ? $geodir_post_type_info->description : $geodir_meta_desc;
1158
-			$geodir_meta_desc = isset( $geodir_post_type_info->seo['meta_description'] ) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1157
+			$geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc;
1158
+			$geodir_meta_desc = isset($geodir_post_type_info->seo['meta_description']) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1159 1159
 
1160
-			if ( $geodir_is_category ) {
1161
-				$category = $geodir_is_category ? get_term_by( 'slug', $geodir_is_category, $category_taxonomy[0] ) : null;
1162
-				if ( isset( $category->term_id ) && ! empty( $category->term_id ) ) {
1160
+			if ($geodir_is_category) {
1161
+				$category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : null;
1162
+				if (isset($category->term_id) && !empty($category->term_id)) {
1163 1163
 					$category_id   = $category->term_id;
1164
-					$category_desc = trim( $category->description ) != '' ? trim( $category->description ) : get_tax_meta( $category_id, 'ct_cat_top_desc', false, $geodir_post_type );
1165
-					if ( $location_id ) {
1166
-						$option_name    = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id;
1167
-						$cat_loc_option = get_option( $option_name );
1168
-
1169
-						$gd_cat_loc_default = ! empty( $cat_loc_option ) && isset( $cat_loc_option['gd_cat_loc_default'] ) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1170
-						if ( ! $gd_cat_loc_default ) {
1171
-							$option_name   = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id;
1172
-							$option        = get_option( $option_name );
1173
-							$category_desc = isset( $option['gd_cat_loc_desc'] ) && trim( $option['gd_cat_loc_desc'] ) != '' ? trim( $option['gd_cat_loc_desc'] ) : $category_desc;
1164
+					$category_desc = trim($category->description) != '' ? trim($category->description) : get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type);
1165
+					if ($location_id) {
1166
+						$option_name    = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id;
1167
+						$cat_loc_option = get_option($option_name);
1168
+
1169
+						$gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1170
+						if (!$gd_cat_loc_default) {
1171
+							$option_name   = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id.'_'.$location_id;
1172
+							$option        = get_option($option_name);
1173
+							$category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc;
1174 1174
 						}
1175 1175
 					}
1176
-					$geodir_meta_desc = __( "Posts related to Category:", 'geodirectory' ) . " " . ucfirst( single_cat_title( "", false ) ) . '. ' . $category_desc;
1176
+					$geodir_meta_desc = __("Posts related to Category:", 'geodirectory')." ".ucfirst(single_cat_title("", false)).'. '.$category_desc;
1177 1177
 				}
1178
-			} else if ( $geodir_is_tag ) {
1179
-				$geodir_meta_desc = __( "Posts related to Tag:", 'geodirectory' ) . " " . ucfirst( single_tag_title( "", false ) ) . '. ' . $geodir_meta_desc;
1178
+			} else if ($geodir_is_tag) {
1179
+				$geodir_meta_desc = __("Posts related to Tag:", 'geodirectory')." ".ucfirst(single_tag_title("", false)).'. '.$geodir_meta_desc;
1180 1180
 			}
1181 1181
 		}
1182 1182
 	}
1183 1183
 
1184 1184
 
1185 1185
 	$gd_page = '';
1186
-	if ( geodir_is_page( 'home' ) ) {
1186
+	if (geodir_is_page('home')) {
1187 1187
 		$gd_page   = 'home';
1188
-		$meta_desc = ( get_option( 'geodir_meta_desc_homepage' ) ) ? get_option( 'geodir_meta_desc_homepage' ) : $meta_desc;
1189
-	} elseif ( geodir_is_page( 'detail' ) ) {
1188
+		$meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1189
+	} elseif (geodir_is_page('detail')) {
1190 1190
 		$gd_page   = 'detail';
1191
-		$meta_desc = ( get_option( 'geodir_meta_desc_detail' ) ) ? get_option( 'geodir_meta_desc_detail' ) : $meta_desc;
1192
-	} elseif ( geodir_is_page( 'pt' ) ) {
1191
+		$meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1192
+	} elseif (geodir_is_page('pt')) {
1193 1193
 		$gd_page   = 'pt';
1194
-		$meta_desc = ( get_option( 'geodir_meta_desc_pt' ) ) ? get_option( 'geodir_meta_desc_pt' ) : $meta_desc;
1195
-	} elseif ( geodir_is_page( 'listing' ) ) {
1194
+		$meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1195
+	} elseif (geodir_is_page('listing')) {
1196 1196
 		$gd_page   = 'listing';
1197
-		$meta_desc = ( get_option( 'geodir_meta_desc_listing' ) ) ? get_option( 'geodir_meta_desc_listing' ) : $meta_desc;
1198
-	} elseif ( geodir_is_page( 'location' ) ) {
1197
+		$meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1198
+	} elseif (geodir_is_page('location')) {
1199 1199
 		$gd_page   = 'location';
1200
-		$meta_desc = ( get_option( 'geodir_meta_desc_location' ) ) ? get_option( 'geodir_meta_desc_location' ) : $meta_desc;
1201
-		$meta_desc = apply_filters( 'geodir_seo_meta_location_description', $meta_desc );
1200
+		$meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1201
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1202 1202
 
1203
-	} elseif ( geodir_is_page( 'search' ) ) {
1203
+	} elseif (geodir_is_page('search')) {
1204 1204
 		$gd_page   = 'search';
1205
-		$meta_desc = ( get_option( 'geodir_meta_desc_search' ) ) ? get_option( 'geodir_meta_desc_search' ) : $meta_desc;
1206
-	} elseif ( geodir_is_page( 'add-listing' ) ) {
1205
+		$meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1206
+	} elseif (geodir_is_page('add-listing')) {
1207 1207
 		$gd_page   = 'add-listing';
1208
-		$meta_desc = ( get_option( 'geodir_meta_desc_add-listing' ) ) ? get_option( 'geodir_meta_desc_add-listing' ) : $meta_desc;
1209
-	} elseif ( geodir_is_page( 'author' ) ) {
1208
+		$meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1209
+	} elseif (geodir_is_page('author')) {
1210 1210
 		$gd_page   = 'author';
1211
-		$meta_desc = ( get_option( 'geodir_meta_desc_author' ) ) ? get_option( 'geodir_meta_desc_author' ) : $meta_desc;
1212
-	} elseif ( geodir_is_page( 'login' ) ) {
1211
+		$meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1212
+	} elseif (geodir_is_page('login')) {
1213 1213
 		$gd_page   = 'login';
1214
-		$meta_desc = ( get_option( 'geodir_meta_desc_login' ) ) ? get_option( 'geodir_meta_desc_login' ) : $meta_desc;
1215
-	} elseif ( geodir_is_page( 'listing-success' ) ) {
1214
+		$meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1215
+	} elseif (geodir_is_page('listing-success')) {
1216 1216
 		$gd_page   = 'listing-success';
1217
-		$meta_desc = ( get_option( 'geodir_meta_desc_listing-success' ) ) ? get_option( 'geodir_meta_desc_listing-success' ) : $meta_desc;
1217
+		$meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1218 1218
 	}
1219 1219
 
1220 1220
 
1221
-	if ( $meta_desc ) {
1222
-		$meta_desc = stripslashes_deep( $meta_desc );
1221
+	if ($meta_desc) {
1222
+		$meta_desc = stripslashes_deep($meta_desc);
1223 1223
 		/**
1224 1224
 		 * Filter page description to replace variables.
1225 1225
 		 *
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
 		 * @param string $title   The page description including variables.
1229 1229
 		 * @param string $gd_page The GeoDirectory page type if any.
1230 1230
 		 */
1231
-		$meta_desc = apply_filters( 'geodir_seo_meta_description_pre', __( $meta_desc, 'geodirectory' ), $gd_page, '' );
1231
+		$meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'), $gd_page, '');
1232 1232
 
1233 1233
 		/**
1234 1234
 		 * Filter SEO meta description.
@@ -1237,49 +1237,49 @@  discard block
 block discarded – undo
1237 1237
 		 *
1238 1238
 		 * @param string $meta_desc Meta description content.
1239 1239
 		 */
1240
-		echo apply_filters( 'geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc );
1240
+		echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="'.$meta_desc.'" />', $meta_desc);
1241 1241
 	}
1242 1242
 
1243 1243
 	// meta keywords
1244
-	if ( isset( $post->post_type ) && in_array( $post->post_type, $all_postypes ) ) {
1245
-		$place_tags = wp_get_post_terms( $post->ID, $post->post_type . '_tags', array( "fields" => "names" ) );
1246
-		$place_cats = wp_get_post_terms( $post->ID, $post->post_type . 'category', array( "fields" => "names" ) );
1244
+	if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
1245
+		$place_tags = wp_get_post_terms($post->ID, $post->post_type.'_tags', array("fields" => "names"));
1246
+		$place_cats = wp_get_post_terms($post->ID, $post->post_type.'category', array("fields" => "names"));
1247 1247
 
1248
-		$meta_key .= implode( ", ", array_merge( (array) $place_cats, (array) $place_tags ) );
1248
+		$meta_key .= implode(", ", array_merge((array) $place_cats, (array) $place_tags));
1249 1249
 	} else {
1250 1250
 		$posttags = get_the_tags();
1251
-		if ( $posttags ) {
1252
-			foreach ( $posttags as $tag ) {
1253
-				$meta_key .= $tag->name . ' ';
1251
+		if ($posttags) {
1252
+			foreach ($posttags as $tag) {
1253
+				$meta_key .= $tag->name.' ';
1254 1254
 			}
1255 1255
 		} else {
1256
-			$tags = get_tags( array( 'orderby' => 'count', 'order' => 'DESC' ) );
1256
+			$tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
1257 1257
 			$xt   = 1;
1258 1258
 
1259
-			foreach ( $tags as $tag ) {
1260
-				if ( $xt <= 20 ) {
1261
-					$meta_key .= $tag->name . ", ";
1259
+			foreach ($tags as $tag) {
1260
+				if ($xt <= 20) {
1261
+					$meta_key .= $tag->name.", ";
1262 1262
 				}
1263 1263
 
1264
-				$xt ++;
1264
+				$xt++;
1265 1265
 			}
1266 1266
 		}
1267 1267
 	}
1268 1268
 
1269
-	$meta_key         = $meta_key != '' ? rtrim( trim( $meta_key ), "," ) : $meta_key;
1270
-	$geodir_meta_keys = $geodir_meta_keys != '' ? ( $meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys ) : $meta_key;
1271
-	if ( $geodir_meta_keys != '' ) {
1272
-		$geodir_meta_keys = strip_tags( $geodir_meta_keys );
1273
-		$geodir_meta_keys = esc_html( $geodir_meta_keys );
1274
-		$geodir_meta_keys = geodir_strtolower( $geodir_meta_keys );
1275
-		$geodir_meta_keys = wp_html_excerpt( $geodir_meta_keys, 1000, '' );
1276
-		$geodir_meta_keys = str_replace( '%location%', $replace_location, $geodir_meta_keys );
1269
+	$meta_key         = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key;
1270
+	$geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key.', '.$geodir_meta_keys : $geodir_meta_keys) : $meta_key;
1271
+	if ($geodir_meta_keys != '') {
1272
+		$geodir_meta_keys = strip_tags($geodir_meta_keys);
1273
+		$geodir_meta_keys = esc_html($geodir_meta_keys);
1274
+		$geodir_meta_keys = geodir_strtolower($geodir_meta_keys);
1275
+		$geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, '');
1276
+		$geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
1277 1277
 
1278
-		$meta_key = rtrim( trim( $geodir_meta_keys ), "," );
1278
+		$meta_key = rtrim(trim($geodir_meta_keys), ",");
1279 1279
 	}
1280 1280
 
1281
-	if ( $meta_key ) {
1282
-		$meta_key = stripslashes_deep( $meta_key );
1281
+	if ($meta_key) {
1282
+		$meta_key = stripslashes_deep($meta_key);
1283 1283
 		/**
1284 1284
 		 * Filter SEO meta keywords.
1285 1285
 		 *
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
 		 *
1288 1288
 		 * @param string $meta_desc Meta keywords.
1289 1289
 		 */
1290
-		echo apply_filters( 'geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key );
1290
+		echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="'.$meta_key.'" />', $meta_key);
1291 1291
 	}
1292 1292
 
1293 1293
 }
@@ -1307,8 +1307,8 @@  discard block
 block discarded – undo
1307 1307
 
1308 1308
 	$geodir_detail_page_tabs_array = geodir_detail_page_tabs_array();
1309 1309
 
1310
-	foreach ( $geodir_detail_page_tabs_array as $key => $tabs_obj ) {
1311
-		$geodir_detail_page_tabs_key_value_array[ $key ] = $tabs_obj['heading_text'];
1310
+	foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
1311
+		$geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text'];
1312 1312
 	}
1313 1313
 
1314 1314
 	return $geodir_detail_page_tabs_key_value_array;
@@ -1330,57 +1330,57 @@  discard block
 block discarded – undo
1330 1330
 	 * @since 1.0.0
1331 1331
 	 */
1332 1332
 	$arr_tabs['post_profile'] = array(
1333
-		'heading_text'  => __( 'Profile', 'geodirectory' ),
1333
+		'heading_text'  => __('Profile', 'geodirectory'),
1334 1334
 		'is_active_tab' => true,
1335
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_profile' ),
1335
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
1336 1336
 		'tab_content'   => ''
1337 1337
 	);
1338
-	$arr_tabs['post_info']    = array(
1339
-		'heading_text'  => __( 'More Info', 'geodirectory' ),
1338
+	$arr_tabs['post_info'] = array(
1339
+		'heading_text'  => __('More Info', 'geodirectory'),
1340 1340
 		'is_active_tab' => false,
1341
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_info' ),
1341
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
1342 1342
 		'tab_content'   => ''
1343 1343
 	);
1344 1344
 
1345 1345
 	$arr_tabs['post_images'] = array(
1346
-		'heading_text'  => __( 'Photos', 'geodirectory' ),
1346
+		'heading_text'  => __('Photos', 'geodirectory'),
1347 1347
 		'is_active_tab' => false,
1348
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_images' ),
1348
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
1349 1349
 		'tab_content'   => ''
1350 1350
 	);
1351 1351
 
1352 1352
 	$arr_tabs['post_video'] = array(
1353
-		'heading_text'  => __( 'Video', 'geodirectory' ),
1353
+		'heading_text'  => __('Video', 'geodirectory'),
1354 1354
 		'is_active_tab' => false,
1355
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_video' ),
1355
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
1356 1356
 		'tab_content'   => ''
1357 1357
 	);
1358 1358
 
1359 1359
 	$arr_tabs['special_offers'] = array(
1360
-		'heading_text'  => __( 'Special Offers', 'geodirectory' ),
1360
+		'heading_text'  => __('Special Offers', 'geodirectory'),
1361 1361
 		'is_active_tab' => false,
1362
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'special_offers' ),
1362
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
1363 1363
 		'tab_content'   => ''
1364 1364
 	);
1365 1365
 
1366 1366
 	$arr_tabs['post_map'] = array(
1367
-		'heading_text'  => __( 'Map', 'geodirectory' ),
1367
+		'heading_text'  => __('Map', 'geodirectory'),
1368 1368
 		'is_active_tab' => false,
1369
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_map' ),
1369
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
1370 1370
 		'tab_content'   => ''
1371 1371
 	);
1372 1372
 
1373 1373
 	$arr_tabs['reviews'] = array(
1374
-		'heading_text'  => __( 'Reviews', 'geodirectory' ),
1374
+		'heading_text'  => __('Reviews', 'geodirectory'),
1375 1375
 		'is_active_tab' => false,
1376
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'reviews' ),
1376
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
1377 1377
 		'tab_content'   => 'review display'
1378 1378
 	);
1379 1379
 
1380 1380
 	$arr_tabs['related_listing'] = array(
1381
-		'heading_text'  => __( 'Related Listing', 'geodirectory' ),
1381
+		'heading_text'  => __('Related Listing', 'geodirectory'),
1382 1382
 		'is_active_tab' => false,
1383
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'related_listing' ),
1383
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
1384 1384
 		'tab_content'   => ''
1385 1385
 	);
1386 1386
 
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
 	 *
1390 1390
 	 * @since 1.0.0
1391 1391
 	 */
1392
-	return apply_filters( 'geodir_detail_page_tab_list_extend', $arr_tabs );
1392
+	return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
1393 1393
 
1394 1394
 
1395 1395
 }
@@ -1403,13 +1403,13 @@  discard block
 block discarded – undo
1403 1403
  * @return mixed|array Tabs array.
1404 1404
  */
1405 1405
 function geodir_detail_page_tabs_list() {
1406
-	$tabs_excluded = get_option( 'geodir_detail_page_tabs_excluded' );
1406
+	$tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
1407 1407
 	$tabs_array    = geodir_detail_page_tabs_array();
1408 1408
 
1409
-	if ( ! empty( $tabs_excluded ) ) {
1410
-		foreach ( $tabs_excluded as $tab ) {
1411
-			if ( array_key_exists( $tab, $tabs_array ) ) {
1412
-				unset( $tabs_array[ $tab ] );
1409
+	if (!empty($tabs_excluded)) {
1410
+		foreach ($tabs_excluded as $tab) {
1411
+			if (array_key_exists($tab, $tabs_array)) {
1412
+				unset($tabs_array[$tab]);
1413 1413
 			}
1414 1414
 		}
1415 1415
 	}
@@ -1433,58 +1433,58 @@  discard block
 block discarded – undo
1433 1433
 function geodir_show_detail_page_tabs() {
1434 1434
 	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields, $preview;
1435 1435
 
1436
-	$post_id            = ! empty( $post ) && isset( $post->ID ) ? (int) $post->ID : 0;
1437
-	$request_post_id    = ! empty( $_REQUEST['p'] ) ? (int) $_REQUEST['p'] : 0;
1438
-	$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
1436
+	$post_id            = !empty($post) && isset($post->ID) ? (int) $post->ID : 0;
1437
+	$request_post_id    = !empty($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;
1438
+	$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
1439 1439
 
1440
-	if ( $is_backend_preview && ! $post_id > 0 && $request_post_id > 0 ) {
1441
-		$post = geodir_get_post_info( $request_post_id );
1442
-		setup_postdata( $post );
1440
+	if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
1441
+		$post = geodir_get_post_info($request_post_id);
1442
+		setup_postdata($post);
1443 1443
 	}
1444 1444
 
1445
-	$geodir_post_detail_fields = geodir_show_listing_info( 'moreinfo' );
1445
+	$geodir_post_detail_fields = geodir_show_listing_info('moreinfo');
1446 1446
 
1447 1447
 
1448
-	if ( geodir_is_page( 'detail' ) ) {
1449
-		$video                 = geodir_get_video( $post->ID );
1450
-		$special_offers        = geodir_get_special_offers( $post->ID );
1448
+	if (geodir_is_page('detail')) {
1449
+		$video                 = geodir_get_video($post->ID);
1450
+		$special_offers        = geodir_get_special_offers($post->ID);
1451 1451
 		$related_listing_array = array();
1452
-		if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
1453
-			$related_listing_array = get_option( 'geodir_add_related_listing_posttypes' );
1452
+		if (get_option('geodir_add_related_listing_posttypes')) {
1453
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
1454 1454
 		}
1455 1455
 
1456 1456
 
1457
-		$excluded_tabs = get_option( 'geodir_detail_page_tabs_excluded' );
1458
-		if ( ! $excluded_tabs ) {
1457
+		$excluded_tabs = get_option('geodir_detail_page_tabs_excluded');
1458
+		if (!$excluded_tabs) {
1459 1459
 			$excluded_tabs = array();
1460 1460
 		}
1461 1461
 
1462 1462
 		$related_listing = '';
1463
-		if ( in_array( $post->post_type, $related_listing_array ) && ! in_array( 'related_listing', $excluded_tabs ) ) {
1463
+		if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) {
1464 1464
 			$request = array(
1465
-				'post_number'         => get_option( 'geodir_related_post_count' ),
1466
-				'relate_to'           => get_option( 'geodir_related_post_relate_to' ),
1467
-				'layout'              => get_option( 'geodir_related_post_listing_view' ),
1468
-				'add_location_filter' => get_option( 'geodir_related_post_location_filter' ),
1469
-				'list_sort'           => get_option( 'geodir_related_post_sortby' ),
1470
-				'character_count'     => get_option( 'geodir_related_post_excerpt' )
1465
+				'post_number'         => get_option('geodir_related_post_count'),
1466
+				'relate_to'           => get_option('geodir_related_post_relate_to'),
1467
+				'layout'              => get_option('geodir_related_post_listing_view'),
1468
+				'add_location_filter' => get_option('geodir_related_post_location_filter'),
1469
+				'list_sort'           => get_option('geodir_related_post_sortby'),
1470
+				'character_count'     => get_option('geodir_related_post_excerpt')
1471 1471
 			);
1472 1472
 
1473
-			if ( $post->post_type == 'gd_event' && defined( 'GDEVENTS_VERSION' ) ) {
1474
-				$related_listing = geodir_get_detail_page_related_events( $request );
1473
+			if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
1474
+				$related_listing = geodir_get_detail_page_related_events($request);
1475 1475
 			} else {
1476
-				$related_listing = geodir_related_posts_display( $request );
1476
+				$related_listing = geodir_related_posts_display($request);
1477 1477
 			}
1478 1478
 
1479 1479
 		}
1480 1480
 
1481
-		$post_images = geodir_get_images( $post->ID, 'thumbnail' );
1481
+		$post_images = geodir_get_images($post->ID, 'thumbnail');
1482 1482
 		$thumb_image = '';
1483
-		if ( ! empty( $post_images ) ) {
1484
-			foreach ( $post_images as $image ) {
1485
-				$caption = ( ! empty( $image->caption ) ) ? $image->caption : '';
1486
-				$thumb_image .= '<a href="' . $image->src . '" title="' . $caption . '">';
1487
-				$thumb_image .= geodir_show_image( $image, 'thumbnail', true, false );
1483
+		if (!empty($post_images)) {
1484
+			foreach ($post_images as $image) {
1485
+				$caption = (!empty($image->caption)) ? $image->caption : '';
1486
+				$thumb_image .= '<a href="'.$image->src.'" title="'.$caption.'">';
1487
+				$thumb_image .= geodir_show_image($image, 'thumbnail', true, false);
1488 1488
 				$thumb_image .= '</a>';
1489 1489
 			}
1490 1490
 		}
@@ -1493,11 +1493,11 @@  discard block
 block discarded – undo
1493 1493
 		$map_args['map_canvas_name'] = 'detail_page_map_canvas';
1494 1494
 		$map_args['width']           = '600';
1495 1495
 		$map_args['height']          = '300';
1496
-		if ( $post->post_mapzoom ) {
1497
-			$map_args['zoom'] = '' . $post->post_mapzoom . '';
1496
+		if ($post->post_mapzoom) {
1497
+			$map_args['zoom'] = ''.$post->post_mapzoom.'';
1498 1498
 		}
1499 1499
 		$map_args['autozoom']                 = false;
1500
-		$map_args['scrollwheel']              = ( get_option( 'geodir_add_listing_mouse_scroll' ) ) ? 0 : 1;
1500
+		$map_args['scrollwheel']              = (get_option('geodir_add_listing_mouse_scroll')) ? 0 : 1;
1501 1501
 		$map_args['child_collapse']           = '0';
1502 1502
 		$map_args['enable_cat_filters']       = false;
1503 1503
 		$map_args['enable_text_search']       = false;
@@ -1506,43 +1506,43 @@  discard block
 block discarded – undo
1506 1506
 		$map_args['enable_jason_on_load']     = true;
1507 1507
 		$map_args['enable_map_direction']     = true;
1508 1508
 		$map_args['map_class_name']           = 'geodir-map-detail-page';
1509
-		$map_args['maptype']                  = ( ! empty( $post->post_mapview ) ) ? $post->post_mapview : 'ROADMAP';
1510
-	} else if ( geodir_is_page( 'preview' ) ) {
1511
-		$video          = isset( $post->geodir_video ) ? $post->geodir_video : '';
1512
-		$special_offers = isset( $post->geodir_special_offers ) ? $post->geodir_special_offers : '';
1509
+		$map_args['maptype']                  = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP';
1510
+	} else if (geodir_is_page('preview')) {
1511
+		$video          = isset($post->geodir_video) ? $post->geodir_video : '';
1512
+		$special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : '';
1513 1513
 
1514
-		if ( isset( $post->post_images ) ) {
1515
-			$post->post_images = trim( $post->post_images, "," );
1514
+		if (isset($post->post_images)) {
1515
+			$post->post_images = trim($post->post_images, ",");
1516 1516
 		}
1517 1517
 
1518
-		if ( isset( $post->post_images ) && ! empty( $post->post_images ) ) {
1519
-			$post_images = explode( ",", $post->post_images );
1518
+		if (isset($post->post_images) && !empty($post->post_images)) {
1519
+			$post_images = explode(",", $post->post_images);
1520 1520
 		}
1521 1521
 
1522 1522
 		$thumb_image = '';
1523
-		if ( ! empty( $post_images ) ) {
1524
-			foreach ( $post_images as $image ) {
1525
-				if ( $image != '' ) {
1526
-					$thumb_image .= '<a href="' . $image . '">';
1527
-					$thumb_image .= geodir_show_image( array( 'src' => $image ), 'thumbnail', true, false );
1523
+		if (!empty($post_images)) {
1524
+			foreach ($post_images as $image) {
1525
+				if ($image != '') {
1526
+					$thumb_image .= '<a href="'.$image.'">';
1527
+					$thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
1528 1528
 					$thumb_image .= '</a>';
1529 1529
 				}
1530 1530
 			}
1531 1531
 		}
1532 1532
 
1533 1533
 		global $map_jason;
1534
-		$marker_json      = $post->marker_json != '' ? json_decode( $post->marker_json, true ) : array();
1535
-		$marker_icon      = ( ! empty( $marker_json ) && ! empty( $marker_json['i'] ) ) ? $marker_json['i'] : '';
1536
-		$icon_size        = geodir_get_marker_size( $marker_icon );
1534
+		$marker_json      = $post->marker_json != '' ? json_decode($post->marker_json, true) : array();
1535
+		$marker_icon      = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : '';
1536
+		$icon_size        = geodir_get_marker_size($marker_icon);
1537 1537
 		$marker_json['w'] = $icon_size['w'];
1538 1538
 		$marker_json['h'] = $icon_size['h'];
1539
-		$map_jason[]      = json_encode( $marker_json );
1539
+		$map_jason[]      = json_encode($marker_json);
1540 1540
 
1541
-		$address_latitude  = isset( $post->post_latitude ) ? $post->post_latitude : '';
1542
-		$address_longitude = isset( $post->post_longitude ) ? $post->post_longitude : '';
1543
-		$mapview           = isset( $post->post_mapview ) ? $post->post_mapview : '';
1544
-		$mapzoom           = isset( $post->post_mapzoom ) ? $post->post_mapzoom : '';
1545
-		if ( ! $mapzoom ) {
1541
+		$address_latitude  = isset($post->post_latitude) ? $post->post_latitude : '';
1542
+		$address_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
1543
+		$mapview           = isset($post->post_mapview) ? $post->post_mapview : '';
1544
+		$mapzoom           = isset($post->post_mapzoom) ? $post->post_mapzoom : '';
1545
+		if (!$mapzoom) {
1546 1546
 			$mapzoom = 12;
1547 1547
 		}
1548 1548
 
@@ -1565,37 +1565,37 @@  discard block
 block discarded – undo
1565 1565
 		$map_args['map_class_name']           = 'geodir-map-preview-page';
1566 1566
 	}
1567 1567
 
1568
-	$arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user
1568
+	$arr_detail_page_tabs = geodir_detail_page_tabs_list(); // get this sooner so we can get the active tab for the user
1569 1569
 
1570 1570
 	$active_tab       = '';
1571 1571
 	$active_tab_name  = '';
1572 1572
 	$default_tab      = '';
1573 1573
 	$default_tab_name = '';
1574
-	foreach ( $arr_detail_page_tabs as $tab_index => $tabs ) {
1575
-		if ( isset( $tabs['is_active_tab'] ) && $tabs['is_active_tab'] && ! empty( $tabs['is_display'] ) && isset( $tabs['heading_text'] ) && $tabs['heading_text'] ) {
1574
+	foreach ($arr_detail_page_tabs as $tab_index => $tabs) {
1575
+		if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
1576 1576
 			$active_tab      = $tab_index;
1577
-			$active_tab_name = __( $tabs['heading_text'], 'geodirectory' );
1577
+			$active_tab_name = __($tabs['heading_text'], 'geodirectory');
1578 1578
 		}
1579 1579
 
1580
-		if ( $default_tab === '' && ! empty( $tabs['is_display'] ) && ! empty( $tabs['heading_text'] ) ) {
1580
+		if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
1581 1581
 			$default_tab      = $tab_index;
1582
-			$default_tab_name = __( $tabs['heading_text'], 'geodirectory' );
1582
+			$default_tab_name = __($tabs['heading_text'], 'geodirectory');
1583 1583
 		}
1584 1584
 	}
1585 1585
 
1586
-	if ( $active_tab === '' && $default_tab !== '' ) { // Make first tab acs a active tab if not any tab is active.
1587
-		if ( isset( $arr_detail_page_tabs[ $active_tab ] ) && isset( $arr_detail_page_tabs[ $active_tab ]['is_active_tab'] ) ) {
1588
-			$arr_detail_page_tabs[ $active_tab ]['is_active_tab'] = false;
1586
+	if ($active_tab === '' && $default_tab !== '') { // Make first tab acs a active tab if not any tab is active.
1587
+		if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
1588
+			$arr_detail_page_tabs[$active_tab]['is_active_tab'] = false;
1589 1589
 		}
1590 1590
 
1591
-		$arr_detail_page_tabs[ $default_tab ]['is_active_tab'] = true;
1591
+		$arr_detail_page_tabs[$default_tab]['is_active_tab'] = true;
1592 1592
 		$active_tab                                            = $default_tab;
1593 1593
 		$active_tab_name                                       = $default_tab_name;
1594 1594
 	}
1595
-	$tab_list = ( get_option( 'geodir_disable_tabs', false ) ) ? true : false;
1595
+	$tab_list = (get_option('geodir_disable_tabs', false)) ? true : false;
1596 1596
 	?>
1597 1597
 	<div class="geodir-tabs" id="gd-tabs" style="position:relative;">
1598
-		<?php if ( ! $tab_list ){ ?>
1598
+		<?php if (!$tab_list) { ?>
1599 1599
 		<div id="geodir-tab-mobile-menu">
1600 1600
 			<i class="fa fa-bars"></i>
1601 1601
 			<span class="geodir-mobile-active-tab"><?php echo $active_tab_name; ?></span>
@@ -1610,26 +1610,26 @@  discard block
 block discarded – undo
1610 1610
 			 * @since 1.0.0
1611 1611
 			 * @see   'geodir_after_tab_list'
1612 1612
 			 */
1613
-			do_action( 'geodir_before_tab_list' ); ?>
1613
+			do_action('geodir_before_tab_list'); ?>
1614 1614
 			<?php
1615 1615
 
1616
-			foreach ( $arr_detail_page_tabs as $tab_index => $detail_page_tab ) {
1617
-				if ( $detail_page_tab['is_display'] ) {
1616
+			foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
1617
+				if ($detail_page_tab['is_display']) {
1618 1618
 
1619
-					if ( ! $tab_list ) {
1619
+					if (!$tab_list) {
1620 1620
 						?>
1621 1621
 						<dt></dt> <!-- added to comply with validation -->
1622
-						<dd <?php if ( $detail_page_tab['is_active_tab'] ){ ?>class="geodir-tab-active"<?php } ?> ><a
1622
+						<dd <?php if ($detail_page_tab['is_active_tab']) { ?>class="geodir-tab-active"<?php } ?> ><a
1623 1623
 								data-tab="#<?php echo $tab_index; ?>"
1624
-								data-status="enable"><?php _e( $detail_page_tab['heading_text'], 'geodirectory' ); ?></a>
1624
+								data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a>
1625 1625
 						</dd>
1626 1626
 						<?php
1627 1627
 					}
1628 1628
 					ob_start() // start tab content buffering
1629 1629
 					?>
1630 1630
 					<li id="<?php echo $tab_index; ?>Tab">
1631
-						<?php if ( $tab_list ) {
1632
-							$tab_title = '<span class="gd-tab-list-title" ><a href="#' . $tab_index . '">' . __( $detail_page_tab['heading_text'], 'geodirectory' ) . '</a></span><hr />';
1631
+						<?php if ($tab_list) {
1632
+							$tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'], 'geodirectory').'</a></span><hr />';
1633 1633
 							/**
1634 1634
 							 * Filter the tab list title html.
1635 1635
 							 *
@@ -1639,7 +1639,7 @@  discard block
 block discarded – undo
1639 1639
 							 * @param string $tab_index      The tab index type.
1640 1640
 							 * @param array $detail_page_tab The array of values including title text.
1641 1641
 							 */
1642
-							echo apply_filters( 'geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab );
1642
+							echo apply_filters('geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab);
1643 1643
 						} ?>
1644 1644
 						<div id="<?php echo $tab_index; ?>" class="hash-offset"></div>
1645 1645
 						<?php
@@ -1650,7 +1650,7 @@  discard block
 block discarded – undo
1650 1650
 						 *
1651 1651
 						 * @param string $tab_index The tab name ID.
1652 1652
 						 */
1653
-						do_action( 'geodir_before_tab_content', $tab_index );
1653
+						do_action('geodir_before_tab_content', $tab_index);
1654 1654
 
1655 1655
 						/**
1656 1656
 						 * Called before the details tab content is output per tab.
@@ -1660,21 +1660,21 @@  discard block
 block discarded – undo
1660 1660
 						 * @since 1.0.0
1661 1661
 						 * @todo  do we need this if we have the hook above? 'geodir_before_tab_content'
1662 1662
 						 */
1663
-						do_action( 'geodir_before_' . $tab_index . '_tab_content' );
1663
+						do_action('geodir_before_'.$tab_index.'_tab_content');
1664 1664
 						/// write a code to generate content of each tab
1665
-						switch ( $tab_index ) {
1665
+						switch ($tab_index) {
1666 1666
 							case 'post_profile':
1667 1667
 								/**
1668 1668
 								 * Called before the listing description content on the details page tab.
1669 1669
 								 *
1670 1670
 								 * @since 1.0.0
1671 1671
 								 */
1672
-								do_action( 'geodir_before_description_on_listing_detail' );
1673
-								if ( geodir_is_page( 'detail' ) ) {
1672
+								do_action('geodir_before_description_on_listing_detail');
1673
+								if (geodir_is_page('detail')) {
1674 1674
 									the_content();
1675 1675
 								} else {
1676 1676
 									/** This action is documented in geodirectory_template_actions.php */
1677
-									echo apply_filters( 'the_content', stripslashes( $post->post_desc ) );
1677
+									echo apply_filters('the_content', stripslashes($post->post_desc));
1678 1678
 								}
1679 1679
 
1680 1680
 								/**
@@ -1682,7 +1682,7 @@  discard block
 block discarded – undo
1682 1682
 								 *
1683 1683
 								 * @since 1.0.0
1684 1684
 								 */
1685
-								do_action( 'geodir_after_description_on_listing_detail' );
1685
+								do_action('geodir_after_description_on_listing_detail');
1686 1686
 								break;
1687 1687
 							case 'post_info':
1688 1688
 								echo $geodir_post_detail_fields;
@@ -1692,32 +1692,32 @@  discard block
 block discarded – undo
1692 1692
 								break;
1693 1693
 							case 'post_video':
1694 1694
 								// some browsers hide $_POST data if used for embeds so we repalce with a placeholder
1695
-								if ( $preview ) {
1696
-									if ( $video ) {
1697
-										echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />" . __( 'Video Preview Placeholder', 'geodirectory' ) . "</p></span>";
1695
+								if ($preview) {
1696
+									if ($video) {
1697
+										echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />".__('Video Preview Placeholder', 'geodirectory')."</p></span>";
1698 1698
 									}
1699 1699
 								} else {
1700 1700
 
1701 1701
 									// stop payment manager filtering content length
1702
-									$filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1703
-									if ( false !== $filter_priority ) {
1704
-										remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1702
+									$filter_priority = has_filter('the_content', 'geodir_payments_the_content');
1703
+									if (false !== $filter_priority) {
1704
+										remove_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1705 1705
 									}
1706 1706
 
1707 1707
 									/** This action is documented in geodirectory_template_actions.php */
1708
-									echo apply_filters( 'the_content', stripslashes( $video ) );// we apply the_content filter so oembed works also;
1708
+									echo apply_filters('the_content', stripslashes($video)); // we apply the_content filter so oembed works also;
1709 1709
 
1710
-									if ( false !== $filter_priority ) {
1711
-										add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1710
+									if (false !== $filter_priority) {
1711
+										add_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1712 1712
 									}
1713 1713
 								}
1714 1714
 								break;
1715 1715
 							case 'special_offers':
1716
-								echo apply_filters( 'gd_special_offers_content', wpautop( stripslashes( $special_offers ) ) );
1716
+								echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
1717 1717
 
1718 1718
 								break;
1719 1719
 							case 'post_map':
1720
-								geodir_draw_map( $map_args );
1720
+								geodir_draw_map($map_args);
1721 1721
 								break;
1722 1722
 							case 'reviews':
1723 1723
 								comments_template();
@@ -1726,7 +1726,7 @@  discard block
 block discarded – undo
1726 1726
 								echo $related_listing;
1727 1727
 								break;
1728 1728
 							default: {
1729
-								if ( ( isset( $post->{$tab_index} ) || ( ! isset( $post->{$tab_index} ) && ( strpos( $tab_index, 'gd_tab_' ) !== false || $tab_index == 'link_business' ) ) ) && ! empty( $detail_page_tab['tab_content'] ) ) {
1729
+								if ((isset($post->{$tab_index} ) || (!isset($post->{$tab_index} ) && (strpos($tab_index, 'gd_tab_') !== false || $tab_index == 'link_business'))) && !empty($detail_page_tab['tab_content'])) {
1730 1730
 									echo $detail_page_tab['tab_content'];
1731 1731
 								}
1732 1732
 							}
@@ -1738,7 +1738,7 @@  discard block
 block discarded – undo
1738 1738
 						 *
1739 1739
 						 * @since 1.0.0
1740 1740
 						 */
1741
-						do_action( 'geodir_after_tab_content', $tab_index );
1741
+						do_action('geodir_after_tab_content', $tab_index);
1742 1742
 
1743 1743
 						/**
1744 1744
 						 * Called after the details tab content is output per tab.
@@ -1748,7 +1748,7 @@  discard block
 block discarded – undo
1748 1748
 						 * @since 1.0.0
1749 1749
 						 * @todo  do we need this if we have the hook above? 'geodir_after_tab_content'
1750 1750
 						 */
1751
-						do_action( 'geodir_after_' . $tab_index . '_tab_content' );
1751
+						do_action('geodir_after_'.$tab_index.'_tab_content');
1752 1752
 						?> </li>
1753 1753
 					<?php
1754 1754
 					/**
@@ -1756,7 +1756,7 @@  discard block
 block discarded – undo
1756 1756
 					 *
1757 1757
 					 * @since 1.0.0
1758 1758
 					 */
1759
-					$arr_detail_page_tabs[ $tab_index ]['tab_content'] = apply_filters( "geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean() );
1759
+					$arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_".$detail_page_tab['tab_content']."_tab_content", ob_get_clean());
1760 1760
 				} // end of if for is_display
1761 1761
 			}// end of foreach
1762 1762
 
@@ -1766,14 +1766,14 @@  discard block
 block discarded – undo
1766 1766
 			 * @since 1.0.0
1767 1767
 			 * @see   'geodir_before_tab_list'
1768 1768
 			 */
1769
-			do_action( 'geodir_after_tab_list' );
1769
+			do_action('geodir_after_tab_list');
1770 1770
 			?>
1771
-			<?php if ( ! $tab_list ){ ?></dl><?php } ?>
1772
-		<ul class="geodir-tabs-content entry-content <?php if ( $tab_list ) { ?>geodir-tabs-list<?php } ?>"
1771
+			<?php if (!$tab_list) { ?></dl><?php } ?>
1772
+		<ul class="geodir-tabs-content entry-content <?php if ($tab_list) { ?>geodir-tabs-list<?php } ?>"
1773 1773
 		    style="position:relative;">
1774 1774
 			<?php
1775
-			foreach ( $arr_detail_page_tabs as $detail_page_tab ) {
1776
-				if ( $detail_page_tab['is_display'] && ! empty( $detail_page_tab['tab_content'] ) ) {
1775
+			foreach ($arr_detail_page_tabs as $detail_page_tab) {
1776
+				if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
1777 1777
 					echo $detail_page_tab['tab_content'];
1778 1778
 				}// end of if
1779 1779
 			}// end of foreach
@@ -1783,11 +1783,11 @@  discard block
 block discarded – undo
1783 1783
 			 *
1784 1784
 			 * @since 1.0.0
1785 1785
 			 */
1786
-			do_action( 'geodir_add_tab_content' ); ?>
1786
+			do_action('geodir_add_tab_content'); ?>
1787 1787
 		</ul>
1788 1788
 		<!--gd-tabs-content ul end-->
1789 1789
 	</div>
1790
-	<?php if ( ! $tab_list ) { ?>
1790
+	<?php if (!$tab_list) { ?>
1791 1791
 		<script>
1792 1792
 			if (window.location.hash && window.location.hash.indexOf('&') === -1 && jQuery(window.location.hash + 'Tab').length) {
1793 1793
 				hashVal = window.location.hash;
@@ -1819,31 +1819,31 @@  discard block
 block discarded – undo
1819 1819
  *
1820 1820
  * @return mixed Image file.
1821 1821
  */
1822
-function geodir_exif( $file ) {
1823
-	if ( empty( $file ) || ! is_array( $file ) ) {
1822
+function geodir_exif($file) {
1823
+	if (empty($file) || !is_array($file)) {
1824 1824
 		return $file;
1825 1825
 	}
1826 1826
 
1827
-	$file_path = ! empty( $file['tmp_name'] ) ? sanitize_text_field( $file['tmp_name'] ) : '';
1828
-	if ( ! ( $file_path && file_exists( $file_path ) ) ) {
1827
+	$file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : '';
1828
+	if (!($file_path && file_exists($file_path))) {
1829 1829
 		return $file;
1830 1830
 	}
1831 1831
 	$file['file'] = $file_path;
1832 1832
 
1833
-	if ( ! file_is_valid_image( $file_path ) ) {
1833
+	if (!file_is_valid_image($file_path)) {
1834 1834
 		return $file; // Bail if file is not an image.
1835 1835
 	}
1836 1836
 
1837
-	if ( ! function_exists( 'wp_get_image_editor' ) ) {
1837
+	if (!function_exists('wp_get_image_editor')) {
1838 1838
 		return $file;
1839 1839
 	}
1840 1840
 
1841 1841
 	$mime_type = $file['type'];
1842 1842
 	$exif      = array();
1843
-	if ( $mime_type == 'image/jpeg' && function_exists( 'exif_read_data' ) ) {
1843
+	if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
1844 1844
 		try {
1845
-			$exif = exif_read_data( $file_path );
1846
-		} catch ( Exception $e ) {
1845
+			$exif = exif_read_data($file_path);
1846
+		} catch (Exception $e) {
1847 1847
 			$exif = array();
1848 1848
 		}
1849 1849
 	}
@@ -1852,13 +1852,13 @@  discard block
 block discarded – undo
1852 1852
 	$flip        = false;
1853 1853
 	$modify      = false;
1854 1854
 	$orientation = 0;
1855
-	if ( ! empty( $exif ) && isset( $exif['Orientation'] ) ) {
1856
-		switch ( (int) $exif['Orientation'] ) {
1855
+	if (!empty($exif) && isset($exif['Orientation'])) {
1856
+		switch ((int) $exif['Orientation']) {
1857 1857
 			case 1:
1858 1858
 				// do nothing
1859 1859
 				break;
1860 1860
 			case 2:
1861
-				$flip   = array( false, true );
1861
+				$flip   = array(false, true);
1862 1862
 				$modify = true;
1863 1863
 				break;
1864 1864
 			case 3:
@@ -1867,13 +1867,13 @@  discard block
 block discarded – undo
1867 1867
 				$modify      = true;
1868 1868
 				break;
1869 1869
 			case 4:
1870
-				$flip   = array( true, false );
1870
+				$flip   = array(true, false);
1871 1871
 				$modify = true;
1872 1872
 				break;
1873 1873
 			case 5:
1874 1874
 				$orientation = - 90;
1875 1875
 				$rotate      = true;
1876
-				$flip        = array( false, true );
1876
+				$flip        = array(false, true);
1877 1877
 				$modify      = true;
1878 1878
 				break;
1879 1879
 			case 6:
@@ -1884,7 +1884,7 @@  discard block
 block discarded – undo
1884 1884
 			case 7:
1885 1885
 				$orientation = - 270;
1886 1886
 				$rotate      = true;
1887
-				$flip        = array( false, true );
1887
+				$flip        = array(false, true);
1888 1888
 				$modify      = true;
1889 1889
 				break;
1890 1890
 			case 8:
@@ -1910,31 +1910,31 @@  discard block
 block discarded – undo
1910 1910
 	 * @param int|null $quality Image Compression quality between 1-100% scale. Default null.
1911 1911
 	 * @param string $quality   Image mime type.
1912 1912
 	 */
1913
-	$quality = apply_filters( 'geodir_image_upload_set_quality', $quality, $mime_type );
1914
-	if ( $quality !== null ) {
1913
+	$quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
1914
+	if ($quality !== null) {
1915 1915
 		$modify = true;
1916 1916
 	}
1917 1917
 
1918
-	if ( ! $modify ) {
1918
+	if (!$modify) {
1919 1919
 		return $file; // no change
1920 1920
 	}
1921 1921
 
1922
-	$image = wp_get_image_editor( $file_path );
1923
-	if ( ! is_wp_error( $image ) ) {
1924
-		if ( $rotate ) {
1925
-			$image->rotate( $orientation );
1922
+	$image = wp_get_image_editor($file_path);
1923
+	if (!is_wp_error($image)) {
1924
+		if ($rotate) {
1925
+			$image->rotate($orientation);
1926 1926
 		}
1927 1927
 
1928
-		if ( ! empty( $flip ) ) {
1929
-			$image->flip( $flip[0], $flip[1] );
1928
+		if (!empty($flip)) {
1929
+			$image->flip($flip[0], $flip[1]);
1930 1930
 		}
1931 1931
 
1932
-		if ( $quality !== null ) {
1933
-			$image->set_quality( (int) $quality );
1932
+		if ($quality !== null) {
1933
+			$image->set_quality((int) $quality);
1934 1934
 		}
1935 1935
 
1936
-		$result = $image->save( $file_path );
1937
-		if ( ! is_wp_error( $result ) ) {
1936
+		$result = $image->save($file_path);
1937
+		if (!is_wp_error($result)) {
1938 1938
 			$file['file']     = $result['path'];
1939 1939
 			$file['tmp_name'] = $result['path'];
1940 1940
 		}
@@ -1961,7 +1961,7 @@  discard block
 block discarded – undo
1961 1961
  *
1962 1962
  * @return string Returns the recent reviews html.
1963 1963
  */
1964
-function geodir_get_recent_reviews( $g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false ) {
1964
+function geodir_get_recent_reviews($g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false) {
1965 1965
 	global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session;
1966 1966
 	$tablecomments = $wpdb->comments;
1967 1967
 	$tableposts    = $wpdb->posts;
@@ -1971,28 +1971,28 @@  discard block
 block discarded – undo
1971 1971
 	$region_filter  = '';
1972 1972
 	$country_filter = '';
1973 1973
 
1974
-	if ( $gd_session->get( 'gd_multi_location' ) ) {
1975
-		if ( $gd_ses_country = $gd_session->get( 'gd_country' ) ) {
1976
-			$country_filter = $wpdb->prepare( " AND r.post_country=%s ", str_replace( "-", " ", $gd_ses_country ) );
1974
+	if ($gd_session->get('gd_multi_location')) {
1975
+		if ($gd_ses_country = $gd_session->get('gd_country')) {
1976
+			$country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
1977 1977
 		}
1978 1978
 
1979
-		if ( $gd_ses_region = $gd_session->get( 'gd_region' ) ) {
1980
-			$region_filter = $wpdb->prepare( " AND r.post_region=%s ", str_replace( "-", " ", $gd_ses_region ) );
1979
+		if ($gd_ses_region = $gd_session->get('gd_region')) {
1980
+			$region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
1981 1981
 		}
1982 1982
 
1983
-		if ( $gd_ses_city = $gd_session->get( 'gd_city' ) ) {
1984
-			$city_filter = $wpdb->prepare( " AND r.post_city=%s ", str_replace( "-", " ", $gd_ses_city ) );
1983
+		if ($gd_ses_city = $gd_session->get('gd_city')) {
1984
+			$city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
1985 1985
 		}
1986 1986
 	}
1987 1987
 
1988 1988
 	$review_table = GEODIR_REVIEW_TABLE;
1989 1989
 	$request      = "SELECT r.id as ID, r.post_type, r.comment_id as comment_ID, r.post_date as comment_date,r.overall_rating, r.user_id, r.post_id FROM $review_table as r WHERE r.post_status = 1 AND r.status =1 AND r.overall_rating>=1 $country_filter $region_filter $city_filter ORDER BY r.post_date DESC, r.id DESC LIMIT $no_comments";
1990 1990
 
1991
-	$comments = $wpdb->get_results( $request );
1991
+	$comments = $wpdb->get_results($request);
1992 1992
 
1993
-	foreach ( $comments as $comment ) {
1993
+	foreach ($comments as $comment) {
1994 1994
 		// Set the extra comment info needed.
1995
-		$comment_extra = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID" );
1995
+		$comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
1996 1996
 		//echo "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID";
1997 1997
 		$comment->comment_content      = $comment_extra->comment_content;
1998 1998
 		$comment->comment_author       = $comment_extra->comment_author;
@@ -2000,75 +2000,75 @@  discard block
 block discarded – undo
2000 2000
 
2001 2001
 		$comment_id      = '';
2002 2002
 		$comment_id      = $comment->comment_ID;
2003
-		$comment_content = strip_tags( $comment->comment_content );
2003
+		$comment_content = strip_tags($comment->comment_content);
2004 2004
 
2005
-		$comment_content = preg_replace( '#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content );
2005
+		$comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
2006 2006
 
2007
-		$permalink            = get_permalink( $comment->ID ) . "#comment-" . $comment->comment_ID;
2007
+		$permalink            = get_permalink($comment->ID)."#comment-".$comment->comment_ID;
2008 2008
 		$comment_author_email = $comment->comment_author_email;
2009 2009
 		$comment_post_ID      = $comment->post_id;
2010 2010
 
2011 2011
 		$na = true;
2012
-		if ( function_exists( 'icl_object_id' ) && icl_object_id( $comment_post_ID, $comment->post_type, true ) ) {
2013
-			$comment_post_ID2 = icl_object_id( $comment_post_ID, $comment->post_type, false );
2014
-			if ( $comment_post_ID == $comment_post_ID2 ) {
2012
+		if (function_exists('icl_object_id') && icl_object_id($comment_post_ID, $comment->post_type, true)) {
2013
+			$comment_post_ID2 = icl_object_id($comment_post_ID, $comment->post_type, false);
2014
+			if ($comment_post_ID == $comment_post_ID2) {
2015 2015
 			} else {
2016 2016
 				$na = false;
2017 2017
 			}
2018 2018
 		}
2019 2019
 
2020
-		$post_title        = get_the_title( $comment_post_ID );
2021
-		$permalink         = get_permalink( $comment_post_ID );
2022
-		$comment_permalink = $permalink . "#comment-" . $comment->comment_ID;
2023
-		$read_more         = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __( 'Read more', 'geodirectory' ) . '</a>';
2020
+		$post_title        = get_the_title($comment_post_ID);
2021
+		$permalink         = get_permalink($comment_post_ID);
2022
+		$comment_permalink = $permalink."#comment-".$comment->comment_ID;
2023
+		$read_more         = '<a class="comment_excerpt" href="'.$comment_permalink.'">'.__('Read more', 'geodirectory').'</a>';
2024 2024
 
2025
-		$comment_content_length = strlen( $comment_content );
2026
-		if ( $comment_content_length > $comment_lenth ) {
2027
-			$comment_excerpt = mb_substr( $comment_content, 0, $comment_lenth ) . '... ' . $read_more;
2025
+		$comment_content_length = strlen($comment_content);
2026
+		if ($comment_content_length > $comment_lenth) {
2027
+			$comment_excerpt = mb_substr($comment_content, 0, $comment_lenth).'... '.$read_more;
2028 2028
 		} else {
2029 2029
 			$comment_excerpt = $comment_content;
2030 2030
 		}
2031 2031
 
2032
-		if ( $comment->user_id ) {
2033
-			$user_profile_url = get_author_posts_url( $comment->user_id );
2032
+		if ($comment->user_id) {
2033
+			$user_profile_url = get_author_posts_url($comment->user_id);
2034 2034
 		} else {
2035 2035
 			$user_profile_url = '';
2036 2036
 		}
2037 2037
 
2038
-		if ( $comment_id && $na ) {
2038
+		if ($comment_id && $na) {
2039 2039
 			$comments_echo .= '<li class="clearfix">';
2040
-			$comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">";
2041
-			if ( function_exists( 'get_avatar' ) ) {
2042
-				if ( ! isset( $comment->comment_type ) ) {
2043
-					if ( $user_profile_url ) {
2044
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2040
+			$comments_echo .= "<span class=\"li".$comment_id." geodir_reviewer_image\">";
2041
+			if (function_exists('get_avatar')) {
2042
+				if (!isset($comment->comment_type)) {
2043
+					if ($user_profile_url) {
2044
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2045 2045
 					}
2046
-					$comments_echo .= get_avatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2047
-					if ( $user_profile_url ) {
2046
+					$comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2047
+					if ($user_profile_url) {
2048 2048
 						$comments_echo .= '</a>';
2049 2049
 					}
2050
-				} elseif ( ( isset( $comment->comment_type ) && $comment->comment_type == 'trackback' ) || ( isset( $comment->comment_type ) && $comment->comment_type == 'pingback' ) ) {
2051
-					if ( $user_profile_url ) {
2052
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2050
+				} elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
2051
+					if ($user_profile_url) {
2052
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2053 2053
 					}
2054
-					$comments_echo .= get_avatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2054
+					$comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2055 2055
 				}
2056
-			} elseif ( function_exists( 'gravatar' ) ) {
2057
-				if ( $user_profile_url ) {
2058
-					$comments_echo .= '<a href="' . $user_profile_url . '">';
2056
+			} elseif (function_exists('gravatar')) {
2057
+				if ($user_profile_url) {
2058
+					$comments_echo .= '<a href="'.$user_profile_url.'">';
2059 2059
 				}
2060 2060
 				$comments_echo .= "<img src=\"";
2061
-				if ( '' == $comment->comment_type ) {
2062
-					$comments_echo .= gravatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2063
-					if ( $user_profile_url ) {
2061
+				if ('' == $comment->comment_type) {
2062
+					$comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2063
+					if ($user_profile_url) {
2064 2064
 						$comments_echo .= '</a>';
2065 2065
 					}
2066
-				} elseif ( ( 'trackback' == $comment->comment_type ) || ( 'pingback' == $comment->comment_type ) ) {
2067
-					if ( $user_profile_url ) {
2068
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2066
+				} elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
2067
+					if ($user_profile_url) {
2068
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2069 2069
 					}
2070
-					$comments_echo .= gravatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2071
-					if ( $user_profile_url ) {
2070
+					$comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2071
+					if ($user_profile_url) {
2072 2072
 						$comments_echo .= '</a>';
2073 2073
 					}
2074 2074
 				}
@@ -2078,17 +2078,17 @@  discard block
 block discarded – undo
2078 2078
 			$comments_echo .= "</span>\n";
2079 2079
 
2080 2080
 			$comments_echo .= '<span class="geodir_reviewer_content">';
2081
-			if ( $comment->user_id ) {
2082
-				$comments_echo .= '<a href="' . get_author_posts_url( $comment->user_id ) . '">';
2081
+			if ($comment->user_id) {
2082
+				$comments_echo .= '<a href="'.get_author_posts_url($comment->user_id).'">';
2083 2083
 			}
2084
-			$comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> ';
2085
-			if ( $comment->user_id ) {
2084
+			$comments_echo .= '<span class="geodir_reviewer_author">'.$comment->comment_author.'</span> ';
2085
+			if ($comment->user_id) {
2086 2086
 				$comments_echo .= '</a>';
2087 2087
 			}
2088
-			$comments_echo .= '<span class="geodir_reviewer_reviewed">' . __( 'reviewed', 'geodirectory' ) . '</span> ';
2089
-			$comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>';
2090
-			$comments_echo .= geodir_get_rating_stars( $comment->overall_rating, $comment_post_ID );
2091
-			$comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . '';
2088
+			$comments_echo .= '<span class="geodir_reviewer_reviewed">'.__('reviewed', 'geodirectory').'</span> ';
2089
+			$comments_echo .= '<a href="'.$permalink.'" class="geodir_reviewer_title">'.$post_title.'</a>';
2090
+			$comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID);
2091
+			$comments_echo .= '<p class="geodir_reviewer_text">'.$comment_excerpt.'';
2092 2092
 			//echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
2093 2093
 			$comments_echo .= '</p>';
2094 2094
 
@@ -2108,25 +2108,25 @@  discard block
 block discarded – undo
2108 2108
  * @return array Returns post categories as an array.
2109 2109
  */
2110 2110
 function geodir_home_map_cats_key_value_array() {
2111
-	$post_types = geodir_get_posttypes( 'object' );
2111
+	$post_types = geodir_get_posttypes('object');
2112 2112
 
2113 2113
 	$return = array();
2114
-	if ( ! empty( $post_types ) ) {
2115
-		foreach ( $post_types as $key => $post_type ) {
2116
-			$cpt_name       = __( $post_type->labels->singular_name, 'geodirectory' );
2117
-			$post_type_name = sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name );
2118
-			$taxonomies     = geodir_get_taxonomies( $key );
2119
-			$cat_taxonomy   = ! empty( $taxonomies[0] ) ? $taxonomies[0] : null;
2120
-			$cat_terms      = $cat_taxonomy ? get_terms( $cat_taxonomy ) : null;
2121
-
2122
-			if ( ! empty( $cat_terms ) ) {
2123
-				$return[ 'optgroup_start-' . $key ] = $post_type_name;
2124
-
2125
-				foreach ( $cat_terms as $cat_term ) {
2126
-					$return[ $key . '_' . $cat_term->term_id ] = $cat_term->name;
2114
+	if (!empty($post_types)) {
2115
+		foreach ($post_types as $key => $post_type) {
2116
+			$cpt_name       = __($post_type->labels->singular_name, 'geodirectory');
2117
+			$post_type_name = sprintf(__('%s Categories', 'geodirectory'), $cpt_name);
2118
+			$taxonomies     = geodir_get_taxonomies($key);
2119
+			$cat_taxonomy   = !empty($taxonomies[0]) ? $taxonomies[0] : null;
2120
+			$cat_terms      = $cat_taxonomy ? get_terms($cat_taxonomy) : null;
2121
+
2122
+			if (!empty($cat_terms)) {
2123
+				$return['optgroup_start-'.$key] = $post_type_name;
2124
+
2125
+				foreach ($cat_terms as $cat_term) {
2126
+					$return[$key.'_'.$cat_term->term_id] = $cat_term->name;
2127 2127
 				}
2128 2128
 
2129
-				$return[ 'optgroup_end-' . $key ] = $post_type_name;
2129
+				$return['optgroup_end-'.$key] = $post_type_name;
2130 2130
 			}
2131 2131
 		}
2132 2132
 	}
@@ -2142,14 +2142,14 @@  discard block
 block discarded – undo
2142 2142
  * @package GeoDirectory
2143 2143
  */
2144 2144
 function geodir_twitter_tweet_button() {
2145
-	if ( isset( $_GET['gde'] ) ) {
2146
-		$link = '?url=' . urlencode( geodir_curPageURL() );
2145
+	if (isset($_GET['gde'])) {
2146
+		$link = '?url='.urlencode(geodir_curPageURL());
2147 2147
 	} else {
2148 2148
 		$link = '';
2149 2149
 	}
2150 2150
 	?>
2151 2151
 	<a href="http://twitter.com/share<?php echo $link; ?>"
2152
-	   class="twitter-share-button"><?php _e( 'Tweet', 'geodirectory' ); ?></a>
2152
+	   class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
2153 2153
 	<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
2154 2154
 	<?php
2155 2155
 }
@@ -2166,10 +2166,10 @@  discard block
 block discarded – undo
2166 2166
 function geodir_fb_like_button() {
2167 2167
 	global $post;
2168 2168
 	?>
2169
-	<iframe <?php if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) ) {
2169
+	<iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
2170 2170
 		echo 'allowtransparency="true"';
2171 2171
 	} ?> class="facebook"
2172
-	     src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode( get_permalink( $post->ID ) ); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
2172
+	     src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
2173 2173
 	     style="border:none; overflow:hidden; width:100px; height:20px"></iframe>
2174 2174
 	<?php
2175 2175
 }
@@ -2200,7 +2200,7 @@  discard block
 block discarded – undo
2200 2200
 
2201 2201
 
2202 2202
 function geodir_listing_bounce_map_pin_on_hover() {
2203
-	if ( get_option( 'geodir_listing_hover_bounce_map_pin', true ) ) {
2203
+	if (get_option('geodir_listing_hover_bounce_map_pin', true)) {
2204 2204
 		?>
2205 2205
 		<script>
2206 2206
 			jQuery(function ($) {
@@ -2223,44 +2223,44 @@  discard block
 block discarded – undo
2223 2223
 	}
2224 2224
 }
2225 2225
 
2226
-add_action( 'geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10 );
2226
+add_action('geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10);
2227 2227
 
2228
-add_action( 'geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1 );
2229
-function geodir_output_favourite_html_listings( $post_id ) {
2230
-	geodir_favourite_html( '', $post_id );
2228
+add_action('geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1);
2229
+function geodir_output_favourite_html_listings($post_id) {
2230
+	geodir_favourite_html('', $post_id);
2231 2231
 }
2232 2232
 
2233
-add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2 );
2234
-function geodir_output_pinpoint_html_listings( $post_id, $post ) {
2233
+add_action('geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2);
2234
+function geodir_output_pinpoint_html_listings($post_id, $post) {
2235 2235
 	global $wp_query;
2236 2236
 
2237 2237
 	$show_pin_point = $wp_query->is_main_query();
2238 2238
 
2239
-	if ( ! empty( $show_pin_point ) && is_active_widget( false, "", "geodir_map_v3_listing_map" ) ) {
2240
-		$term_icon_url = get_tax_meta( $post->default_category, 'ct_cat_icon', false, $post->post_type );
2241
-		$marker_icon   = isset( $term_icon_url['src'] ) ? $term_icon_url['src'] : get_option( 'geodir_default_marker_icon' );
2239
+	if (!empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
2240
+		$term_icon_url = get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type);
2241
+		$marker_icon   = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
2242 2242
 		?>
2243 2243
 		<span class="geodir-pinpoint"
2244
-		      style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters( 'geodir_listing_listview_pinpoint_inner_content', '', 'listing' ); ?></span>
2244
+		      style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters('geodir_listing_listview_pinpoint_inner_content', '', 'listing'); ?></span>
2245 2245
 		<a class="geodir-pinpoint-link" href="javascript:void(0)"
2246 2246
 		   onclick="openMarker('listing_map_canvas' ,'<?php echo $post->ID; ?>')"
2247 2247
 		   onmouseover="animate_marker('listing_map_canvas' ,'<?php echo $post->ID; ?>')"
2248
-		   onmouseout="stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')"><?php _e( 'Pinpoint', 'geodirectory' ); ?></a>
2248
+		   onmouseout="stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')"><?php _e('Pinpoint', 'geodirectory'); ?></a>
2249 2249
 		<?php
2250 2250
 	}
2251 2251
 }
2252 2252
 
2253 2253
 function geodir_search_form_submit_button() {
2254 2254
 
2255
-	$new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true;
2255
+	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2256 2256
 
2257
-	if ( $new_style ) {
2257
+	if ($new_style) {
2258 2258
 		$default_search_button_label = '<i class="fa fa-search" aria-hidden="true"></i>';
2259
-	}else{
2259
+	} else {
2260 2260
 		$default_search_button_label = 'Search';
2261 2261
 	}
2262
-	if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) {
2263
-		$default_search_button_label = __( get_option( 'geodir_search_button_label' ), 'geodirectory' );
2262
+	if (get_option('geodir_search_button_label') && get_option('geodir_search_button_label') != 'Search') {
2263
+		$default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
2264 2264
 	}
2265 2265
 
2266 2266
 	/**
@@ -2272,78 +2272,78 @@  discard block
 block discarded – undo
2272 2272
 	 *
2273 2273
 	 * @param string $default_search_button_label The current search button text.
2274 2274
 	 */
2275
-	$default_search_button_label = apply_filters( 'geodir_search_default_search_button_text', $default_search_button_label );
2275
+	$default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);
2276 2276
 
2277 2277
 	$fa_class = '';
2278
-	if ( strpos( $default_search_button_label, '&#' ) !== false ) {
2278
+	if (strpos($default_search_button_label, '&#') !== false) {
2279 2279
 		$fa_class = 'fa';
2280 2280
 	}
2281 2281
 
2282 2282
 
2283
-	if ( $new_style ) {
2283
+	if ($new_style) {
2284 2284
 	?>
2285
-		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e( $default_search_button_label ,'geodirectory'); ?></button>
2286
-<?php }else{?>
2287
-		<input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>"
2285
+		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e($default_search_button_label, 'geodirectory'); ?></button>
2286
+<?php } else {?>
2287
+		<input type="button" value="<?php esc_attr_e($default_search_button_label); ?>"
2288 2288
 	       class="geodir_submit_search <?php echo $fa_class; ?>"/>
2289 2289
 	<?php }
2290 2290
 }
2291 2291
 
2292
-add_action( 'geodir_before_search_button', 'geodir_search_form_submit_button', 5000 );
2292
+add_action('geodir_before_search_button', 'geodir_search_form_submit_button', 5000);
2293 2293
 
2294 2294
 function geodir_search_form_post_type_input() {
2295 2295
 	global $geodir_search_post_type;
2296
-	$post_types     = apply_filters( 'geodir_search_form_post_types', geodir_get_posttypes( 'object' ) );
2296
+	$post_types     = apply_filters('geodir_search_form_post_types', geodir_get_posttypes('object'));
2297 2297
 	$curr_post_type = $geodir_search_post_type;
2298 2298
 
2299
-	if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2299
+	if (!empty($post_types) && count((array) $post_types) > 1) {
2300 2300
 
2301
-		foreach ( $post_types as $post_type => $info ){
2301
+		foreach ($post_types as $post_type => $info) {
2302 2302
 			global $wpdb;
2303
-			$has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
2304
-			if ( ! $has_posts ) {
2303
+			$has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
2304
+			if (!$has_posts) {
2305 2305
 				unset($post_types->{$post_type});
2306 2306
 			}
2307 2307
 		}
2308 2308
 
2309
-		if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2309
+		if (!empty($post_types) && count((array) $post_types) > 1) {
2310 2310
 
2311
-			$new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true;
2312
-			if ( $new_style ) {
2311
+			$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2312
+			if ($new_style) {
2313 2313
 				echo "<div class='gd-search-input-wrapper gd-search-field-cpt'>";
2314 2314
 			}
2315 2315
 			?>
2316 2316
 			<select name="stype" class="search_by_post">
2317
-				<?php foreach ( $post_types as $post_type => $info ):
2317
+				<?php foreach ($post_types as $post_type => $info):
2318 2318
 					global $wpdb;
2319 2319
 					?>
2320 2320
 
2321
-					<option data-label="<?php echo get_post_type_archive_link( $post_type ); ?>"
2322
-					        value="<?php echo $post_type; ?>" <?php if ( isset( $_REQUEST['stype'] ) ) {
2323
-						if ( $post_type == $_REQUEST['stype'] ) {
2321
+					<option data-label="<?php echo get_post_type_archive_link($post_type); ?>"
2322
+					        value="<?php echo $post_type; ?>" <?php if (isset($_REQUEST['stype'])) {
2323
+						if ($post_type == $_REQUEST['stype']) {
2324 2324
 							echo 'selected="selected"';
2325 2325
 						}
2326
-					} elseif ( $curr_post_type == $post_type ) {
2326
+					} elseif ($curr_post_type == $post_type) {
2327 2327
 						echo 'selected="selected"';
2328
-					} ?>><?php _e( ucfirst( $info->labels->name ), 'geodirectory' ); ?></option>
2328
+					} ?>><?php _e(ucfirst($info->labels->name), 'geodirectory'); ?></option>
2329 2329
 
2330 2330
 				<?php endforeach; ?>
2331 2331
 			</select>
2332 2332
 			<?php
2333
-			if ( $new_style ) {
2333
+			if ($new_style) {
2334 2334
 				echo "</div>";
2335 2335
 			}
2336
-		}else{
2337
-			if(! empty( $post_types )){
2338
-				$pt_arr = (array)$post_types;
2339
-				echo '<input type="hidden" name="stype" value="' . key( $pt_arr  ) . '"  />';
2340
-			}else{
2336
+		} else {
2337
+			if (!empty($post_types)) {
2338
+				$pt_arr = (array) $post_types;
2339
+				echo '<input type="hidden" name="stype" value="'.key($pt_arr).'"  />';
2340
+			} else {
2341 2341
 				echo '<input type="hidden" name="stype" value="gd_place"  />';
2342 2342
 			}
2343 2343
 
2344 2344
 		}
2345 2345
 
2346
-	}elseif ( ! empty( $post_types ) ) {
2346
+	}elseif (!empty($post_types)) {
2347 2347
 		echo '<input type="hidden" name="stype" value="gd_place"  />';
2348 2348
 	}
2349 2349
 }
@@ -2351,26 +2351,26 @@  discard block
 block discarded – undo
2351 2351
 function geodir_search_form_search_input() {
2352 2352
 
2353 2353
 	$default_search_for_text = SEARCH_FOR_TEXT;
2354
-	if ( get_option( 'geodir_search_field_default_text' ) ) {
2355
-		$default_search_for_text = __( get_option( 'geodir_search_field_default_text' ), 'geodirectory' );
2354
+	if (get_option('geodir_search_field_default_text')) {
2355
+		$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
2356 2356
 	}
2357 2357
 
2358 2358
 	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2359
-	if($new_style){
2359
+	if ($new_style) {
2360 2360
 		echo "<div class='gd-search-input-wrapper gd-search-field-search'>";
2361 2361
 	}
2362 2362
 	?>
2363 2363
 	<input class="search_text" name="s"
2364
-	       value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) {
2365
-		       echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2364
+	       value="<?php if (isset($_REQUEST['s']) && trim($_REQUEST['s']) != '') {
2365
+		       echo esc_attr(stripslashes_deep($_REQUEST['s']));
2366 2366
 	       } else {
2367 2367
 		       echo $default_search_for_text;
2368 2368
 	       } ?>" type="text"
2369
-	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}"
2370
-	       onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}"
2369
+	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql($default_search_for_text); ?>';}"
2370
+	       onfocus="if (this.value == '<?php echo esc_sql($default_search_for_text); ?>') {this.value = '';}"
2371 2371
 	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);">
2372 2372
 	<?php
2373
-	if($new_style){
2373
+	if ($new_style) {
2374 2374
 		echo "</div>";
2375 2375
 	}
2376 2376
 }
@@ -2378,12 +2378,12 @@  discard block
 block discarded – undo
2378 2378
 function geodir_search_form_near_input() {
2379 2379
 
2380 2380
 	$default_near_text = NEAR_TEXT;
2381
-	if ( get_option( 'geodir_near_field_default_text' ) ) {
2382
-		$default_near_text = __( get_option( 'geodir_near_field_default_text' ), 'geodirectory' );
2381
+	if (get_option('geodir_near_field_default_text')) {
2382
+		$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
2383 2383
 	}
2384 2384
 
2385
-	if ( isset( $_REQUEST['snear'] ) && $_REQUEST['snear'] != '' ) {
2386
-		$near = esc_attr( stripslashes_deep( $_REQUEST['snear'] ) );
2385
+	if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') {
2386
+		$near = esc_attr(stripslashes_deep($_REQUEST['snear']));
2387 2387
 	} else {
2388 2388
 		$near = $default_near_text;
2389 2389
 	}
@@ -2397,7 +2397,7 @@  discard block
 block discarded – undo
2397 2397
 	 * @since 1.6.9
2398 2398
 	 * @param string $curr_post_type The current post type.
2399 2399
 	 */
2400
-	$near_input_extra = apply_filters('geodir_near_input_extra','',$curr_post_type);
2400
+	$near_input_extra = apply_filters('geodir_near_input_extra', '', $curr_post_type);
2401 2401
 
2402 2402
 
2403 2403
 	/**
@@ -2410,7 +2410,7 @@  discard block
 block discarded – undo
2410 2410
 	 * @param string $near              The current near value.
2411 2411
 	 * @param string $default_near_text The default near value.
2412 2412
 	 */
2413
-	$near = apply_filters( 'geodir_search_near_text', $near, $default_near_text );
2413
+	$near = apply_filters('geodir_search_near_text', $near, $default_near_text);
2414 2414
 	/**
2415 2415
 	 * Filter the default "Near" text value for the search form.
2416 2416
 	 *
@@ -2421,7 +2421,7 @@  discard block
 block discarded – undo
2421 2421
 	 * @param string $near              The current near value.
2422 2422
 	 * @param string $default_near_text The default near value.
2423 2423
 	 */
2424
-	$default_near_text = apply_filters( 'geodir_search_default_near_text', $default_near_text, $near );
2424
+	$default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near);
2425 2425
 	/**
2426 2426
 	 * Filter the class for the near search input.
2427 2427
 	 *
@@ -2429,10 +2429,10 @@  discard block
 block discarded – undo
2429 2429
 	 *
2430 2430
 	 * @param string $class The class for the HTML near input, default is blank.
2431 2431
 	 */
2432
-	$near_class = apply_filters( 'geodir_search_near_class', '' );
2432
+	$near_class = apply_filters('geodir_search_near_class', '');
2433 2433
 
2434 2434
 	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2435
-	if($new_style){
2435
+	if ($new_style) {
2436 2436
 		echo "<div class='gd-search-input-wrapper gd-search-field-near' $near_input_extra>";
2437 2437
 		
2438 2438
 		do_action('geodir_before_near_input');
@@ -2440,30 +2440,30 @@  discard block
 block discarded – undo
2440 2440
 
2441 2441
 	?>
2442 2442
 	<input name="snear" class="snear <?php echo $near_class; ?>" type="text" value="<?php echo $near; ?>"
2443
-	       onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql( $near ); ?>' != '' ? '<?php echo esc_sql( $near ); ?>' : '<?php echo $default_near_text; ?>');}"
2444
-	       onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql( $near ); ?>') {this.value = '';}"
2445
-	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra;?>/>
2443
+	       onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql($near); ?>' != '' ? '<?php echo esc_sql($near); ?>' : '<?php echo $default_near_text; ?>');}"
2444
+	       onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql($near); ?>') {this.value = '';}"
2445
+	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra; ?>/>
2446 2446
 	<?php
2447
-	if($new_style){
2447
+	if ($new_style) {
2448 2448
 		do_action('geodir_after_near_input');
2449 2449
 
2450 2450
 		echo "</div>";
2451 2451
 	}
2452 2452
 }
2453 2453
 
2454
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10 );
2455
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_search_input', 20 );
2456
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_near_input', 30 );
2454
+add_action('geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10);
2455
+add_action('geodir_search_form_inputs', 'geodir_search_form_search_input', 20);
2456
+add_action('geodir_search_form_inputs', 'geodir_search_form_near_input', 30);
2457 2457
 
2458
-function geodir_get_search_post_type($pt=''){
2458
+function geodir_get_search_post_type($pt = '') {
2459 2459
 	global $geodir_search_post_type;
2460 2460
 
2461
-	if($pt!=''){return $geodir_search_post_type = $pt;}
2462
-	if(!empty($geodir_search_post_type)){ return $geodir_search_post_type;}
2461
+	if ($pt != '') {return $geodir_search_post_type = $pt; }
2462
+	if (!empty($geodir_search_post_type)) { return $geodir_search_post_type; }
2463 2463
 
2464 2464
 	$geodir_search_post_type = geodir_get_current_posttype();
2465 2465
 
2466
-	if(!$geodir_search_post_type) {
2466
+	if (!$geodir_search_post_type) {
2467 2467
 		$geodir_search_post_type = geodir_get_default_posttype();
2468 2468
 	}
2469 2469
 
@@ -2471,7 +2471,7 @@  discard block
 block discarded – undo
2471 2471
 	return $geodir_search_post_type;
2472 2472
 }
2473 2473
 
2474
-function geodir_search_form(){
2474
+function geodir_search_form() {
2475 2475
 
2476 2476
 	geodir_get_search_post_type();
2477 2477
 
@@ -2481,8 +2481,8 @@  discard block
 block discarded – undo
2481 2481
 	die();
2482 2482
 }
2483 2483
 
2484
-add_action( 'wp_ajax_geodir_search_form', 'geodir_search_form' );
2485
-add_action( 'wp_ajax_nopriv_geodir_search_form', 'geodir_search_form' );
2484
+add_action('wp_ajax_geodir_search_form', 'geodir_search_form');
2485
+add_action('wp_ajax_nopriv_geodir_search_form', 'geodir_search_form');
2486 2486
 
2487 2487
 /**
2488 2488
  * Check wpml active or not.
@@ -2553,7 +2553,7 @@  discard block
 block discarded – undo
2553 2553
         }
2554 2554
     }
2555 2555
 }
2556
-add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 );
2556
+add_filter('icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4);
2557 2557
 
2558 2558
 /**
2559 2559
  * Duplicate post listing manually after listing saved.
@@ -2591,7 +2591,7 @@  discard block
 block discarded – undo
2591 2591
 function geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang) {
2592 2592
     global $wpdb;
2593 2593
 
2594
-    $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2594
+    $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM ".GEODIR_REVIEW_TABLE." WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2595 2595
 
2596 2596
     if (!empty($reviews)) {
2597 2597
         foreach ($reviews as $review) {
@@ -2619,14 +2619,14 @@  discard block
 block discarded – undo
2619 2619
     global $wpdb, $plugin_prefix;
2620 2620
 
2621 2621
     $post_type = get_post_type($master_post_id);
2622
-    $post_table = $plugin_prefix . $post_type . '_detail';
2622
+    $post_table = $plugin_prefix.$post_type.'_detail';
2623 2623
 
2624
-    $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
2625
-    $data = (array)$wpdb->get_row($query);
2624
+    $query = $wpdb->prepare("SELECT * FROM ".$post_table." WHERE post_id = %d", array($master_post_id));
2625
+    $data = (array) $wpdb->get_row($query);
2626 2626
 
2627
-    if ( !empty( $data ) ) {
2627
+    if (!empty($data)) {
2628 2628
         $data['post_id'] = $tr_post_id;
2629
-        unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category']);
2629
+        unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type.'category']);
2630 2630
         $wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
2631 2631
         return true;
2632 2632
     }
@@ -2651,7 +2651,7 @@  discard block
 block discarded – undo
2651 2651
     global $sitepress, $wpdb;
2652 2652
     $post_type = get_post_type($master_post_id);
2653 2653
 
2654
-    remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
2654
+    remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language
2655 2655
 
2656 2656
     $taxonomies = get_object_taxonomies($post_type);
2657 2657
     foreach ($taxonomies as $taxonomy) {
@@ -2660,9 +2660,9 @@  discard block
 block discarded – undo
2660 2660
         
2661 2661
         if ($terms) {
2662 2662
             foreach ($terms as $term) {
2663
-                $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
2663
+                $tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang);
2664 2664
                 
2665
-                if (!is_null($tr_id)){
2665
+                if (!is_null($tr_id)) {
2666 2666
                     // not using get_term - unfiltered get_term
2667 2667
                     $translated_term = $wpdb->get_row($wpdb->prepare("
2668 2668
                         SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
@@ -2671,14 +2671,14 @@  discard block
 block discarded – undo
2671 2671
                 }
2672 2672
             }
2673 2673
 
2674
-            if (!is_taxonomy_hierarchical($taxonomy)){
2675
-                $terms_array = array_unique( array_map( 'intval', $terms_array ) );
2674
+            if (!is_taxonomy_hierarchical($taxonomy)) {
2675
+                $terms_array = array_unique(array_map('intval', $terms_array));
2676 2676
             }
2677 2677
 
2678 2678
             wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
2679 2679
             
2680
-            if ($taxonomy == $post_type . 'category') {
2681
-                geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
2680
+            if ($taxonomy == $post_type.'category') {
2681
+                geodir_set_postcat_structure($tr_post_id, $post_type.'category');
2682 2682
             }
2683 2683
         }
2684 2684
     }
@@ -2699,15 +2699,15 @@  discard block
 block discarded – undo
2699 2699
 function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) {
2700 2700
     global $wpdb;
2701 2701
 
2702
-    $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2702
+    $query = $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2703 2703
     $wpdb->query($query);
2704 2704
 
2705
-    $query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2705
+    $query = $wpdb->prepare("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2706 2706
     $post_images = $wpdb->get_results($query);
2707 2707
 
2708
-    if ( !empty( $post_images ) ) {
2709
-        foreach ( $post_images as $post_image) {
2710
-            $image_data = (array)$post_image;
2708
+    if (!empty($post_images)) {
2709
+        foreach ($post_images as $post_image) {
2710
+            $image_data = (array) $post_image;
2711 2711
             unset($image_data['ID']);
2712 2712
             $image_data['post_id'] = $tr_post_id;
2713 2713
             
@@ -2740,13 +2740,13 @@  discard block
 block discarded – undo
2740 2740
 function geodir_wpml_duplicate_post_review($master_comment_id, $master_post_id, $tr_post_id, $lang) {
2741 2741
     global $wpdb, $plugin_prefix, $sitepress;
2742 2742
 
2743
-    $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2743
+    $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2744 2744
 
2745 2745
     if (empty($review)) {
2746 2746
         return false;
2747 2747
     }
2748 2748
     if ($review['post_id'] != $master_post_id) {
2749
-        $wpdb->query($wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2749
+        $wpdb->query($wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2750 2750
         geodir_update_postrating($master_post_id, $post_type);
2751 2751
     }
2752 2752
 
@@ -2757,9 +2757,9 @@  discard block
 block discarded – undo
2757 2757
     }
2758 2758
 
2759 2759
     $post_type = get_post_type($master_post_id);
2760
-    $post_table = $plugin_prefix . $post_type . '_detail';
2760
+    $post_table = $plugin_prefix.$post_type.'_detail';
2761 2761
 
2762
-    $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM " . $post_table . " WHERE post_id = %d", $tr_post_id), ARRAY_A);
2762
+    $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM ".$post_table." WHERE post_id = %d", $tr_post_id), ARRAY_A);
2763 2763
     if (empty($translated_post)) {
2764 2764
         return false;
2765 2765
     }
@@ -2777,7 +2777,7 @@  discard block
 block discarded – undo
2777 2777
         unset($review['id']);
2778 2778
     }
2779 2779
 
2780
-    $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2780
+    $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2781 2781
 
2782 2782
     if ($tr_review_id) { // update review
2783 2783
         $wpdb->update(GEODIR_REVIEW_TABLE, $review, array('id' => $tr_review_id));
@@ -2790,8 +2790,8 @@  discard block
 block discarded – undo
2790 2790
         geodir_update_postrating($tr_post_id, $post_type);
2791 2791
         
2792 2792
         if (defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_review') && $sitepress->get_setting('sync_comments_on_duplicates')) {
2793
-            $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id = %d", array($tr_comment_id)));
2794
-            $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2793
+            $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id = %d", array($tr_comment_id)));
2794
+            $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2795 2795
 
2796 2796
             if (!empty($likes)) {
2797 2797
                 foreach ($likes as $like) {
@@ -2893,7 +2893,7 @@  discard block
 block discarded – undo
2893 2893
  * @return bool True if review star disabled, otherwise false.
2894 2894
  */ 
2895 2895
 function geodir_rating_disabled_post_types() {
2896
-	$post_types = get_option( 'geodir_disable_rating_cpt' );
2896
+	$post_types = get_option('geodir_disable_rating_cpt');
2897 2897
 	
2898 2898
 	/**
2899 2899
 	 * Filter the post types array which have rating disabled.
@@ -2902,7 +2902,7 @@  discard block
 block discarded – undo
2902 2902
 	 *
2903 2903
 	 * @param array $post_types Array of post types which have rating starts disabled.
2904 2904
 	 */
2905
-	return apply_filters( 'geodir_rating_disabled_post_types', $post_types );
2905
+	return apply_filters('geodir_rating_disabled_post_types', $post_types);
2906 2906
 }
2907 2907
 
2908 2908
 /**
@@ -2914,30 +2914,30 @@  discard block
 block discarded – undo
2914 2914
  * @param bool $taxonomy Whether $post_type is taxonomy or not.
2915 2915
  * @return bool True if review star disabled, otherwise false.
2916 2916
  */ 
2917
-function geodir_cpt_has_rating_disabled( $post_type = '', $taxonomy = false ) {
2917
+function geodir_cpt_has_rating_disabled($post_type = '', $taxonomy = false) {
2918 2918
 	$post_types = geodir_rating_disabled_post_types();
2919 2919
 	
2920
-	if ( empty( $post_types ) ) {
2920
+	if (empty($post_types)) {
2921 2921
 		return false;
2922 2922
 	}
2923 2923
 	
2924
-	if ( is_int( $post_type ) ) {
2925
-		$post_type = get_post_type( $post_type );
2924
+	if (is_int($post_type)) {
2925
+		$post_type = get_post_type($post_type);
2926 2926
 	}
2927 2927
 	
2928
-	if ( $taxonomy && !empty( $post_types ) ) {
2928
+	if ($taxonomy && !empty($post_types)) {
2929 2929
 		$posttypes = array();
2930 2930
 		
2931
-		foreach ( $post_types as $posttype ) {
2932
-			$posttypes[] = $posttype . 'category';
2933
-			$posttypes[] = $posttype . '_tags';
2931
+		foreach ($post_types as $posttype) {
2932
+			$posttypes[] = $posttype.'category';
2933
+			$posttypes[] = $posttype.'_tags';
2934 2934
 		}
2935 2935
 		
2936 2936
 		$post_types = $posttypes;
2937 2937
 	}
2938 2938
 
2939 2939
 	$return = false;
2940
-	if ( $post_type != '' && !empty( $post_types ) && in_array( $post_type, $post_types ) ) {
2940
+	if ($post_type != '' && !empty($post_types) && in_array($post_type, $post_types)) {
2941 2941
 		$return = true;
2942 2942
 	}
2943 2943
 
Please login to merge, or discard this patch.
Indentation   +203 added lines, -203 removed lines patch added patch discarded remove patch
@@ -2362,10 +2362,10 @@  discard block
 block discarded – undo
2362 2362
 	?>
2363 2363
 	<input class="search_text" name="s"
2364 2364
 	       value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) {
2365
-		       echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2366
-	       } else {
2367
-		       echo $default_search_for_text;
2368
-	       } ?>" type="text"
2365
+			   echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2366
+		   } else {
2367
+			   echo $default_search_for_text;
2368
+		   } ?>" type="text"
2369 2369
 	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}"
2370 2370
 	       onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}"
2371 2371
 	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);">
@@ -2492,11 +2492,11 @@  discard block
 block discarded – undo
2492 2492
  * @return True if WPML is active else False.
2493 2493
  */
2494 2494
 function geodir_is_wpml() {
2495
-    if (function_exists('icl_object_id')) {
2496
-        return true;
2497
-    }
2495
+	if (function_exists('icl_object_id')) {
2496
+		return true;
2497
+	}
2498 2498
 
2499
-    return false;
2499
+	return false;
2500 2500
 }
2501 2501
 
2502 2502
 /**
@@ -2511,9 +2511,9 @@  discard block
 block discarded – undo
2511 2511
  * @return Language code.
2512 2512
  */
2513 2513
 function geodir_get_language_for_element($element_id, $element_type) {
2514
-    global $sitepress;
2514
+	global $sitepress;
2515 2515
 
2516
-    return $sitepress->get_language_for_element($element_id, $element_type);
2516
+	return $sitepress->get_language_for_element($element_id, $element_type);
2517 2517
 }
2518 2518
 
2519 2519
 /**
@@ -2530,31 +2530,31 @@  discard block
 block discarded – undo
2530 2530
  *                         Added to fix duplicate transaltion for front end.
2531 2531
  */
2532 2532
 function geodir_icl_make_duplicate($master_post_id, $lang, $postarr, $tr_post_id, $after_save = false) {
2533
-    global $sitepress;
2533
+	global $sitepress;
2534 2534
     
2535
-    $post_type = get_post_type($master_post_id);
2536
-    $icl_ajx_action = !empty($_REQUEST['icl_ajx_action']) && $_REQUEST['icl_ajx_action'] == 'make_duplicates' ? true : false;
2537
-    if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpml_duplicate_dashboard' && !empty($_REQUEST['duplicate_post_ids'])) {
2538
-        $icl_ajx_action = true;
2539
-    }
2535
+	$post_type = get_post_type($master_post_id);
2536
+	$icl_ajx_action = !empty($_REQUEST['icl_ajx_action']) && $_REQUEST['icl_ajx_action'] == 'make_duplicates' ? true : false;
2537
+	if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpml_duplicate_dashboard' && !empty($_REQUEST['duplicate_post_ids'])) {
2538
+		$icl_ajx_action = true;
2539
+	}
2540 2540
     
2541
-    if (in_array($post_type, geodir_get_posttypes())) {
2542
-        if ($icl_ajx_action || $after_save) {
2543
-            // Duplicate post details
2544
-            geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang);
2541
+	if (in_array($post_type, geodir_get_posttypes())) {
2542
+		if ($icl_ajx_action || $after_save) {
2543
+			// Duplicate post details
2544
+			geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang);
2545 2545
             
2546
-            // Duplicate taxonomies
2547
-            geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang);
2546
+			// Duplicate taxonomies
2547
+			geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang);
2548 2548
             
2549
-            // Duplicate post images
2550
-            geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang);
2551
-        }
2549
+			// Duplicate post images
2550
+			geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang);
2551
+		}
2552 2552
         
2553
-        // Sync post reviews
2554
-        if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2555
-            geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang);
2556
-        }
2557
-    }
2553
+		// Sync post reviews
2554
+		if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2555
+			geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang);
2556
+		}
2557
+	}
2558 2558
 }
2559 2559
 add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 );
2560 2560
 
@@ -2568,18 +2568,18 @@  discard block
 block discarded – undo
2568 2568
  * @param array $request_info The post details in an array.
2569 2569
  */
2570 2570
 function geodir_wpml_duplicate_listing($post_id, $request_info) {
2571
-    global $sitepress;
2571
+	global $sitepress;
2572 2572
     
2573
-    $icl_ajx_action = !empty($_REQUEST['icl_ajx_action']) && $_REQUEST['icl_ajx_action'] == 'make_duplicates' ? true : false;
2574
-    if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpml_duplicate_dashboard' && !empty($_REQUEST['duplicate_post_ids'])) {
2575
-        $icl_ajx_action = true;
2576
-    }
2573
+	$icl_ajx_action = !empty($_REQUEST['icl_ajx_action']) && $_REQUEST['icl_ajx_action'] == 'make_duplicates' ? true : false;
2574
+	if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpml_duplicate_dashboard' && !empty($_REQUEST['duplicate_post_ids'])) {
2575
+		$icl_ajx_action = true;
2576
+	}
2577 2577
     
2578
-    if (!$icl_ajx_action && in_array(get_post_type($post_id), geodir_get_posttypes()) && $post_duplicates = $sitepress->get_duplicates($post_id)) {
2579
-        foreach ($post_duplicates as $lang => $dup_post_id) {
2580
-            geodir_icl_make_duplicate($post_id, $lang, $request_info, $dup_post_id, true);
2581
-        }
2582
-    }
2578
+	if (!$icl_ajx_action && in_array(get_post_type($post_id), geodir_get_posttypes()) && $post_duplicates = $sitepress->get_duplicates($post_id)) {
2579
+		foreach ($post_duplicates as $lang => $dup_post_id) {
2580
+			geodir_icl_make_duplicate($post_id, $lang, $request_info, $dup_post_id, true);
2581
+		}
2582
+	}
2583 2583
 }
2584 2584
 
2585 2585
 /**
@@ -2595,17 +2595,17 @@  discard block
 block discarded – undo
2595 2595
  * @return bool True for success, False for fail.
2596 2596
  */
2597 2597
 function geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang) {
2598
-    global $wpdb;
2598
+	global $wpdb;
2599 2599
 
2600
-    $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2600
+	$reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2601 2601
 
2602
-    if (!empty($reviews)) {
2603
-        foreach ($reviews as $review) {
2604
-            geodir_wpml_duplicate_post_review($review['comment_id'], $master_post_id, $tr_post_id, $lang);
2605
-        }
2606
-    }
2602
+	if (!empty($reviews)) {
2603
+		foreach ($reviews as $review) {
2604
+			geodir_wpml_duplicate_post_review($review['comment_id'], $master_post_id, $tr_post_id, $lang);
2605
+		}
2606
+	}
2607 2607
 
2608
-    return false;
2608
+	return false;
2609 2609
 }
2610 2610
 
2611 2611
 /**
@@ -2622,22 +2622,22 @@  discard block
 block discarded – undo
2622 2622
  * @return bool True for success, False for fail.
2623 2623
  */
2624 2624
 function geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang) {
2625
-    global $wpdb, $plugin_prefix;
2625
+	global $wpdb, $plugin_prefix;
2626 2626
 
2627
-    $post_type = get_post_type($master_post_id);
2628
-    $post_table = $plugin_prefix . $post_type . '_detail';
2627
+	$post_type = get_post_type($master_post_id);
2628
+	$post_table = $plugin_prefix . $post_type . '_detail';
2629 2629
 
2630
-    $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
2631
-    $data = (array)$wpdb->get_row($query);
2630
+	$query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
2631
+	$data = (array)$wpdb->get_row($query);
2632 2632
 
2633
-    if ( !empty( $data ) ) {
2634
-        $data['post_id'] = $tr_post_id;
2635
-        unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category']);
2636
-        $wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
2637
-        return true;
2638
-    }
2633
+	if ( !empty( $data ) ) {
2634
+		$data['post_id'] = $tr_post_id;
2635
+		unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category']);
2636
+		$wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
2637
+		return true;
2638
+	}
2639 2639
 
2640
-    return false;
2640
+	return false;
2641 2641
 }
2642 2642
 
2643 2643
 /**
@@ -2654,40 +2654,40 @@  discard block
 block discarded – undo
2654 2654
  * @return bool True for success, False for fail.
2655 2655
  */
2656 2656
 function geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang) {
2657
-    global $sitepress, $wpdb;
2658
-    $post_type = get_post_type($master_post_id);
2657
+	global $sitepress, $wpdb;
2658
+	$post_type = get_post_type($master_post_id);
2659 2659
 
2660
-    remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
2660
+	remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
2661 2661
 
2662
-    $taxonomies = get_object_taxonomies($post_type);
2663
-    foreach ($taxonomies as $taxonomy) {
2664
-        $terms = get_the_terms($master_post_id, $taxonomy);
2665
-        $terms_array = array();
2662
+	$taxonomies = get_object_taxonomies($post_type);
2663
+	foreach ($taxonomies as $taxonomy) {
2664
+		$terms = get_the_terms($master_post_id, $taxonomy);
2665
+		$terms_array = array();
2666 2666
         
2667
-        if ($terms) {
2668
-            foreach ($terms as $term) {
2669
-                $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
2667
+		if ($terms) {
2668
+			foreach ($terms as $term) {
2669
+				$tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
2670 2670
                 
2671
-                if (!is_null($tr_id)){
2672
-                    // not using get_term - unfiltered get_term
2673
-                    $translated_term = $wpdb->get_row($wpdb->prepare("
2671
+				if (!is_null($tr_id)){
2672
+					// not using get_term - unfiltered get_term
2673
+					$translated_term = $wpdb->get_row($wpdb->prepare("
2674 2674
                         SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
2675 2675
 
2676
-                    $terms_array[] = $translated_term->term_id;
2677
-                }
2678
-            }
2676
+					$terms_array[] = $translated_term->term_id;
2677
+				}
2678
+			}
2679 2679
 
2680
-            if (!is_taxonomy_hierarchical($taxonomy)){
2681
-                $terms_array = array_unique( array_map( 'intval', $terms_array ) );
2682
-            }
2680
+			if (!is_taxonomy_hierarchical($taxonomy)){
2681
+				$terms_array = array_unique( array_map( 'intval', $terms_array ) );
2682
+			}
2683 2683
 
2684
-            wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
2684
+			wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
2685 2685
             
2686
-            if ($taxonomy == $post_type . 'category') {
2687
-                geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
2688
-            }
2689
-        }
2690
-    }
2686
+			if ($taxonomy == $post_type . 'category') {
2687
+				geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
2688
+			}
2689
+		}
2690
+	}
2691 2691
 }
2692 2692
 
2693 2693
 /**
@@ -2703,29 +2703,29 @@  discard block
 block discarded – undo
2703 2703
  * @return bool True for success, False for fail.
2704 2704
  */
2705 2705
 function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) {
2706
-    global $wpdb;
2706
+	global $wpdb;
2707 2707
 
2708
-    $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2709
-    $wpdb->query($query);
2708
+	$query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2709
+	$wpdb->query($query);
2710 2710
 
2711
-    $query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2712
-    $post_images = $wpdb->get_results($query);
2711
+	$query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2712
+	$post_images = $wpdb->get_results($query);
2713 2713
 
2714
-    if ( !empty( $post_images ) ) {
2715
-        foreach ( $post_images as $post_image) {
2716
-            $image_data = (array)$post_image;
2717
-            unset($image_data['ID']);
2718
-            $image_data['post_id'] = $tr_post_id;
2714
+	if ( !empty( $post_images ) ) {
2715
+		foreach ( $post_images as $post_image) {
2716
+			$image_data = (array)$post_image;
2717
+			unset($image_data['ID']);
2718
+			$image_data['post_id'] = $tr_post_id;
2719 2719
             
2720
-            $wpdb->insert(GEODIR_ATTACHMENT_TABLE, $image_data);
2720
+			$wpdb->insert(GEODIR_ATTACHMENT_TABLE, $image_data);
2721 2721
             
2722
-            geodir_set_wp_featured_image($tr_post_id);
2723
-        }
2722
+			geodir_set_wp_featured_image($tr_post_id);
2723
+		}
2724 2724
         
2725
-        return true;
2726
-    }
2725
+		return true;
2726
+	}
2727 2727
 
2728
-    return false;
2728
+	return false;
2729 2729
 }
2730 2730
 
2731 2731
 
@@ -2744,73 +2744,73 @@  discard block
 block discarded – undo
2744 2744
  * @return bool True for success, False for fail.
2745 2745
  */
2746 2746
 function geodir_wpml_duplicate_post_review($master_comment_id, $master_post_id, $tr_post_id, $lang) {
2747
-    global $wpdb, $plugin_prefix, $sitepress;
2748
-
2749
-    $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2750
-
2751
-    if (empty($review)) {
2752
-        return false;
2753
-    }
2754
-    if ($review['post_id'] != $master_post_id) {
2755
-        $wpdb->query($wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2756
-        geodir_update_postrating($master_post_id, $post_type);
2757
-    }
2758
-
2759
-    $tr_comment_id = geodir_wpml_duplicate_comment_exists($tr_post_id, $master_comment_id);
2760
-
2761
-    if (empty($tr_comment_id)) {
2762
-        return false;
2763
-    }
2764
-
2765
-    $post_type = get_post_type($master_post_id);
2766
-    $post_table = $plugin_prefix . $post_type . '_detail';
2767
-
2768
-    $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM " . $post_table . " WHERE post_id = %d", $tr_post_id), ARRAY_A);
2769
-    if (empty($translated_post)) {
2770
-        return false;
2771
-    }
2772
-
2773
-    $review['comment_id'] = $tr_comment_id;
2774
-    $review['post_id'] = $tr_post_id;
2775
-    $review['post_title'] = $translated_post['post_title'];
2776
-    $review['post_city'] = $translated_post['post_city'];
2777
-    $review['post_region'] = $translated_post['post_region'];
2778
-    $review['post_country'] = $translated_post['post_country'];
2779
-    $review['post_latitude'] = $translated_post['post_latitude'];
2780
-    $review['post_longitude'] = $translated_post['post_longitude'];
2781
-
2782
-    if (isset($review['id'])) {
2783
-        unset($review['id']);
2784
-    }
2785
-
2786
-    $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2787
-
2788
-    if ($tr_review_id) { // update review
2789
-        $wpdb->update(GEODIR_REVIEW_TABLE, $review, array('id' => $tr_review_id));
2790
-    } else { // insert review
2791
-        $wpdb->insert(GEODIR_REVIEW_TABLE, $review);
2792
-        $tr_review_id = $wpdb->insert_id;
2793
-    }
2794
-
2795
-    if ($tr_post_id) {
2796
-        geodir_update_postrating($tr_post_id, $post_type);
2747
+	global $wpdb, $plugin_prefix, $sitepress;
2748
+
2749
+	$review = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2750
+
2751
+	if (empty($review)) {
2752
+		return false;
2753
+	}
2754
+	if ($review['post_id'] != $master_post_id) {
2755
+		$wpdb->query($wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2756
+		geodir_update_postrating($master_post_id, $post_type);
2757
+	}
2758
+
2759
+	$tr_comment_id = geodir_wpml_duplicate_comment_exists($tr_post_id, $master_comment_id);
2760
+
2761
+	if (empty($tr_comment_id)) {
2762
+		return false;
2763
+	}
2764
+
2765
+	$post_type = get_post_type($master_post_id);
2766
+	$post_table = $plugin_prefix . $post_type . '_detail';
2767
+
2768
+	$translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM " . $post_table . " WHERE post_id = %d", $tr_post_id), ARRAY_A);
2769
+	if (empty($translated_post)) {
2770
+		return false;
2771
+	}
2772
+
2773
+	$review['comment_id'] = $tr_comment_id;
2774
+	$review['post_id'] = $tr_post_id;
2775
+	$review['post_title'] = $translated_post['post_title'];
2776
+	$review['post_city'] = $translated_post['post_city'];
2777
+	$review['post_region'] = $translated_post['post_region'];
2778
+	$review['post_country'] = $translated_post['post_country'];
2779
+	$review['post_latitude'] = $translated_post['post_latitude'];
2780
+	$review['post_longitude'] = $translated_post['post_longitude'];
2781
+
2782
+	if (isset($review['id'])) {
2783
+		unset($review['id']);
2784
+	}
2785
+
2786
+	$tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2787
+
2788
+	if ($tr_review_id) { // update review
2789
+		$wpdb->update(GEODIR_REVIEW_TABLE, $review, array('id' => $tr_review_id));
2790
+	} else { // insert review
2791
+		$wpdb->insert(GEODIR_REVIEW_TABLE, $review);
2792
+		$tr_review_id = $wpdb->insert_id;
2793
+	}
2794
+
2795
+	if ($tr_post_id) {
2796
+		geodir_update_postrating($tr_post_id, $post_type);
2797 2797
         
2798
-        if (defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_review') && $sitepress->get_setting('sync_comments_on_duplicates')) {
2799
-            $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id = %d", array($tr_comment_id)));
2800
-            $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2801
-
2802
-            if (!empty($likes)) {
2803
-                foreach ($likes as $like) {
2804
-                    unset($like['like_id']);
2805
-                    $like['comment_id'] = $tr_comment_id;
2798
+		if (defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_review') && $sitepress->get_setting('sync_comments_on_duplicates')) {
2799
+			$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id = %d", array($tr_comment_id)));
2800
+			$likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2801
+
2802
+			if (!empty($likes)) {
2803
+				foreach ($likes as $like) {
2804
+					unset($like['like_id']);
2805
+					$like['comment_id'] = $tr_comment_id;
2806 2806
                     
2807
-                    $wpdb->insert(GEODIR_COMMENTS_REVIEWS_TABLE, $like);
2808
-                }
2809
-            }
2810
-        }
2811
-    }
2807
+					$wpdb->insert(GEODIR_COMMENTS_REVIEWS_TABLE, $like);
2808
+				}
2809
+			}
2810
+		}
2811
+	}
2812 2812
 
2813
-    return $tr_review_id;
2813
+	return $tr_review_id;
2814 2814
 }
2815 2815
 
2816 2816
 /**
@@ -2825,36 +2825,36 @@  discard block
 block discarded – undo
2825 2825
  * @param int $comment_id The Comment ID.
2826 2826
  */
2827 2827
 function gepdir_wpml_sync_comment($comment_id) {
2828
-    global $wpdb, $sitepress, $gd_wpml_posttypes;
2829
-
2830
-    if (empty($gd_post_types)) {
2831
-        $gd_wpml_posttypes = geodir_get_posttypes();
2832
-    }
2833
-
2834
-    $comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->comments} WHERE comment_ID=%d", $comment_id), ARRAY_A);
2835
-    if (empty($comment)) {
2836
-        return;
2837
-    }
2838
-
2839
-    $post_id = $comment['comment_post_ID'];
2840
-    $post_type = $post_id ? get_post_type($post_id) : NULL;
2841
-
2842
-    if (!($post_type && in_array($post_type, $gd_wpml_posttypes))) {
2843
-        return;
2844
-    }
2845
-
2846
-    $post_duplicates = $sitepress->get_duplicates($post_id);
2847
-    if (empty($post_duplicates)) {
2848
-        return;
2849
-    }
2850
-
2851
-    foreach ($post_duplicates as $lang => $dup_post_id) {
2852
-        if (empty($comment['comment_parent'])) {
2853
-            geodir_wpml_duplicate_post_review($comment_id, $post_id, $dup_post_id, $lang);
2854
-        }
2855
-    }
2828
+	global $wpdb, $sitepress, $gd_wpml_posttypes;
2829
+
2830
+	if (empty($gd_post_types)) {
2831
+		$gd_wpml_posttypes = geodir_get_posttypes();
2832
+	}
2833
+
2834
+	$comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->comments} WHERE comment_ID=%d", $comment_id), ARRAY_A);
2835
+	if (empty($comment)) {
2836
+		return;
2837
+	}
2838
+
2839
+	$post_id = $comment['comment_post_ID'];
2840
+	$post_type = $post_id ? get_post_type($post_id) : NULL;
2841
+
2842
+	if (!($post_type && in_array($post_type, $gd_wpml_posttypes))) {
2843
+		return;
2844
+	}
2845
+
2846
+	$post_duplicates = $sitepress->get_duplicates($post_id);
2847
+	if (empty($post_duplicates)) {
2848
+		return;
2849
+	}
2850
+
2851
+	foreach ($post_duplicates as $lang => $dup_post_id) {
2852
+		if (empty($comment['comment_parent'])) {
2853
+			geodir_wpml_duplicate_post_review($comment_id, $post_id, $dup_post_id, $lang);
2854
+		}
2855
+	}
2856 2856
     
2857
-    return true;
2857
+	return true;
2858 2858
 }
2859 2859
 
2860 2860
 /**
@@ -2869,11 +2869,11 @@  discard block
 block discarded – undo
2869 2869
  * @return int The duplicate comment ID.
2870 2870
  */
2871 2871
 function geodir_wpml_duplicate_comment_exists($dup_post_id, $original_cid) {
2872
-    global $wpdb;
2872
+	global $wpdb;
2873 2873
 
2874
-    $duplicate = $wpdb->get_var(
2875
-        $wpdb->prepare(
2876
-            "   SELECT comm.comment_ID
2874
+	$duplicate = $wpdb->get_var(
2875
+		$wpdb->prepare(
2876
+			"   SELECT comm.comment_ID
2877 2877
                 FROM {$wpdb->comments} comm
2878 2878
                 JOIN {$wpdb->commentmeta} cm
2879 2879
                     ON comm.comment_ID = cm.comment_id
@@ -2881,12 +2881,12 @@  discard block
 block discarded – undo
2881 2881
                     AND cm.meta_key = '_icl_duplicate_of'
2882 2882
                     AND cm.meta_value = %d
2883 2883
                 LIMIT 1",
2884
-            $dup_post_id,
2885
-            $original_cid
2886
-        )
2887
-    );
2884
+			$dup_post_id,
2885
+			$original_cid
2886
+		)
2887
+	);
2888 2888
 
2889
-    return $duplicate;
2889
+	return $duplicate;
2890 2890
 }
2891 2891
 
2892 2892
 /**
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/map_template_tags.php 3 patches
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -225,10 +225,11 @@  discard block
 block discarded – undo
225 225
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/>
226 226
                 <?php }
227 227
 
228
-                if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
229
-                    $show_entire_cat_panel = "none";
230
-                else
231
-                    $show_entire_cat_panel = "''";
228
+                if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) {
229
+                                    $show_entire_cat_panel = "none";
230
+                } else {
231
+                                    $show_entire_cat_panel = "''";
232
+                }
232 233
                 ?>
233 234
 
234 235
                 <?php if ($geodir_map_options['enable_map_direction']) { ?>
@@ -302,8 +303,9 @@  discard block
 block discarded – undo
302 303
 				}
303 304
 				
304 305
 				$geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
305
-				if (empty($geodir_default_map_search_pt))
306
-					$geodir_default_map_search_pt = 'gd_place';
306
+				if (empty($geodir_default_map_search_pt)) {
307
+									$geodir_default_map_search_pt = 'gd_place';
308
+				}
307 309
 
308 310
                 global $gd_session;
309 311
                 $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
Please login to merge, or discard this patch.
Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -67,77 +67,77 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function geodir_draw_map($map_args = array())
69 69
 {
70
-    global $map_canvas_arr;
71
-    $map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas';
72
-    $map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : '';
73
-
74
-    $default_location = geodir_get_default_location();
75
-
76
-    $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
77
-    $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
78
-    $map_default_zoom = 12;
79
-    // map options default values
80
-    $width = 950;
81
-    $height = 450;
82
-    $child_collapse = '0';
83
-    $sticky = '';
84
-    $enable_cat_filters = false;
85
-    $enable_text_search = false;
86
-    $enable_post_type_filters = false;
87
-    $enable_location_filters = false;
88
-    $enable_jason_on_load = false;
89
-    $enable_map_direction = false;
90
-    $enable_marker_cluster = false;
91
-    $enable_map_resize_button = false;
92
-    $maptype = 'ROADMAP';
93
-
94
-    $geodir_map_options = array(
95
-        'width' => $width,
96
-        'height' => $height,
97
-        'child_collapse' => $child_collapse,
98
-        'sticky' => $sticky,
99
-        'enable_map_resize_button' => $enable_map_resize_button,
100
-        'enable_cat_filters' => $enable_cat_filters,
101
-        'enable_text_search' => $enable_text_search,
102
-        'enable_post_type_filters' => $enable_post_type_filters,
103
-        'enable_location_filters' => $enable_location_filters,
104
-        'enable_jason_on_load' => $enable_jason_on_load,
105
-        'enable_map_direction' => $enable_map_direction,
106
-        'enable_marker_cluster' => $enable_marker_cluster,
107
-        'ajax_url' => geodir_get_ajax_url(),
108
-        'map_canvas_name' => $map_canvas_name,
109
-        'inputText' => __('Title or Keyword', 'geodirectory'),
110
-        'latitude' => $map_default_lat,
111
-        'longitude' => $map_default_lng,
112
-        'zoom' => $map_default_zoom,
113
-        'scrollwheel' => true,
114
-        'streetViewControl' => true,
115
-        'maptype' => $maptype,
116
-        'showPreview' => '0',
117
-        'maxZoom' => 21,
118
-        'autozoom' => true,
119
-        'bubble_size' => 'small',
120
-        'token' => '68f48005e256696074e1da9bf9f67f06',
121
-        'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN')
122
-    );
123
-
124
-    if (!empty($map_args)) {
125
-        foreach ($map_args as $map_option_key => $map_option_value) {
126
-            $geodir_map_options[$map_option_key] = $map_option_value;
127
-        }
128
-    }
129
-
130
-    if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
131
-    } else {
132
-        $geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
133
-    }
134
-
135
-    if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
136
-    } else {
137
-        $geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
138
-    }
139
-
140
-    /**
70
+	global $map_canvas_arr;
71
+	$map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas';
72
+	$map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : '';
73
+
74
+	$default_location = geodir_get_default_location();
75
+
76
+	$map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
77
+	$map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
78
+	$map_default_zoom = 12;
79
+	// map options default values
80
+	$width = 950;
81
+	$height = 450;
82
+	$child_collapse = '0';
83
+	$sticky = '';
84
+	$enable_cat_filters = false;
85
+	$enable_text_search = false;
86
+	$enable_post_type_filters = false;
87
+	$enable_location_filters = false;
88
+	$enable_jason_on_load = false;
89
+	$enable_map_direction = false;
90
+	$enable_marker_cluster = false;
91
+	$enable_map_resize_button = false;
92
+	$maptype = 'ROADMAP';
93
+
94
+	$geodir_map_options = array(
95
+		'width' => $width,
96
+		'height' => $height,
97
+		'child_collapse' => $child_collapse,
98
+		'sticky' => $sticky,
99
+		'enable_map_resize_button' => $enable_map_resize_button,
100
+		'enable_cat_filters' => $enable_cat_filters,
101
+		'enable_text_search' => $enable_text_search,
102
+		'enable_post_type_filters' => $enable_post_type_filters,
103
+		'enable_location_filters' => $enable_location_filters,
104
+		'enable_jason_on_load' => $enable_jason_on_load,
105
+		'enable_map_direction' => $enable_map_direction,
106
+		'enable_marker_cluster' => $enable_marker_cluster,
107
+		'ajax_url' => geodir_get_ajax_url(),
108
+		'map_canvas_name' => $map_canvas_name,
109
+		'inputText' => __('Title or Keyword', 'geodirectory'),
110
+		'latitude' => $map_default_lat,
111
+		'longitude' => $map_default_lng,
112
+		'zoom' => $map_default_zoom,
113
+		'scrollwheel' => true,
114
+		'streetViewControl' => true,
115
+		'maptype' => $maptype,
116
+		'showPreview' => '0',
117
+		'maxZoom' => 21,
118
+		'autozoom' => true,
119
+		'bubble_size' => 'small',
120
+		'token' => '68f48005e256696074e1da9bf9f67f06',
121
+		'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN')
122
+	);
123
+
124
+	if (!empty($map_args)) {
125
+		foreach ($map_args as $map_option_key => $map_option_value) {
126
+			$geodir_map_options[$map_option_key] = $map_option_value;
127
+		}
128
+	}
129
+
130
+	if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
131
+	} else {
132
+		$geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
133
+	}
134
+
135
+	if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
136
+	} else {
137
+		$geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
138
+	}
139
+
140
+	/**
141 141
 	 * Filter the options to use in google map.
142 142
 	 *
143 143
 	 * @since 1.0.0
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	$geodir_map_options = apply_filters("geodir_map_options_{$map_canvas_name}", $geodir_map_options);
148 148
 
149
-    $map_canvas_arr[$map_canvas_name] = array();
149
+	$map_canvas_arr[$map_canvas_name] = array();
150 150
 
151
-    /**
151
+	/**
152 152
 	 * Filter the post types to display data on map.
153 153
 	 *
154 154
 	 * @since 1.0.0
@@ -166,20 +166,20 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	$exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map'));
168 168
 
169
-    if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
170
-        // Set default map options
169
+	if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
170
+		// Set default map options
171 171
 
172
-        wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
172
+		wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
173 173
 
174
-        wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
174
+		wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
175 175
 
176
-        if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
177
-            $map_width = '100%';
178
-        } else {
179
-            $map_width = $geodir_map_options['width'];
180
-        }
176
+		if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
177
+			$map_width = '100%';
178
+		} else {
179
+			$map_width = $geodir_map_options['width'];
180
+		}
181 181
 
182
-        /**
182
+		/**
183 183
 		 * Filter the width of map.
184 184
 		 *
185 185
 		 * @since 1.0.0
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 		 * @param int $map_width Width of map box, eg: gd_place.
188 188
 		 */
189 189
 		$map_width = apply_filters('geodir_change_map_width', $map_width);
190
-        ?>
190
+		?>
191 191
         <div id="catcher_<?php echo $map_canvas_name;?>"></div>
192 192
         <div class="stick_trigger_container">
193 193
             <div class="trigger_sticky triggeroff_sticky"></div>
@@ -221,15 +221,15 @@  discard block
 block discarded – undo
221 221
                 <?php if ($geodir_map_options['enable_jason_on_load']) { ?>
222 222
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/>
223 223
                 <?php } else {
224
-                    ?>
224
+					?>
225 225
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/>
226 226
                 <?php }
227 227
 
228
-                if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
229
-                    $show_entire_cat_panel = "none";
230
-                else
231
-                    $show_entire_cat_panel = "''";
232
-                ?>
228
+				if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
229
+					$show_entire_cat_panel = "none";
230
+				else
231
+					$show_entire_cat_panel = "''";
232
+				?>
233 233
 
234 234
                 <?php if ($geodir_map_options['enable_map_direction']) { ?>
235 235
                     <div class="gd-input-group gd-get-directions">
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
                         <select id="travel-units" onchange="calcRoute('<?php echo $map_canvas_name; ?>')">
293 293
                             <option value="miles"><?php _e('Miles', 'geodirectory'); ?></option>
294 294
                             <option <?php if (get_option('geodir_search_dist_1') == 'km') {
295
-                                echo 'selected="selected"';
296
-                            } ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option>
295
+								echo 'selected="selected"';
296
+							} ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option>
297 297
                         </select>
298 298
                     </div>
299 299
 
@@ -305,12 +305,12 @@  discard block
 block discarded – undo
305 305
 				if (empty($geodir_default_map_search_pt))
306 306
 					$geodir_default_map_search_pt = 'gd_place';
307 307
 
308
-                global $gd_session;
309
-                $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
308
+				global $gd_session;
309
+				$homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
310 310
 
311
-                if ($homemap_catlist_ptype) {
312
-                    $geodir_default_map_search_pt = $homemap_catlist_ptype;
313
-                }
311
+				if ($homemap_catlist_ptype) {
312
+					$geodir_default_map_search_pt = $homemap_catlist_ptype;
313
+				}
314 314
 
315 315
 				/**
316 316
 				 * Filter the post type to retrieve data for map
@@ -323,13 +323,13 @@  discard block
 block discarded – undo
323 323
 				?>
324 324
                 <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>">
325 325
                     <?php
326
-                    $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
327
-                    $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
326
+					$exclude_post_types = get_option('geodir_exclude_post_type_on_map');
327
+					$geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
328 328
 					$map_cat_class = '';
329 329
 					if ($geodir_map_options['enable_post_type_filters']) {
330 330
 						$map_cat_class = $geodir_available_pt_on_map > 1 ? ' map-cat-ptypes' : ' map-cat-floor';
331 331
 					}
332
-                    ?>
332
+					?>
333 333
                     <div
334 334
                         class="map-category-listing<?php echo $map_cat_class;?>">
335 335
                         <div class="gd-trigger gd-triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div>
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
                                 <?php if ($geodir_map_options['child_collapse']) { $child_collapse = "1"; ?>
348 348
                                     <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/>
349 349
                                 <?php } else {$child_collapse = "0";
350
-                                    ?>
350
+									?>
351 351
                                     <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/>
352 352
                                 <?php } ?>
353 353
                                 <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/>
@@ -369,17 +369,17 @@  discard block
 block discarded – undo
369 369
                 <!-- map-category-listings-->
370 370
 
371 371
                 <?php
372
-                if ($geodir_map_options['enable_location_filters']) {
372
+				if ($geodir_map_options['enable_location_filters']) {
373 373
 					$country = get_query_var('gd_country');
374 374
 					$region = get_query_var('gd_region');
375 375
 					$city = get_query_var('gd_city');
376 376
                     
377
-                    //fix for location/me page
378
-                    $country = $country != 'me' ? $country : '';
377
+					//fix for location/me page
378
+					$country = $country != 'me' ? $country : '';
379 379
 					$region = $region != 'me' ? $region : '';
380 380
 					$city = $country != 'me' ? $city : '';
381
-                    $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : '';
382
-                    ?>
381
+					$gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : '';
382
+					?>
383 383
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/>
384 384
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country"
385 385
                            value="<?php echo $country;?>"/>
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood"
391 391
                            value="<?php echo $gd_neighbourhood;?>"/>
392 392
                 <?php } else { //end of location filter
393
-                    ?>
393
+					?>
394 394
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/>
395 395
                 <?php }?>
396 396
 
@@ -401,9 +401,9 @@  discard block
 block discarded – undo
401 401
 
402 402
 
403 403
                 <?php if ($geodir_map_options['enable_post_type_filters']) {
404
-                    $post_types = geodir_get_posttypes('object');
405
-                    if (count((array)($post_types)) > 1) {
406
-                        ?>
404
+					$post_types = geodir_get_posttypes('object');
405
+					if (count((array)($post_types)) > 1) {
406
+						?>
407 407
                         <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu"
408 408
                              style="max-width:<?php echo $map_width;?>!important;">
409 409
 
@@ -411,15 +411,15 @@  discard block
 block discarded – undo
411 411
                             <div class="geodir-map-posttype-list"><?php } ?>
412 412
                                 <ul class="clearfix place-list">
413 413
                                     <?php
414
-                                    $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
414
+									$exclude_post_types = get_option('geodir_exclude_post_type_on_map');
415 415
 
416
-                                    foreach ($post_types as $post_type => $args) {
417
-                                        if (!in_array($post_type, $exclude_post_types)) {
418
-                                            $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
416
+									foreach ($post_types as $post_type => $args) {
417
+										if (!in_array($post_type, $exclude_post_types)) {
418
+											$class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
419 419
 											echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __($args->labels->name, 'geodirectory') . '</a></li>';
420
-                                        }
421
-                                    }
422
-                                    ?>
420
+										}
421
+									}
422
+									?>
423 423
                                 </ul>
424 424
                                 <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
425 425
                             </div><?php } ?>
@@ -433,8 +433,8 @@  discard block
 block discarded – undo
433 433
 
434 434
                         </div> <!-- map-places-listings-->
435 435
                     <?php }
436
-                } // end of post type filter if
437
-                ?>
436
+				} // end of post type filter if
437
+				?>
438 438
 
439 439
             </div>
440 440
         </div> <!--end of stick trigger container-->
@@ -449,8 +449,8 @@  discard block
 block discarded – undo
449 449
         </script>
450 450
         <?php
451 451
 
452
-        if (strpos($geodir_map_options['height'], 'vh')) {
453
-            ?>
452
+		if (strpos($geodir_map_options['height'], 'vh')) {
453
+			?>
454 454
             <script>
455 455
                 (function () {
456 456
                     var screenH = jQuery(window).height();
@@ -472,8 +472,8 @@  discard block
 block discarded – undo
472 472
 
473 473
         <?php
474 474
 
475
-        } elseif (strpos($geodir_map_options['height'], 'px')) {
476
-            ?>
475
+		} elseif (strpos($geodir_map_options['height'], 'px')) {
476
+			?>
477 477
             <script>
478 478
                 (function () {
479 479
                     var screenH = jQuery(window).height();
@@ -488,20 +488,20 @@  discard block
 block discarded – undo
488 488
                 }());
489 489
             </script>
490 490
         <?php
491
-        }
491
+		}
492 492
 
493
-        /**
494
-         * Action that runs after all the map code has been output;
495
-         *
496
-         * @since 1.5.3
497
-         *
498
-         * @param array $geodir_map_options Array of map settings.
499
-         * @param string $map_canvas_name The canvas name and ID for the map.
500
-         */
501
-        do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
493
+		/**
494
+		 * Action that runs after all the map code has been output;
495
+		 *
496
+		 * @since 1.5.3
497
+		 *
498
+		 * @param array $geodir_map_options Array of map settings.
499
+		 * @param string $map_canvas_name The canvas name and ID for the map.
500
+		 */
501
+		do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
502 502
 
503 503
 
504
-    endif; // Exclude posttypes if end
504
+	endif; // Exclude posttypes if end
505 505
 }
506 506
 
507 507
 /**
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 
130 130
     if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
131 131
     } else {
132
-        $geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
132
+        $geodir_map_options['height'] = $geodir_map_options['height'].'px';
133 133
     }
134 134
 
135 135
     if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
136 136
     } else {
137
-        $geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
137
+        $geodir_map_options['width'] = $geodir_map_options['width'].'px';
138 138
     }
139 139
 
140 140
     /**
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	$exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map'));
168 168
 
169
-    if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
169
+    if (count((array) $post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
170 170
         // Set default map options
171 171
 
172
-        wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
172
+        wp_enqueue_script('geodir-map-widget', geodir_plugin_url().'/geodirectory-functions/map-functions/js/map.min.js', array(), false, true);
173 173
 
174 174
         wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
175 175
 
@@ -188,41 +188,41 @@  discard block
 block discarded – undo
188 188
 		 */
189 189
 		$map_width = apply_filters('geodir_change_map_width', $map_width);
190 190
         ?>
191
-        <div id="catcher_<?php echo $map_canvas_name;?>"></div>
191
+        <div id="catcher_<?php echo $map_canvas_name; ?>"></div>
192 192
         <div class="stick_trigger_container">
193 193
             <div class="trigger_sticky triggeroff_sticky"></div>
194
-            <div class="top_banner_section geodir_map_container <?php echo $map_class_name;?>"
195
-                 id="sticky_map_<?php echo $map_canvas_name;?>"
196
-                 style="min-height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;">
194
+            <div class="top_banner_section geodir_map_container <?php echo $map_class_name; ?>"
195
+                 id="sticky_map_<?php echo $map_canvas_name; ?>"
196
+                 style="min-height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;">
197 197
 
198 198
                 <div class="map_background">
199 199
                     <div class="top_banner_section_in clearfix">
200
-                        <div class="<?php echo $map_canvas_name;?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name;?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div>
201
-                        <div class="<?php echo $map_canvas_name;?>_TopRight TopRight"></div>
202
-                        <div id="<?php echo $map_canvas_name;?>_wrapper" class="main_map_wrapper"
203
-                             style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;">
200
+                        <div class="<?php echo $map_canvas_name; ?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name; ?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div>
201
+                        <div class="<?php echo $map_canvas_name; ?>_TopRight TopRight"></div>
202
+                        <div id="<?php echo $map_canvas_name; ?>_wrapper" class="main_map_wrapper"
203
+                             style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;">
204 204
                             <!-- new map start -->
205 205
                             <div class="iprelative">
206
-                                <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name;?>"
207
-                                     style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div>
208
-                                <div id="<?php echo $map_canvas_name;?>_loading_div" class="loading_div"
209
-                                     style=" height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div>
206
+                                <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name; ?>"
207
+                                     style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div>
208
+                                <div id="<?php echo $map_canvas_name; ?>_loading_div" class="loading_div"
209
+                                     style=" height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div>
210 210
                                 <!--<div id="home_map_counter"></div>        -->
211
-                                <div id="<?php echo $map_canvas_name;?>_map_nofound"
211
+                                <div id="<?php echo $map_canvas_name; ?>_map_nofound"
212 212
                                      class="advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div>
213
-                                <div id="<?php echo $map_canvas_name;?>_map_notloaded"
213
+                                <div id="<?php echo $map_canvas_name; ?>_map_notloaded"
214 214
                                      class="advmap_notloaded"><?php _e('<h3>Google Map Not Loaded</h3><p>Sorry, unable to load Google Maps API.', 'geodirectory'); ?></div>
215 215
                             </div>
216 216
                             <!-- new map end -->
217 217
                         </div>
218
-                        <div class="<?php echo $map_canvas_name;?>_BottomLeft BottomLeft"></div>
218
+                        <div class="<?php echo $map_canvas_name; ?>_BottomLeft BottomLeft"></div>
219 219
                     </div>
220 220
                 </div>
221 221
                 <?php if ($geodir_map_options['enable_jason_on_load']) { ?>
222
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/>
222
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="1"/>
223 223
                 <?php } else {
224 224
                     ?>
225
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/>
225
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="0"/>
226 226
                 <?php }
227 227
 
228 228
                 if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
                       <div class="gd-input-group-addon gd-directions-right gd-mylocation-go"><input type="button" value="<?php _e('Get Directions', 'geodirectory'); ?>" class="<?php echo $map_canvas_name; ?>_getdirection" id="directions" onclick="calcRoute('<?php echo $map_canvas_name; ?>')" /></div>
243 243
                     </div>
244 244
                     <script>
245
-                        <?php if(geodir_is_page('detail')){?>
245
+                        <?php if (geodir_is_page('detail')) {?>
246 246
                         jQuery(function () {
247 247
                             gd_initialize_ac();
248 248
                         });
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
                                 // Create the autocomplete object, restricting the search
254 254
                                 // to geographical location types.
255 255
                                 autocomplete = new google.maps.places.Autocomplete(
256
-                                    /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name;?>_fromAddress')),
256
+                                    /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name; ?>_fromAddress')),
257 257
                                     {types: ['geocode']});
258 258
                                 // When the user selects an address from the dropdown,
259 259
                                 // populate the address fields in the form.
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
                                 
268 268
                                 if (window.gdMaps == 'osm') {
269 269
                                     window.setTimeout(function() {
270
-                                        calcRoute('<?php echo $map_canvas_name;?>');
270
+                                        calcRoute('<?php echo $map_canvas_name; ?>');
271 271
                                     }, 1000);
272 272
                                 }
273 273
                             }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 				 */
322 322
 				$map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt);
323 323
 				?>
324
-                <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>">
324
+                <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel; ?>">
325 325
                     <?php
326 326
                     $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
327 327
                     $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
@@ -331,12 +331,12 @@  discard block
 block discarded – undo
331 331
 					}
332 332
                     ?>
333 333
                     <div
334
-                        class="map-category-listing<?php echo $map_cat_class;?>">
334
+                        class="map-category-listing<?php echo $map_cat_class; ?>">
335 335
                         <div class="gd-trigger gd-triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div>
336
-                        <div id="<?php echo $map_canvas_name;?>_cat"
337
-                             class="<?php echo $map_canvas_name;?>_map_category  map_category"
338
-                             <?php if ($child_collapse){ ?>checked="checked" <?php }?>
339
-                             style="max-height:<?php echo $geodir_map_options['height'];?>;">
336
+                        <div id="<?php echo $map_canvas_name; ?>_cat"
337
+                             class="<?php echo $map_canvas_name; ?>_map_category  map_category"
338
+                             <?php if ($child_collapse) { ?>checked="checked" <?php }?>
339
+                             style="max-height:<?php echo $geodir_map_options['height']; ?>;">
340 340
                             <input
341 341
                                 onkeydown="if(event.keyCode == 13){build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false)}"
342 342
                                 type="text"
@@ -348,11 +348,11 @@  discard block
 block discarded – undo
348 348
                                     <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/>
349 349
                                 <?php } else {$child_collapse = "0";
350 350
                                     ?>
351
-                                    <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/>
351
+                                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="0"/>
352 352
                                 <?php } ?>
353 353
                                 <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/>
354 354
                                 <div class="geodir_toggle">
355
-                                    <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'),0,true,0,$map_canvas_name,$child_collapse,true); ?>
355
+                                    <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'), 0, true, 0, $map_canvas_name, $child_collapse, true); ?>
356 356
                                     <script>jQuery( document ).ready(function() {
357 357
                                             geodir_show_sub_cat_collapse_button();
358 358
                                         });</script>
@@ -380,21 +380,21 @@  discard block
 block discarded – undo
380 380
 					$city = $country != 'me' ? $city : '';
381 381
                     $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : '';
382 382
                     ?>
383
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/>
384
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country"
385
-                           value="<?php echo $country;?>"/>
386
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_region" name="gd_region"
387
-                           value="<?php echo $region;?>"/>
388
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_city" name="gd_city"
389
-                           value="<?php echo $city;?>"/>
390
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood"
391
-                           value="<?php echo $gd_neighbourhood;?>"/>
383
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="1"/>
384
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_country" name="gd_country"
385
+                           value="<?php echo $country; ?>"/>
386
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_region" name="gd_region"
387
+                           value="<?php echo $region; ?>"/>
388
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_city" name="gd_city"
389
+                           value="<?php echo $city; ?>"/>
390
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_neighbourhood" name="gd_neighbourhood"
391
+                           value="<?php echo $gd_neighbourhood; ?>"/>
392 392
                 <?php } else { //end of location filter
393 393
                     ?>
394
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/>
394
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="0"/>
395 395
                 <?php }?>
396 396
 
397
-                <input type="hidden" id="<?php echo $map_canvas_name;?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt;?>"/>
397
+                <input type="hidden" id="<?php echo $map_canvas_name; ?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt; ?>"/>
398 398
 
399 399
                 <input type="hidden" name="limitstart" value=""/>
400 400
 
@@ -402,10 +402,10 @@  discard block
 block discarded – undo
402 402
 
403 403
                 <?php if ($geodir_map_options['enable_post_type_filters']) {
404 404
                     $post_types = geodir_get_posttypes('object');
405
-                    if (count((array)($post_types)) > 1) {
405
+                    if (count((array) ($post_types)) > 1) {
406 406
                         ?>
407
-                        <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu"
408
-                             style="max-width:<?php echo $map_width;?>!important;">
407
+                        <div class="map-places-listing" id="<?php echo $map_canvas_name; ?>_posttype_menu"
408
+                             style="max-width:<?php echo $map_width; ?>!important;">
409 409
 
410 410
                             <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
411 411
                             <div class="geodir-map-posttype-list"><?php } ?>
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
                                     foreach ($post_types as $post_type => $args) {
417 417
                                         if (!in_array($post_type, $exclude_post_types)) {
418 418
                                             $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
419
-											echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __($args->labels->name, 'geodirectory') . '</a></li>';
419
+											echo '<li id="'.$post_type.'" '.$class.'><a href="javascript:void(0);" onclick="jQuery(\'#'.$map_canvas_name.'_posttype\').val(\''.$post_type.'\');build_map_ajax_search_param(\''.$map_canvas_name.'\', true)">'.__($args->labels->name, 'geodirectory').'</a></li>';
420 420
                                         }
421 421
                                     }
422 422
                                     ?>
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
         <script type="text/javascript">
442 442
 
443 443
             jQuery(document).ready(function () {
444
-                //initMap('<?php echo $map_canvas_name;?>'); // depreciated, no need to load this twice
445
-                build_map_ajax_search_param('<?php echo $map_canvas_name;?>', false);
446
-                map_sticky('<?php echo $map_canvas_name;?>');
444
+                //initMap('<?php echo $map_canvas_name; ?>'); // depreciated, no need to load this twice
445
+                build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false);
446
+                map_sticky('<?php echo $map_canvas_name; ?>');
447 447
             });
448 448
 
449 449
         </script>
@@ -454,18 +454,18 @@  discard block
 block discarded – undo
454 454
             <script>
455 455
                 (function () {
456 456
                     var screenH = jQuery(window).height();
457
-                    var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']);?>";
457
+                    var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']); ?>";
458 458
 
459 459
                     var ptypeH = '';
460
-                    if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
461
-                        ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
460
+                    if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
461
+                        ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
462 462
                     }
463 463
 
464
-                    jQuery("#sticky_map_<?php echo $map_canvas_name;?>").css("min-height", screenH * (heightVH / 100) + 'px');
465
-                    jQuery("#<?php echo $map_canvas_name;?>_wrapper").height(screenH * (heightVH / 100) + 'px');
466
-                    jQuery("#<?php echo $map_canvas_name;?>").height(screenH * (heightVH / 100) + 'px');
467
-                    jQuery("#<?php echo $map_canvas_name;?>_loading_div").height(screenH * (heightVH / 100) + 'px');
468
-                    jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
464
+                    jQuery("#sticky_map_<?php echo $map_canvas_name; ?>").css("min-height", screenH * (heightVH / 100) + 'px');
465
+                    jQuery("#<?php echo $map_canvas_name; ?>_wrapper").height(screenH * (heightVH / 100) + 'px');
466
+                    jQuery("#<?php echo $map_canvas_name; ?>").height(screenH * (heightVH / 100) + 'px');
467
+                    jQuery("#<?php echo $map_canvas_name; ?>_loading_div").height(screenH * (heightVH / 100) + 'px');
468
+                    jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
469 469
 
470 470
                 }());
471 471
             </script>
@@ -477,13 +477,13 @@  discard block
 block discarded – undo
477 477
             <script>
478 478
                 (function () {
479 479
                     var screenH = jQuery(window).height();
480
-                    var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']);?>";
480
+                    var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']); ?>";
481 481
                     var ptypeH = '';
482
-                    if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
483
-                        ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
482
+                    if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
483
+                        ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
484 484
                     }
485 485
 
486
-                    jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", heightVH - ptypeH + 'px');
486
+                    jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", heightVH - ptypeH + 'px');
487 487
 
488 488
                 }());
489 489
             </script>
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
          * @param array $geodir_map_options Array of map settings.
499 499
          * @param string $map_canvas_name The canvas name and ID for the map.
500 500
          */
501
-        do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
501
+        do_action('geodir_map_after_render', $geodir_map_options, $map_canvas_name);
502 502
 
503 503
 
504 504
     endif; // Exclude posttypes if end
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_input_functions.php 3 patches
Indentation   +709 added lines, -709 removed lines patch added patch discarded remove patch
@@ -19,35 +19,35 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_cfi_fieldset($html,$cf){
21 21
 
22
-    $html_var = $cf['htmlvar_name'];
23
-
24
-    // Check if there is a custom field specific filter.
25
-    if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){
26
-        /**
27
-         * Filter the fieldset html by individual custom field.
28
-         *
29
-         * @param string $html The html to filter.
30
-         * @param array $cf The custom field array.
31
-         * @since 1.6.6
32
-         */
33
-        $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf);
34
-    }
35
-
36
-    // If no html then we run the standard output.
37
-    if(empty($html)) {
38
-
39
-        ob_start(); // Start  buffering;
40
-        ?>
22
+	$html_var = $cf['htmlvar_name'];
23
+
24
+	// Check if there is a custom field specific filter.
25
+	if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){
26
+		/**
27
+		 * Filter the fieldset html by individual custom field.
28
+		 *
29
+		 * @param string $html The html to filter.
30
+		 * @param array $cf The custom field array.
31
+		 * @since 1.6.6
32
+		 */
33
+		$html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf);
34
+	}
35
+
36
+	// If no html then we run the standard output.
37
+	if(empty($html)) {
38
+
39
+		ob_start(); // Start  buffering;
40
+		?>
41 41
         <h5 id="geodir_fieldset_<?php echo (int) $cf['id']; ?>" class="geodir-fieldset-row"
42 42
             gd-fieldset="<?php echo (int) $cf['id']; ?>"><?php echo __( $cf['site_title'], 'geodirectory' ); ?>
43 43
             <?php if ( $cf['desc'] != '' ) {
44
-                echo '<small>( ' . __( $cf['desc'], 'geodirectory' ) . ' )</small>';
45
-            } ?></h5>
44
+				echo '<small>( ' . __( $cf['desc'], 'geodirectory' ) . ' )</small>';
45
+			} ?></h5>
46 46
         <?php
47
-        $html = ob_get_clean();
48
-    }
47
+		$html = ob_get_clean();
48
+	}
49 49
 
50
-    return $html;
50
+	return $html;
51 51
 }
52 52
 add_filter('geodir_custom_field_input_fieldset','geodir_cfi_fieldset',10,2);
53 53
 
@@ -64,47 +64,47 @@  discard block
 block discarded – undo
64 64
  */
65 65
 function geodir_cfi_text($html,$cf){
66 66
 
67
-    $html_var = $cf['htmlvar_name'];
68
-
69
-    // Check if there is a custom field specific filter.
70
-    if(has_filter("geodir_custom_field_input_text_{$html_var}")){
71
-        /**
72
-         * Filter the text html by individual custom field.
73
-         *
74
-         * @param string $html The html to filter.
75
-         * @param array $cf The custom field array.
76
-         * @since 1.6.6
77
-         */
78
-        $html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf);
79
-    }
80
-
81
-    // If no html then we run the standard output.
82
-    if(empty($html)) {
83
-
84
-        ob_start(); // Start  buffering;
85
-
86
-        $value = geodir_get_cf_value($cf);
87
-        $type = $cf['type'];
88
-        //number and float validation $validation_pattern
89
-        if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
-        elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
91
-
92
-        //validation
93
-        if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
94
-            $validation = 'pattern="'.$cf['validation_pattern'].'"';
95
-        }else{$validation='';}
96
-
97
-        // validation message
98
-        if(isset($cf['validation_msg']) && $cf['validation_msg']){
99
-            $validation_msg = 'title="'.$cf['validation_msg'].'"';
100
-        }else{$validation_msg='';}
101
-        ?>
67
+	$html_var = $cf['htmlvar_name'];
68
+
69
+	// Check if there is a custom field specific filter.
70
+	if(has_filter("geodir_custom_field_input_text_{$html_var}")){
71
+		/**
72
+		 * Filter the text html by individual custom field.
73
+		 *
74
+		 * @param string $html The html to filter.
75
+		 * @param array $cf The custom field array.
76
+		 * @since 1.6.6
77
+		 */
78
+		$html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf);
79
+	}
80
+
81
+	// If no html then we run the standard output.
82
+	if(empty($html)) {
83
+
84
+		ob_start(); // Start  buffering;
85
+
86
+		$value = geodir_get_cf_value($cf);
87
+		$type = $cf['type'];
88
+		//number and float validation $validation_pattern
89
+		if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
+		elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
91
+
92
+		//validation
93
+		if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
94
+			$validation = 'pattern="'.$cf['validation_pattern'].'"';
95
+		}else{$validation='';}
96
+
97
+		// validation message
98
+		if(isset($cf['validation_msg']) && $cf['validation_msg']){
99
+			$validation_msg = 'title="'.$cf['validation_msg'].'"';
100
+		}else{$validation_msg='';}
101
+		?>
102 102
 
103 103
         <div id="<?php echo $cf['name'];?>_row"
104 104
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
105 105
             <label>
106 106
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
107
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
107
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
108 108
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
109 109
             </label>
110 110
             <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
         </div>
117 117
 
118 118
         <?php
119
-        $html = ob_get_clean();
120
-    }
119
+		$html = ob_get_clean();
120
+	}
121 121
 
122
-    return $html;
122
+	return $html;
123 123
 }
124 124
 add_filter('geodir_custom_field_input_text','geodir_cfi_text',10,2);
125 125
 
@@ -135,35 +135,35 @@  discard block
 block discarded – undo
135 135
  */
136 136
 function geodir_cfi_email($html,$cf){
137 137
 
138
-    $html_var = $cf['htmlvar_name'];
138
+	$html_var = $cf['htmlvar_name'];
139 139
 
140
-    // Check if there is a custom field specific filter.
141
-    if(has_filter("geodir_custom_field_input_email_{$html_var}")){
142
-        /**
143
-         * Filter the email html by individual custom field.
144
-         *
145
-         * @param string $html The html to filter.
146
-         * @param array $cf The custom field array.
147
-         * @since 1.6.6
148
-         */
149
-        $html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf);
150
-    }
140
+	// Check if there is a custom field specific filter.
141
+	if(has_filter("geodir_custom_field_input_email_{$html_var}")){
142
+		/**
143
+		 * Filter the email html by individual custom field.
144
+		 *
145
+		 * @param string $html The html to filter.
146
+		 * @param array $cf The custom field array.
147
+		 * @since 1.6.6
148
+		 */
149
+		$html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf);
150
+	}
151 151
 
152
-    // If no html then we run the standard output.
153
-    if(empty($html)) {
152
+	// If no html then we run the standard output.
153
+	if(empty($html)) {
154 154
 
155
-        ob_start(); // Start  buffering;
156
-        $value = geodir_get_cf_value($cf);
155
+		ob_start(); // Start  buffering;
156
+		$value = geodir_get_cf_value($cf);
157 157
 
158
-        if ($value == $cf['default']) {
159
-            $value = '';
160
-        }?>
158
+		if ($value == $cf['default']) {
159
+			$value = '';
160
+		}?>
161 161
 
162 162
         <div id="<?php echo $cf['name'];?>_row"
163 163
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
164 164
             <label>
165 165
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
166
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
166
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
167 167
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
168 168
             </label>
169 169
             <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
         </div>
176 176
 
177 177
         <?php
178
-        $html = ob_get_clean();
179
-    }
178
+		$html = ob_get_clean();
179
+	}
180 180
 
181
-    return $html;
181
+	return $html;
182 182
 }
183 183
 add_filter('geodir_custom_field_input_email','geodir_cfi_email',10,2);
184 184
 
@@ -195,35 +195,35 @@  discard block
 block discarded – undo
195 195
  */
196 196
 function geodir_cfi_phone($html,$cf){
197 197
 
198
-    $html_var = $cf['htmlvar_name'];
198
+	$html_var = $cf['htmlvar_name'];
199 199
 
200
-    // Check if there is a custom field specific filter.
201
-    if(has_filter("geodir_custom_field_input_phone_{$html_var}")){
202
-        /**
203
-         * Filter the phone html by individual custom field.
204
-         *
205
-         * @param string $html The html to filter.
206
-         * @param array $cf The custom field array.
207
-         * @since 1.6.6
208
-         */
209
-        $html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf);
210
-    }
200
+	// Check if there is a custom field specific filter.
201
+	if(has_filter("geodir_custom_field_input_phone_{$html_var}")){
202
+		/**
203
+		 * Filter the phone html by individual custom field.
204
+		 *
205
+		 * @param string $html The html to filter.
206
+		 * @param array $cf The custom field array.
207
+		 * @since 1.6.6
208
+		 */
209
+		$html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf);
210
+	}
211 211
 
212
-    // If no html then we run the standard output.
213
-    if(empty($html)) {
212
+	// If no html then we run the standard output.
213
+	if(empty($html)) {
214 214
 
215
-        ob_start(); // Start  buffering;
216
-        $value = geodir_get_cf_value($cf);
215
+		ob_start(); // Start  buffering;
216
+		$value = geodir_get_cf_value($cf);
217 217
 
218
-        if ($value == $cf['default']) {
219
-            $value = '';
220
-        }?>
218
+		if ($value == $cf['default']) {
219
+			$value = '';
220
+		}?>
221 221
 
222 222
         <div id="<?php echo $cf['name'];?>_row"
223 223
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
224 224
             <label>
225 225
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
226
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
226
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
227 227
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
228 228
             </label>
229 229
             <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
         </div>
236 236
 
237 237
         <?php
238
-        $html = ob_get_clean();
239
-    }
238
+		$html = ob_get_clean();
239
+	}
240 240
 
241
-    return $html;
241
+	return $html;
242 242
 }
243 243
 add_filter('geodir_custom_field_input_phone','geodir_cfi_phone',10,2);
244 244
 
@@ -255,35 +255,35 @@  discard block
 block discarded – undo
255 255
  */
256 256
 function geodir_cfi_url($html,$cf){
257 257
 
258
-    $html_var = $cf['htmlvar_name'];
258
+	$html_var = $cf['htmlvar_name'];
259 259
 
260
-    // Check if there is a custom field specific filter.
261
-    if(has_filter("geodir_custom_field_input_url_{$html_var}")){
262
-        /**
263
-         * Filter the url html by individual custom field.
264
-         *
265
-         * @param string $html The html to filter.
266
-         * @param array $cf The custom field array.
267
-         * @since 1.6.6
268
-         */
269
-        $html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf);
270
-    }
260
+	// Check if there is a custom field specific filter.
261
+	if(has_filter("geodir_custom_field_input_url_{$html_var}")){
262
+		/**
263
+		 * Filter the url html by individual custom field.
264
+		 *
265
+		 * @param string $html The html to filter.
266
+		 * @param array $cf The custom field array.
267
+		 * @since 1.6.6
268
+		 */
269
+		$html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf);
270
+	}
271 271
 
272
-    // If no html then we run the standard output.
273
-    if(empty($html)) {
272
+	// If no html then we run the standard output.
273
+	if(empty($html)) {
274 274
 
275
-        ob_start(); // Start  buffering;
276
-        $value = geodir_get_cf_value($cf);
275
+		ob_start(); // Start  buffering;
276
+		$value = geodir_get_cf_value($cf);
277 277
 
278
-        if ($value == $cf['default']) {
279
-            $value = '';
280
-        }?>
278
+		if ($value == $cf['default']) {
279
+			$value = '';
280
+		}?>
281 281
 
282 282
         <div id="<?php echo $cf['name'];?>_row"
283 283
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
284 284
             <label>
285 285
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
286
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
286
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
287 287
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
288 288
             </label>
289 289
             <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
         </div>
299 299
 
300 300
         <?php
301
-        $html = ob_get_clean();
302
-    }
301
+		$html = ob_get_clean();
302
+	}
303 303
 
304
-    return $html;
304
+	return $html;
305 305
 }
306 306
 add_filter('geodir_custom_field_input_url','geodir_cfi_url',10,2);
307 307
 
@@ -317,48 +317,48 @@  discard block
 block discarded – undo
317 317
  */
318 318
 function geodir_cfi_radio($html,$cf){
319 319
 
320
-    $html_var = $cf['htmlvar_name'];
320
+	$html_var = $cf['htmlvar_name'];
321 321
 
322
-    // Check if there is a custom field specific filter.
323
-    if(has_filter("geodir_custom_field_input_radio_{$html_var}")){
324
-        /**
325
-         * Filter the radio html by individual custom field.
326
-         *
327
-         * @param string $html The html to filter.
328
-         * @param array $cf The custom field array.
329
-         * @since 1.6.6
330
-         */
331
-        $html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf);
332
-    }
322
+	// Check if there is a custom field specific filter.
323
+	if(has_filter("geodir_custom_field_input_radio_{$html_var}")){
324
+		/**
325
+		 * Filter the radio html by individual custom field.
326
+		 *
327
+		 * @param string $html The html to filter.
328
+		 * @param array $cf The custom field array.
329
+		 * @since 1.6.6
330
+		 */
331
+		$html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf);
332
+	}
333 333
 
334
-    // If no html then we run the standard output.
335
-    if(empty($html)) {
334
+	// If no html then we run the standard output.
335
+	if(empty($html)) {
336 336
 
337
-        ob_start(); // Start  buffering;
338
-        $value = geodir_get_cf_value($cf);
337
+		ob_start(); // Start  buffering;
338
+		$value = geodir_get_cf_value($cf);
339 339
 
340
-        ?>
340
+		?>
341 341
         <div id="<?php echo $cf['name'];?>_row"
342 342
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
343 343
             <label>
344 344
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
345
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
345
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
346 346
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
347 347
             </label>
348 348
             <?php if ($cf['option_values']) {
349
-                $option_values = geodir_string_values_to_options($cf['option_values'], true);
349
+				$option_values = geodir_string_values_to_options($cf['option_values'], true);
350 350
 
351
-                if (!empty($option_values)) {
352
-                    foreach ($option_values as $option_value) {
353
-                        if (empty($option_value['optgroup'])) {
354
-                            ?>
351
+				if (!empty($option_values)) {
352
+					foreach ($option_values as $option_value) {
353
+						if (empty($option_value['optgroup'])) {
354
+							?>
355 355
                             <span class="gd-radios"><input name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="radio" /><?php echo $option_value['label']; ?></span>
356 356
                             <?php
357
-                        }
358
-                    }
359
-                }
360
-            }
361
-            ?>
357
+						}
358
+					}
359
+				}
360
+			}
361
+			?>
362 362
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
363 363
             <?php if ($cf['is_required']) { ?>
364 364
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
@@ -366,10 +366,10 @@  discard block
 block discarded – undo
366 366
         </div>
367 367
 
368 368
         <?php
369
-        $html = ob_get_clean();
370
-    }
369
+		$html = ob_get_clean();
370
+	}
371 371
 
372
-    return $html;
372
+	return $html;
373 373
 }
374 374
 add_filter('geodir_custom_field_input_radio','geodir_cfi_radio',10,2);
375 375
 
@@ -385,46 +385,46 @@  discard block
 block discarded – undo
385 385
  */
386 386
 function geodir_cfi_checkbox($html,$cf){
387 387
 
388
-    $html_var = $cf['htmlvar_name'];
388
+	$html_var = $cf['htmlvar_name'];
389 389
 
390
-    // Check if there is a custom field specific filter.
391
-    if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){
392
-        /**
393
-         * Filter the checkbox html by individual custom field.
394
-         *
395
-         * @param string $html The html to filter.
396
-         * @param array $cf The custom field array.
397
-         * @since 1.6.6
398
-         */
399
-        $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf);
400
-    }
390
+	// Check if there is a custom field specific filter.
391
+	if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){
392
+		/**
393
+		 * Filter the checkbox html by individual custom field.
394
+		 *
395
+		 * @param string $html The html to filter.
396
+		 * @param array $cf The custom field array.
397
+		 * @since 1.6.6
398
+		 */
399
+		$html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf);
400
+	}
401 401
 
402
-    // If no html then we run the standard output.
403
-    if(empty($html)) {
402
+	// If no html then we run the standard output.
403
+	if(empty($html)) {
404 404
 
405
-        ob_start(); // Start  buffering;
406
-        $value = geodir_get_cf_value($cf);
405
+		ob_start(); // Start  buffering;
406
+		$value = geodir_get_cf_value($cf);
407 407
 
408 408
 
409
-        if ($value == '' && $cf['default']) {
410
-            $value = '1';
411
-        }
412
-        ?>
409
+		if ($value == '' && $cf['default']) {
410
+			$value = '1';
411
+		}
412
+		?>
413 413
 
414 414
         <div id="<?php echo $cf['name'];?>_row"
415 415
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
416 416
             <label>
417 417
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
418
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
418
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
419 419
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
420 420
             </label>
421 421
             <?php if ($value != '1') {
422
-                $value = '0';
423
-            }?>
422
+				$value = '0';
423
+			}?>
424 424
             <input type="hidden" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" value="<?php echo esc_attr($value);?>"/>
425 425
             <input  <?php if ($value == '1') {
426
-                echo 'checked="checked"';
427
-            }?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox"
426
+				echo 'checked="checked"';
427
+			}?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox"
428 428
                  onchange="if(this.checked){jQuery('#<?php echo $cf['name'];?>').val('1');} else{ jQuery('#<?php echo $cf['name'];?>').val('0');}"/>
429 429
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
430 430
             <?php if ($cf['is_required']) { ?>
@@ -433,10 +433,10 @@  discard block
 block discarded – undo
433 433
         </div>
434 434
 
435 435
         <?php
436
-        $html = ob_get_clean();
437
-    }
436
+		$html = ob_get_clean();
437
+	}
438 438
 
439
-    return $html;
439
+	return $html;
440 440
 }
441 441
 add_filter('geodir_custom_field_input_checkbox','geodir_cfi_checkbox',10,2);
442 442
 
@@ -452,52 +452,52 @@  discard block
 block discarded – undo
452 452
  */
453 453
 function geodir_cfi_textarea($html,$cf){
454 454
 
455
-    $html_var = $cf['htmlvar_name'];
455
+	$html_var = $cf['htmlvar_name'];
456 456
 
457
-    // Check if there is a custom field specific filter.
458
-    if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){
459
-        /**
460
-         * Filter the textarea html by individual custom field.
461
-         *
462
-         * @param string $html The html to filter.
463
-         * @param array $cf The custom field array.
464
-         * @since 1.6.6
465
-         */
466
-        $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf);
467
-    }
457
+	// Check if there is a custom field specific filter.
458
+	if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){
459
+		/**
460
+		 * Filter the textarea html by individual custom field.
461
+		 *
462
+		 * @param string $html The html to filter.
463
+		 * @param array $cf The custom field array.
464
+		 * @since 1.6.6
465
+		 */
466
+		$html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf);
467
+	}
468 468
 
469
-    // If no html then we run the standard output.
470
-    if(empty($html)) {
469
+	// If no html then we run the standard output.
470
+	if(empty($html)) {
471 471
 
472
-        ob_start(); // Start  buffering;
473
-        $value = geodir_get_cf_value($cf);
472
+		ob_start(); // Start  buffering;
473
+		$value = geodir_get_cf_value($cf);
474 474
 
475
-        $extra_fields = unserialize($cf['extra_fields']);
476
-        ?>
475
+		$extra_fields = unserialize($cf['extra_fields']);
476
+		?>
477 477
 
478 478
         <div id="<?php echo $cf['name'];?>_row"
479 479
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
480 480
             <label>
481 481
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
482
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
482
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
483 483
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
484 484
             </label><?php
485 485
 
486 486
 
487
-            if (is_array($extra_fields) && in_array('1', $extra_fields)) {
487
+			if (is_array($extra_fields) && in_array('1', $extra_fields)) {
488 488
 
489
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
489
+				$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
490 490
 
491 491
             <div class="editor" field_id="<?php echo $cf['name'];?>" field_type="editor">
492 492
                 <?php wp_editor(stripslashes($value), $cf['name'], $editor_settings); ?>
493 493
                 </div><?php
494 494
 
495
-            } else {
495
+			} else {
496 496
 
497
-                ?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>"
497
+				?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>"
498 498
                             id="<?php echo $cf['name'];?>"><?php echo stripslashes($value);?></textarea><?php
499 499
 
500
-            }?>
500
+			}?>
501 501
 
502 502
 
503 503
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
@@ -507,10 +507,10 @@  discard block
 block discarded – undo
507 507
         </div>
508 508
 
509 509
         <?php
510
-        $html = ob_get_clean();
511
-    }
510
+		$html = ob_get_clean();
511
+	}
512 512
 
513
-    return $html;
513
+	return $html;
514 514
 }
515 515
 add_filter('geodir_custom_field_input_textarea','geodir_cfi_textarea',10,2);
516 516
 
@@ -526,53 +526,53 @@  discard block
 block discarded – undo
526 526
  */
527 527
 function geodir_cfi_select($html,$cf){
528 528
 
529
-    $html_var = $cf['htmlvar_name'];
529
+	$html_var = $cf['htmlvar_name'];
530 530
 
531
-    // Check if there is a custom field specific filter.
532
-    if(has_filter("geodir_custom_field_input_select_{$html_var}")){
533
-        /**
534
-         * Filter the select html by individual custom field.
535
-         *
536
-         * @param string $html The html to filter.
537
-         * @param array $cf The custom field array.
538
-         * @since 1.6.6
539
-         */
540
-        $html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf);
541
-    }
531
+	// Check if there is a custom field specific filter.
532
+	if(has_filter("geodir_custom_field_input_select_{$html_var}")){
533
+		/**
534
+		 * Filter the select html by individual custom field.
535
+		 *
536
+		 * @param string $html The html to filter.
537
+		 * @param array $cf The custom field array.
538
+		 * @since 1.6.6
539
+		 */
540
+		$html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf);
541
+	}
542 542
 
543
-    // If no html then we run the standard output.
544
-    if(empty($html)) {
543
+	// If no html then we run the standard output.
544
+	if(empty($html)) {
545 545
 
546
-        ob_start(); // Start  buffering;
547
-        $value = geodir_get_cf_value($cf);
546
+		ob_start(); // Start  buffering;
547
+		$value = geodir_get_cf_value($cf);
548 548
 
549
-        ?>
549
+		?>
550 550
         <div id="<?php echo $cf['name'];?>_row"
551 551
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
552 552
             <label>
553 553
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
554
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
554
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
555 555
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
556 556
             </label>
557 557
             <?php
558
-            $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
559
-            $select_options = '';
560
-            if (!empty($option_values_arr)) {
561
-                foreach ($option_values_arr as $option_row) {
562
-                    if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
563
-                        $option_label = isset($option_row['label']) ? $option_row['label'] : '';
564
-
565
-                        $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
566
-                    } else {
567
-                        $option_label = isset($option_row['label']) ? $option_row['label'] : '';
568
-                        $option_value = isset($option_row['value']) ? $option_row['value'] : '';
569
-                        $selected = $option_value == $value ? 'selected="selected"' : '';
570
-
571
-                        $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
572
-                    }
573
-                }
574
-            }
575
-            ?>
558
+			$option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
559
+			$select_options = '';
560
+			if (!empty($option_values_arr)) {
561
+				foreach ($option_values_arr as $option_row) {
562
+					if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
563
+						$option_label = isset($option_row['label']) ? $option_row['label'] : '';
564
+
565
+						$select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
566
+					} else {
567
+						$option_label = isset($option_row['label']) ? $option_row['label'] : '';
568
+						$option_value = isset($option_row['value']) ? $option_row['value'] : '';
569
+						$selected = $option_value == $value ? 'selected="selected"' : '';
570
+
571
+						$select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
572
+					}
573
+				}
574
+			}
575
+			?>
576 576
             <select field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
577 577
                     class="geodir_textfield textfield_x chosen_select"
578 578
                     data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '&hellip;';?>"
@@ -584,10 +584,10 @@  discard block
 block discarded – undo
584 584
         </div>
585 585
 
586 586
         <?php
587
-        $html = ob_get_clean();
588
-    }
587
+		$html = ob_get_clean();
588
+	}
589 589
 
590
-    return $html;
590
+	return $html;
591 591
 }
592 592
 add_filter('geodir_custom_field_input_select','geodir_cfi_select',10,2);
593 593
 
@@ -603,36 +603,36 @@  discard block
 block discarded – undo
603 603
  */
604 604
 function geodir_cfi_multiselect($html,$cf){
605 605
 
606
-    $html_var = $cf['htmlvar_name'];
607
-
608
-    // Check if there is a custom field specific filter.
609
-    if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){
610
-        /**
611
-         * Filter the multiselect html by individual custom field.
612
-         *
613
-         * @param string $html The html to filter.
614
-         * @param array $cf The custom field array.
615
-         * @since 1.6.6
616
-         */
617
-        $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf);
618
-    }
619
-
620
-    // If no html then we run the standard output.
621
-    if(empty($html)) {
622
-
623
-        ob_start(); // Start  buffering;
624
-        $value = geodir_get_cf_value($cf);
625
-
626
-        $multi_display = 'select';
627
-        if (!empty($cf['extra_fields'])) {
628
-            $multi_display = unserialize($cf['extra_fields']);
629
-        }
630
-        ?>
606
+	$html_var = $cf['htmlvar_name'];
607
+
608
+	// Check if there is a custom field specific filter.
609
+	if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){
610
+		/**
611
+		 * Filter the multiselect html by individual custom field.
612
+		 *
613
+		 * @param string $html The html to filter.
614
+		 * @param array $cf The custom field array.
615
+		 * @since 1.6.6
616
+		 */
617
+		$html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf);
618
+	}
619
+
620
+	// If no html then we run the standard output.
621
+	if(empty($html)) {
622
+
623
+		ob_start(); // Start  buffering;
624
+		$value = geodir_get_cf_value($cf);
625
+
626
+		$multi_display = 'select';
627
+		if (!empty($cf['extra_fields'])) {
628
+			$multi_display = unserialize($cf['extra_fields']);
629
+		}
630
+		?>
631 631
         <div id="<?php echo $cf['name']; ?>_row"
632 632
              class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
633 633
             <label>
634 634
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
635
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
635
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
636 636
                 <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
637 637
             </label>
638 638
             <input type="hidden" name="gd_field_<?php echo $cf['name']; ?>" value="1"/>
@@ -643,61 +643,61 @@  discard block
 block discarded – undo
643 643
                         data-placeholder="<?php _e('Select', 'geodirectory'); ?>"
644 644
                         option-ajaxchosen="false">
645 645
                     <?php
646
-                    } else {
647
-                        echo '<ul class="gd_multi_choice">';
648
-                    }
649
-
650
-                    $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
651
-                    $select_options = '';
652
-                    if (!empty($option_values_arr)) {
653
-                        foreach ($option_values_arr as $option_row) {
654
-                            if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
655
-                                $option_label = isset($option_row['label']) ? $option_row['label'] : '';
656
-
657
-                                if ($multi_display == 'select') {
658
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
659
-                                } else {
660
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
661
-                                }
662
-                            } else {
663
-                                if (!is_array($value) && $value != '') {
664
-                                    $value = trim($value);
665
-                                }
646
+					} else {
647
+						echo '<ul class="gd_multi_choice">';
648
+					}
649
+
650
+					$option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
651
+					$select_options = '';
652
+					if (!empty($option_values_arr)) {
653
+						foreach ($option_values_arr as $option_row) {
654
+							if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
655
+								$option_label = isset($option_row['label']) ? $option_row['label'] : '';
656
+
657
+								if ($multi_display == 'select') {
658
+									$select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
659
+								} else {
660
+									$select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
661
+								}
662
+							} else {
663
+								if (!is_array($value) && $value != '') {
664
+									$value = trim($value);
665
+								}
666 666
                                 
667
-                                $option_label = isset($option_row['label']) ? $option_row['label'] : '';
668
-                                $option_value = isset($option_row['value']) ? $option_row['value'] : '';
669
-                                $selected = $option_value == $value ? 'selected="selected"' : '';
670
-                                $selected = '';
671
-                                $checked = '';
672
-
673
-                                if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) {
674
-                                    if (!is_array($value)) {
675
-                                        $value_array = explode(',', $value);
676
-                                    } else {
677
-                                        $value_array = $value;
678
-                                    }
679
-
680
-                                    if (is_array($value_array)) {
681
-                                        $value_array = array_map('trim', $value_array);
667
+								$option_label = isset($option_row['label']) ? $option_row['label'] : '';
668
+								$option_value = isset($option_row['value']) ? $option_row['value'] : '';
669
+								$selected = $option_value == $value ? 'selected="selected"' : '';
670
+								$selected = '';
671
+								$checked = '';
672
+
673
+								if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) {
674
+									if (!is_array($value)) {
675
+										$value_array = explode(',', $value);
676
+									} else {
677
+										$value_array = $value;
678
+									}
679
+
680
+									if (is_array($value_array)) {
681
+										$value_array = array_map('trim', $value_array);
682 682
                                         
683
-                                        if (in_array($option_value, $value_array)) {
684
-                                            $selected = 'selected="selected"';
685
-                                            $checked = 'checked="checked"';
686
-                                        }
687
-                                    }
688
-                                }
689
-
690
-                                if ($multi_display == 'select') {
691
-                                    $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
692
-                                } else {
693
-                                    $select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
694
-                                }
695
-                            }
696
-                        }
697
-                    }
698
-                    echo $select_options;
699
-
700
-                    if ($multi_display == 'select') { ?></select></div>
683
+										if (in_array($option_value, $value_array)) {
684
+											$selected = 'selected="selected"';
685
+											$checked = 'checked="checked"';
686
+										}
687
+									}
688
+								}
689
+
690
+								if ($multi_display == 'select') {
691
+									$select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
692
+								} else {
693
+									$select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
694
+								}
695
+							}
696
+						}
697
+					}
698
+					echo $select_options;
699
+
700
+					if ($multi_display == 'select') { ?></select></div>
701 701
         <?php } else { ?></ul><?php } ?>
702 702
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
703 703
             <?php if ($cf['is_required']) { ?>
@@ -705,10 +705,10 @@  discard block
 block discarded – undo
705 705
             <?php } ?>
706 706
         </div>
707 707
         <?php
708
-        $html = ob_get_clean();
709
-    }
708
+		$html = ob_get_clean();
709
+	}
710 710
 
711
-    return $html;
711
+	return $html;
712 712
 }
713 713
 add_filter('geodir_custom_field_input_multiselect','geodir_cfi_multiselect',10,2);
714 714
 
@@ -724,32 +724,32 @@  discard block
 block discarded – undo
724 724
  */
725 725
 function geodir_cfi_html($html,$cf){
726 726
 
727
-    $html_var = $cf['htmlvar_name'];
727
+	$html_var = $cf['htmlvar_name'];
728 728
 
729
-    // Check if there is a custom field specific filter.
730
-    if(has_filter("geodir_custom_field_input_html_{$html_var}")){
731
-        /**
732
-         * Filter the html html by individual custom field.
733
-         *
734
-         * @param string $html The html to filter.
735
-         * @param array $cf The custom field array.
736
-         * @since 1.6.6
737
-         */
738
-        $html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf);
739
-    }
729
+	// Check if there is a custom field specific filter.
730
+	if(has_filter("geodir_custom_field_input_html_{$html_var}")){
731
+		/**
732
+		 * Filter the html html by individual custom field.
733
+		 *
734
+		 * @param string $html The html to filter.
735
+		 * @param array $cf The custom field array.
736
+		 * @since 1.6.6
737
+		 */
738
+		$html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf);
739
+	}
740 740
 
741
-    // If no html then we run the standard output.
742
-    if(empty($html)) {
741
+	// If no html then we run the standard output.
742
+	if(empty($html)) {
743 743
 
744
-        ob_start(); // Start  buffering;
745
-        $value = geodir_get_cf_value($cf);
746
-        ?>
744
+		ob_start(); // Start  buffering;
745
+		$value = geodir_get_cf_value($cf);
746
+		?>
747 747
 
748 748
         <div id="<?php echo $cf['name']; ?>_row"
749 749
              class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
750 750
             <label>
751 751
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
752
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
752
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
753 753
                 <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
754 754
             </label>
755 755
 
@@ -767,10 +767,10 @@  discard block
 block discarded – undo
767 767
         </div>
768 768
 
769 769
         <?php
770
-        $html = ob_get_clean();
771
-    }
770
+		$html = ob_get_clean();
771
+	}
772 772
 
773
-    return $html;
773
+	return $html;
774 774
 }
775 775
 add_filter('geodir_custom_field_input_html','geodir_cfi_html',10,2);
776 776
 
@@ -787,68 +787,68 @@  discard block
 block discarded – undo
787 787
  */
788 788
 function geodir_cfi_datepicker($html,$cf){
789 789
 
790
-    $html_var = $cf['htmlvar_name'];
790
+	$html_var = $cf['htmlvar_name'];
791 791
 
792
-    // Check if there is a custom field specific filter.
793
-    if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){
794
-        /**
795
-         * Filter the datepicker html by individual custom field.
796
-         *
797
-         * @param string $html The html to filter.
798
-         * @param array $cf The custom field array.
799
-         * @since 1.6.6
800
-         */
801
-        $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf);
802
-    }
792
+	// Check if there is a custom field specific filter.
793
+	if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){
794
+		/**
795
+		 * Filter the datepicker html by individual custom field.
796
+		 *
797
+		 * @param string $html The html to filter.
798
+		 * @param array $cf The custom field array.
799
+		 * @since 1.6.6
800
+		 */
801
+		$html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf);
802
+	}
803 803
 
804
-    // If no html then we run the standard output.
805
-    if(empty($html)) {
804
+	// If no html then we run the standard output.
805
+	if(empty($html)) {
806 806
 
807
-        ob_start(); // Start  buffering;
808
-        $value = geodir_get_cf_value($cf);
807
+		ob_start(); // Start  buffering;
808
+		$value = geodir_get_cf_value($cf);
809 809
 
810
-        $extra_fields = unserialize($cf['extra_fields']);
811
-        $name = $cf['name'];
810
+		$extra_fields = unserialize($cf['extra_fields']);
811
+		$name = $cf['name'];
812 812
 
813
-        if ($extra_fields['date_format'] == '')
814
-            $extra_fields['date_format'] = 'yy-mm-dd';
813
+		if ($extra_fields['date_format'] == '')
814
+			$extra_fields['date_format'] = 'yy-mm-dd';
815 815
 
816
-        $date_format = $extra_fields['date_format'];
817
-        $jquery_date_format  = $date_format;
816
+		$date_format = $extra_fields['date_format'];
817
+		$jquery_date_format  = $date_format;
818 818
 
819 819
 
820
-        // check if we need to change the format or not
821
-        $date_format_len = strlen(str_replace(' ', '', $date_format));
822
-        if($date_format_len>5){// if greater then 5 then it's the old style format.
820
+		// check if we need to change the format or not
821
+		$date_format_len = strlen(str_replace(' ', '', $date_format));
822
+		if($date_format_len>5){// if greater then 5 then it's the old style format.
823 823
 
824
-            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
825
-            $replace = array('d','j','l','m','n','F','Y');//PHP date format
824
+			$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
825
+			$replace = array('d','j','l','m','n','F','Y');//PHP date format
826 826
 
827
-            $date_format = str_replace($search, $replace, $date_format);
828
-        }else{
829
-            $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
830
-        }
827
+			$date_format = str_replace($search, $replace, $date_format);
828
+		}else{
829
+			$jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
830
+		}
831 831
 
832
-        if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
833
-        if($value && !isset($_REQUEST['backandedit'])) {
834
-            //$time = strtotime($value);
835
-            //$value = date_i18n($date_format, $time);
836
-        }
837
-        $value = geodir_date($value, 'Y-m-d', $date_format);
832
+		if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
833
+		if($value && !isset($_REQUEST['backandedit'])) {
834
+			//$time = strtotime($value);
835
+			//$value = date_i18n($date_format, $time);
836
+		}
837
+		$value = geodir_date($value, 'Y-m-d', $date_format);
838 838
 
839
-        ?>
839
+		?>
840 840
         <script type="text/javascript">
841 841
 
842 842
             jQuery(function () {
843 843
 
844 844
                 jQuery("#<?php echo $cf['name'];?>").datepicker({changeMonth: true, changeYear: true <?php
845
-                    /**
846
-                     * Used to add extra option to datepicker per custom field.
847
-                     *
848
-                     * @since 1.5.7
849
-                     * @param string $name The custom field name.
850
-                     */
851
-                    echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
845
+					/**
846
+					 * Used to add extra option to datepicker per custom field.
847
+					 *
848
+					 * @since 1.5.7
849
+					 * @param string $name The custom field name.
850
+					 */
851
+					echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
852 852
 
853 853
                 jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format;?>');
854 854
 
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
             <label>
865 865
 
866 866
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
867
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
867
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
868 868
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
869 869
             </label>
870 870
 
@@ -878,10 +878,10 @@  discard block
 block discarded – undo
878 878
         </div>
879 879
 
880 880
         <?php
881
-        $html = ob_get_clean();
882
-    }
881
+		$html = ob_get_clean();
882
+	}
883 883
 
884
-    return $html;
884
+	return $html;
885 885
 }
886 886
 add_filter('geodir_custom_field_input_datepicker','geodir_cfi_datepicker',10,2);
887 887
 
@@ -897,31 +897,31 @@  discard block
 block discarded – undo
897 897
  */
898 898
 function geodir_cfi_time($html,$cf){
899 899
 
900
-    $html_var = $cf['htmlvar_name'];
900
+	$html_var = $cf['htmlvar_name'];
901 901
 
902
-    // Check if there is a custom field specific filter.
903
-    if(has_filter("geodir_custom_field_input_time_{$html_var}")){
904
-        /**
905
-         * Filter the time html by individual custom field.
906
-         *
907
-         * @param string $html The html to filter.
908
-         * @param array $cf The custom field array.
909
-         * @since 1.6.6
910
-         */
911
-        $html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf);
912
-    }
902
+	// Check if there is a custom field specific filter.
903
+	if(has_filter("geodir_custom_field_input_time_{$html_var}")){
904
+		/**
905
+		 * Filter the time html by individual custom field.
906
+		 *
907
+		 * @param string $html The html to filter.
908
+		 * @param array $cf The custom field array.
909
+		 * @since 1.6.6
910
+		 */
911
+		$html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf);
912
+	}
913 913
 
914
-    // If no html then we run the standard output.
915
-    if(empty($html)) {
914
+	// If no html then we run the standard output.
915
+	if(empty($html)) {
916 916
 
917
-        ob_start(); // Start  buffering;
918
-        $value = geodir_get_cf_value($cf);
917
+		ob_start(); // Start  buffering;
918
+		$value = geodir_get_cf_value($cf);
919 919
 
920
-        $name = $cf['name'];
920
+		$name = $cf['name'];
921 921
 
922
-        if ($value != '')
923
-            $value = date('H:i', strtotime($value));
924
-        ?>
922
+		if ($value != '')
923
+			$value = date('H:i', strtotime($value));
924
+		?>
925 925
         <script type="text/javascript">
926 926
             jQuery(document).ready(function () {
927 927
 
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
             <label>
938 938
 
939 939
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
940
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
940
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
941 941
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
942 942
             </label>
943 943
             <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>"
@@ -949,10 +949,10 @@  discard block
 block discarded – undo
949 949
             <?php } ?>
950 950
         </div>
951 951
         <?php
952
-        $html = ob_get_clean();
953
-    }
952
+		$html = ob_get_clean();
953
+	}
954 954
 
955
-    return $html;
955
+	return $html;
956 956
 }
957 957
 add_filter('geodir_custom_field_input_time','geodir_cfi_time',10,2);
958 958
 
@@ -968,100 +968,100 @@  discard block
 block discarded – undo
968 968
  */
969 969
 function geodir_cfi_address($html,$cf){
970 970
 
971
-    $html_var = $cf['htmlvar_name'];
972
-
973
-    // Check if there is a custom field specific filter.
974
-    if(has_filter("geodir_custom_field_input_address_{$html_var}")){
975
-        /**
976
-         * Filter the address html by individual custom field.
977
-         *
978
-         * @param string $html The html to filter.
979
-         * @param array $cf The custom field array.
980
-         * @since 1.6.6
981
-         */
982
-        $html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf);
983
-    }
984
-
985
-    // If no html then we run the standard output.
986
-    if(empty($html)) {
987
-
988
-        global $gd_session;
989
-        ob_start(); // Start  buffering;
990
-        $value = geodir_get_cf_value($cf);
991
-        $name = $cf['name'];
992
-        $type = $cf['type'];
993
-        $admin_desc = $cf['desc'];
994
-        $is_required = $cf['is_required'];
995
-        $required_msg = $cf['required_msg'];
996
-        $site_title = $cf['site_title'];
997
-        $is_admin = $cf['is_admin'];
998
-        $extra_fields = stripslashes_deep(unserialize($cf['extra_fields']));
999
-        $prefix = $name . '_';
1000
-
1001
-        ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
1002
-        ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
1003
-        ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
1004
-        ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
1005
-
1006
-        $address = '';
1007
-        $zip = '';
1008
-        $mapview = '';
1009
-        $mapzoom = '';
1010
-        $lat = '';
1011
-        $lng = '';
1012
-
1013
-        if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1014
-            $post = $gd_ses_listing;
1015
-            $address = $post[$prefix . 'address'];
1016
-            $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1017
-            $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1018
-            $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1019
-            $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1020
-            $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1021
-        } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1022
-            $post_info = (array)$post_info;
1023
-
1024
-            $address = $post_info[$prefix . 'address'];
1025
-            $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1026
-            $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1027
-            $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1028
-            $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1029
-            $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1030
-        }
1031
-
1032
-        $location = geodir_get_default_location();
1033
-        if (empty($city)) $city = isset($location->city) ? $location->city : '';
1034
-        if (empty($region)) $region = isset($location->region) ? $location->region : '';
1035
-        if (empty($country)) $country = isset($location->country) ? $location->country : '';
1036
-
1037
-        $lat_lng_blank = false;
1038
-        if (empty($lat) && empty($lng)) {
1039
-            $lat_lng_blank = true;
1040
-        }
1041
-
1042
-        if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1043
-        if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1044
-
1045
-        /**
1046
-         * Filter the default latitude.
1047
-         *
1048
-         * @since 1.0.0
1049
-         *
1050
-         * @param float $lat Default latitude.
1051
-         * @param bool $is_admin For admin use only?.
1052
-         */
1053
-        $lat = apply_filters('geodir_default_latitude', $lat, $is_admin);
1054
-        /**
1055
-         * Filter the default longitude.
1056
-         *
1057
-         * @since 1.0.0
1058
-         *
1059
-         * @param float $lat Default longitude.
1060
-         * @param bool $is_admin For admin use only?.
1061
-         */
1062
-        $lng = apply_filters('geodir_default_longitude', $lng, $is_admin);
1063
-
1064
-        ?>
971
+	$html_var = $cf['htmlvar_name'];
972
+
973
+	// Check if there is a custom field specific filter.
974
+	if(has_filter("geodir_custom_field_input_address_{$html_var}")){
975
+		/**
976
+		 * Filter the address html by individual custom field.
977
+		 *
978
+		 * @param string $html The html to filter.
979
+		 * @param array $cf The custom field array.
980
+		 * @since 1.6.6
981
+		 */
982
+		$html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf);
983
+	}
984
+
985
+	// If no html then we run the standard output.
986
+	if(empty($html)) {
987
+
988
+		global $gd_session;
989
+		ob_start(); // Start  buffering;
990
+		$value = geodir_get_cf_value($cf);
991
+		$name = $cf['name'];
992
+		$type = $cf['type'];
993
+		$admin_desc = $cf['desc'];
994
+		$is_required = $cf['is_required'];
995
+		$required_msg = $cf['required_msg'];
996
+		$site_title = $cf['site_title'];
997
+		$is_admin = $cf['is_admin'];
998
+		$extra_fields = stripslashes_deep(unserialize($cf['extra_fields']));
999
+		$prefix = $name . '_';
1000
+
1001
+		($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
1002
+		($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
1003
+		($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
1004
+		($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
1005
+
1006
+		$address = '';
1007
+		$zip = '';
1008
+		$mapview = '';
1009
+		$mapzoom = '';
1010
+		$lat = '';
1011
+		$lng = '';
1012
+
1013
+		if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1014
+			$post = $gd_ses_listing;
1015
+			$address = $post[$prefix . 'address'];
1016
+			$zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1017
+			$lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1018
+			$lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1019
+			$mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1020
+			$mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1021
+		} else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1022
+			$post_info = (array)$post_info;
1023
+
1024
+			$address = $post_info[$prefix . 'address'];
1025
+			$zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1026
+			$lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1027
+			$lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1028
+			$mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1029
+			$mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1030
+		}
1031
+
1032
+		$location = geodir_get_default_location();
1033
+		if (empty($city)) $city = isset($location->city) ? $location->city : '';
1034
+		if (empty($region)) $region = isset($location->region) ? $location->region : '';
1035
+		if (empty($country)) $country = isset($location->country) ? $location->country : '';
1036
+
1037
+		$lat_lng_blank = false;
1038
+		if (empty($lat) && empty($lng)) {
1039
+			$lat_lng_blank = true;
1040
+		}
1041
+
1042
+		if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1043
+		if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1044
+
1045
+		/**
1046
+		 * Filter the default latitude.
1047
+		 *
1048
+		 * @since 1.0.0
1049
+		 *
1050
+		 * @param float $lat Default latitude.
1051
+		 * @param bool $is_admin For admin use only?.
1052
+		 */
1053
+		$lat = apply_filters('geodir_default_latitude', $lat, $is_admin);
1054
+		/**
1055
+		 * Filter the default longitude.
1056
+		 *
1057
+		 * @since 1.0.0
1058
+		 *
1059
+		 * @param float $lat Default longitude.
1060
+		 * @param bool $is_admin For admin use only?.
1061
+		 */
1062
+		$lng = apply_filters('geodir_default_longitude', $lng, $is_admin);
1063
+
1064
+		?>
1065 1065
 
1066 1066
         <div id="geodir_<?php echo $prefix . 'address';?>_row"
1067 1067
              class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
@@ -1080,17 +1080,17 @@  discard block
 block discarded – undo
1080 1080
 
1081 1081
 
1082 1082
         <?php
1083
-        /**
1084
-         * Called after the address input on the add listings.
1085
-         *
1086
-         * This is used by the location manage to add further locations info etc.
1087
-         *
1088
-         * @since 1.0.0
1089
-         * @param array $cf The array of setting for the custom field. {@see geodir_custom_field_save()}.
1090
-         */
1091
-        do_action('geodir_address_extra_listing_fields', $cf);
1092
-
1093
-        if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1083
+		/**
1084
+		 * Called after the address input on the add listings.
1085
+		 *
1086
+		 * This is used by the location manage to add further locations info etc.
1087
+		 *
1088
+		 * @since 1.0.0
1089
+		 * @param array $cf The array of setting for the custom field. {@see geodir_custom_field_save()}.
1090
+		 */
1091
+		do_action('geodir_address_extra_listing_fields', $cf);
1092
+
1093
+		if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1094 1094
 
1095 1095
             <div id="geodir_<?php echo $prefix . 'zip'; ?>_row"
1096 1096
                  class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix gd-fieldset-details">
@@ -1111,22 +1111,22 @@  discard block
 block discarded – undo
1111 1111
 
1112 1112
             <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1113 1113
                 <?php
1114
-                /**
1115
-                 * Contains add listing page map functions.
1116
-                 *
1117
-                 * @since 1.0.0
1118
-                 */
1119
-                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1120
-                if ($lat_lng_blank) {
1121
-                    $lat = '';
1122
-                    $lng = '';
1123
-                }
1124
-                ?>
1114
+				/**
1115
+				 * Contains add listing page map functions.
1116
+				 *
1117
+				 * @since 1.0.0
1118
+				 */
1119
+				include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1120
+				if ($lat_lng_blank) {
1121
+					$lat = '';
1122
+					$lng = '';
1123
+				}
1124
+				?>
1125 1125
                 <span class="geodir_message_note"><?php echo stripslashes(GET_MAP_MSG); ?></span>
1126 1126
             </div>
1127 1127
             <?php
1128
-            /* show lat lng */
1129
-            $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1128
+			/* show lat lng */
1129
+			$style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1130 1130
             <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1131 1131
                  class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1132 1132
                 <label>
@@ -1167,27 +1167,27 @@  discard block
 block discarded – undo
1167 1167
                                                             class="gd-checkbox"
1168 1168
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1169 1169
                                                             id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
1170
-                            echo 'checked="checked"';
1171
-                        } ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1170
+							echo 'checked="checked"';
1171
+						} ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1172 1172
                     <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio"
1173 1173
                                                              class="gd-checkbox"
1174 1174
                                                              name="<?php echo $prefix . 'mapview'; ?>"
1175 1175
                                                              id="map_view1" <?php if ($mapview == 'SATELLITE') {
1176
-                            echo 'checked="checked"';
1177
-                        } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1176
+							echo 'checked="checked"';
1177
+						} ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1178 1178
 
1179 1179
                     <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1180 1180
                                                             class="gd-checkbox"
1181 1181
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1182 1182
                                                             id="map_view2" <?php if ($mapview == 'HYBRID') {
1183
-                            echo 'checked="checked"';
1184
-                        } ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1183
+							echo 'checked="checked"';
1184
+						} ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1185 1185
 					<span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1186 1186
                                                             class="gd-checkbox"
1187 1187
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1188 1188
                                                             id="map_view3" <?php if ($mapview == 'TERRAIN') {
1189
-                            echo 'checked="checked"';
1190
-                        } ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
1189
+							echo 'checked="checked"';
1190
+						} ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
1191 1191
 
1192 1192
 
1193 1193
             </div>
@@ -1195,14 +1195,14 @@  discard block
 block discarded – undo
1195 1195
 
1196 1196
         <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?>
1197 1197
             <input type="hidden" value="<?php if (isset($mapzoom)) {
1198
-                echo esc_attr($mapzoom);
1199
-            } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1198
+				echo esc_attr($mapzoom);
1199
+			} ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1200 1200
         <?php }
1201 1201
 
1202
-        $html = ob_get_clean();
1203
-    }
1202
+		$html = ob_get_clean();
1203
+	}
1204 1204
 
1205
-    return $html;
1205
+	return $html;
1206 1206
 }
1207 1207
 add_filter('geodir_custom_field_input_address','geodir_cfi_address',10,2);
1208 1208
 
@@ -1219,137 +1219,137 @@  discard block
 block discarded – undo
1219 1219
  */
1220 1220
 function geodir_cfi_taxonomy($html,$cf){
1221 1221
 
1222
-    $html_var = $cf['htmlvar_name'];
1223
-
1224
-    // Check if there is a custom field specific filter.
1225
-    if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){
1226
-        /**
1227
-         * Filter the taxonomy html by individual custom field.
1228
-         *
1229
-         * @param string $html The html to filter.
1230
-         * @param array $cf The custom field array.
1231
-         * @since 1.6.6
1232
-         */
1233
-        $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf);
1234
-    }
1235
-
1236
-    // If no html then we run the standard output.
1237
-    if(empty($html)) {
1238
-
1239
-        ob_start(); // Start  buffering;
1240
-        $value = geodir_get_cf_value($cf);
1241
-
1242
-        $name = $cf['name'];
1243
-        $site_title = $cf['site_title'];
1244
-        $admin_desc = $cf['desc'];
1245
-        $is_required = $cf['is_required'];
1246
-        $is_admin = $cf['is_admin'];
1247
-        $required_msg = $cf['required_msg'];
1248
-
1249
-        if ($value == $cf['default']) {
1250
-            $value = '';
1251
-        } ?>
1222
+	$html_var = $cf['htmlvar_name'];
1223
+
1224
+	// Check if there is a custom field specific filter.
1225
+	if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){
1226
+		/**
1227
+		 * Filter the taxonomy html by individual custom field.
1228
+		 *
1229
+		 * @param string $html The html to filter.
1230
+		 * @param array $cf The custom field array.
1231
+		 * @since 1.6.6
1232
+		 */
1233
+		$html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf);
1234
+	}
1235
+
1236
+	// If no html then we run the standard output.
1237
+	if(empty($html)) {
1238
+
1239
+		ob_start(); // Start  buffering;
1240
+		$value = geodir_get_cf_value($cf);
1241
+
1242
+		$name = $cf['name'];
1243
+		$site_title = $cf['site_title'];
1244
+		$admin_desc = $cf['desc'];
1245
+		$is_required = $cf['is_required'];
1246
+		$is_admin = $cf['is_admin'];
1247
+		$required_msg = $cf['required_msg'];
1248
+
1249
+		if ($value == $cf['default']) {
1250
+			$value = '';
1251
+		} ?>
1252 1252
         <div id="<?php echo $name;?>_row"
1253 1253
              class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1254 1254
             <label>
1255 1255
                 <?php $site_title = __($site_title, 'geodirectory');
1256
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1256
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1257 1257
                 <?php if ($is_required) echo '<span>*</span>';?>
1258 1258
             </label>
1259 1259
 
1260 1260
             <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1261 1261
                 <?php
1262
-                global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1262
+				global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1263 1263
 
1264
-                $exclude_cats = array();
1264
+				$exclude_cats = array();
1265 1265
 
1266
-                if ($is_admin == '1') {
1266
+				if ($is_admin == '1') {
1267 1267
 
1268
-                    $post_type = get_post_type();
1268
+					$post_type = get_post_type();
1269 1269
 
1270
-                    $package_info = array();
1270
+					$package_info = array();
1271 1271
 
1272
-                    $package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1272
+					$package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1273 1273
 
1274
-                    if (!empty($package_info)) {
1274
+					if (!empty($package_info)) {
1275 1275
 
1276
-                        if (isset($package_info['cat']) && $package_info['cat'] != '') {
1276
+						if (isset($package_info['cat']) && $package_info['cat'] != '') {
1277 1277
 
1278
-                            $exclude_cats = explode(',', $package_info['cat']);
1278
+							$exclude_cats = explode(',', $package_info['cat']);
1279 1279
 
1280
-                        }
1281
-                    }
1282
-                }
1280
+						}
1281
+					}
1282
+				}
1283 1283
 
1284
-                $cat_display = unserialize($cf['extra_fields']);
1284
+				$cat_display = unserialize($cf['extra_fields']);
1285 1285
 
1286
-                if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) {
1286
+				if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) {
1287 1287
 
1288
-                    $post_cat = implode(",", $post_cat[$name]);
1288
+					$post_cat = implode(",", $post_cat[$name]);
1289 1289
 
1290
-                } else {
1291
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1292
-                        $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1293
-                }
1290
+				} else {
1291
+					if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1292
+						$post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1293
+				}
1294 1294
 
1295 1295
 
1296
-                global $geodir_addon_list;
1297
-                if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1296
+				global $geodir_addon_list;
1297
+				if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1298 1298
 
1299
-                    $catadd_limit = $wpdb->get_var(
1300
-                        $wpdb->prepare(
1301
-                            "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1302
-                            array($package_id)
1303
-                        )
1304
-                    );
1299
+					$catadd_limit = $wpdb->get_var(
1300
+						$wpdb->prepare(
1301
+							"SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1302
+							array($package_id)
1303
+						)
1304
+					);
1305 1305
 
1306 1306
 
1307
-                } else {
1308
-                    $catadd_limit = 0;
1309
-                }
1307
+				} else {
1308
+					$catadd_limit = 0;
1309
+				}
1310 1310
 
1311 1311
 
1312
-                if ($cat_display != '' && $cat_display != 'ajax_chained') {
1312
+				if ($cat_display != '' && $cat_display != 'ajax_chained') {
1313 1313
 
1314
-                    $required_limit_msg = '';
1315
-                    if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1314
+					$required_limit_msg = '';
1315
+					if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1316 1316
 
1317
-                        $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1317
+						$required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1318 1318
 
1319
-                    } else {
1320
-                        $required_limit_msg = $required_msg;
1321
-                    }
1319
+					} else {
1320
+						$required_limit_msg = $required_msg;
1321
+					}
1322 1322
 
1323
-                    echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1323
+					echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1324 1324
 
1325 1325
 
1326
-                    if ($cat_display == 'select' || $cat_display == 'multiselect') {
1326
+					if ($cat_display == 'select' || $cat_display == 'multiselect') {
1327 1327
 
1328
-                        $cat_display == '';
1329
-                        $multiple = '';
1330
-                        if ($cat_display == 'multiselect')
1331
-                            $multiple = 'multiple="multiple"';
1328
+						$cat_display == '';
1329
+						$multiple = '';
1330
+						if ($cat_display == 'multiselect')
1331
+							$multiple = 'multiple="multiple"';
1332 1332
 
1333
-                        echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1333
+						echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1334 1334
 
1335 1335
 
1336
-                        if ($cat_display == 'select')
1337
-                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1336
+						if ($cat_display == 'select')
1337
+							echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1338 1338
 
1339
-                    }
1339
+					}
1340 1340
 
1341
-                    echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1341
+					echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1342 1342
 
1343
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
1344
-                        echo '</select>';
1343
+					if ($cat_display == 'select' || $cat_display == 'multiselect')
1344
+						echo '</select>';
1345 1345
 
1346
-                } else {
1346
+				} else {
1347 1347
 
1348
-                    echo geodir_custom_taxonomy_walker2($name, $catadd_limit);
1348
+					echo geodir_custom_taxonomy_walker2($name, $catadd_limit);
1349 1349
 
1350
-                }
1350
+				}
1351 1351
 
1352
-                ?>
1352
+				?>
1353 1353
             </div>
1354 1354
 
1355 1355
             <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
@@ -1359,10 +1359,10 @@  discard block
 block discarded – undo
1359 1359
         </div>
1360 1360
 
1361 1361
         <?php
1362
-        $html = ob_get_clean();
1363
-    }
1362
+		$html = ob_get_clean();
1363
+	}
1364 1364
 
1365
-    return $html;
1365
+	return $html;
1366 1366
 }
1367 1367
 add_filter('geodir_custom_field_input_taxonomy','geodir_cfi_taxonomy',10,2);
1368 1368
 
@@ -1378,74 +1378,74 @@  discard block
 block discarded – undo
1378 1378
  */
1379 1379
 function geodir_cfi_file($html,$cf){
1380 1380
 
1381
-    $html_var = $cf['htmlvar_name'];
1381
+	$html_var = $cf['htmlvar_name'];
1382 1382
 
1383
-    // Check if there is a custom field specific filter.
1384
-    if(has_filter("geodir_custom_field_input_file_{$html_var}")){
1385
-        /**
1386
-         * Filter the file html by individual custom field.
1387
-         *
1388
-         * @param string $html The html to filter.
1389
-         * @param array $cf The custom field array.
1390
-         * @since 1.6.6
1391
-         */
1392
-        $html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf);
1393
-    }
1383
+	// Check if there is a custom field specific filter.
1384
+	if(has_filter("geodir_custom_field_input_file_{$html_var}")){
1385
+		/**
1386
+		 * Filter the file html by individual custom field.
1387
+		 *
1388
+		 * @param string $html The html to filter.
1389
+		 * @param array $cf The custom field array.
1390
+		 * @since 1.6.6
1391
+		 */
1392
+		$html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf);
1393
+	}
1394 1394
 
1395
-    // If no html then we run the standard output.
1396
-    if(empty($html)) {
1395
+	// If no html then we run the standard output.
1396
+	if(empty($html)) {
1397 1397
 
1398
-        ob_start(); // Start  buffering;
1399
-        $value = geodir_get_cf_value($cf);
1398
+		ob_start(); // Start  buffering;
1399
+		$value = geodir_get_cf_value($cf);
1400 1400
 
1401
-        $name = $cf['name'];
1402
-        $site_title = $cf['site_title'];
1403
-        $admin_desc = $cf['desc'];
1404
-        $is_required = $cf['is_required'];
1405
-        $required_msg = $cf['required_msg'];
1406
-        $extra_fields = unserialize($cf['extra_fields']);
1401
+		$name = $cf['name'];
1402
+		$site_title = $cf['site_title'];
1403
+		$admin_desc = $cf['desc'];
1404
+		$is_required = $cf['is_required'];
1405
+		$required_msg = $cf['required_msg'];
1406
+		$extra_fields = unserialize($cf['extra_fields']);
1407 1407
 
1408 1408
 
1409
-        // adjust values here
1410
-        $file_id = $name; // 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
1409
+		// adjust values here
1410
+		$file_id = $name; // 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
1411 1411
 
1412
-        if ($value != '') {
1412
+		if ($value != '') {
1413 1413
 
1414
-            $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
1414
+			$file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
1415 1415
 
1416
-        } else
1417
-            $file_value = '';
1416
+		} else
1417
+			$file_value = '';
1418 1418
 
1419
-        if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
1420
-            $file_multiple = true; // allow multiple files upload
1421
-        else
1422
-            $file_multiple = false;
1419
+		if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
1420
+			$file_multiple = true; // allow multiple files upload
1421
+		else
1422
+			$file_multiple = false;
1423 1423
 
1424
-        if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
1425
-            $file_image_limit = $extra_fields['image_limit'];
1426
-        else
1427
-            $file_image_limit = 1;
1424
+		if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
1425
+			$file_image_limit = $extra_fields['image_limit'];
1426
+		else
1427
+			$file_image_limit = 1;
1428 1428
 
1429
-        $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1429
+		$file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1430 1430
 
1431
-        $file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
1431
+		$file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
1432 1432
 
1433
-        if (!empty($file_value)) {
1434
-            $curImages = explode(',', $file_value);
1435
-            if (!empty($curImages))
1436
-                $file_totImg = count($curImages);
1437
-        }
1433
+		if (!empty($file_value)) {
1434
+			$curImages = explode(',', $file_value);
1435
+			if (!empty($curImages))
1436
+				$file_totImg = count($curImages);
1437
+		}
1438 1438
 
1439
-        $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
1440
-        $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
1439
+		$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
1440
+		$display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
1441 1441
 
1442
-        ?>
1442
+		?>
1443 1443
         <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?>
1444 1444
 				 <?php if($file_image_limit!=0 && $file_image_limit==1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('image with this package').')</small>';} ?>
1445 1445
 				 <?php if($file_image_limit!=0 && $file_image_limit>1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('images with this package').')</small>';} ?>
1446 1446
 				 <?php if($file_image_limit==0){echo '<br /><small>('.__('You can upload unlimited images with this package').')</small>';} ?>
1447 1447
 			</h5>   <?php */
1448
-        ?>
1448
+		?>
1449 1449
 
1450 1450
         <div id="<?php echo $name;?>_row"
1451 1451
              class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
@@ -1453,7 +1453,7 @@  discard block
 block discarded – undo
1453 1453
             <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
1454 1454
                 <label
1455 1455
                     style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
1456
-                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1456
+					echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1457 1457
                 <input class="geodir-custom-file-upload" field_type="file" type="hidden"
1458 1458
                        name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
1459 1459
                        value="<?php echo esc_attr($file_value); ?>"/>
@@ -1465,17 +1465,17 @@  discard block
 block discarded – undo
1465 1465
                 <?php } ?>
1466 1466
                 <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg"
1467 1467
                        value="<?php if (isset($file_totImg)) {
1468
-                           echo esc_attr($file_totImg);
1469
-                       } else {
1470
-                           echo '0';
1471
-                       } ?>"/>
1468
+						   echo esc_attr($file_totImg);
1469
+					   } else {
1470
+						   echo '0';
1471
+					   } ?>"/>
1472 1472
 
1473 1473
                 <div style="float:left; width:55%;">
1474 1474
                     <div
1475 1475
                         class="plupload-upload-uic hide-if-no-js <?php if ($file_multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
1476 1476
                         id="<?php echo $file_id; ?>plupload-upload-ui" style="float:left; width:30%;">
1477 1477
                         <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */
1478
-                        ?>
1478
+						?>
1479 1479
                         <input id="<?php echo $file_id; ?>plupload-browse-button" type="button"
1480 1480
                                value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>"
1481 1481
                                class="geodir_button" style="margin-top:10px;"/>
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
                         style=" clear:inherit; margin-top:0; margin-left:15px; padding-top:10px; float:left; width:50%;">
1495 1495
                     </div>
1496 1496
                     <?php /*?><span id="upload-msg" ><?php _e('Please drag &amp; drop the images to rearrange the order');?></span><?php */
1497
-                    ?>
1497
+					?>
1498 1498
 
1499 1499
                     <span id="<?php echo $file_id; ?>upload-error" style="display:none"></span>
1500 1500
 
@@ -1508,9 +1508,9 @@  discard block
 block discarded – undo
1508 1508
 
1509 1509
 
1510 1510
         <?php
1511
-        $html = ob_get_clean();
1512
-    }
1511
+		$html = ob_get_clean();
1512
+	}
1513 1513
 
1514
-    return $html;
1514
+	return $html;
1515 1515
 }
1516 1516
 add_filter('geodir_custom_field_input_file','geodir_cfi_file',10,2);
1517 1517
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +234 added lines, -234 removed lines patch added patch discarded remove patch
@@ -17,12 +17,12 @@  discard block
 block discarded – undo
17 17
  *
18 18
  * @return string The html to output for the custom field.
19 19
  */
20
-function geodir_cfi_fieldset($html,$cf){
20
+function geodir_cfi_fieldset($html, $cf) {
21 21
 
22 22
     $html_var = $cf['htmlvar_name'];
23 23
 
24 24
     // Check if there is a custom field specific filter.
25
-    if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){
25
+    if (has_filter("geodir_custom_field_input_fieldset_{$html_var}")) {
26 26
         /**
27 27
          * Filter the fieldset html by individual custom field.
28 28
          *
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
          * @param array $cf The custom field array.
31 31
          * @since 1.6.6
32 32
          */
33
-        $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf);
33
+        $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}", $html, $cf);
34 34
     }
35 35
 
36 36
     // If no html then we run the standard output.
37
-    if(empty($html)) {
37
+    if (empty($html)) {
38 38
 
39 39
         ob_start(); // Start  buffering;
40 40
         ?>
41 41
         <h5 id="geodir_fieldset_<?php echo (int) $cf['id']; ?>" class="geodir-fieldset-row"
42
-            gd-fieldset="<?php echo (int) $cf['id']; ?>"><?php echo __( $cf['site_title'], 'geodirectory' ); ?>
43
-            <?php if ( $cf['desc'] != '' ) {
44
-                echo '<small>( ' . __( $cf['desc'], 'geodirectory' ) . ' )</small>';
42
+            gd-fieldset="<?php echo (int) $cf['id']; ?>"><?php echo __($cf['site_title'], 'geodirectory'); ?>
43
+            <?php if ($cf['desc'] != '') {
44
+                echo '<small>( '.__($cf['desc'], 'geodirectory').' )</small>';
45 45
             } ?></h5>
46 46
         <?php
47 47
         $html = ob_get_clean();
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     return $html;
51 51
 }
52
-add_filter('geodir_custom_field_input_fieldset','geodir_cfi_fieldset',10,2);
52
+add_filter('geodir_custom_field_input_fieldset', 'geodir_cfi_fieldset', 10, 2);
53 53
 
54 54
 
55 55
 
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
  *
63 63
  * @return string The html to output for the custom field.
64 64
  */
65
-function geodir_cfi_text($html,$cf){
65
+function geodir_cfi_text($html, $cf) {
66 66
 
67 67
     $html_var = $cf['htmlvar_name'];
68 68
 
69 69
     // Check if there is a custom field specific filter.
70
-    if(has_filter("geodir_custom_field_input_text_{$html_var}")){
70
+    if (has_filter("geodir_custom_field_input_text_{$html_var}")) {
71 71
         /**
72 72
          * Filter the text html by individual custom field.
73 73
          *
@@ -75,41 +75,41 @@  discard block
 block discarded – undo
75 75
          * @param array $cf The custom field array.
76 76
          * @since 1.6.6
77 77
          */
78
-        $html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf);
78
+        $html = apply_filters("geodir_custom_field_input_text_{$html_var}", $html, $cf);
79 79
     }
80 80
 
81 81
     // If no html then we run the standard output.
82
-    if(empty($html)) {
82
+    if (empty($html)) {
83 83
 
84 84
         ob_start(); // Start  buffering;
85 85
 
86 86
         $value = geodir_get_cf_value($cf);
87 87
         $type = $cf['type'];
88 88
         //number and float validation $validation_pattern
89
-        if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
-        elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
89
+        if (isset($cf['data_type']) && $cf['data_type'] == 'INT') {$type = 'number'; }
90
+        elseif (isset($cf['data_type']) && $cf['data_type'] == 'FLOAT') {$type = 'float'; }
91 91
 
92 92
         //validation
93
-        if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
93
+        if (isset($cf['validation_pattern']) && $cf['validation_pattern']) {
94 94
             $validation = 'pattern="'.$cf['validation_pattern'].'"';
95
-        }else{$validation='';}
95
+        } else {$validation = ''; }
96 96
 
97 97
         // validation message
98
-        if(isset($cf['validation_msg']) && $cf['validation_msg']){
98
+        if (isset($cf['validation_msg']) && $cf['validation_msg']) {
99 99
             $validation_msg = 'title="'.$cf['validation_msg'].'"';
100
-        }else{$validation_msg='';}
100
+        } else {$validation_msg = ''; }
101 101
         ?>
102 102
 
103
-        <div id="<?php echo $cf['name'];?>_row"
104
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
103
+        <div id="<?php echo $cf['name']; ?>_row"
104
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
105 105
             <label>
106 106
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
107 107
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
108
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
108
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
109 109
             </label>
110
-            <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
111
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> />
112
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
110
+            <input field_type="<?php echo $type; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
111
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="<?php echo $type; ?>" class="geodir_textfield" <?php echo $validation; echo $validation_msg; ?> />
112
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
113 113
             <?php if ($cf['is_required']) { ?>
114 114
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
115 115
             <?php } ?>
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
     return $html;
123 123
 }
124
-add_filter('geodir_custom_field_input_text','geodir_cfi_text',10,2);
124
+add_filter('geodir_custom_field_input_text', 'geodir_cfi_text', 10, 2);
125 125
 
126 126
 
127 127
 /**
@@ -133,12 +133,12 @@  discard block
 block discarded – undo
133 133
  *
134 134
  * @return string The html to output for the custom field.
135 135
  */
136
-function geodir_cfi_email($html,$cf){
136
+function geodir_cfi_email($html, $cf) {
137 137
 
138 138
     $html_var = $cf['htmlvar_name'];
139 139
 
140 140
     // Check if there is a custom field specific filter.
141
-    if(has_filter("geodir_custom_field_input_email_{$html_var}")){
141
+    if (has_filter("geodir_custom_field_input_email_{$html_var}")) {
142 142
         /**
143 143
          * Filter the email html by individual custom field.
144 144
          *
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
          * @param array $cf The custom field array.
147 147
          * @since 1.6.6
148 148
          */
149
-        $html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf);
149
+        $html = apply_filters("geodir_custom_field_input_email_{$html_var}", $html, $cf);
150 150
     }
151 151
 
152 152
     // If no html then we run the standard output.
153
-    if(empty($html)) {
153
+    if (empty($html)) {
154 154
 
155 155
         ob_start(); // Start  buffering;
156 156
         $value = geodir_get_cf_value($cf);
@@ -159,16 +159,16 @@  discard block
 block discarded – undo
159 159
             $value = '';
160 160
         }?>
161 161
 
162
-        <div id="<?php echo $cf['name'];?>_row"
163
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
162
+        <div id="<?php echo $cf['name']; ?>_row"
163
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
164 164
             <label>
165 165
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
166 166
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
167
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
167
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
168 168
             </label>
169
-            <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
170
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/>
171
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
169
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php  echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
170
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="email" class="geodir_textfield"/>
171
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
172 172
             <?php if ($cf['is_required']) { ?>
173 173
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
174 174
             <?php } ?>
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 
181 181
     return $html;
182 182
 }
183
-add_filter('geodir_custom_field_input_email','geodir_cfi_email',10,2);
183
+add_filter('geodir_custom_field_input_email', 'geodir_cfi_email', 10, 2);
184 184
 
185 185
 
186 186
 
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
  *
194 194
  * @return string The html to output for the custom field.
195 195
  */
196
-function geodir_cfi_phone($html,$cf){
196
+function geodir_cfi_phone($html, $cf) {
197 197
 
198 198
     $html_var = $cf['htmlvar_name'];
199 199
 
200 200
     // Check if there is a custom field specific filter.
201
-    if(has_filter("geodir_custom_field_input_phone_{$html_var}")){
201
+    if (has_filter("geodir_custom_field_input_phone_{$html_var}")) {
202 202
         /**
203 203
          * Filter the phone html by individual custom field.
204 204
          *
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
          * @param array $cf The custom field array.
207 207
          * @since 1.6.6
208 208
          */
209
-        $html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf);
209
+        $html = apply_filters("geodir_custom_field_input_phone_{$html_var}", $html, $cf);
210 210
     }
211 211
 
212 212
     // If no html then we run the standard output.
213
-    if(empty($html)) {
213
+    if (empty($html)) {
214 214
 
215 215
         ob_start(); // Start  buffering;
216 216
         $value = geodir_get_cf_value($cf);
@@ -219,16 +219,16 @@  discard block
 block discarded – undo
219 219
             $value = '';
220 220
         }?>
221 221
 
222
-        <div id="<?php echo $cf['name'];?>_row"
223
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
222
+        <div id="<?php echo $cf['name']; ?>_row"
223
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
224 224
             <label>
225 225
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
226 226
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
227
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
227
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
228 228
             </label>
229
-            <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
230
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/>
231
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
229
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php  echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
230
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="tel" class="geodir_textfield"/>
231
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
232 232
             <?php if ($cf['is_required']) { ?>
233 233
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
234 234
             <?php } ?>
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
     return $html;
242 242
 }
243
-add_filter('geodir_custom_field_input_phone','geodir_cfi_phone',10,2);
243
+add_filter('geodir_custom_field_input_phone', 'geodir_cfi_phone', 10, 2);
244 244
 
245 245
 
246 246
 
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
  *
254 254
  * @return string The html to output for the custom field.
255 255
  */
256
-function geodir_cfi_url($html,$cf){
256
+function geodir_cfi_url($html, $cf) {
257 257
 
258 258
     $html_var = $cf['htmlvar_name'];
259 259
 
260 260
     // Check if there is a custom field specific filter.
261
-    if(has_filter("geodir_custom_field_input_url_{$html_var}")){
261
+    if (has_filter("geodir_custom_field_input_url_{$html_var}")) {
262 262
         /**
263 263
          * Filter the url html by individual custom field.
264 264
          *
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
          * @param array $cf The custom field array.
267 267
          * @since 1.6.6
268 268
          */
269
-        $html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf);
269
+        $html = apply_filters("geodir_custom_field_input_url_{$html_var}", $html, $cf);
270 270
     }
271 271
 
272 272
     // If no html then we run the standard output.
273
-    if(empty($html)) {
273
+    if (empty($html)) {
274 274
 
275 275
         ob_start(); // Start  buffering;
276 276
         $value = geodir_get_cf_value($cf);
@@ -279,19 +279,19 @@  discard block
 block discarded – undo
279 279
             $value = '';
280 280
         }?>
281 281
 
282
-        <div id="<?php echo $cf['name'];?>_row"
283
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
282
+        <div id="<?php echo $cf['name']; ?>_row"
283
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
284 284
             <label>
285 285
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
286 286
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
287
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
287
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
288 288
             </label>
289
-            <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
290
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield"
289
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
290
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="url" class="geodir_textfield"
291 291
                    oninvalid="setCustomValidity('<?php _e('Please enter a valid URL including http://', 'geodirectory'); ?>')"
292 292
                    onchange="try{setCustomValidity('')}catch(e){}"
293 293
             />
294
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
294
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
295 295
             <?php if ($cf['is_required']) { ?>
296 296
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
297 297
             <?php } ?>
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 
304 304
     return $html;
305 305
 }
306
-add_filter('geodir_custom_field_input_url','geodir_cfi_url',10,2);
306
+add_filter('geodir_custom_field_input_url', 'geodir_cfi_url', 10, 2);
307 307
 
308 308
 
309 309
 /**
@@ -315,12 +315,12 @@  discard block
 block discarded – undo
315 315
  *
316 316
  * @return string The html to output for the custom field.
317 317
  */
318
-function geodir_cfi_radio($html,$cf){
318
+function geodir_cfi_radio($html, $cf) {
319 319
 
320 320
     $html_var = $cf['htmlvar_name'];
321 321
 
322 322
     // Check if there is a custom field specific filter.
323
-    if(has_filter("geodir_custom_field_input_radio_{$html_var}")){
323
+    if (has_filter("geodir_custom_field_input_radio_{$html_var}")) {
324 324
         /**
325 325
          * Filter the radio html by individual custom field.
326 326
          *
@@ -328,22 +328,22 @@  discard block
 block discarded – undo
328 328
          * @param array $cf The custom field array.
329 329
          * @since 1.6.6
330 330
          */
331
-        $html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf);
331
+        $html = apply_filters("geodir_custom_field_input_radio_{$html_var}", $html, $cf);
332 332
     }
333 333
 
334 334
     // If no html then we run the standard output.
335
-    if(empty($html)) {
335
+    if (empty($html)) {
336 336
 
337 337
         ob_start(); // Start  buffering;
338 338
         $value = geodir_get_cf_value($cf);
339 339
 
340 340
         ?>
341
-        <div id="<?php echo $cf['name'];?>_row"
342
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
341
+        <div id="<?php echo $cf['name']; ?>_row"
342
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
343 343
             <label>
344 344
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
345 345
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
346
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
346
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
347 347
             </label>
348 348
             <?php if ($cf['option_values']) {
349 349
                 $option_values = geodir_string_values_to_options($cf['option_values'], true);
@@ -352,14 +352,14 @@  discard block
 block discarded – undo
352 352
                     foreach ($option_values as $option_value) {
353 353
                         if (empty($option_value['optgroup'])) {
354 354
                             ?>
355
-                            <span class="gd-radios"><input name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="radio" /><?php echo $option_value['label']; ?></span>
355
+                            <span class="gd-radios"><input name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" <?php checked($value, $option_value['value']); ?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type']; ?>" type="radio" /><?php echo $option_value['label']; ?></span>
356 356
                             <?php
357 357
                         }
358 358
                     }
359 359
                 }
360 360
             }
361 361
             ?>
362
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
362
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
363 363
             <?php if ($cf['is_required']) { ?>
364 364
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
365 365
             <?php } ?>
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 
372 372
     return $html;
373 373
 }
374
-add_filter('geodir_custom_field_input_radio','geodir_cfi_radio',10,2);
374
+add_filter('geodir_custom_field_input_radio', 'geodir_cfi_radio', 10, 2);
375 375
 
376 376
 
377 377
 /**
@@ -383,12 +383,12 @@  discard block
 block discarded – undo
383 383
  *
384 384
  * @return string The html to output for the custom field.
385 385
  */
386
-function geodir_cfi_checkbox($html,$cf){
386
+function geodir_cfi_checkbox($html, $cf) {
387 387
 
388 388
     $html_var = $cf['htmlvar_name'];
389 389
 
390 390
     // Check if there is a custom field specific filter.
391
-    if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){
391
+    if (has_filter("geodir_custom_field_input_checkbox_{$html_var}")) {
392 392
         /**
393 393
          * Filter the checkbox html by individual custom field.
394 394
          *
@@ -396,11 +396,11 @@  discard block
 block discarded – undo
396 396
          * @param array $cf The custom field array.
397 397
          * @since 1.6.6
398 398
          */
399
-        $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf);
399
+        $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}", $html, $cf);
400 400
     }
401 401
 
402 402
     // If no html then we run the standard output.
403
-    if(empty($html)) {
403
+    if (empty($html)) {
404 404
 
405 405
         ob_start(); // Start  buffering;
406 406
         $value = geodir_get_cf_value($cf);
@@ -411,22 +411,22 @@  discard block
 block discarded – undo
411 411
         }
412 412
         ?>
413 413
 
414
-        <div id="<?php echo $cf['name'];?>_row"
415
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
414
+        <div id="<?php echo $cf['name']; ?>_row"
415
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
416 416
             <label>
417 417
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
418 418
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
419
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
419
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
420 420
             </label>
421 421
             <?php if ($value != '1') {
422 422
                 $value = '0';
423 423
             }?>
424
-            <input type="hidden" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" value="<?php echo esc_attr($value);?>"/>
424
+            <input type="hidden" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" value="<?php echo esc_attr($value); ?>"/>
425 425
             <input  <?php if ($value == '1') {
426 426
                 echo 'checked="checked"';
427
-            }?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox"
428
-                 onchange="if(this.checked){jQuery('#<?php echo $cf['name'];?>').val('1');} else{ jQuery('#<?php echo $cf['name'];?>').val('0');}"/>
429
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
427
+            }?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type']; ?>" type="checkbox"
428
+                 onchange="if(this.checked){jQuery('#<?php echo $cf['name']; ?>').val('1');} else{ jQuery('#<?php echo $cf['name']; ?>').val('0');}"/>
429
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
430 430
             <?php if ($cf['is_required']) { ?>
431 431
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
432 432
             <?php } ?>
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 
439 439
     return $html;
440 440
 }
441
-add_filter('geodir_custom_field_input_checkbox','geodir_cfi_checkbox',10,2);
441
+add_filter('geodir_custom_field_input_checkbox', 'geodir_cfi_checkbox', 10, 2);
442 442
 
443 443
 
444 444
 /**
@@ -450,12 +450,12 @@  discard block
 block discarded – undo
450 450
  *
451 451
  * @return string The html to output for the custom field.
452 452
  */
453
-function geodir_cfi_textarea($html,$cf){
453
+function geodir_cfi_textarea($html, $cf) {
454 454
 
455 455
     $html_var = $cf['htmlvar_name'];
456 456
 
457 457
     // Check if there is a custom field specific filter.
458
-    if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){
458
+    if (has_filter("geodir_custom_field_input_textarea_{$html_var}")) {
459 459
         /**
460 460
          * Filter the textarea html by individual custom field.
461 461
          *
@@ -463,11 +463,11 @@  discard block
 block discarded – undo
463 463
          * @param array $cf The custom field array.
464 464
          * @since 1.6.6
465 465
          */
466
-        $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf);
466
+        $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}", $html, $cf);
467 467
     }
468 468
 
469 469
     // If no html then we run the standard output.
470
-    if(empty($html)) {
470
+    if (empty($html)) {
471 471
 
472 472
         ob_start(); // Start  buffering;
473 473
         $value = geodir_get_cf_value($cf);
@@ -475,32 +475,32 @@  discard block
 block discarded – undo
475 475
         $extra_fields = unserialize($cf['extra_fields']);
476 476
         ?>
477 477
 
478
-        <div id="<?php echo $cf['name'];?>_row"
479
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
478
+        <div id="<?php echo $cf['name']; ?>_row"
479
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
480 480
             <label>
481 481
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
482 482
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
483
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
483
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
484 484
             </label><?php
485 485
 
486 486
 
487 487
             if (is_array($extra_fields) && in_array('1', $extra_fields)) {
488 488
 
489
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
489
+                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
490 490
 
491
-            <div class="editor" field_id="<?php echo $cf['name'];?>" field_type="editor">
491
+            <div class="editor" field_id="<?php echo $cf['name']; ?>" field_type="editor">
492 492
                 <?php wp_editor(stripslashes($value), $cf['name'], $editor_settings); ?>
493 493
                 </div><?php
494 494
 
495 495
             } else {
496 496
 
497
-                ?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>"
498
-                            id="<?php echo $cf['name'];?>"><?php echo stripslashes($value);?></textarea><?php
497
+                ?><textarea field_type="<?php echo $cf['type']; ?>" class="geodir_textarea" name="<?php echo $cf['name']; ?>"
498
+                            id="<?php echo $cf['name']; ?>"><?php echo stripslashes($value); ?></textarea><?php
499 499
 
500 500
             }?>
501 501
 
502 502
 
503
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
503
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
504 504
             <?php if ($cf['is_required']) { ?>
505 505
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
506 506
             <?php } ?>
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 
513 513
     return $html;
514 514
 }
515
-add_filter('geodir_custom_field_input_textarea','geodir_cfi_textarea',10,2);
515
+add_filter('geodir_custom_field_input_textarea', 'geodir_cfi_textarea', 10, 2);
516 516
 
517 517
 
518 518
 /**
@@ -524,12 +524,12 @@  discard block
 block discarded – undo
524 524
  *
525 525
  * @return string The html to output for the custom field.
526 526
  */
527
-function geodir_cfi_select($html,$cf){
527
+function geodir_cfi_select($html, $cf) {
528 528
 
529 529
     $html_var = $cf['htmlvar_name'];
530 530
 
531 531
     // Check if there is a custom field specific filter.
532
-    if(has_filter("geodir_custom_field_input_select_{$html_var}")){
532
+    if (has_filter("geodir_custom_field_input_select_{$html_var}")) {
533 533
         /**
534 534
          * Filter the select html by individual custom field.
535 535
          *
@@ -537,22 +537,22 @@  discard block
 block discarded – undo
537 537
          * @param array $cf The custom field array.
538 538
          * @since 1.6.6
539 539
          */
540
-        $html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf);
540
+        $html = apply_filters("geodir_custom_field_input_select_{$html_var}", $html, $cf);
541 541
     }
542 542
 
543 543
     // If no html then we run the standard output.
544
-    if(empty($html)) {
544
+    if (empty($html)) {
545 545
 
546 546
         ob_start(); // Start  buffering;
547 547
         $value = geodir_get_cf_value($cf);
548 548
 
549 549
         ?>
550
-        <div id="<?php echo $cf['name'];?>_row"
551
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
550
+        <div id="<?php echo $cf['name']; ?>_row"
551
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
552 552
             <label>
553 553
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
554 554
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
555
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
555
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
556 556
             </label>
557 557
             <?php
558 558
             $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
@@ -562,22 +562,22 @@  discard block
 block discarded – undo
562 562
                     if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
563 563
                         $option_label = isset($option_row['label']) ? $option_row['label'] : '';
564 564
 
565
-                        $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
565
+                        $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="'.esc_attr($option_label).'">' : '</optgroup>';
566 566
                     } else {
567 567
                         $option_label = isset($option_row['label']) ? $option_row['label'] : '';
568 568
                         $option_value = isset($option_row['value']) ? $option_row['value'] : '';
569 569
                         $selected = $option_value == $value ? 'selected="selected"' : '';
570 570
 
571
-                        $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
571
+                        $select_options .= '<option value="'.esc_attr($option_value).'" '.$selected.'>'.$option_label.'</option>';
572 572
                     }
573 573
                 }
574 574
             }
575 575
             ?>
576
-            <select field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
576
+            <select field_type="<?php echo $cf['type']; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
577 577
                     class="geodir_textfield textfield_x chosen_select"
578
-                    data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '&hellip;';?>"
579
-                    option-ajaxchosen="false"><?php echo $select_options;?></select>
580
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
578
+                    data-placeholder="<?php echo __('Choose', 'geodirectory').' '.$site_title.'&hellip;'; ?>"
579
+                    option-ajaxchosen="false"><?php echo $select_options; ?></select>
580
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
581 581
             <?php if ($cf['is_required']) { ?>
582 582
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
583 583
             <?php } ?>
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 
590 590
     return $html;
591 591
 }
592
-add_filter('geodir_custom_field_input_select','geodir_cfi_select',10,2);
592
+add_filter('geodir_custom_field_input_select', 'geodir_cfi_select', 10, 2);
593 593
 
594 594
 
595 595
 /**
@@ -601,12 +601,12 @@  discard block
 block discarded – undo
601 601
  *
602 602
  * @return string The html to output for the custom field.
603 603
  */
604
-function geodir_cfi_multiselect($html,$cf){
604
+function geodir_cfi_multiselect($html, $cf) {
605 605
 
606 606
     $html_var = $cf['htmlvar_name'];
607 607
 
608 608
     // Check if there is a custom field specific filter.
609
-    if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){
609
+    if (has_filter("geodir_custom_field_input_multiselect_{$html_var}")) {
610 610
         /**
611 611
          * Filter the multiselect html by individual custom field.
612 612
          *
@@ -614,11 +614,11 @@  discard block
 block discarded – undo
614 614
          * @param array $cf The custom field array.
615 615
          * @since 1.6.6
616 616
          */
617
-        $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf);
617
+        $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}", $html, $cf);
618 618
     }
619 619
 
620 620
     // If no html then we run the standard output.
621
-    if(empty($html)) {
621
+    if (empty($html)) {
622 622
 
623 623
         ob_start(); // Start  buffering;
624 624
         $value = geodir_get_cf_value($cf);
@@ -655,9 +655,9 @@  discard block
 block discarded – undo
655 655
                                 $option_label = isset($option_row['label']) ? $option_row['label'] : '';
656 656
 
657 657
                                 if ($multi_display == 'select') {
658
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
658
+                                    $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="'.esc_attr($option_label).'">' : '</optgroup>';
659 659
                                 } else {
660
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
660
+                                    $select_options .= $option_row['optgroup'] == 'start' ? '<li>'.$option_label.'</li>' : '';
661 661
                                 }
662 662
                             } else {
663 663
                                 if (!is_array($value) && $value != '') {
@@ -688,9 +688,9 @@  discard block
 block discarded – undo
688 688
                                 }
689 689
 
690 690
                                 if ($multi_display == 'select') {
691
-                                    $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
691
+                                    $select_options .= '<option value="'.esc_attr($option_value).'" '.$selected.'>'.$option_label.'</option>';
692 692
                                 } else {
693
-                                    $select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
693
+                                    $select_options .= '<li><input name="'.$cf['name'].'[]" '.$checked.' value="'.esc_attr($option_value).'" class="gd-'.$multi_display.'" field_type="'.$multi_display.'" type="'.$multi_display.'" />&nbsp;'.$option_label.' </li>';
694 694
                                 }
695 695
                             }
696 696
                         }
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 
711 711
     return $html;
712 712
 }
713
-add_filter('geodir_custom_field_input_multiselect','geodir_cfi_multiselect',10,2);
713
+add_filter('geodir_custom_field_input_multiselect', 'geodir_cfi_multiselect', 10, 2);
714 714
 
715 715
 
716 716
 /**
@@ -722,12 +722,12 @@  discard block
 block discarded – undo
722 722
  *
723 723
  * @return string The html to output for the custom field.
724 724
  */
725
-function geodir_cfi_html($html,$cf){
725
+function geodir_cfi_html($html, $cf) {
726 726
 
727 727
     $html_var = $cf['htmlvar_name'];
728 728
 
729 729
     // Check if there is a custom field specific filter.
730
-    if(has_filter("geodir_custom_field_input_html_{$html_var}")){
730
+    if (has_filter("geodir_custom_field_input_html_{$html_var}")) {
731 731
         /**
732 732
          * Filter the html html by individual custom field.
733 733
          *
@@ -735,11 +735,11 @@  discard block
 block discarded – undo
735 735
          * @param array $cf The custom field array.
736 736
          * @since 1.6.6
737 737
          */
738
-        $html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf);
738
+        $html = apply_filters("geodir_custom_field_input_html_{$html_var}", $html, $cf);
739 739
     }
740 740
 
741 741
     // If no html then we run the standard output.
742
-    if(empty($html)) {
742
+    if (empty($html)) {
743 743
 
744 744
         ob_start(); // Start  buffering;
745 745
         $value = geodir_get_cf_value($cf);
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
 
773 773
     return $html;
774 774
 }
775
-add_filter('geodir_custom_field_input_html','geodir_cfi_html',10,2);
775
+add_filter('geodir_custom_field_input_html', 'geodir_cfi_html', 10, 2);
776 776
 
777 777
 
778 778
 
@@ -785,12 +785,12 @@  discard block
 block discarded – undo
785 785
  *
786 786
  * @return string The html to output for the custom field.
787 787
  */
788
-function geodir_cfi_datepicker($html,$cf){
788
+function geodir_cfi_datepicker($html, $cf) {
789 789
 
790 790
     $html_var = $cf['htmlvar_name'];
791 791
 
792 792
     // Check if there is a custom field specific filter.
793
-    if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){
793
+    if (has_filter("geodir_custom_field_input_datepicker_{$html_var}")) {
794 794
         /**
795 795
          * Filter the datepicker html by individual custom field.
796 796
          *
@@ -798,11 +798,11 @@  discard block
 block discarded – undo
798 798
          * @param array $cf The custom field array.
799 799
          * @since 1.6.6
800 800
          */
801
-        $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf);
801
+        $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}", $html, $cf);
802 802
     }
803 803
 
804 804
     // If no html then we run the standard output.
805
-    if(empty($html)) {
805
+    if (empty($html)) {
806 806
 
807 807
         ob_start(); // Start  buffering;
808 808
         $value = geodir_get_cf_value($cf);
@@ -814,23 +814,23 @@  discard block
 block discarded – undo
814 814
             $extra_fields['date_format'] = 'yy-mm-dd';
815 815
 
816 816
         $date_format = $extra_fields['date_format'];
817
-        $jquery_date_format  = $date_format;
817
+        $jquery_date_format = $date_format;
818 818
 
819 819
 
820 820
         // check if we need to change the format or not
821 821
         $date_format_len = strlen(str_replace(' ', '', $date_format));
822
-        if($date_format_len>5){// if greater then 5 then it's the old style format.
822
+        if ($date_format_len > 5) {// if greater then 5 then it's the old style format.
823 823
 
824
-            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
825
-            $replace = array('d','j','l','m','n','F','Y');//PHP date format
824
+            $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
825
+            $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
826 826
 
827 827
             $date_format = str_replace($search, $replace, $date_format);
828
-        }else{
829
-            $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
828
+        } else {
829
+            $jquery_date_format = geodir_date_format_php_to_jqueryui($jquery_date_format);
830 830
         }
831 831
 
832
-        if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
833
-        if($value && !isset($_REQUEST['backandedit'])) {
832
+        if ($value == '0000-00-00') {$value = ''; }//if date not set, then mark it empty
833
+        if ($value && !isset($_REQUEST['backandedit'])) {
834 834
             //$time = strtotime($value);
835 835
             //$value = date_i18n($date_format, $time);
836 836
         }
@@ -841,37 +841,37 @@  discard block
 block discarded – undo
841 841
 
842 842
             jQuery(function () {
843 843
 
844
-                jQuery("#<?php echo $cf['name'];?>").datepicker({changeMonth: true, changeYear: true <?php
844
+                jQuery("#<?php echo $cf['name']; ?>").datepicker({changeMonth: true, changeYear: true <?php
845 845
                     /**
846 846
                      * Used to add extra option to datepicker per custom field.
847 847
                      *
848 848
                      * @since 1.5.7
849 849
                      * @param string $name The custom field name.
850 850
                      */
851
-                    echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
851
+                    echo apply_filters("gd_datepicker_extra_{$name}", ''); ?>});
852 852
 
853
-                jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format;?>');
853
+                jQuery("#<?php echo $name; ?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format; ?>');
854 854
 
855
-                <?php if(!empty($value)){?>
856
-                jQuery("#<?php echo $name;?>").datepicker("setDate", '<?php echo $value;?>');
855
+                <?php if (!empty($value)) {?>
856
+                jQuery("#<?php echo $name; ?>").datepicker("setDate", '<?php echo $value; ?>');
857 857
                 <?php } ?>
858 858
 
859 859
             });
860 860
 
861 861
         </script>
862
-        <div id="<?php echo $name;?>_row"
863
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
862
+        <div id="<?php echo $name; ?>_row"
863
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
864 864
             <label>
865 865
 
866 866
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
867 867
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
868
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
868
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
869 869
             </label>
870 870
 
871
-            <input field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
872
-                   value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
871
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
872
+                   value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/>
873 873
 
874
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
874
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
875 875
             <?php if ($cf['is_required']) { ?>
876 876
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
877 877
             <?php } ?>
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
 
884 884
     return $html;
885 885
 }
886
-add_filter('geodir_custom_field_input_datepicker','geodir_cfi_datepicker',10,2);
886
+add_filter('geodir_custom_field_input_datepicker', 'geodir_cfi_datepicker', 10, 2);
887 887
 
888 888
 
889 889
 /**
@@ -895,12 +895,12 @@  discard block
 block discarded – undo
895 895
  *
896 896
  * @return string The html to output for the custom field.
897 897
  */
898
-function geodir_cfi_time($html,$cf){
898
+function geodir_cfi_time($html, $cf) {
899 899
 
900 900
     $html_var = $cf['htmlvar_name'];
901 901
 
902 902
     // Check if there is a custom field specific filter.
903
-    if(has_filter("geodir_custom_field_input_time_{$html_var}")){
903
+    if (has_filter("geodir_custom_field_input_time_{$html_var}")) {
904 904
         /**
905 905
          * Filter the time html by individual custom field.
906 906
          *
@@ -908,11 +908,11 @@  discard block
 block discarded – undo
908 908
          * @param array $cf The custom field array.
909 909
          * @since 1.6.6
910 910
          */
911
-        $html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf);
911
+        $html = apply_filters("geodir_custom_field_input_time_{$html_var}", $html, $cf);
912 912
     }
913 913
 
914 914
     // If no html then we run the standard output.
915
-    if(empty($html)) {
915
+    if (empty($html)) {
916 916
 
917 917
         ob_start(); // Start  buffering;
918 918
         $value = geodir_get_cf_value($cf);
@@ -925,25 +925,25 @@  discard block
 block discarded – undo
925 925
         <script type="text/javascript">
926 926
             jQuery(document).ready(function () {
927 927
 
928
-                jQuery('#<?php echo $name;?>').timepicker({
928
+                jQuery('#<?php echo $name; ?>').timepicker({
929 929
                     showPeriod: true,
930 930
                     showLeadingZero: true,
931 931
                     showPeriod: true,
932 932
                 });
933 933
             });
934 934
         </script>
935
-        <div id="<?php echo $name;?>_row"
936
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
935
+        <div id="<?php echo $name; ?>_row"
936
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
937 937
             <label>
938 938
 
939 939
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
940 940
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
941
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
941
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
942 942
             </label>
943
-            <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>"
944
-                   id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
943
+            <input readonly="readonly" field_type="<?php echo $cf['type']; ?>" name="<?php echo $name; ?>"
944
+                   id="<?php echo $name; ?>" value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/>
945 945
 
946
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
946
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
947 947
             <?php if ($cf['is_required']) { ?>
948 948
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
949 949
             <?php } ?>
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
 
955 955
     return $html;
956 956
 }
957
-add_filter('geodir_custom_field_input_time','geodir_cfi_time',10,2);
957
+add_filter('geodir_custom_field_input_time', 'geodir_cfi_time', 10, 2);
958 958
 
959 959
 
960 960
 /**
@@ -966,12 +966,12 @@  discard block
 block discarded – undo
966 966
  *
967 967
  * @return string The html to output for the custom field.
968 968
  */
969
-function geodir_cfi_address($html,$cf){
969
+function geodir_cfi_address($html, $cf) {
970 970
 
971 971
     $html_var = $cf['htmlvar_name'];
972 972
 
973 973
     // Check if there is a custom field specific filter.
974
-    if(has_filter("geodir_custom_field_input_address_{$html_var}")){
974
+    if (has_filter("geodir_custom_field_input_address_{$html_var}")) {
975 975
         /**
976 976
          * Filter the address html by individual custom field.
977 977
          *
@@ -979,11 +979,11 @@  discard block
 block discarded – undo
979 979
          * @param array $cf The custom field array.
980 980
          * @since 1.6.6
981 981
          */
982
-        $html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf);
982
+        $html = apply_filters("geodir_custom_field_input_address_{$html_var}", $html, $cf);
983 983
     }
984 984
 
985 985
     // If no html then we run the standard output.
986
-    if(empty($html)) {
986
+    if (empty($html)) {
987 987
 
988 988
         global $gd_session;
989 989
         ob_start(); // Start  buffering;
@@ -996,12 +996,12 @@  discard block
 block discarded – undo
996 996
         $site_title = $cf['site_title'];
997 997
         $is_admin = $cf['is_admin'];
998 998
         $extra_fields = stripslashes_deep(unserialize($cf['extra_fields']));
999
-        $prefix = $name . '_';
999
+        $prefix = $name.'_';
1000 1000
 
1001
-        ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
1002
-        ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
1001
+        ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix.' address');
1002
+        ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix.' zip/post code ');
1003 1003
         ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
1004
-        ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
1004
+        ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix.' mapview');
1005 1005
 
1006 1006
         $address = '';
1007 1007
         $zip = '';
@@ -1012,21 +1012,21 @@  discard block
 block discarded – undo
1012 1012
 
1013 1013
         if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1014 1014
             $post = $gd_ses_listing;
1015
-            $address = $post[$prefix . 'address'];
1016
-            $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1017
-            $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1018
-            $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1019
-            $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1020
-            $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1015
+            $address = $post[$prefix.'address'];
1016
+            $zip = isset($post[$prefix.'zip']) ? $post[$prefix.'zip'] : '';
1017
+            $lat = isset($post[$prefix.'latitude']) ? $post[$prefix.'latitude'] : '';
1018
+            $lng = isset($post[$prefix.'longitude']) ? $post[$prefix.'longitude'] : '';
1019
+            $mapview = isset($post[$prefix.'mapview']) ? $post[$prefix.'mapview'] : '';
1020
+            $mapzoom = isset($post[$prefix.'mapzoom']) ? $post[$prefix.'mapzoom'] : '';
1021 1021
         } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1022
-            $post_info = (array)$post_info;
1023
-
1024
-            $address = $post_info[$prefix . 'address'];
1025
-            $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1026
-            $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1027
-            $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1028
-            $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1029
-            $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1022
+            $post_info = (array) $post_info;
1023
+
1024
+            $address = $post_info[$prefix.'address'];
1025
+            $zip = isset($post_info[$prefix.'zip']) ? $post_info[$prefix.'zip'] : '';
1026
+            $lat = isset($post_info[$prefix.'latitude']) ? $post_info[$prefix.'latitude'] : '';
1027
+            $lng = isset($post_info[$prefix.'longitude']) ? $post_info[$prefix.'longitude'] : '';
1028
+            $mapview = isset($post_info[$prefix.'mapview']) ? $post_info[$prefix.'mapview'] : '';
1029
+            $mapzoom = isset($post_info[$prefix.'mapzoom']) ? $post_info[$prefix.'mapzoom'] : '';
1030 1030
         }
1031 1031
 
1032 1032
         $location = geodir_get_default_location();
@@ -1063,16 +1063,16 @@  discard block
 block discarded – undo
1063 1063
 
1064 1064
         ?>
1065 1065
 
1066
-        <div id="geodir_<?php echo $prefix . 'address';?>_row"
1067
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1066
+        <div id="geodir_<?php echo $prefix.'address'; ?>_row"
1067
+             class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
1068 1068
             <label>
1069 1069
                 <?php _e($address_title, 'geodirectory'); ?>
1070
-                <?php if ($is_required) echo '<span>*</span>';?>
1070
+                <?php if ($is_required) echo '<span>*</span>'; ?>
1071 1071
             </label>
1072
-            <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>"
1073
-                   id="<?php echo $prefix . 'address';?>" class="geodir_textfield"
1072
+            <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'address'; ?>"
1073
+                   id="<?php echo $prefix.'address'; ?>" class="geodir_textfield"
1074 1074
                    value="<?php echo esc_attr(stripslashes($address)); ?>"/>
1075
-            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1075
+            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1076 1076
             <?php if ($is_required) { ?>
1077 1077
                 <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1078 1078
             <?php } ?>
@@ -1092,14 +1092,14 @@  discard block
 block discarded – undo
1092 1092
 
1093 1093
         if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1094 1094
 
1095
-            <div id="geodir_<?php echo $prefix . 'zip'; ?>_row"
1095
+            <div id="geodir_<?php echo $prefix.'zip'; ?>_row"
1096 1096
                  class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix gd-fieldset-details">
1097 1097
                 <label>
1098 1098
                     <?php _e($zip_title, 'geodirectory'); ?>
1099 1099
                     <?php /*if($is_required) echo '<span>*</span>';*/ ?>
1100 1100
                 </label>
1101
-                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'zip'; ?>"
1102
-                       id="<?php echo $prefix . 'zip'; ?>" class="geodir_textfield autofill"
1101
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'zip'; ?>"
1102
+                       id="<?php echo $prefix.'zip'; ?>" class="geodir_textfield autofill"
1103 1103
                        value="<?php echo esc_attr(stripslashes($zip)); ?>"/>
1104 1104
                 <?php /*if($is_required) {?>
1105 1105
 					<span class="geodir_message_error"><?php echo _e($required_msg,'geodirectory');?></span>
@@ -1109,14 +1109,14 @@  discard block
 block discarded – undo
1109 1109
 
1110 1110
         <?php if (isset($extra_fields['show_map']) && $extra_fields['show_map']) { ?>
1111 1111
 
1112
-            <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1112
+            <div id="geodir_<?php echo $prefix.'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1113 1113
                 <?php
1114 1114
                 /**
1115 1115
                  * Contains add listing page map functions.
1116 1116
                  *
1117 1117
                  * @since 1.0.0
1118 1118
                  */
1119
-                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1119
+                include(geodir_plugin_path()."/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1120 1120
                 if ($lat_lng_blank) {
1121 1121
                     $lat = '';
1122 1122
                     $lng = '';
@@ -1127,14 +1127,14 @@  discard block
 block discarded – undo
1127 1127
             <?php
1128 1128
             /* show lat lng */
1129 1129
             $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1130
-            <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1130
+            <div id="geodir_<?php echo $prefix.'latitude'; ?>_row"
1131 1131
                  class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1132 1132
                 <label>
1133 1133
                     <?php echo PLACE_ADDRESS_LAT; ?>
1134 1134
                     <?php if ($is_required) echo '<span>*</span>'; ?>
1135 1135
                 </label>
1136
-                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>"
1137
-                       id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield"
1136
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'latitude'; ?>"
1137
+                       id="<?php echo $prefix.'latitude'; ?>" class="geodir_textfield"
1138 1138
                        value="<?php echo esc_attr(stripslashes($lat)); ?>" size="25"/>
1139 1139
                 <span class="geodir_message_note"><?php echo GET_LATITUDE_MSG; ?></span>
1140 1140
                 <?php if ($is_required) { ?>
@@ -1142,14 +1142,14 @@  discard block
 block discarded – undo
1142 1142
                 <?php } ?>
1143 1143
             </div>
1144 1144
 
1145
-            <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row"
1145
+            <div id="geodir_<?php echo $prefix.'longitude'; ?>_row"
1146 1146
                  class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1147 1147
                 <label>
1148 1148
                     <?php echo PLACE_ADDRESS_LNG; ?>
1149 1149
                     <?php if ($is_required) echo '<span>*</span>'; ?>
1150 1150
                 </label>
1151
-                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>"
1152
-                       id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield"
1151
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'longitude'; ?>"
1152
+                       id="<?php echo $prefix.'longitude'; ?>" class="geodir_textfield"
1153 1153
                        value="<?php echo esc_attr(stripslashes($lng)); ?>" size="25"/>
1154 1154
                 <span class="geodir_message_note"><?php echo GET_LOGNGITUDE_MSG; ?></span>
1155 1155
                 <?php if ($is_required) { ?>
@@ -1159,32 +1159,32 @@  discard block
 block discarded – undo
1159 1159
         <?php } ?>
1160 1160
 
1161 1161
         <?php if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) { ?>
1162
-            <div id="geodir_<?php echo $prefix . 'mapview'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1162
+            <div id="geodir_<?php echo $prefix.'mapview'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1163 1163
                 <label><?php _e($mapview_title, 'geodirectory'); ?></label>
1164 1164
 
1165 1165
 
1166 1166
                     <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1167 1167
                                                             class="gd-checkbox"
1168
-                                                            name="<?php echo $prefix . 'mapview'; ?>"
1169
-                                                            id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
1168
+                                                            name="<?php echo $prefix.'mapview'; ?>"
1169
+                                                            id="<?php echo $prefix.'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
1170 1170
                             echo 'checked="checked"';
1171 1171
                         } ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1172 1172
                     <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio"
1173 1173
                                                              class="gd-checkbox"
1174
-                                                             name="<?php echo $prefix . 'mapview'; ?>"
1174
+                                                             name="<?php echo $prefix.'mapview'; ?>"
1175 1175
                                                              id="map_view1" <?php if ($mapview == 'SATELLITE') {
1176 1176
                             echo 'checked="checked"';
1177 1177
                         } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1178 1178
 
1179 1179
                     <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1180 1180
                                                             class="gd-checkbox"
1181
-                                                            name="<?php echo $prefix . 'mapview'; ?>"
1181
+                                                            name="<?php echo $prefix.'mapview'; ?>"
1182 1182
                                                             id="map_view2" <?php if ($mapview == 'HYBRID') {
1183 1183
                             echo 'checked="checked"';
1184 1184
                         } ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1185 1185
 					<span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1186 1186
                                                             class="gd-checkbox"
1187
-                                                            name="<?php echo $prefix . 'mapview'; ?>"
1187
+                                                            name="<?php echo $prefix.'mapview'; ?>"
1188 1188
                                                             id="map_view3" <?php if ($mapview == 'TERRAIN') {
1189 1189
                             echo 'checked="checked"';
1190 1190
                         } ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
         <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?>
1197 1197
             <input type="hidden" value="<?php if (isset($mapzoom)) {
1198 1198
                 echo esc_attr($mapzoom);
1199
-            } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1199
+            } ?>" name="<?php echo $prefix.'mapzoom'; ?>" id="<?php echo $prefix.'mapzoom'; ?>"/>
1200 1200
         <?php }
1201 1201
 
1202 1202
         $html = ob_get_clean();
@@ -1204,7 +1204,7 @@  discard block
 block discarded – undo
1204 1204
 
1205 1205
     return $html;
1206 1206
 }
1207
-add_filter('geodir_custom_field_input_address','geodir_cfi_address',10,2);
1207
+add_filter('geodir_custom_field_input_address', 'geodir_cfi_address', 10, 2);
1208 1208
 
1209 1209
 
1210 1210
 
@@ -1217,12 +1217,12 @@  discard block
 block discarded – undo
1217 1217
  *
1218 1218
  * @return string The html to output for the custom field.
1219 1219
  */
1220
-function geodir_cfi_taxonomy($html,$cf){
1220
+function geodir_cfi_taxonomy($html, $cf) {
1221 1221
 
1222 1222
     $html_var = $cf['htmlvar_name'];
1223 1223
 
1224 1224
     // Check if there is a custom field specific filter.
1225
-    if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){
1225
+    if (has_filter("geodir_custom_field_input_taxonomy_{$html_var}")) {
1226 1226
         /**
1227 1227
          * Filter the taxonomy html by individual custom field.
1228 1228
          *
@@ -1230,11 +1230,11 @@  discard block
 block discarded – undo
1230 1230
          * @param array $cf The custom field array.
1231 1231
          * @since 1.6.6
1232 1232
          */
1233
-        $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf);
1233
+        $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}", $html, $cf);
1234 1234
     }
1235 1235
 
1236 1236
     // If no html then we run the standard output.
1237
-    if(empty($html)) {
1237
+    if (empty($html)) {
1238 1238
 
1239 1239
         ob_start(); // Start  buffering;
1240 1240
         $value = geodir_get_cf_value($cf);
@@ -1249,15 +1249,15 @@  discard block
 block discarded – undo
1249 1249
         if ($value == $cf['default']) {
1250 1250
             $value = '';
1251 1251
         } ?>
1252
-        <div id="<?php echo $name;?>_row"
1253
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1252
+        <div id="<?php echo $name; ?>_row"
1253
+             class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
1254 1254
             <label>
1255 1255
                 <?php $site_title = __($site_title, 'geodirectory');
1256 1256
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1257
-                <?php if ($is_required) echo '<span>*</span>';?>
1257
+                <?php if ($is_required) echo '<span>*</span>'; ?>
1258 1258
             </label>
1259 1259
 
1260
-            <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1260
+            <div id="<?php echo $name; ?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1261 1261
                 <?php
1262 1262
                 global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1263 1263
 
@@ -1269,7 +1269,7 @@  discard block
 block discarded – undo
1269 1269
 
1270 1270
                     $package_info = array();
1271 1271
 
1272
-                    $package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1272
+                    $package_info = (array) geodir_post_package_info($package_info, $post, $post_type);
1273 1273
 
1274 1274
                     if (!empty($package_info)) {
1275 1275
 
@@ -1298,7 +1298,7 @@  discard block
 block discarded – undo
1298 1298
 
1299 1299
                     $catadd_limit = $wpdb->get_var(
1300 1300
                         $wpdb->prepare(
1301
-                            "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1301
+                            "SELECT cat_limit FROM ".GEODIR_PRICE_TABLE." WHERE pid = %d",
1302 1302
                             array($package_id)
1303 1303
                         )
1304 1304
                     );
@@ -1314,13 +1314,13 @@  discard block
 block discarded – undo
1314 1314
                     $required_limit_msg = '';
1315 1315
                     if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1316 1316
 
1317
-                        $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1317
+                        $required_limit_msg = __('Only select', 'geodirectory').' '.$catadd_limit.__(' categories for this package.', 'geodirectory');
1318 1318
 
1319 1319
                     } else {
1320 1320
                         $required_limit_msg = $required_msg;
1321 1321
                     }
1322 1322
 
1323
-                    echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1323
+                    echo '<input type="hidden" cat_limit="'.$catadd_limit.'" id="cat_limit" value="'.esc_attr($required_limit_msg).'" name="cat_limit['.$name.']"  />';
1324 1324
 
1325 1325
 
1326 1326
                     if ($cat_display == 'select' || $cat_display == 'multiselect') {
@@ -1330,11 +1330,11 @@  discard block
 block discarded – undo
1330 1330
                         if ($cat_display == 'multiselect')
1331 1331
                             $multiple = 'multiple="multiple"';
1332 1332
 
1333
-                        echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1333
+                        echo '<select id="'.$name.'" '.$multiple.' type="'.$name.'" name="post_category['.$name.'][]" alt="'.$name.'" field_type="'.$cat_display.'" class="geodir_textfield textfield_x chosen_select" data-placeholder="'.__('Select Category', 'geodirectory').'">';
1334 1334
 
1335 1335
 
1336 1336
                         if ($cat_display == 'select')
1337
-                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1337
+                            echo '<option value="">'.__('Select Category', 'geodirectory').'</option>';
1338 1338
 
1339 1339
                     }
1340 1340
 
@@ -1352,7 +1352,7 @@  discard block
 block discarded – undo
1352 1352
                 ?>
1353 1353
             </div>
1354 1354
 
1355
-            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1355
+            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1356 1356
             <?php if ($is_required) { ?>
1357 1357
                 <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1358 1358
             <?php } ?>
@@ -1364,7 +1364,7 @@  discard block
 block discarded – undo
1364 1364
 
1365 1365
     return $html;
1366 1366
 }
1367
-add_filter('geodir_custom_field_input_taxonomy','geodir_cfi_taxonomy',10,2);
1367
+add_filter('geodir_custom_field_input_taxonomy', 'geodir_cfi_taxonomy', 10, 2);
1368 1368
 
1369 1369
 
1370 1370
 /**
@@ -1376,12 +1376,12 @@  discard block
 block discarded – undo
1376 1376
  *
1377 1377
  * @return string The html to output for the custom field.
1378 1378
  */
1379
-function geodir_cfi_file($html,$cf){
1379
+function geodir_cfi_file($html, $cf) {
1380 1380
 
1381 1381
     $html_var = $cf['htmlvar_name'];
1382 1382
 
1383 1383
     // Check if there is a custom field specific filter.
1384
-    if(has_filter("geodir_custom_field_input_file_{$html_var}")){
1384
+    if (has_filter("geodir_custom_field_input_file_{$html_var}")) {
1385 1385
         /**
1386 1386
          * Filter the file html by individual custom field.
1387 1387
          *
@@ -1389,11 +1389,11 @@  discard block
 block discarded – undo
1389 1389
          * @param array $cf The custom field array.
1390 1390
          * @since 1.6.6
1391 1391
          */
1392
-        $html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf);
1392
+        $html = apply_filters("geodir_custom_field_input_file_{$html_var}", $html, $cf);
1393 1393
     }
1394 1394
 
1395 1395
     // If no html then we run the standard output.
1396
-    if(empty($html)) {
1396
+    if (empty($html)) {
1397 1397
 
1398 1398
         ob_start(); // Start  buffering;
1399 1399
         $value = geodir_get_cf_value($cf);
@@ -1436,8 +1436,8 @@  discard block
 block discarded – undo
1436 1436
                 $file_totImg = count($curImages);
1437 1437
         }
1438 1438
 
1439
-        $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
1440
-        $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
1439
+        $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? implode(",", $extra_fields['gd_file_types']) : '';
1440
+        $display_file_types = $allowed_file_types != '' ? '.'.implode(", .", $extra_fields['gd_file_types']) : '';
1441 1441
 
1442 1442
         ?>
1443 1443
         <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?>
@@ -1447,13 +1447,13 @@  discard block
 block discarded – undo
1447 1447
 			</h5>   <?php */
1448 1448
         ?>
1449 1449
 
1450
-        <div id="<?php echo $name;?>_row"
1451
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1450
+        <div id="<?php echo $name; ?>_row"
1451
+             class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
1452 1452
 
1453 1453
             <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
1454 1454
                 <label
1455 1455
                     style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
1456
-                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1456
+                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>'; ?></label>
1457 1457
                 <input class="geodir-custom-file-upload" field_type="file" type="hidden"
1458 1458
                        name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
1459 1459
                        value="<?php echo esc_attr($file_value); ?>"/>
@@ -1461,7 +1461,7 @@  discard block
 block discarded – undo
1461 1461
                        id="<?php echo $file_id; ?>image_limit" value="<?php echo $file_image_limit; ?>"/>
1462 1462
                 <?php if ($allowed_file_types != '') { ?>
1463 1463
                     <input type="hidden" name="<?php echo $file_id; ?>_allowed_types"
1464
-                           id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types);?>"/>
1464
+                           id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types); ?>"/>
1465 1465
                 <?php } ?>
1466 1466
                 <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg"
1467 1467
                        value="<?php if (isset($file_totImg)) {
@@ -1477,10 +1477,10 @@  discard block
 block discarded – undo
1477 1477
                         <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */
1478 1478
                         ?>
1479 1479
                         <input id="<?php echo $file_id; ?>plupload-browse-button" type="button"
1480
-                               value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>"
1480
+                               value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory')); ?>"
1481 1481
                                class="geodir_button" style="margin-top:10px;"/>
1482 1482
                             <span class="ajaxnonceplu"
1483
-                                  id="ajaxnonceplu<?php echo wp_create_nonce($file_id . 'pluploadan'); ?>"></span>
1483
+                                  id="ajaxnonceplu<?php echo wp_create_nonce($file_id.'pluploadan'); ?>"></span>
1484 1484
                         <?php if ($file_width && $file_height): ?>
1485 1485
                             <span class="plupload-resize"></span>
1486 1486
                             <span class="plupload-width" id="plupload-width<?php echo $file_width; ?>"></span>
@@ -1500,7 +1500,7 @@  discard block
 block discarded – undo
1500 1500
 
1501 1501
                 </div>
1502 1502
             </div>
1503
-            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?> <?php echo ( $display_file_types != '' ? __('Allowed file types:', 'geodirectory') . ' ' . $display_file_types : '' );?></span>
1503
+            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> <?php echo ($display_file_types != '' ? __('Allowed file types:', 'geodirectory').' '.$display_file_types : ''); ?></span>
1504 1504
             <?php if ($is_required) { ?>
1505 1505
                 <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1506 1506
             <?php } ?>
@@ -1513,4 +1513,4 @@  discard block
 block discarded – undo
1513 1513
 
1514 1514
     return $html;
1515 1515
 }
1516
-add_filter('geodir_custom_field_input_file','geodir_cfi_file',10,2);
1517 1516
\ No newline at end of file
1517
+add_filter('geodir_custom_field_input_file', 'geodir_cfi_file', 10, 2);
1518 1518
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +191 added lines, -68 removed lines patch added patch discarded remove patch
@@ -86,26 +86,31 @@  discard block
 block discarded – undo
86 86
         $value = geodir_get_cf_value($cf);
87 87
         $type = $cf['type'];
88 88
         //number and float validation $validation_pattern
89
-        if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
-        elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
89
+        if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';} elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
91 90
 
92 91
         //validation
93 92
         if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
94 93
             $validation = 'pattern="'.$cf['validation_pattern'].'"';
95
-        }else{$validation='';}
94
+        } else{$validation='';}
96 95
 
97 96
         // validation message
98 97
         if(isset($cf['validation_msg']) && $cf['validation_msg']){
99 98
             $validation_msg = 'title="'.$cf['validation_msg'].'"';
100
-        }else{$validation_msg='';}
99
+        } else{$validation_msg='';}
101 100
         ?>
102 101
 
103 102
         <div id="<?php echo $cf['name'];?>_row"
104
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
103
+             class="<?php if ($cf['is_required']) {
104
+	echo 'required_field';
105
+}
106
+?> geodir_form_row clearfix gd-fieldset-details">
105 107
             <label>
106 108
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
107 109
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
108
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
110
+                <?php if ($cf['is_required']) {
111
+	echo '<span>*</span>';
112
+}
113
+?>
109 114
             </label>
110 115
             <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
111 116
                    value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> />
@@ -160,11 +165,17 @@  discard block
 block discarded – undo
160 165
         }?>
161 166
 
162 167
         <div id="<?php echo $cf['name'];?>_row"
163
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
168
+             class="<?php if ($cf['is_required']) {
169
+	echo 'required_field';
170
+}
171
+?> geodir_form_row clearfix gd-fieldset-details">
164 172
             <label>
165 173
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
166 174
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
167
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
175
+                <?php if ($cf['is_required']) {
176
+	echo '<span>*</span>';
177
+}
178
+?>
168 179
             </label>
169 180
             <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
170 181
                    value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/>
@@ -220,11 +231,17 @@  discard block
 block discarded – undo
220 231
         }?>
221 232
 
222 233
         <div id="<?php echo $cf['name'];?>_row"
223
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
234
+             class="<?php if ($cf['is_required']) {
235
+	echo 'required_field';
236
+}
237
+?> geodir_form_row clearfix gd-fieldset-details">
224 238
             <label>
225 239
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
226 240
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
227
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
241
+                <?php if ($cf['is_required']) {
242
+	echo '<span>*</span>';
243
+}
244
+?>
228 245
             </label>
229 246
             <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
230 247
                    value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/>
@@ -280,11 +297,17 @@  discard block
 block discarded – undo
280 297
         }?>
281 298
 
282 299
         <div id="<?php echo $cf['name'];?>_row"
283
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
300
+             class="<?php if ($cf['is_required']) {
301
+	echo 'required_field';
302
+}
303
+?> geodir_form_row clearfix gd-fieldset-details">
284 304
             <label>
285 305
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
286 306
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
287
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
307
+                <?php if ($cf['is_required']) {
308
+	echo '<span>*</span>';
309
+}
310
+?>
288 311
             </label>
289 312
             <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
290 313
                    value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield"
@@ -339,11 +362,17 @@  discard block
 block discarded – undo
339 362
 
340 363
         ?>
341 364
         <div id="<?php echo $cf['name'];?>_row"
342
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
365
+             class="<?php if ($cf['is_required']) {
366
+	echo 'required_field';
367
+}
368
+?> geodir_form_row clearfix gd-fieldset-details">
343 369
             <label>
344 370
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
345 371
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
346
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
372
+                <?php if ($cf['is_required']) {
373
+	echo '<span>*</span>';
374
+}
375
+?>
347 376
             </label>
348 377
             <?php if ($cf['option_values']) {
349 378
                 $option_values = geodir_string_values_to_options($cf['option_values'], true);
@@ -412,11 +441,17 @@  discard block
 block discarded – undo
412 441
         ?>
413 442
 
414 443
         <div id="<?php echo $cf['name'];?>_row"
415
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
444
+             class="<?php if ($cf['is_required']) {
445
+	echo 'required_field';
446
+}
447
+?> geodir_form_row clearfix gd-fieldset-details">
416 448
             <label>
417 449
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
418 450
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
419
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
451
+                <?php if ($cf['is_required']) {
452
+	echo '<span>*</span>';
453
+}
454
+?>
420 455
             </label>
421 456
             <?php if ($value != '1') {
422 457
                 $value = '0';
@@ -476,11 +511,17 @@  discard block
 block discarded – undo
476 511
         ?>
477 512
 
478 513
         <div id="<?php echo $cf['name'];?>_row"
479
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
514
+             class="<?php if ($cf['is_required']) {
515
+	echo 'required_field';
516
+}
517
+?> geodir_form_row clearfix gd-fieldset-details">
480 518
             <label>
481 519
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
482 520
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
483
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
521
+                <?php if ($cf['is_required']) {
522
+	echo '<span>*</span>';
523
+}
524
+?>
484 525
             </label><?php
485 526
 
486 527
 
@@ -548,11 +589,17 @@  discard block
 block discarded – undo
548 589
 
549 590
         ?>
550 591
         <div id="<?php echo $cf['name'];?>_row"
551
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
592
+             class="<?php if ($cf['is_required']) {
593
+	echo 'required_field';
594
+}
595
+?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
552 596
             <label>
553 597
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
554 598
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
555
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
599
+                <?php if ($cf['is_required']) {
600
+	echo '<span>*</span>';
601
+}
602
+?>
556 603
             </label>
557 604
             <?php
558 605
             $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
@@ -629,11 +676,17 @@  discard block
 block discarded – undo
629 676
         }
630 677
         ?>
631 678
         <div id="<?php echo $cf['name']; ?>_row"
632
-             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
679
+             class="<?php if ($cf['is_required']) {
680
+	echo 'required_field';
681
+}
682
+?> geodir_form_row clearfix gd-fieldset-details">
633 683
             <label>
634 684
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
635 685
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
636
-                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
686
+                <?php if ($cf['is_required']) {
687
+	echo '<span>*</span>';
688
+}
689
+?>
637 690
             </label>
638 691
             <input type="hidden" name="gd_field_<?php echo $cf['name']; ?>" value="1"/>
639 692
             <?php if ($multi_display == 'select') { ?>
@@ -746,11 +799,17 @@  discard block
 block discarded – undo
746 799
         ?>
747 800
 
748 801
         <div id="<?php echo $cf['name']; ?>_row"
749
-             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
802
+             class="<?php if ($cf['is_required']) {
803
+	echo 'required_field';
804
+}
805
+?> geodir_form_row clearfix gd-fieldset-details">
750 806
             <label>
751 807
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
752 808
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
753
-                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
809
+                <?php if ($cf['is_required']) {
810
+	echo '<span>*</span>';
811
+}
812
+?>
754 813
             </label>
755 814
 
756 815
             <?php $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
@@ -810,8 +869,9 @@  discard block
 block discarded – undo
810 869
         $extra_fields = unserialize($cf['extra_fields']);
811 870
         $name = $cf['name'];
812 871
 
813
-        if ($extra_fields['date_format'] == '')
814
-            $extra_fields['date_format'] = 'yy-mm-dd';
872
+        if ($extra_fields['date_format'] == '') {
873
+                    $extra_fields['date_format'] = 'yy-mm-dd';
874
+        }
815 875
 
816 876
         $date_format = $extra_fields['date_format'];
817 877
         $jquery_date_format  = $date_format;
@@ -825,7 +885,7 @@  discard block
 block discarded – undo
825 885
             $replace = array('d','j','l','m','n','F','Y');//PHP date format
826 886
 
827 887
             $date_format = str_replace($search, $replace, $date_format);
828
-        }else{
888
+        } else{
829 889
             $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
830 890
         }
831 891
 
@@ -860,12 +920,18 @@  discard block
 block discarded – undo
860 920
 
861 921
         </script>
862 922
         <div id="<?php echo $name;?>_row"
863
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
923
+             class="<?php if ($cf['is_required']) {
924
+	echo 'required_field';
925
+}
926
+?> geodir_form_row clearfix gd-fieldset-details">
864 927
             <label>
865 928
 
866 929
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
867 930
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
868
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
931
+                <?php if ($cf['is_required']) {
932
+	echo '<span>*</span>';
933
+}
934
+?>
869 935
             </label>
870 936
 
871 937
             <input field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
@@ -919,8 +985,9 @@  discard block
 block discarded – undo
919 985
 
920 986
         $name = $cf['name'];
921 987
 
922
-        if ($value != '')
923
-            $value = date('H:i', strtotime($value));
988
+        if ($value != '') {
989
+                    $value = date('H:i', strtotime($value));
990
+        }
924 991
         ?>
925 992
         <script type="text/javascript">
926 993
             jQuery(document).ready(function () {
@@ -933,12 +1000,18 @@  discard block
 block discarded – undo
933 1000
             });
934 1001
         </script>
935 1002
         <div id="<?php echo $name;?>_row"
936
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1003
+             class="<?php if ($cf['is_required']) {
1004
+	echo 'required_field';
1005
+}
1006
+?> geodir_form_row clearfix gd-fieldset-details">
937 1007
             <label>
938 1008
 
939 1009
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
940 1010
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
941
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
1011
+                <?php if ($cf['is_required']) {
1012
+	echo '<span>*</span>';
1013
+}
1014
+?>
942 1015
             </label>
943 1016
             <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>"
944 1017
                    id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
@@ -1030,17 +1103,27 @@  discard block
 block discarded – undo
1030 1103
         }
1031 1104
 
1032 1105
         $location = geodir_get_default_location();
1033
-        if (empty($city)) $city = isset($location->city) ? $location->city : '';
1034
-        if (empty($region)) $region = isset($location->region) ? $location->region : '';
1035
-        if (empty($country)) $country = isset($location->country) ? $location->country : '';
1106
+        if (empty($city)) {
1107
+        	$city = isset($location->city) ? $location->city : '';
1108
+        }
1109
+        if (empty($region)) {
1110
+        	$region = isset($location->region) ? $location->region : '';
1111
+        }
1112
+        if (empty($country)) {
1113
+        	$country = isset($location->country) ? $location->country : '';
1114
+        }
1036 1115
 
1037 1116
         $lat_lng_blank = false;
1038 1117
         if (empty($lat) && empty($lng)) {
1039 1118
             $lat_lng_blank = true;
1040 1119
         }
1041 1120
 
1042
-        if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1043
-        if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1121
+        if (empty($lat)) {
1122
+        	$lat = isset($location->city_latitude) ? $location->city_latitude : '';
1123
+        }
1124
+        if (empty($lng)) {
1125
+        	$lng = isset($location->city_longitude) ? $location->city_longitude : '';
1126
+        }
1044 1127
 
1045 1128
         /**
1046 1129
          * Filter the default latitude.
@@ -1064,10 +1147,16 @@  discard block
 block discarded – undo
1064 1147
         ?>
1065 1148
 
1066 1149
         <div id="geodir_<?php echo $prefix . 'address';?>_row"
1067
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1150
+             class="<?php if ($is_required) {
1151
+	echo 'required_field';
1152
+}
1153
+?> geodir_form_row clearfix gd-fieldset-details">
1068 1154
             <label>
1069 1155
                 <?php _e($address_title, 'geodirectory'); ?>
1070
-                <?php if ($is_required) echo '<span>*</span>';?>
1156
+                <?php if ($is_required) {
1157
+	echo '<span>*</span>';
1158
+}
1159
+?>
1071 1160
             </label>
1072 1161
             <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>"
1073 1162
                    id="<?php echo $prefix . 'address';?>" class="geodir_textfield"
@@ -1128,10 +1217,16 @@  discard block
 block discarded – undo
1128 1217
             /* show lat lng */
1129 1218
             $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1130 1219
             <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1131
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1220
+                 class="<?php if ($is_required) {
1221
+	echo 'required_field';
1222
+}
1223
+?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1132 1224
                 <label>
1133 1225
                     <?php echo PLACE_ADDRESS_LAT; ?>
1134
-                    <?php if ($is_required) echo '<span>*</span>'; ?>
1226
+                    <?php if ($is_required) {
1227
+	echo '<span>*</span>';
1228
+}
1229
+?>
1135 1230
                 </label>
1136 1231
                 <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>"
1137 1232
                        id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield"
@@ -1143,10 +1238,16 @@  discard block
 block discarded – undo
1143 1238
             </div>
1144 1239
 
1145 1240
             <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row"
1146
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1241
+                 class="<?php if ($is_required) {
1242
+	echo 'required_field';
1243
+}
1244
+?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1147 1245
                 <label>
1148 1246
                     <?php echo PLACE_ADDRESS_LNG; ?>
1149
-                    <?php if ($is_required) echo '<span>*</span>'; ?>
1247
+                    <?php if ($is_required) {
1248
+	echo '<span>*</span>';
1249
+}
1250
+?>
1150 1251
                 </label>
1151 1252
                 <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>"
1152 1253
                        id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield"
@@ -1250,11 +1351,17 @@  discard block
 block discarded – undo
1250 1351
             $value = '';
1251 1352
         } ?>
1252 1353
         <div id="<?php echo $name;?>_row"
1253
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1354
+             class="<?php if ($is_required) {
1355
+	echo 'required_field';
1356
+}
1357
+?> geodir_form_row clearfix gd-fieldset-details">
1254 1358
             <label>
1255 1359
                 <?php $site_title = __($site_title, 'geodirectory');
1256 1360
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1257
-                <?php if ($is_required) echo '<span>*</span>';?>
1361
+                <?php if ($is_required) {
1362
+	echo '<span>*</span>';
1363
+}
1364
+?>
1258 1365
             </label>
1259 1366
 
1260 1367
             <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
@@ -1288,8 +1395,9 @@  discard block
 block discarded – undo
1288 1395
                     $post_cat = implode(",", $post_cat[$name]);
1289 1396
 
1290 1397
                 } else {
1291
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1292
-                        $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1398
+                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1399
+                                            $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1400
+                    }
1293 1401
                 }
1294 1402
 
1295 1403
 
@@ -1327,21 +1435,24 @@  discard block
 block discarded – undo
1327 1435
 
1328 1436
                         $cat_display == '';
1329 1437
                         $multiple = '';
1330
-                        if ($cat_display == 'multiselect')
1331
-                            $multiple = 'multiple="multiple"';
1438
+                        if ($cat_display == 'multiselect') {
1439
+                                                    $multiple = 'multiple="multiple"';
1440
+                        }
1332 1441
 
1333 1442
                         echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1334 1443
 
1335 1444
 
1336
-                        if ($cat_display == 'select')
1337
-                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1445
+                        if ($cat_display == 'select') {
1446
+                                                    echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1447
+                        }
1338 1448
 
1339 1449
                     }
1340 1450
 
1341 1451
                     echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1342 1452
 
1343
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
1344
-                        echo '</select>';
1453
+                    if ($cat_display == 'select' || $cat_display == 'multiselect') {
1454
+                                            echo '</select>';
1455
+                    }
1345 1456
 
1346 1457
                 } else {
1347 1458
 
@@ -1413,18 +1524,23 @@  discard block
 block discarded – undo
1413 1524
 
1414 1525
             $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
1415 1526
 
1416
-        } else
1417
-            $file_value = '';
1527
+        } else {
1528
+                    $file_value = '';
1529
+        }
1418 1530
 
1419
-        if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
1420
-            $file_multiple = true; // allow multiple files upload
1421
-        else
1422
-            $file_multiple = false;
1531
+        if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) {
1532
+                    $file_multiple = true;
1533
+        }
1534
+        // allow multiple files upload
1535
+        else {
1536
+                    $file_multiple = false;
1537
+        }
1423 1538
 
1424
-        if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
1425
-            $file_image_limit = $extra_fields['image_limit'];
1426
-        else
1427
-            $file_image_limit = 1;
1539
+        if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) {
1540
+                    $file_image_limit = $extra_fields['image_limit'];
1541
+        } else {
1542
+                    $file_image_limit = 1;
1543
+        }
1428 1544
 
1429 1545
         $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1430 1546
 
@@ -1432,8 +1548,9 @@  discard block
 block discarded – undo
1432 1548
 
1433 1549
         if (!empty($file_value)) {
1434 1550
             $curImages = explode(',', $file_value);
1435
-            if (!empty($curImages))
1436
-                $file_totImg = count($curImages);
1551
+            if (!empty($curImages)) {
1552
+                            $file_totImg = count($curImages);
1553
+            }
1437 1554
         }
1438 1555
 
1439 1556
         $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
@@ -1448,12 +1565,18 @@  discard block
 block discarded – undo
1448 1565
         ?>
1449 1566
 
1450 1567
         <div id="<?php echo $name;?>_row"
1451
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1568
+             class="<?php if ($is_required) {
1569
+	echo 'required_field';
1570
+}
1571
+?> geodir_form_row clearfix gd-fieldset-details">
1452 1572
 
1453 1573
             <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
1454 1574
                 <label
1455 1575
                     style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
1456
-                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1576
+                    echo $site_title; ?><?php if ($is_required) {
1577
+                    	echo '<span>*</span>';
1578
+                    }
1579
+                    ?></label>
1457 1580
                 <input class="geodir-custom-file-upload" field_type="file" type="hidden"
1458 1581
                        name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
1459 1582
                        value="<?php echo esc_attr($file_value); ?>"/>
Please login to merge, or discard this patch.
geodirectory_shortcodes.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -427,7 +427,7 @@
 block discarded – undo
427 427
         }
428 428
 
429 429
         return $output;
430
-    }else{
430
+    } else{
431 431
         ob_start();
432 432
         add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
433 433
         add_action('the_post', 'create_list_jsondata'); // Add marker in json array
Please login to merge, or discard this patch.
Indentation   +875 added lines, -875 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,43 +32,43 @@  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
-       // Add listing page will be used if shortcode is detected in page content, no need to call it here
66
-    }
67
-    $output = ob_get_contents();
68
-
69
-    ob_end_clean();
70
-
71
-    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
+	   // Add listing page will be used if shortcode is detected in page content, no need to call it here
66
+	}
67
+	$output = ob_get_contents();
68
+
69
+	ob_end_clean();
70
+
71
+	return $output;
72 72
 }
73 73
 
74 74
 /**
@@ -96,136 +96,136 @@  discard block
 block discarded – undo
96 96
  */
97 97
 function geodir_sc_home_map($atts)
98 98
 {
99
-    ob_start();
100
-    $defaults = array(
101
-        'width' => '960',
102
-        'height' => '425',
103
-        'maptype' => 'ROADMAP',
104
-        'zoom' => '13',
105
-        'autozoom' => '',
106
-        'child_collapse' => '0',
107
-        'scrollwheel' => '0',
99
+	ob_start();
100
+	$defaults = array(
101
+		'width' => '960',
102
+		'height' => '425',
103
+		'maptype' => 'ROADMAP',
104
+		'zoom' => '13',
105
+		'autozoom' => '',
106
+		'child_collapse' => '0',
107
+		'scrollwheel' => '0',
108 108
 		'marker_cluster' => false,
109
-        'latitude' => '',
110
-        'longitude' => ''
111
-    );
112
-
113
-    $params = shortcode_atts($defaults, $atts);
114
-
115
-    $params = gdsc_validate_map_args($params);
116
-
117
-    $map_args = array(
118
-        'map_canvas_name' => 'gd_home_map',
119
-        'latitude' => $params['latitude'],
120
-        'longitude' => $params['longitude'],
121
-
122
-        /**
123
-         * Filter the widget width of the map on home/listings page.
124
-         *
125
-         * @since 1.0.0
126
-         * @param mixed(string|int|float) $params['width'] The map width.
127
-         */
128
-        'width' => apply_filters('widget_width', $params['width']),
129
-        /**
130
-         * Filter the widget height of the map on home/listings page.
131
-         *
132
-         * @since 1.0.0
133
-         * @param mixed(string|int|float) $params['height'] The map height.
134
-         */
135
-        'height' => apply_filters('widget_heigh', $params['height']),
136
-        /**
137
-         * Filter the widget maptype of the map on home/listings page.
138
-         *
139
-         * @since 1.0.0
109
+		'latitude' => '',
110
+		'longitude' => ''
111
+	);
112
+
113
+	$params = shortcode_atts($defaults, $atts);
114
+
115
+	$params = gdsc_validate_map_args($params);
116
+
117
+	$map_args = array(
118
+		'map_canvas_name' => 'gd_home_map',
119
+		'latitude' => $params['latitude'],
120
+		'longitude' => $params['longitude'],
121
+
122
+		/**
123
+		 * Filter the widget width of the map on home/listings page.
124
+		 *
125
+		 * @since 1.0.0
126
+		 * @param mixed(string|int|float) $params['width'] The map width.
127
+		 */
128
+		'width' => apply_filters('widget_width', $params['width']),
129
+		/**
130
+		 * Filter the widget height of the map on home/listings page.
131
+		 *
132
+		 * @since 1.0.0
133
+		 * @param mixed(string|int|float) $params['height'] The map height.
134
+		 */
135
+		'height' => apply_filters('widget_heigh', $params['height']),
136
+		/**
137
+		 * Filter the widget maptype of the map on home/listings page.
138
+		 *
139
+		 * @since 1.0.0
140 140
 		 * @since 1.5.2 Added TERRAIN map type.
141
-         * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN.
142
-         */
143
-        'maptype' => apply_filters('widget_maptype', $params['maptype']),
144
-        /**
145
-         * Filter the widget scrollwheel value of the map on home/listings page.
146
-         *
147
-         * Should the scrollwheel zoom the map or not.
148
-         *
149
-         * @since 1.0.0
150
-         * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not.
151
-         */
152
-        'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']),
153
-        /**
154
-         * Filter the widget zoom level of the map on home/listings page.
155
-         *
156
-         * @since 1.0.0
157
-         * @param int $params['zoom'] The zoom level of the map. Between 1-19.
158
-         */
159
-        'zoom' => apply_filters('widget_zoom', $params['zoom']),
160
-        /**
161
-         * Filter the widget auto zoom value of the map on home/listings page.
162
-         *
163
-         * If the map should autozoom to fit the markers shown.
164
-         *
165
-         * @since 1.0.0
166
-         * @param bool $params['autozoom'] True if the map should autozoom, false if not.
167
-         */
168
-        'autozoom' => apply_filters('widget_autozoom', $params['autozoom']),
169
-        /**
170
-         * Filter the widget child_collapse value of the map on home/listings page.
171
-         *
172
-         * If the map should auto collapse the child categories if the category bar is present.
173
-         *
174
-         * @since 1.0.0
175
-         * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not.
176
-         */
177
-        'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']),
178
-        'enable_cat_filters' => true,
179
-        'enable_text_search' => true,
180
-        'enable_post_type_filters' => true,
181
-        /**
182
-         * Filter the widget enable_location_filters value of the map on home/listings page.
183
-         *
184
-         * This is used when the location addon is used.
185
-         *
186
-         * @since 1.0.0
187
-         * @param bool $val True if location filters should be used, false if not.
188
-         */
189
-        'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false),
190
-        'enable_jason_on_load' => false,
191
-        'enable_marker_cluster' => false,
192
-        'enable_map_resize_button' => true,
193
-        'map_class_name' => 'geodir-map-home-page',
194
-        'is_geodir_home_map_widget' => true,
195
-    );
141
+		 * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN.
142
+		 */
143
+		'maptype' => apply_filters('widget_maptype', $params['maptype']),
144
+		/**
145
+		 * Filter the widget scrollwheel value of the map on home/listings page.
146
+		 *
147
+		 * Should the scrollwheel zoom the map or not.
148
+		 *
149
+		 * @since 1.0.0
150
+		 * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not.
151
+		 */
152
+		'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']),
153
+		/**
154
+		 * Filter the widget zoom level of the map on home/listings page.
155
+		 *
156
+		 * @since 1.0.0
157
+		 * @param int $params['zoom'] The zoom level of the map. Between 1-19.
158
+		 */
159
+		'zoom' => apply_filters('widget_zoom', $params['zoom']),
160
+		/**
161
+		 * Filter the widget auto zoom value of the map on home/listings page.
162
+		 *
163
+		 * If the map should autozoom to fit the markers shown.
164
+		 *
165
+		 * @since 1.0.0
166
+		 * @param bool $params['autozoom'] True if the map should autozoom, false if not.
167
+		 */
168
+		'autozoom' => apply_filters('widget_autozoom', $params['autozoom']),
169
+		/**
170
+		 * Filter the widget child_collapse value of the map on home/listings page.
171
+		 *
172
+		 * If the map should auto collapse the child categories if the category bar is present.
173
+		 *
174
+		 * @since 1.0.0
175
+		 * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not.
176
+		 */
177
+		'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']),
178
+		'enable_cat_filters' => true,
179
+		'enable_text_search' => true,
180
+		'enable_post_type_filters' => true,
181
+		/**
182
+		 * Filter the widget enable_location_filters value of the map on home/listings page.
183
+		 *
184
+		 * This is used when the location addon is used.
185
+		 *
186
+		 * @since 1.0.0
187
+		 * @param bool $val True if location filters should be used, false if not.
188
+		 */
189
+		'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false),
190
+		'enable_jason_on_load' => false,
191
+		'enable_marker_cluster' => false,
192
+		'enable_map_resize_button' => true,
193
+		'map_class_name' => 'geodir-map-home-page',
194
+		'is_geodir_home_map_widget' => true,
195
+	);
196 196
 
197 197
 	// Add marker cluster
198 198
 	if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
199
-        $map_args['enable_marker_cluster'] = true;
200
-        if(get_option('geodir_marker_cluster_type')) {
201
-            if ($map_args['autozoom']) {
202
-                $map_args['enable_marker_cluster_no_reposition'] = false;
203
-            } else {
204
-                $map_args['enable_marker_cluster_no_reposition'] = true;
205
-            }
199
+		$map_args['enable_marker_cluster'] = true;
200
+		if(get_option('geodir_marker_cluster_type')) {
201
+			if ($map_args['autozoom']) {
202
+				$map_args['enable_marker_cluster_no_reposition'] = false;
203
+			} else {
204
+				$map_args['enable_marker_cluster_no_reposition'] = true;
205
+			}
206 206
 
207
-            $map_args['enable_marker_cluster_server'] = true ;
207
+			$map_args['enable_marker_cluster_server'] = true ;
208 208
 
209
-        }
209
+		}
210 210
 	} else {
211 211
 		$map_args['enable_marker_cluster'] = false;
212 212
 	}
213 213
 
214
-    // if lat and long set in shortcode, hack it so the map is not repositioned
215
-    if(!empty($params['latitude']) && !empty($params['longitude']) ){
216
-        $map_args['enable_marker_cluster_no_reposition'] = true;
217
-    }
214
+	// if lat and long set in shortcode, hack it so the map is not repositioned
215
+	if(!empty($params['latitude']) && !empty($params['longitude']) ){
216
+		$map_args['enable_marker_cluster_no_reposition'] = true;
217
+	}
218 218
 
219 219
 
220
-    geodir_draw_map($map_args);
220
+	geodir_draw_map($map_args);
221 221
 
222
-    add_action('wp_footer', 'geodir_home_map_add_script', 100);
222
+	add_action('wp_footer', 'geodir_home_map_add_script', 100);
223 223
 
224
-    $output = ob_get_contents();
224
+	$output = ob_get_contents();
225 225
 
226
-    ob_end_clean();
226
+	ob_end_clean();
227 227
 
228
-    return $output;
228
+	return $output;
229 229
 }
230 230
 add_shortcode('gd_homepage_map', 'geodir_sc_home_map');
231 231
 
@@ -264,243 +264,243 @@  discard block
 block discarded – undo
264 264
  */
265 265
 function geodir_sc_listing_map($atts) {
266 266
 
267
-    // if some params are set then we need a new query, if not then we can use the main query
268
-    if( isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type']) ) {
269
-
270
-        global $add_post_in_marker_array, $gd_sc_map_params;
271
-        $backup_globals                             = array();
272
-        $backup_globals['add_post_in_marker_array'] = $add_post_in_marker_array;
273
-        $backup_globals['gd_sc_map_params']         = $gd_sc_map_params;
274
-
275
-        $defaults = array(
276
-            'width'          => '294',
277
-            'height'         => '370',
278
-            'zoom'           => '13',
279
-            'autozoom'       => '',
280
-            'sticky'         => '',
281
-            'showall'        => '0',
282
-            'scrollwheel'    => '0',
283
-            'maptype'        => 'ROADMAP',
284
-            'child_collapse' => 0,
285
-            'marker_cluster' => false,
286
-            'post_type'      => 'gd_place',
287
-            'category'       => '0',
288
-            'event_type'     => 'all'
289
-        );
290
-
291
-        $params = shortcode_atts( $defaults, $atts );
292
-
293
-        if ( ! ( gdsc_is_post_type_valid( $params['post_type'] ) ) ) {
294
-            $params['post_type'] = 'gd_place';
295
-        }
296
-
297
-        // Validate the selected category/ies - Grab the current list based on post_type
298
-        $category_taxonomy = geodir_get_taxonomies( $params['post_type'] );
299
-        $categories        = get_terms( $category_taxonomy, array(
300
-            'orderby' => 'count',
301
-            'order'   => 'DESC',
302
-            'fields'  => 'ids'
303
-        ) );
304
-
305
-        // Make sure we have an array
306
-        if ( ! ( is_array( $params['category'] ) ) ) {
307
-            $params['category'] = explode( ',', $params['category'] );
308
-        }
309
-
310
-        // Array_intersect returns only the items in $params['category'] that are also in our category list
311
-        // Otherwise it becomes empty and later on that will mean "All"
312
-        $params['category'] = array_intersect( $params['category'], $categories );
313
-
314
-        if ( $params['post_type'] == 'gd_event' ) {
315
-            $params['event_type'] = gdsc_validate_list_filter_choice( $params['event_type'] );
316
-        }
317
-
318
-        $params = gdsc_validate_map_args( $params );
319
-
320
-        $gd_sc_map_params = $params;
321
-
322
-        $query_args = array(
323
-            'posts_per_page' => 1000000, //@todo kiran why was this added? 
324
-            'is_geodir_loop' => true,
325
-            'gd_location'    => false,
326
-            'post_type'      => $params['post_type'],
327
-        );
328
-
329
-        if ( ! empty( $params['category'] ) && isset( $params['category'][0] ) && (int) $params['category'][0] != 0 ) {
330
-            $category_taxonomy = geodir_get_taxonomies( $params['post_type'] );
331
-
332
-            ######### WPML #########
333
-            if ( function_exists( 'icl_object_id' ) ) {
334
-                $category = gd_lang_object_ids( $params['category'], $category_taxonomy[0] );
335
-            }
336
-            ######### WPML #########
337
-
338
-            $tax_query = array(
339
-                'taxonomy' => $category_taxonomy[0],
340
-                'field'    => 'id',
341
-                'terms'    => $params['category']
342
-            );
343
-
344
-            $query_args['tax_query'] = array( $tax_query );
345
-        }
346
-
347
-        $add_post_in_marker_array = true;
348
-
349
-        if ( $params['post_type'] == 'gd_event' && function_exists( 'geodir_event_get_widget_events' ) ) {
350
-            global $geodir_event_widget_listview;
351
-            $geodir_event_widget_listview = true;
352
-
353
-            $query_args['geodir_event_type'] = $params['event_type'];
354
-
355
-            $listings = geodir_event_get_widget_events( $query_args );
356
-
357
-            $geodir_event_widget_listview = false;
358
-        } else {
359
-            $listings = geodir_get_widget_listings( $query_args );
360
-        }
361
-
362
-        if ( ! empty( $listings ) ) {
363
-            foreach ( $listings as $listing ) {
364
-                create_marker_jason_of_posts( $listing );
365
-            }
366
-        }
367
-
368
-        ob_start();
369
-        add_action( 'wp_head', 'init_listing_map_script' ); // Initialize the map object and marker array
370
-
371
-        add_action( 'the_post', 'create_list_jsondata' ); // Add marker in json array
372
-
373
-        add_action( 'wp_footer', 'show_listing_widget_map' ); // Show map for listings with markers
374
-
375
-        $default_location = geodir_get_default_location();
376
-
377
-        $map_args = array(
378
-            'map_canvas_name'          => 'gd_listing_map',
379
-            'width'                    => $params['width'],
380
-            'height'                   => $params['height'],
381
-            'zoom'                     => $params['zoom'],
382
-            'autozoom'                 => $params['autozoom'],
383
-            'sticky'                   => $params['sticky'],
384
-            'showall'                  => $params['showall'],
385
-            'scrollwheel'              => $params['scrollwheel'],
386
-            'maptype'                  => $params['maptype'],
387
-            'child_collapse'           => 0,
388
-            'enable_cat_filters'       => false,
389
-            'enable_text_search'       => false,
390
-            'enable_post_type_filters' => false,
391
-            'enable_location_filters'  => false,
392
-            'enable_jason_on_load'     => true,
393
-            'ajax_url'                 => geodir_get_ajax_url(),
394
-            'latitude'                 => isset( $default_location->city_latitude ) ? $default_location->city_latitude : '',
395
-            'longitude'                => isset( $default_location->city_longitude ) ? $default_location->city_longitude : '',
396
-            'streetViewControl'        => true,
397
-            'showPreview'              => '0',
398
-            'maxZoom'                  => 21,
399
-            'bubble_size'              => 'small',
400
-        );
401
-
402
-        if ( is_single() ) {
403
-            global $post;
404
-            if ( isset( $post->post_latitude ) ) {
405
-                $map_args['latitude']  = $post->post_latitude;
406
-                $map_args['longitude'] = $post->post_longitude;
407
-            }
408
-
409
-            $map_args['map_class_name'] = 'geodir-map-listing-page-single';
410
-        } else {
411
-            $map_args['map_class_name'] = 'geodir-map-listing-page';
412
-        }
413
-
414
-        // Add marker cluster
415
-        if ( isset( $params['marker_cluster'] ) && gdsc_to_bool_val( $params['marker_cluster'] ) && defined( 'GDCLUSTER_VERSION' ) ) {
416
-            $map_args['enable_marker_cluster'] = true;
417
-        } else {
418
-            $map_args['enable_marker_cluster'] = false;
419
-        }
420
-
421
-        geodir_draw_map( $map_args );
422
-
423
-        $output = ob_get_contents();
424
-
425
-        ob_end_clean();
426
-
427
-        foreach ( $backup_globals as $global => $value ) {
428
-            ${$global} = $value;
429
-        }
430
-
431
-        return $output;
432
-    }else{
433
-        ob_start();
434
-        add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
435
-        add_action('the_post', 'create_list_jsondata'); // Add marker in json array
436
-        add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
437
-        $defaults = array(
438
-            'width' => '294',
439
-            'height' => '370',
440
-            'zoom' => '13',
441
-            'autozoom' => '',
442
-            'sticky' => '',
443
-            'showall' => '0',
444
-            'scrollwheel' => '0',
445
-            'maptype' => 'ROADMAP',
446
-            'child_collapse' => 0,
447
-            'marker_cluster' => false
448
-        );
449
-        $params = shortcode_atts($defaults, $atts);
450
-        $params = gdsc_validate_map_args($params);
451
-        $map_args = array(
452
-            'map_canvas_name' => 'gd_listing_map',
453
-            'width' => $params['width'],
454
-            'height' => $params['height'],
455
-            'zoom' => $params['zoom'],
456
-            'autozoom' => $params['autozoom'],
457
-            'sticky' => $params['sticky'],
458
-            'showall' => $params['showall'],
459
-            'scrollwheel' => $params['scrollwheel'],
460
-            'child_collapse' => 0,
461
-            'enable_cat_filters' => false,
462
-            'enable_text_search' => false,
463
-            'enable_post_type_filters' => false,
464
-            'enable_location_filters' => false,
465
-            'enable_jason_on_load' => true,
466
-        );
467
-        if (is_single()) {
468
-            global $post;
469
-            $map_default_lat = $address_latitude = $post->post_latitude;
470
-            $map_default_lng = $address_longitude = $post->post_longitude;
471
-            $mapview = $post->post_mapview;
472
-            $map_args['zoom'] = $post->post_mapzoom;
473
-            $map_args['map_class_name'] = 'geodir-map-listing-page-single';
474
-        } else {
475
-            $default_location = geodir_get_default_location();
476
-            $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
477
-            $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
478
-            $map_args['map_class_name'] = 'geodir-map-listing-page';
479
-        }
480
-        if (empty($mapview)) {
481
-            $mapview = 'ROADMAP';
482
-        }
483
-        // Set default map options
484
-        $map_args['ajax_url'] = geodir_get_ajax_url();
485
-        $map_args['latitude'] = $map_default_lat;
486
-        $map_args['longitude'] = $map_default_lng;
487
-        $map_args['streetViewControl'] = true;
488
-        $map_args['maptype'] = $mapview;
489
-        $map_args['showPreview'] = '0';
490
-        $map_args['maxZoom'] = 21;
491
-        $map_args['bubble_size'] = 'small';
492
-
493
-        // Add marker cluster
494
-        if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
495
-            $map_args['enable_marker_cluster'] = true;
496
-        } else {
497
-            $map_args['enable_marker_cluster'] = false;
498
-        }
499
-        geodir_draw_map($map_args);
500
-        $output = ob_get_contents();
501
-        ob_end_clean();
502
-        return $output;
503
-    }
267
+	// if some params are set then we need a new query, if not then we can use the main query
268
+	if( isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type']) ) {
269
+
270
+		global $add_post_in_marker_array, $gd_sc_map_params;
271
+		$backup_globals                             = array();
272
+		$backup_globals['add_post_in_marker_array'] = $add_post_in_marker_array;
273
+		$backup_globals['gd_sc_map_params']         = $gd_sc_map_params;
274
+
275
+		$defaults = array(
276
+			'width'          => '294',
277
+			'height'         => '370',
278
+			'zoom'           => '13',
279
+			'autozoom'       => '',
280
+			'sticky'         => '',
281
+			'showall'        => '0',
282
+			'scrollwheel'    => '0',
283
+			'maptype'        => 'ROADMAP',
284
+			'child_collapse' => 0,
285
+			'marker_cluster' => false,
286
+			'post_type'      => 'gd_place',
287
+			'category'       => '0',
288
+			'event_type'     => 'all'
289
+		);
290
+
291
+		$params = shortcode_atts( $defaults, $atts );
292
+
293
+		if ( ! ( gdsc_is_post_type_valid( $params['post_type'] ) ) ) {
294
+			$params['post_type'] = 'gd_place';
295
+		}
296
+
297
+		// Validate the selected category/ies - Grab the current list based on post_type
298
+		$category_taxonomy = geodir_get_taxonomies( $params['post_type'] );
299
+		$categories        = get_terms( $category_taxonomy, array(
300
+			'orderby' => 'count',
301
+			'order'   => 'DESC',
302
+			'fields'  => 'ids'
303
+		) );
304
+
305
+		// Make sure we have an array
306
+		if ( ! ( is_array( $params['category'] ) ) ) {
307
+			$params['category'] = explode( ',', $params['category'] );
308
+		}
309
+
310
+		// Array_intersect returns only the items in $params['category'] that are also in our category list
311
+		// Otherwise it becomes empty and later on that will mean "All"
312
+		$params['category'] = array_intersect( $params['category'], $categories );
313
+
314
+		if ( $params['post_type'] == 'gd_event' ) {
315
+			$params['event_type'] = gdsc_validate_list_filter_choice( $params['event_type'] );
316
+		}
317
+
318
+		$params = gdsc_validate_map_args( $params );
319
+
320
+		$gd_sc_map_params = $params;
321
+
322
+		$query_args = array(
323
+			'posts_per_page' => 1000000, //@todo kiran why was this added? 
324
+			'is_geodir_loop' => true,
325
+			'gd_location'    => false,
326
+			'post_type'      => $params['post_type'],
327
+		);
328
+
329
+		if ( ! empty( $params['category'] ) && isset( $params['category'][0] ) && (int) $params['category'][0] != 0 ) {
330
+			$category_taxonomy = geodir_get_taxonomies( $params['post_type'] );
331
+
332
+			######### WPML #########
333
+			if ( function_exists( 'icl_object_id' ) ) {
334
+				$category = gd_lang_object_ids( $params['category'], $category_taxonomy[0] );
335
+			}
336
+			######### WPML #########
337
+
338
+			$tax_query = array(
339
+				'taxonomy' => $category_taxonomy[0],
340
+				'field'    => 'id',
341
+				'terms'    => $params['category']
342
+			);
343
+
344
+			$query_args['tax_query'] = array( $tax_query );
345
+		}
346
+
347
+		$add_post_in_marker_array = true;
348
+
349
+		if ( $params['post_type'] == 'gd_event' && function_exists( 'geodir_event_get_widget_events' ) ) {
350
+			global $geodir_event_widget_listview;
351
+			$geodir_event_widget_listview = true;
352
+
353
+			$query_args['geodir_event_type'] = $params['event_type'];
354
+
355
+			$listings = geodir_event_get_widget_events( $query_args );
356
+
357
+			$geodir_event_widget_listview = false;
358
+		} else {
359
+			$listings = geodir_get_widget_listings( $query_args );
360
+		}
361
+
362
+		if ( ! empty( $listings ) ) {
363
+			foreach ( $listings as $listing ) {
364
+				create_marker_jason_of_posts( $listing );
365
+			}
366
+		}
367
+
368
+		ob_start();
369
+		add_action( 'wp_head', 'init_listing_map_script' ); // Initialize the map object and marker array
370
+
371
+		add_action( 'the_post', 'create_list_jsondata' ); // Add marker in json array
372
+
373
+		add_action( 'wp_footer', 'show_listing_widget_map' ); // Show map for listings with markers
374
+
375
+		$default_location = geodir_get_default_location();
376
+
377
+		$map_args = array(
378
+			'map_canvas_name'          => 'gd_listing_map',
379
+			'width'                    => $params['width'],
380
+			'height'                   => $params['height'],
381
+			'zoom'                     => $params['zoom'],
382
+			'autozoom'                 => $params['autozoom'],
383
+			'sticky'                   => $params['sticky'],
384
+			'showall'                  => $params['showall'],
385
+			'scrollwheel'              => $params['scrollwheel'],
386
+			'maptype'                  => $params['maptype'],
387
+			'child_collapse'           => 0,
388
+			'enable_cat_filters'       => false,
389
+			'enable_text_search'       => false,
390
+			'enable_post_type_filters' => false,
391
+			'enable_location_filters'  => false,
392
+			'enable_jason_on_load'     => true,
393
+			'ajax_url'                 => geodir_get_ajax_url(),
394
+			'latitude'                 => isset( $default_location->city_latitude ) ? $default_location->city_latitude : '',
395
+			'longitude'                => isset( $default_location->city_longitude ) ? $default_location->city_longitude : '',
396
+			'streetViewControl'        => true,
397
+			'showPreview'              => '0',
398
+			'maxZoom'                  => 21,
399
+			'bubble_size'              => 'small',
400
+		);
401
+
402
+		if ( is_single() ) {
403
+			global $post;
404
+			if ( isset( $post->post_latitude ) ) {
405
+				$map_args['latitude']  = $post->post_latitude;
406
+				$map_args['longitude'] = $post->post_longitude;
407
+			}
408
+
409
+			$map_args['map_class_name'] = 'geodir-map-listing-page-single';
410
+		} else {
411
+			$map_args['map_class_name'] = 'geodir-map-listing-page';
412
+		}
413
+
414
+		// Add marker cluster
415
+		if ( isset( $params['marker_cluster'] ) && gdsc_to_bool_val( $params['marker_cluster'] ) && defined( 'GDCLUSTER_VERSION' ) ) {
416
+			$map_args['enable_marker_cluster'] = true;
417
+		} else {
418
+			$map_args['enable_marker_cluster'] = false;
419
+		}
420
+
421
+		geodir_draw_map( $map_args );
422
+
423
+		$output = ob_get_contents();
424
+
425
+		ob_end_clean();
426
+
427
+		foreach ( $backup_globals as $global => $value ) {
428
+			${$global} = $value;
429
+		}
430
+
431
+		return $output;
432
+	}else{
433
+		ob_start();
434
+		add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
435
+		add_action('the_post', 'create_list_jsondata'); // Add marker in json array
436
+		add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
437
+		$defaults = array(
438
+			'width' => '294',
439
+			'height' => '370',
440
+			'zoom' => '13',
441
+			'autozoom' => '',
442
+			'sticky' => '',
443
+			'showall' => '0',
444
+			'scrollwheel' => '0',
445
+			'maptype' => 'ROADMAP',
446
+			'child_collapse' => 0,
447
+			'marker_cluster' => false
448
+		);
449
+		$params = shortcode_atts($defaults, $atts);
450
+		$params = gdsc_validate_map_args($params);
451
+		$map_args = array(
452
+			'map_canvas_name' => 'gd_listing_map',
453
+			'width' => $params['width'],
454
+			'height' => $params['height'],
455
+			'zoom' => $params['zoom'],
456
+			'autozoom' => $params['autozoom'],
457
+			'sticky' => $params['sticky'],
458
+			'showall' => $params['showall'],
459
+			'scrollwheel' => $params['scrollwheel'],
460
+			'child_collapse' => 0,
461
+			'enable_cat_filters' => false,
462
+			'enable_text_search' => false,
463
+			'enable_post_type_filters' => false,
464
+			'enable_location_filters' => false,
465
+			'enable_jason_on_load' => true,
466
+		);
467
+		if (is_single()) {
468
+			global $post;
469
+			$map_default_lat = $address_latitude = $post->post_latitude;
470
+			$map_default_lng = $address_longitude = $post->post_longitude;
471
+			$mapview = $post->post_mapview;
472
+			$map_args['zoom'] = $post->post_mapzoom;
473
+			$map_args['map_class_name'] = 'geodir-map-listing-page-single';
474
+		} else {
475
+			$default_location = geodir_get_default_location();
476
+			$map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
477
+			$map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
478
+			$map_args['map_class_name'] = 'geodir-map-listing-page';
479
+		}
480
+		if (empty($mapview)) {
481
+			$mapview = 'ROADMAP';
482
+		}
483
+		// Set default map options
484
+		$map_args['ajax_url'] = geodir_get_ajax_url();
485
+		$map_args['latitude'] = $map_default_lat;
486
+		$map_args['longitude'] = $map_default_lng;
487
+		$map_args['streetViewControl'] = true;
488
+		$map_args['maptype'] = $mapview;
489
+		$map_args['showPreview'] = '0';
490
+		$map_args['maxZoom'] = 21;
491
+		$map_args['bubble_size'] = 'small';
492
+
493
+		// Add marker cluster
494
+		if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
495
+			$map_args['enable_marker_cluster'] = true;
496
+		} else {
497
+			$map_args['enable_marker_cluster'] = false;
498
+		}
499
+		geodir_draw_map($map_args);
500
+		$output = ob_get_contents();
501
+		ob_end_clean();
502
+		return $output;
503
+	}
504 504
 }
505 505
 
506 506
 add_shortcode('gd_listing_slider', 'geodir_sc_listing_slider');
@@ -533,120 +533,120 @@  discard block
 block discarded – undo
533 533
  */
534 534
 function geodir_sc_listing_slider($atts)
535 535
 {
536
-    ob_start();
537
-    $defaults = array(
538
-        'post_type' => 'gd_place',
539
-        'category' => '0',
540
-        'post_number' => '5',
541
-        'slideshow' => '0',
542
-        'animation_loop' => 0,
543
-        'direction_nav' => 0,
544
-        'slideshow_speed' => 5000,
545
-        'animation_speed' => 600,
546
-        'animation' => 'slide',
547
-        'order_by' => 'latest',
548
-        'show_title' => '',
549
-        'show_featured_only' => '',
550
-        'title' => '',
551
-    );
552
-
553
-    $params = shortcode_atts($defaults, $atts);
554
-
555
-
556
-    /*
536
+	ob_start();
537
+	$defaults = array(
538
+		'post_type' => 'gd_place',
539
+		'category' => '0',
540
+		'post_number' => '5',
541
+		'slideshow' => '0',
542
+		'animation_loop' => 0,
543
+		'direction_nav' => 0,
544
+		'slideshow_speed' => 5000,
545
+		'animation_speed' => 600,
546
+		'animation' => 'slide',
547
+		'order_by' => 'latest',
548
+		'show_title' => '',
549
+		'show_featured_only' => '',
550
+		'title' => '',
551
+	);
552
+
553
+	$params = shortcode_atts($defaults, $atts);
554
+
555
+
556
+	/*
557 557
      *
558 558
      * Now we begin the validation of the attributes.
559 559
      */
560
-    // Check we have a valid post_type
561
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
562
-        $params['post_type'] = 'gd_place';
563
-    }
564
-
565
-    // Check we have a valid sort_order
566
-    $params['order_by'] = gdsc_validate_sort_choice($params['order_by']);
567
-
568
-    // Match the chosen animation to our options
569
-    $animation_list = array('slide', 'fade');
570
-    if (!(in_array($params['animation'], $animation_list))) {
571
-        $params['animation'] = 'slide';
572
-    }
573
-
574
-    // Post_number needs to be a positive integer
575
-    $params['post_number'] = absint($params['post_number']);
576
-    if (0 == $params['post_number']) {
577
-        $params['post_number'] = 1;
578
-    }
579
-
580
-    // Manage the entered categories
581
-    if (0 != $params['category'] || '' != $params['category']) {
582
-        $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']);
583
-    }
584
-    // Convert show_title to a bool
585
-    $params['show_title'] = intval(gdsc_to_bool_val($params['show_title']));
586
-
587
-    // Convert show_featured_only to a bool
588
-    $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only']));
589
-
590
-    /*
560
+	// Check we have a valid post_type
561
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
562
+		$params['post_type'] = 'gd_place';
563
+	}
564
+
565
+	// Check we have a valid sort_order
566
+	$params['order_by'] = gdsc_validate_sort_choice($params['order_by']);
567
+
568
+	// Match the chosen animation to our options
569
+	$animation_list = array('slide', 'fade');
570
+	if (!(in_array($params['animation'], $animation_list))) {
571
+		$params['animation'] = 'slide';
572
+	}
573
+
574
+	// Post_number needs to be a positive integer
575
+	$params['post_number'] = absint($params['post_number']);
576
+	if (0 == $params['post_number']) {
577
+		$params['post_number'] = 1;
578
+	}
579
+
580
+	// Manage the entered categories
581
+	if (0 != $params['category'] || '' != $params['category']) {
582
+		$params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']);
583
+	}
584
+	// Convert show_title to a bool
585
+	$params['show_title'] = intval(gdsc_to_bool_val($params['show_title']));
586
+
587
+	// Convert show_featured_only to a bool
588
+	$params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only']));
589
+
590
+	/*
591 591
      * Hopefully all attributes are now valid, and safe to pass forward
592 592
      */
593 593
 
594
-    // redeclare vars after validation
595
-
596
-    if (isset($params['direction_nav'])) {
597
-        $params['directionNav'] = $params['direction_nav'];
598
-    }
599
-    if (isset($params['animation_loop'])) {
600
-        $params['animationLoop'] = $params['animation_loop'];
601
-    }
602
-    if (isset($params['slideshow_speed'])) {
603
-        $params['slideshowSpeed'] = $params['slideshow_speed'];
604
-    }
605
-    if (isset($params['animation_speed'])) {
606
-        $params['animationSpeed'] = $params['animation_speed'];
607
-    }
608
-    if (isset($params['order_by'])) {
609
-        $params['list_sort'] = $params['order_by'];
610
-    }
611
-
612
-    $query_args = array(
613
-        'post_number' => $params['post_number'],
614
-        'is_geodir_loop' => true,
615
-        'post_type' => $params['post_type'],
616
-        'order_by' => $params['order_by']
617
-    );
618
-
619
-    if (1 == $params['show_featured_only']) {
620
-        $query_args['show_featured_only'] = 1;
621
-    }
622
-
623
-    if (0 != $params['category'] && '' != $params['category']) {
624
-        $category_taxonomy = geodir_get_taxonomies($params['post_type']);
625
-        $tax_query = array(
626
-            'taxonomy' => $category_taxonomy[0],
627
-            'field' => 'id',
628
-            'terms' => $params['category'],
629
-        );
630
-
631
-        $query_args['tax_query'] = array($tax_query);
632
-    }
633
-
634
-    $defaults = array(
635
-        'before_widget' => '',
636
-        'after_widget' => '',
637
-        'before_title' => '',
638
-        'after_title' => '',
639
-    );
640
-
641
-    $query_args = array_merge($query_args, $params);
642
-
643
-    geodir_listing_slider_widget_output($defaults, $query_args);
644
-
645
-    $output = ob_get_contents();
646
-
647
-    ob_end_clean();
648
-
649
-    return $output;
594
+	// redeclare vars after validation
595
+
596
+	if (isset($params['direction_nav'])) {
597
+		$params['directionNav'] = $params['direction_nav'];
598
+	}
599
+	if (isset($params['animation_loop'])) {
600
+		$params['animationLoop'] = $params['animation_loop'];
601
+	}
602
+	if (isset($params['slideshow_speed'])) {
603
+		$params['slideshowSpeed'] = $params['slideshow_speed'];
604
+	}
605
+	if (isset($params['animation_speed'])) {
606
+		$params['animationSpeed'] = $params['animation_speed'];
607
+	}
608
+	if (isset($params['order_by'])) {
609
+		$params['list_sort'] = $params['order_by'];
610
+	}
611
+
612
+	$query_args = array(
613
+		'post_number' => $params['post_number'],
614
+		'is_geodir_loop' => true,
615
+		'post_type' => $params['post_type'],
616
+		'order_by' => $params['order_by']
617
+	);
618
+
619
+	if (1 == $params['show_featured_only']) {
620
+		$query_args['show_featured_only'] = 1;
621
+	}
622
+
623
+	if (0 != $params['category'] && '' != $params['category']) {
624
+		$category_taxonomy = geodir_get_taxonomies($params['post_type']);
625
+		$tax_query = array(
626
+			'taxonomy' => $category_taxonomy[0],
627
+			'field' => 'id',
628
+			'terms' => $params['category'],
629
+		);
630
+
631
+		$query_args['tax_query'] = array($tax_query);
632
+	}
633
+
634
+	$defaults = array(
635
+		'before_widget' => '',
636
+		'after_widget' => '',
637
+		'before_title' => '',
638
+		'after_title' => '',
639
+	);
640
+
641
+	$query_args = array_merge($query_args, $params);
642
+
643
+	geodir_listing_slider_widget_output($defaults, $query_args);
644
+
645
+	$output = ob_get_contents();
646
+
647
+	ob_end_clean();
648
+
649
+	return $output;
650 650
 }
651 651
 
652 652
 add_shortcode('gd_login_box', 'geodir_sc_login_box');
@@ -670,22 +670,22 @@  discard block
 block discarded – undo
670 670
  */
671 671
 function geodir_sc_login_box($atts)
672 672
 {
673
-    ob_start();
673
+	ob_start();
674 674
 
675
-    $defaults = array(
676
-        'before_widget' => '',
677
-        'after_widget' => '',
678
-        'before_title' => '',
679
-        'after_title' => '',
680
-    );
675
+	$defaults = array(
676
+		'before_widget' => '',
677
+		'after_widget' => '',
678
+		'before_title' => '',
679
+		'after_title' => '',
680
+	);
681 681
 
682
-    geodir_loginwidget_output($defaults, $defaults);
682
+	geodir_loginwidget_output($defaults, $defaults);
683 683
 
684
-    $output = ob_get_contents();
684
+	$output = ob_get_contents();
685 685
 
686
-    ob_end_clean();
686
+	ob_end_clean();
687 687
 
688
-    return $output;
688
+	return $output;
689 689
 }
690 690
 
691 691
 add_shortcode('gd_popular_post_category', 'geodir_sc_popular_post_category');
@@ -716,31 +716,31 @@  discard block
 block discarded – undo
716 716
  */
717 717
 function geodir_sc_popular_post_category($atts)
718 718
 {
719
-    ob_start();
720
-    global $geodir_post_category_str;
721
-    $defaults = array(
722
-        'category_limit' => 15,
723
-        'category_restrict' => false,
724
-        'before_widget' => '',
725
-        'after_widget' => '',
726
-        'before_title' => '',
727
-        'after_title' => '',
728
-        'title' => '',
729
-        'default_post_type' => '',
730
-        'parent_only' => false,
731
-    );
732
-
733
-    $params = shortcode_atts($defaults, $atts, 'popular_post_category');
734
-    $params['category_limit'] = absint($params['category_limit']);
735
-    $params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : '';
736
-    $params['parent_only'] = gdsc_to_bool_val($params['parent_only']);
737
-    geodir_popular_post_category_output($params, $params);
738
-
739
-    $output = ob_get_contents();
740
-
741
-    ob_end_clean();
742
-
743
-    return $output;
719
+	ob_start();
720
+	global $geodir_post_category_str;
721
+	$defaults = array(
722
+		'category_limit' => 15,
723
+		'category_restrict' => false,
724
+		'before_widget' => '',
725
+		'after_widget' => '',
726
+		'before_title' => '',
727
+		'after_title' => '',
728
+		'title' => '',
729
+		'default_post_type' => '',
730
+		'parent_only' => false,
731
+	);
732
+
733
+	$params = shortcode_atts($defaults, $atts, 'popular_post_category');
734
+	$params['category_limit'] = absint($params['category_limit']);
735
+	$params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : '';
736
+	$params['parent_only'] = gdsc_to_bool_val($params['parent_only']);
737
+	geodir_popular_post_category_output($params, $params);
738
+
739
+	$output = ob_get_contents();
740
+
741
+	ob_end_clean();
742
+
743
+	return $output;
744 744
 }
745 745
 
746 746
 add_shortcode('gd_popular_post_view', 'geodir_sc_popular_post_view');
@@ -780,97 +780,97 @@  discard block
 block discarded – undo
780 780
  */
781 781
 function geodir_sc_popular_post_view($atts)
782 782
 {
783
-    ob_start();
784
-    $defaults = array(
785
-        'post_type' => 'gd_place',
786
-        'category' => '0',
787
-        'post_number' => '5',
788
-        'layout' => 'gridview_onehalf',
789
-        'add_location_filter' => '0',
790
-        'list_sort' => 'latest',
791
-        'use_viewing_post_type' => '1',
792
-        'character_count' => '20',
793
-        'listing_width' => '',
794
-        'show_featured_only' => '0',
795
-        'show_special_only' => '0',
796
-        'with_pics_only' => '0',
797
-        'with_videos_only' => '0',
798
-        'before_widget' => '',
799
-        'after_widget' => '',
800
-        'before_title' => '<h3 class="widget-title">',
801
-        'after_title' => '</h3>',
802
-        'title' => '',
803
-        'category_title' => '',
804
-    );
805
-
806
-    $params = shortcode_atts($defaults, $atts);
807
-
808
-    /**
809
-     * Validate our incoming params
810
-     */
783
+	ob_start();
784
+	$defaults = array(
785
+		'post_type' => 'gd_place',
786
+		'category' => '0',
787
+		'post_number' => '5',
788
+		'layout' => 'gridview_onehalf',
789
+		'add_location_filter' => '0',
790
+		'list_sort' => 'latest',
791
+		'use_viewing_post_type' => '1',
792
+		'character_count' => '20',
793
+		'listing_width' => '',
794
+		'show_featured_only' => '0',
795
+		'show_special_only' => '0',
796
+		'with_pics_only' => '0',
797
+		'with_videos_only' => '0',
798
+		'before_widget' => '',
799
+		'after_widget' => '',
800
+		'before_title' => '<h3 class="widget-title">',
801
+		'after_title' => '</h3>',
802
+		'title' => '',
803
+		'category_title' => '',
804
+	);
811 805
 
812
-    // Validate the selected post type, default to gd_place on fail
813
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
814
-        $params['post_type'] = 'gd_place';
815
-    }
816
-
817
-    // Validate the selected category/ies - Grab the current list based on post_type
818
-    $category_taxonomy = geodir_get_taxonomies($params['post_type']);
819
-    $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
820
-
821
-    // Make sure we have an array
822
-    if (!(is_array($params['category']))) {
823
-        $params['category'] = explode(',', $params['category']);
824
-    }
825
-
826
-    // Array_intersect returns only the items in $params['category'] that are also in our category list
827
-    // Otherwise it becomes empty and later on that will mean "All"
828
-    $params['category'] = array_intersect($params['category'], $categories);
829
-
830
-    // Post_number needs to be a positive integer
831
-    $params['post_number'] = absint($params['post_number']);
832
-    if (0 == $params['post_number']) {
833
-        $params['post_number'] = 1;
834
-    }
835
-
836
-    // Validate our layout choice
837
-    // Outside of the norm, I added some more simple terms to match the existing
838
-    // So now I just run the switch to set it properly.
839
-    $params['layout'] = gdsc_validate_layout_choice($params['layout']);
840
-
841
-    // Validate our sorting choice
842
-    $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
843
-
844
-    // Validate character_count
845
-    $params['character_count'] = absint($params['character_count']);
846
-    if (20 > $params['character_count']) {
847
-        $params['character_count'] = 20;
848
-    }
849
-
850
-    // Validate Listing width, used in the template widget-listing-listview.php
851
-    // The context is in width=$listing_width% - So we need a positive number between 0 & 100
852
-    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
853
-
854
-    // Validate the checkboxes used on the widget
855
-    $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
856
-    $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']);
857
-    $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']);
858
-    $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']);
859
-    $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']);
860
-    $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']);
861
-
862
-    /**
863
-     * End of validation
864
-     */
806
+	$params = shortcode_atts($defaults, $atts);
807
+
808
+	/**
809
+	 * Validate our incoming params
810
+	 */
865 811
 
866
-    geodir_popular_postview_output($params, $params);
812
+	// Validate the selected post type, default to gd_place on fail
813
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
814
+		$params['post_type'] = 'gd_place';
815
+	}
867 816
 
817
+	// Validate the selected category/ies - Grab the current list based on post_type
818
+	$category_taxonomy = geodir_get_taxonomies($params['post_type']);
819
+	$categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
868 820
 
869
-    $output = ob_get_contents();
821
+	// Make sure we have an array
822
+	if (!(is_array($params['category']))) {
823
+		$params['category'] = explode(',', $params['category']);
824
+	}
870 825
 
871
-    ob_end_clean();
826
+	// Array_intersect returns only the items in $params['category'] that are also in our category list
827
+	// Otherwise it becomes empty and later on that will mean "All"
828
+	$params['category'] = array_intersect($params['category'], $categories);
872 829
 
873
-    return $output;
830
+	// Post_number needs to be a positive integer
831
+	$params['post_number'] = absint($params['post_number']);
832
+	if (0 == $params['post_number']) {
833
+		$params['post_number'] = 1;
834
+	}
835
+
836
+	// Validate our layout choice
837
+	// Outside of the norm, I added some more simple terms to match the existing
838
+	// So now I just run the switch to set it properly.
839
+	$params['layout'] = gdsc_validate_layout_choice($params['layout']);
840
+
841
+	// Validate our sorting choice
842
+	$params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
843
+
844
+	// Validate character_count
845
+	$params['character_count'] = absint($params['character_count']);
846
+	if (20 > $params['character_count']) {
847
+		$params['character_count'] = 20;
848
+	}
849
+
850
+	// Validate Listing width, used in the template widget-listing-listview.php
851
+	// The context is in width=$listing_width% - So we need a positive number between 0 & 100
852
+	$params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
853
+
854
+	// Validate the checkboxes used on the widget
855
+	$params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
856
+	$params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']);
857
+	$params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']);
858
+	$params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']);
859
+	$params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']);
860
+	$params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']);
861
+
862
+	/**
863
+	 * End of validation
864
+	 */
865
+
866
+	geodir_popular_postview_output($params, $params);
867
+
868
+
869
+	$output = ob_get_contents();
870
+
871
+	ob_end_clean();
872
+
873
+	return $output;
874 874
 }
875 875
 
876 876
 add_shortcode('gd_recent_reviews', 'geodir_sc_recent_reviews');
@@ -892,37 +892,37 @@  discard block
 block discarded – undo
892 892
  * @return string Recent reviews HTML.
893 893
  */
894 894
 function geodir_sc_recent_reviews($atts) {
895
-    ob_start();
896
-    $defaults = array(
895
+	ob_start();
896
+	$defaults = array(
897 897
 		'title' => '',
898 898
 		'count' => 5,
899
-    );
899
+	);
900 900
 
901
-    $params = shortcode_atts($defaults, $atts);
901
+	$params = shortcode_atts($defaults, $atts);
902 902
 
903
-    $count = absint($params['count']);
904
-    if (0 == $count) {
905
-        $count = 1;
906
-    }
903
+	$count = absint($params['count']);
904
+	if (0 == $count) {
905
+		$count = 1;
906
+	}
907 907
 	
908 908
 	$title = !empty($params['title']) ? __($params['title'], 'geodirectory') : '';
909 909
 
910
-    $comments_li = geodir_get_recent_reviews(30, $count, 100, false);
910
+	$comments_li = geodir_get_recent_reviews(30, $count, 100, false);
911 911
 
912
-    if ($comments_li) {
913
-        if ($title != '') { ?>
912
+	if ($comments_li) {
913
+		if ($title != '') { ?>
914 914
 		<h3 class="geodir-sc-recent-reviews-title widget-title"><?php echo $title; ?></h3>
915 915
 		<?php } ?>
916 916
         <div class="geodir_sc_recent_reviews_section">
917 917
             <ul class="geodir_sc_recent_reviews"><?php echo $comments_li; ?></ul>
918 918
         </div>
919 919
     <?php
920
-    }
921
-    $output = ob_get_contents();
920
+	}
921
+	$output = ob_get_contents();
922 922
 
923
-    ob_end_clean();
923
+	ob_end_clean();
924 924
 
925
-    return $output;
925
+	return $output;
926 926
 }
927 927
 
928 928
 add_shortcode('gd_related_listings', 'geodir_sc_related_listings');
@@ -952,64 +952,64 @@  discard block
 block discarded – undo
952 952
  */
953 953
 function geodir_sc_related_listings($atts)
954 954
 {
955
-    ob_start();
956
-    $defaults = array(
957
-        'post_number' => 5,
958
-        'relate_to' => 'category',
959
-        'layout' => 'gridview_onehalf',
960
-        'add_location_filter' => 0,
961
-        'listing_width' => '',
962
-        'list_sort' => 'latest',
963
-        'character_count' => 20,
964
-        'is_widget' => 1,
965
-        'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>',
966
-    );
967
-    // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet.
968
-
969
-    $params = shortcode_atts($defaults, $atts);
970
-
971
-    /**
972
-     * Begin validating parameters
973
-     */
955
+	ob_start();
956
+	$defaults = array(
957
+		'post_number' => 5,
958
+		'relate_to' => 'category',
959
+		'layout' => 'gridview_onehalf',
960
+		'add_location_filter' => 0,
961
+		'listing_width' => '',
962
+		'list_sort' => 'latest',
963
+		'character_count' => 20,
964
+		'is_widget' => 1,
965
+		'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>',
966
+	);
967
+	// The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet.
974 968
 
975
-    // Validate that post_number is a number and is 1 or higher
976
-    $params['post_number'] = absint($params['post_number']);
977
-    if (0 === $params['post_number']) {
978
-        $params['post_number'] = 1;
979
-    }
969
+	$params = shortcode_atts($defaults, $atts);
980 970
 
981
-    // Validate relate_to - only category or tags
982
-    $params['relate_to'] = geodir_strtolower($params['relate_to']);
983
-    if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) {
984
-        $params['relate_to'] = 'category';
985
-    }
971
+	/**
972
+	 * Begin validating parameters
973
+	 */
986 974
 
987
-    // Validate layout selection
988
-    $params['layout'] = gdsc_validate_layout_choice($params['layout']);
975
+	// Validate that post_number is a number and is 1 or higher
976
+	$params['post_number'] = absint($params['post_number']);
977
+	if (0 === $params['post_number']) {
978
+		$params['post_number'] = 1;
979
+	}
989 980
 
990
-    // Validate sorting option
991
-    $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
981
+	// Validate relate_to - only category or tags
982
+	$params['relate_to'] = geodir_strtolower($params['relate_to']);
983
+	if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) {
984
+		$params['relate_to'] = 'category';
985
+	}
992 986
 
993
-    // Validate add_location_filter
994
-    $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
987
+	// Validate layout selection
988
+	$params['layout'] = gdsc_validate_layout_choice($params['layout']);
995 989
 
996
-    // Validate listing_width
997
-    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
990
+	// Validate sorting option
991
+	$params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
998 992
 
999
-    // Validate character_count
1000
-    $params['character_count'] = absint($params['character_count']);
1001
-    if (20 > $params['character_count']) {
1002
-        $params['character_count'] = 20;
1003
-    }
993
+	// Validate add_location_filter
994
+	$params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
1004 995
 
1005
-    if ($related_display = geodir_related_posts_display($params)) {
1006
-        echo $related_display;
1007
-    }
1008
-    $output = ob_get_contents();
996
+	// Validate listing_width
997
+	$params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
1009 998
 
1010
-    ob_end_clean();
999
+	// Validate character_count
1000
+	$params['character_count'] = absint($params['character_count']);
1001
+	if (20 > $params['character_count']) {
1002
+		$params['character_count'] = 20;
1003
+	}
1011 1004
 
1012
-    return $output;
1005
+	if ($related_display = geodir_related_posts_display($params)) {
1006
+		echo $related_display;
1007
+	}
1008
+	$output = ob_get_contents();
1009
+
1010
+	ob_end_clean();
1011
+
1012
+	return $output;
1013 1013
 }
1014 1014
 
1015 1015
 /**
@@ -1033,13 +1033,13 @@  discard block
 block discarded – undo
1033 1033
  * @return string Advanced search widget HTML.
1034 1034
  */
1035 1035
 function geodir_sc_advanced_search($atts) {
1036
-    $defaults = array(
1036
+	$defaults = array(
1037 1037
 		'title' => '',
1038 1038
 		'before_widget' => '<section id="geodir_advanced_search-1" class="widget geodir-widget geodir_advance_search_widget">',
1039
-        'after_widget' => '</section>',
1040
-        'before_title' => '<h3 class="widget-title">',
1041
-        'after_title' => '</h3>',
1042
-        'show_adv_search' => 'default',
1039
+		'after_widget' => '</section>',
1040
+		'before_title' => '<h3 class="widget-title">',
1041
+		'after_title' => '</h3>',
1042
+		'show_adv_search' => 'default',
1043 1043
 		'post_type' => ''
1044 1044
 	);
1045 1045
 	
@@ -1063,9 +1063,9 @@  discard block
 block discarded – undo
1063 1063
 	the_widget('geodir_advance_search_widget', $params, $params );
1064 1064
 	
1065 1065
 	$output = ob_get_contents();
1066
-    ob_end_clean();
1066
+	ob_end_clean();
1067 1067
 
1068
-    return $output;
1068
+	return $output;
1069 1069
 }
1070 1070
 add_shortcode('gd_advanced_search', 'geodir_sc_advanced_search');
1071 1071
 
@@ -1111,48 +1111,48 @@  discard block
 block discarded – undo
1111 1111
 		'add_location_filter' => '1',
1112 1112
 		'tab_layout' => 'bestof-tabs-on-top',
1113 1113
 		'before_widget' => '<section id="bestof_widget-1" class="widget geodir-widget geodir_bestof_widget geodir_sc_bestof_widget">',
1114
-        'after_widget' => '</section>',
1115
-        'before_title' => '<h3 class="widget-title">',
1116
-        'after_title' => '</h3>',
1114
+		'after_widget' => '</section>',
1115
+		'before_title' => '<h3 class="widget-title">',
1116
+		'after_title' => '</h3>',
1117 1117
 	);
1118 1118
 	$params = shortcode_atts($defaults, $atts);
1119 1119
 
1120
-    /**
1121
-     * Validate our incoming params
1122
-     */
1120
+	/**
1121
+	 * Validate our incoming params
1122
+	 */
1123 1123
 
1124
-    // Validate the selected post type, default to gd_place on fail
1125
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
1126
-        $params['post_type'] = 'gd_place';
1127
-    }
1124
+	// Validate the selected post type, default to gd_place on fail
1125
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
1126
+		$params['post_type'] = 'gd_place';
1127
+	}
1128 1128
 	
1129 1129
 	// Post limit needs to be a positive integer
1130
-    $params['post_limit'] = absint($params['post_limit']);
1131
-    if (0 == $params['post_limit']) {
1132
-        $params['post_limit'] = 5;
1133
-    }
1130
+	$params['post_limit'] = absint($params['post_limit']);
1131
+	if (0 == $params['post_limit']) {
1132
+		$params['post_limit'] = 5;
1133
+	}
1134 1134
 	
1135 1135
 	// Category limit needs to be a positive integer
1136
-    $params['categ_limit'] = absint($params['categ_limit']);
1137
-    if (0 == $params['categ_limit']) {
1138
-        $params['categ_limit'] = 3;
1139
-    }
1136
+	$params['categ_limit'] = absint($params['categ_limit']);
1137
+	if (0 == $params['categ_limit']) {
1138
+		$params['categ_limit'] = 3;
1139
+	}
1140 1140
 	
1141 1141
 	// Tab layout validation
1142
-    $params['tab_layout'] = $params['tab_layout'];
1143
-    if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) {
1144
-        $params['tab_layout'] = 'bestof-tabs-on-top';
1145
-    }
1142
+	$params['tab_layout'] = $params['tab_layout'];
1143
+	if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) {
1144
+		$params['tab_layout'] = 'bestof-tabs-on-top';
1145
+	}
1146 1146
 	
1147 1147
 	// Validate character_count
1148
-    $params['character_count'] = $params['character_count'];
1148
+	$params['character_count'] = $params['character_count'];
1149 1149
 
1150 1150
 	ob_start();
1151 1151
 	the_widget('geodir_bestof_widget', $params, $params);
1152
-    $output = ob_get_contents();
1153
-    ob_end_clean();
1152
+	$output = ob_get_contents();
1153
+	ob_end_clean();
1154 1154
 
1155
-    return $output;
1155
+	return $output;
1156 1156
 }
1157 1157
 add_shortcode('gd_bestof_widget', 'geodir_sc_bestof_widget');
1158 1158
 
@@ -1200,127 +1200,127 @@  discard block
 block discarded – undo
1200 1200
  * @return string HTML content to display geodirectory listings.
1201 1201
  */
1202 1202
 function geodir_sc_gd_listings($atts, $content = '') {
1203
-    global $post;
1204
-    $defaults = array(
1205
-        'title'                 => '',
1206
-        'post_type'             => 'gd_place',
1207
-        'category'              => 0,
1208
-        'list_sort'             => 'latest',
1209
-        'event_type'            => '',
1210
-        'post_number'           => 10,
1211
-        'post_author'           => '',
1212
-        'layout'                => 'gridview_onehalf',
1213
-        'listing_width'         => '',
1214
-        'character_count'       => 20,
1215
-        'add_location_filter'   => 1,
1216
-        'show_featured_only'    => '',
1217
-        'show_special_only'     => '',
1218
-        'with_pics_only'        => '',
1219
-        'with_videos_only'      => '',
1220
-        'with_pagination'       => '1',
1221
-        'top_pagination'        => '0',
1222
-        'bottom_pagination'     => '1',
1223
-        'without_no_results'    => 0,
1224
-        'tags'                  => ''
1225
-    );
1226
-    $params = shortcode_atts($defaults, $atts);
1227
-
1228
-    $params['title']        = wp_strip_all_tags($params['title']);
1229
-    $params['post_type']    = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1230
-
1231
-    // Validate the selected category/ies - Grab the current list based on post_type
1232
-    $category_taxonomy      = geodir_get_taxonomies($params['post_type']);
1233
-    $categories             = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
1234
-
1235
-    // Make sure we have an array
1236
-    if (!(is_array($params['category']))) {
1237
-        $params['category'] = explode(',', $params['category']);
1238
-    }
1239
-
1240
-    // Array_intersect returns only the items in $params['category'] that are also in our category list
1241
-    // Otherwise it becomes empty and later on that will mean "All"
1242
-    $params['category']     = array_intersect($params['category'], $categories);
1243
-
1244
-    // Post_number needs to be a positive integer
1245
-    $params['post_number']  = absint($params['post_number']);
1246
-    $params['post_number']  = $params['post_number'] > 0 ? $params['post_number'] : 10;
1203
+	global $post;
1204
+	$defaults = array(
1205
+		'title'                 => '',
1206
+		'post_type'             => 'gd_place',
1207
+		'category'              => 0,
1208
+		'list_sort'             => 'latest',
1209
+		'event_type'            => '',
1210
+		'post_number'           => 10,
1211
+		'post_author'           => '',
1212
+		'layout'                => 'gridview_onehalf',
1213
+		'listing_width'         => '',
1214
+		'character_count'       => 20,
1215
+		'add_location_filter'   => 1,
1216
+		'show_featured_only'    => '',
1217
+		'show_special_only'     => '',
1218
+		'with_pics_only'        => '',
1219
+		'with_videos_only'      => '',
1220
+		'with_pagination'       => '1',
1221
+		'top_pagination'        => '0',
1222
+		'bottom_pagination'     => '1',
1223
+		'without_no_results'    => 0,
1224
+		'tags'                  => ''
1225
+	);
1226
+	$params = shortcode_atts($defaults, $atts);
1227
+
1228
+	$params['title']        = wp_strip_all_tags($params['title']);
1229
+	$params['post_type']    = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1230
+
1231
+	// Validate the selected category/ies - Grab the current list based on post_type
1232
+	$category_taxonomy      = geodir_get_taxonomies($params['post_type']);
1233
+	$categories             = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
1234
+
1235
+	// Make sure we have an array
1236
+	if (!(is_array($params['category']))) {
1237
+		$params['category'] = explode(',', $params['category']);
1238
+	}
1239
+
1240
+	// Array_intersect returns only the items in $params['category'] that are also in our category list
1241
+	// Otherwise it becomes empty and later on that will mean "All"
1242
+	$params['category']     = array_intersect($params['category'], $categories);
1243
+
1244
+	// Post_number needs to be a positive integer
1245
+	$params['post_number']  = absint($params['post_number']);
1246
+	$params['post_number']  = $params['post_number'] > 0 ? $params['post_number'] : 10;
1247 1247
     
1248
-    // Post_number needs to be a positive integer
1249
-    if (!empty($atts['post_author'])) {
1250
-        if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') {
1251
-            $params['post_author'] = $post->post_author;
1252
-        } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) {
1253
-            $params['post_author'] = absint($atts['post_author']);
1254
-        } else {
1255
-            unset($params['post_author']);
1256
-        }
1257
-    } else {
1258
-        unset($params['post_author']);
1259
-    }
1260
-
1261
-    // Validate character_count
1262
-    //todo: is this necessary?
1263
-    $params['character_count']  = $params['character_count'];
1264
-
1265
-    // Validate our layout choice
1266
-    // Outside of the norm, I added some more simple terms to match the existing
1267
-    // So now I just run the switch to set it properly.
1268
-    $params['layout']           = gdsc_validate_layout_choice($params['layout']);
1269
-
1270
-    // Validate our sorting choice
1271
-    $params['list_sort']        = gdsc_validate_sort_choice($params['list_sort']);
1272
-
1273
-    // Validate Listing width, used in the template widget-listing-listview.php
1274
-    // The context is in width=$listing_width% - So we need a positive number between 0 & 100
1275
-    $params['listing_width']    = gdsc_validate_listing_width($params['listing_width']);
1276
-
1277
-    // Validate the checkboxes used on the widget
1278
-    $params['add_location_filter']  = gdsc_to_bool_val($params['add_location_filter']);
1279
-    $params['show_featured_only']   = gdsc_to_bool_val($params['show_featured_only']);
1280
-    $params['show_special_only']    = gdsc_to_bool_val($params['show_special_only']);
1281
-    $params['with_pics_only']       = gdsc_to_bool_val($params['with_pics_only']);
1282
-    $params['with_videos_only']     = gdsc_to_bool_val($params['with_videos_only']);
1283
-    $params['with_pagination']      = gdsc_to_bool_val($params['with_pagination']);
1284
-    $params['top_pagination']       = gdsc_to_bool_val($params['top_pagination']);
1285
-    $params['bottom_pagination']    = gdsc_to_bool_val($params['bottom_pagination']);
1286
-
1287
-    // Clean tags
1288
-    if (!empty($params['tags'])) {
1289
-        if (!is_array($params['tags'])) {
1290
-            $comma = _x(',', 'tag delimiter');
1291
-            if ( ',' !== $comma ) {
1292
-                $params['tags'] = str_replace($comma, ',', $params['tags']);
1293
-            }
1294
-            $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,"));
1295
-            $params['tags'] = array_map('trim', $params['tags']);
1296
-        }
1297
-    } else {
1298
-        $params['tags'] = array();
1299
-    }
1300
-
1301
-    /**
1302
-     * End of validation
1303
-     */
1304
-    if (isset($atts['geodir_ajax'])) {
1305
-        $params['geodir_ajax'] = $atts['geodir_ajax'];
1306
-        unset($atts['geodir_ajax']);
1307
-    }
1308
-    if (isset($atts['pageno'])) {
1309
-        $params['pageno'] = $atts['pageno'];
1310
-        unset($atts['pageno']);
1311
-    }
1312
-
1313
-    if ( !empty($atts['shortcode_content']) ) {
1314
-        $content = $atts['shortcode_content'];
1315
-    }
1316
-    $params['shortcode_content'] = trim($content);
1317
-    $atts['shortcode_content'] = trim($content);
1248
+	// Post_number needs to be a positive integer
1249
+	if (!empty($atts['post_author'])) {
1250
+		if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') {
1251
+			$params['post_author'] = $post->post_author;
1252
+		} else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) {
1253
+			$params['post_author'] = absint($atts['post_author']);
1254
+		} else {
1255
+			unset($params['post_author']);
1256
+		}
1257
+	} else {
1258
+		unset($params['post_author']);
1259
+	}
1260
+
1261
+	// Validate character_count
1262
+	//todo: is this necessary?
1263
+	$params['character_count']  = $params['character_count'];
1264
+
1265
+	// Validate our layout choice
1266
+	// Outside of the norm, I added some more simple terms to match the existing
1267
+	// So now I just run the switch to set it properly.
1268
+	$params['layout']           = gdsc_validate_layout_choice($params['layout']);
1269
+
1270
+	// Validate our sorting choice
1271
+	$params['list_sort']        = gdsc_validate_sort_choice($params['list_sort']);
1272
+
1273
+	// Validate Listing width, used in the template widget-listing-listview.php
1274
+	// The context is in width=$listing_width% - So we need a positive number between 0 & 100
1275
+	$params['listing_width']    = gdsc_validate_listing_width($params['listing_width']);
1276
+
1277
+	// Validate the checkboxes used on the widget
1278
+	$params['add_location_filter']  = gdsc_to_bool_val($params['add_location_filter']);
1279
+	$params['show_featured_only']   = gdsc_to_bool_val($params['show_featured_only']);
1280
+	$params['show_special_only']    = gdsc_to_bool_val($params['show_special_only']);
1281
+	$params['with_pics_only']       = gdsc_to_bool_val($params['with_pics_only']);
1282
+	$params['with_videos_only']     = gdsc_to_bool_val($params['with_videos_only']);
1283
+	$params['with_pagination']      = gdsc_to_bool_val($params['with_pagination']);
1284
+	$params['top_pagination']       = gdsc_to_bool_val($params['top_pagination']);
1285
+	$params['bottom_pagination']    = gdsc_to_bool_val($params['bottom_pagination']);
1286
+
1287
+	// Clean tags
1288
+	if (!empty($params['tags'])) {
1289
+		if (!is_array($params['tags'])) {
1290
+			$comma = _x(',', 'tag delimiter');
1291
+			if ( ',' !== $comma ) {
1292
+				$params['tags'] = str_replace($comma, ',', $params['tags']);
1293
+			}
1294
+			$params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,"));
1295
+			$params['tags'] = array_map('trim', $params['tags']);
1296
+		}
1297
+	} else {
1298
+		$params['tags'] = array();
1299
+	}
1300
+
1301
+	/**
1302
+	 * End of validation
1303
+	 */
1304
+	if (isset($atts['geodir_ajax'])) {
1305
+		$params['geodir_ajax'] = $atts['geodir_ajax'];
1306
+		unset($atts['geodir_ajax']);
1307
+	}
1308
+	if (isset($atts['pageno'])) {
1309
+		$params['pageno'] = $atts['pageno'];
1310
+		unset($atts['pageno']);
1311
+	}
1312
+
1313
+	if ( !empty($atts['shortcode_content']) ) {
1314
+		$content = $atts['shortcode_content'];
1315
+	}
1316
+	$params['shortcode_content'] = trim($content);
1317
+	$atts['shortcode_content'] = trim($content);
1318 1318
     
1319
-    $params['shortcode_atts']       = $atts;
1319
+	$params['shortcode_atts']       = $atts;
1320 1320
 
1321
-    $output = geodir_sc_gd_listings_output($params);
1321
+	$output = geodir_sc_gd_listings_output($params);
1322 1322
 
1323
-    return $output;
1323
+	return $output;
1324 1324
 }
1325 1325
 add_shortcode('gd_listings', 'geodir_sc_gd_listings');
1326 1326
 
@@ -1360,56 +1360,56 @@  discard block
 block discarded – undo
1360 1360
  * @return string HTML content to display CPT categories.
1361 1361
  */
1362 1362
 function geodir_sc_cpt_categories_widget($atts, $content = '') {
1363
-    $defaults = array(
1364
-        'title' => '',
1365
-        'post_type' => '', // NULL for all
1366
-        'hide_empty' => '',
1367
-        'show_count' => '',
1368
-        'hide_icon' => '',
1369
-        'cpt_left' => '',
1370
-        'sort_by' => 'count',
1371
-        'max_count' => 'all',
1372
-        'max_level' => '1',
1373
-        'no_cpt_filter' => '',
1374
-        'no_cat_filter' => '',
1375
-        'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">',
1376
-        'after_widget' => '</section>',
1377
-        'before_title' => '<h3 class="widget-title">',
1378
-        'after_title' => '</h3>',
1379
-    );
1380
-    $params = shortcode_atts($defaults, $atts);
1381
-
1382
-    /**
1383
-     * Validate our incoming params
1384
-     */
1385
-    // Make sure we have an array
1386
-    $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array();
1387
-     
1388
-    // Validate the checkboxes used on the widget
1389
-    $params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1390
-    $params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1391
-    $params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1392
-    $params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1363
+	$defaults = array(
1364
+		'title' => '',
1365
+		'post_type' => '', // NULL for all
1366
+		'hide_empty' => '',
1367
+		'show_count' => '',
1368
+		'hide_icon' => '',
1369
+		'cpt_left' => '',
1370
+		'sort_by' => 'count',
1371
+		'max_count' => 'all',
1372
+		'max_level' => '1',
1373
+		'no_cpt_filter' => '',
1374
+		'no_cat_filter' => '',
1375
+		'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">',
1376
+		'after_widget' => '</section>',
1377
+		'before_title' => '<h3 class="widget-title">',
1378
+		'after_title' => '</h3>',
1379
+	);
1380
+	$params = shortcode_atts($defaults, $atts);
1393 1381
 
1394
-    if ($params['max_count'] != 'all') {
1395
-        $params['max_count'] = absint($params['max_count']);
1396
-    }
1382
+	/**
1383
+	 * Validate our incoming params
1384
+	 */
1385
+	// Make sure we have an array
1386
+	$params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array();
1387
+     
1388
+	// Validate the checkboxes used on the widget
1389
+	$params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1390
+	$params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1391
+	$params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1392
+	$params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1393
+
1394
+	if ($params['max_count'] != 'all') {
1395
+		$params['max_count'] = absint($params['max_count']);
1396
+	}
1397 1397
 
1398
-    if ($params['max_level'] != 'all') {
1399
-        $params['max_level'] = absint($params['max_level']);
1400
-    }
1398
+	if ($params['max_level'] != 'all') {
1399
+		$params['max_level'] = absint($params['max_level']);
1400
+	}
1401 1401
 
1402
-    $params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']);
1403
-    $params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']);
1402
+	$params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']);
1403
+	$params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']);
1404 1404
 
1405
-    $params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count';
1405
+	$params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count';
1406 1406
 
1407
-    ob_start();
1408
-    the_widget('geodir_cpt_categories_widget', $params, $params);
1409
-    $output = ob_get_contents();
1410
-    ob_end_clean();
1407
+	ob_start();
1408
+	the_widget('geodir_cpt_categories_widget', $params, $params);
1409
+	$output = ob_get_contents();
1410
+	ob_end_clean();
1411 1411
 
1412
-    return $output;
1412
+	return $output;
1413 1413
 }
1414 1414
 add_shortcode('gd_cpt_categories', 'geodir_sc_cpt_categories_widget');
1415 1415
 
@@ -1424,6 +1424,6 @@  discard block
 block discarded – undo
1424 1424
  * @return string HTML code.
1425 1425
  */
1426 1426
 function geodir_sc_responsive_videos($atts, $content) {
1427
-    return '<div class="geodir-video-wrapper">'.$content.'</div>';
1427
+	return '<div class="geodir-video-wrapper">'.$content.'</div>';
1428 1428
 }
1429 1429
 add_shortcode('gd_video', 'geodir_sc_responsive_videos');
1430 1430
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
 	// Add marker cluster
198 198
 	if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
199 199
         $map_args['enable_marker_cluster'] = true;
200
-        if(get_option('geodir_marker_cluster_type')) {
200
+        if (get_option('geodir_marker_cluster_type')) {
201 201
             if ($map_args['autozoom']) {
202 202
                 $map_args['enable_marker_cluster_no_reposition'] = false;
203 203
             } else {
204 204
                 $map_args['enable_marker_cluster_no_reposition'] = true;
205 205
             }
206 206
 
207
-            $map_args['enable_marker_cluster_server'] = true ;
207
+            $map_args['enable_marker_cluster_server'] = true;
208 208
 
209 209
         }
210 210
 	} else {
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	}
213 213
 
214 214
     // if lat and long set in shortcode, hack it so the map is not repositioned
215
-    if(!empty($params['latitude']) && !empty($params['longitude']) ){
215
+    if (!empty($params['latitude']) && !empty($params['longitude'])) {
216 216
         $map_args['enable_marker_cluster_no_reposition'] = true;
217 217
     }
218 218
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 function geodir_sc_listing_map($atts) {
266 266
 
267 267
     // if some params are set then we need a new query, if not then we can use the main query
268
-    if( isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type']) ) {
268
+    if (isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type'])) {
269 269
 
270 270
         global $add_post_in_marker_array, $gd_sc_map_params;
271 271
         $backup_globals                             = array();
@@ -288,34 +288,34 @@  discard block
 block discarded – undo
288 288
             'event_type'     => 'all'
289 289
         );
290 290
 
291
-        $params = shortcode_atts( $defaults, $atts );
291
+        $params = shortcode_atts($defaults, $atts);
292 292
 
293
-        if ( ! ( gdsc_is_post_type_valid( $params['post_type'] ) ) ) {
293
+        if (!(gdsc_is_post_type_valid($params['post_type']))) {
294 294
             $params['post_type'] = 'gd_place';
295 295
         }
296 296
 
297 297
         // Validate the selected category/ies - Grab the current list based on post_type
298
-        $category_taxonomy = geodir_get_taxonomies( $params['post_type'] );
299
-        $categories        = get_terms( $category_taxonomy, array(
298
+        $category_taxonomy = geodir_get_taxonomies($params['post_type']);
299
+        $categories        = get_terms($category_taxonomy, array(
300 300
             'orderby' => 'count',
301 301
             'order'   => 'DESC',
302 302
             'fields'  => 'ids'
303
-        ) );
303
+        ));
304 304
 
305 305
         // Make sure we have an array
306
-        if ( ! ( is_array( $params['category'] ) ) ) {
307
-            $params['category'] = explode( ',', $params['category'] );
306
+        if (!(is_array($params['category']))) {
307
+            $params['category'] = explode(',', $params['category']);
308 308
         }
309 309
 
310 310
         // Array_intersect returns only the items in $params['category'] that are also in our category list
311 311
         // Otherwise it becomes empty and later on that will mean "All"
312
-        $params['category'] = array_intersect( $params['category'], $categories );
312
+        $params['category'] = array_intersect($params['category'], $categories);
313 313
 
314
-        if ( $params['post_type'] == 'gd_event' ) {
315
-            $params['event_type'] = gdsc_validate_list_filter_choice( $params['event_type'] );
314
+        if ($params['post_type'] == 'gd_event') {
315
+            $params['event_type'] = gdsc_validate_list_filter_choice($params['event_type']);
316 316
         }
317 317
 
318
-        $params = gdsc_validate_map_args( $params );
318
+        $params = gdsc_validate_map_args($params);
319 319
 
320 320
         $gd_sc_map_params = $params;
321 321
 
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
             'post_type'      => $params['post_type'],
327 327
         );
328 328
 
329
-        if ( ! empty( $params['category'] ) && isset( $params['category'][0] ) && (int) $params['category'][0] != 0 ) {
330
-            $category_taxonomy = geodir_get_taxonomies( $params['post_type'] );
329
+        if (!empty($params['category']) && isset($params['category'][0]) && (int) $params['category'][0] != 0) {
330
+            $category_taxonomy = geodir_get_taxonomies($params['post_type']);
331 331
 
332 332
             ######### WPML #########
333
-            if ( function_exists( 'icl_object_id' ) ) {
334
-                $category = gd_lang_object_ids( $params['category'], $category_taxonomy[0] );
333
+            if (function_exists('icl_object_id')) {
334
+                $category = gd_lang_object_ids($params['category'], $category_taxonomy[0]);
335 335
             }
336 336
             ######### WPML #########
337 337
 
@@ -341,36 +341,36 @@  discard block
 block discarded – undo
341 341
                 'terms'    => $params['category']
342 342
             );
343 343
 
344
-            $query_args['tax_query'] = array( $tax_query );
344
+            $query_args['tax_query'] = array($tax_query);
345 345
         }
346 346
 
347 347
         $add_post_in_marker_array = true;
348 348
 
349
-        if ( $params['post_type'] == 'gd_event' && function_exists( 'geodir_event_get_widget_events' ) ) {
349
+        if ($params['post_type'] == 'gd_event' && function_exists('geodir_event_get_widget_events')) {
350 350
             global $geodir_event_widget_listview;
351 351
             $geodir_event_widget_listview = true;
352 352
 
353 353
             $query_args['geodir_event_type'] = $params['event_type'];
354 354
 
355
-            $listings = geodir_event_get_widget_events( $query_args );
355
+            $listings = geodir_event_get_widget_events($query_args);
356 356
 
357 357
             $geodir_event_widget_listview = false;
358 358
         } else {
359
-            $listings = geodir_get_widget_listings( $query_args );
359
+            $listings = geodir_get_widget_listings($query_args);
360 360
         }
361 361
 
362
-        if ( ! empty( $listings ) ) {
363
-            foreach ( $listings as $listing ) {
364
-                create_marker_jason_of_posts( $listing );
362
+        if (!empty($listings)) {
363
+            foreach ($listings as $listing) {
364
+                create_marker_jason_of_posts($listing);
365 365
             }
366 366
         }
367 367
 
368 368
         ob_start();
369
-        add_action( 'wp_head', 'init_listing_map_script' ); // Initialize the map object and marker array
369
+        add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
370 370
 
371
-        add_action( 'the_post', 'create_list_jsondata' ); // Add marker in json array
371
+        add_action('the_post', 'create_list_jsondata'); // Add marker in json array
372 372
 
373
-        add_action( 'wp_footer', 'show_listing_widget_map' ); // Show map for listings with markers
373
+        add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
374 374
 
375 375
         $default_location = geodir_get_default_location();
376 376
 
@@ -391,17 +391,17 @@  discard block
 block discarded – undo
391 391
             'enable_location_filters'  => false,
392 392
             'enable_jason_on_load'     => true,
393 393
             'ajax_url'                 => geodir_get_ajax_url(),
394
-            'latitude'                 => isset( $default_location->city_latitude ) ? $default_location->city_latitude : '',
395
-            'longitude'                => isset( $default_location->city_longitude ) ? $default_location->city_longitude : '',
394
+            'latitude'                 => isset($default_location->city_latitude) ? $default_location->city_latitude : '',
395
+            'longitude'                => isset($default_location->city_longitude) ? $default_location->city_longitude : '',
396 396
             'streetViewControl'        => true,
397 397
             'showPreview'              => '0',
398 398
             'maxZoom'                  => 21,
399 399
             'bubble_size'              => 'small',
400 400
         );
401 401
 
402
-        if ( is_single() ) {
402
+        if (is_single()) {
403 403
             global $post;
404
-            if ( isset( $post->post_latitude ) ) {
404
+            if (isset($post->post_latitude)) {
405 405
                 $map_args['latitude']  = $post->post_latitude;
406 406
                 $map_args['longitude'] = $post->post_longitude;
407 407
             }
@@ -412,24 +412,24 @@  discard block
 block discarded – undo
412 412
         }
413 413
 
414 414
         // Add marker cluster
415
-        if ( isset( $params['marker_cluster'] ) && gdsc_to_bool_val( $params['marker_cluster'] ) && defined( 'GDCLUSTER_VERSION' ) ) {
415
+        if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
416 416
             $map_args['enable_marker_cluster'] = true;
417 417
         } else {
418 418
             $map_args['enable_marker_cluster'] = false;
419 419
         }
420 420
 
421
-        geodir_draw_map( $map_args );
421
+        geodir_draw_map($map_args);
422 422
 
423 423
         $output = ob_get_contents();
424 424
 
425 425
         ob_end_clean();
426 426
 
427
-        foreach ( $backup_globals as $global => $value ) {
427
+        foreach ($backup_globals as $global => $value) {
428 428
             ${$global} = $value;
429 429
         }
430 430
 
431 431
         return $output;
432
-    }else{
432
+    } else {
433 433
         ob_start();
434 434
         add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
435 435
         add_action('the_post', 'create_list_jsondata'); // Add marker in json array
@@ -1047,20 +1047,20 @@  discard block
 block discarded – undo
1047 1047
 	
1048 1048
 	$show_adv_search = isset($params['show_adv_search']) && in_array($params['show_adv_search'], array('default', 'always', 'searched')) ? $params['show_adv_search'] : '';
1049 1049
 	
1050
-	if ($show_adv_search != '' ) {
1051
-		$show_adv_class = 'geodir-advance-search-' . $show_adv_search . ' ';
1050
+	if ($show_adv_search != '') {
1051
+		$show_adv_class = 'geodir-advance-search-'.$show_adv_search.' ';
1052 1052
 		if ($show_adv_search == 'searched' && geodir_is_page('search')) {
1053 1053
 			$show_adv_search = 'search';
1054 1054
 		}
1055
-		$show_adv_attrs = 'data-show-adv="' . $show_adv_search . '"';
1055
+		$show_adv_attrs = 'data-show-adv="'.$show_adv_search.'"';
1056 1056
 		
1057
-		$params['before_widget'] = str_replace('class="', $show_adv_attrs . ' class="' . $show_adv_class, $params['before_widget']);
1057
+		$params['before_widget'] = str_replace('class="', $show_adv_attrs.' class="'.$show_adv_class, $params['before_widget']);
1058 1058
 	}
1059 1059
 	
1060 1060
 	ob_start();
1061 1061
 	
1062 1062
 	//geodir_get_template_part('listing', 'filter-form');
1063
-	the_widget('geodir_advance_search_widget', $params, $params );
1063
+	the_widget('geodir_advance_search_widget', $params, $params);
1064 1064
 	
1065 1065
 	$output = ob_get_contents();
1066 1066
     ob_end_clean();
@@ -1260,7 +1260,7 @@  discard block
 block discarded – undo
1260 1260
 
1261 1261
     // Validate character_count
1262 1262
     //todo: is this necessary?
1263
-    $params['character_count']  = $params['character_count'];
1263
+    $params['character_count'] = $params['character_count'];
1264 1264
 
1265 1265
     // Validate our layout choice
1266 1266
     // Outside of the norm, I added some more simple terms to match the existing
@@ -1272,7 +1272,7 @@  discard block
 block discarded – undo
1272 1272
 
1273 1273
     // Validate Listing width, used in the template widget-listing-listview.php
1274 1274
     // The context is in width=$listing_width% - So we need a positive number between 0 & 100
1275
-    $params['listing_width']    = gdsc_validate_listing_width($params['listing_width']);
1275
+    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
1276 1276
 
1277 1277
     // Validate the checkboxes used on the widget
1278 1278
     $params['add_location_filter']  = gdsc_to_bool_val($params['add_location_filter']);
@@ -1288,7 +1288,7 @@  discard block
 block discarded – undo
1288 1288
     if (!empty($params['tags'])) {
1289 1289
         if (!is_array($params['tags'])) {
1290 1290
             $comma = _x(',', 'tag delimiter');
1291
-            if ( ',' !== $comma ) {
1291
+            if (',' !== $comma) {
1292 1292
                 $params['tags'] = str_replace($comma, ',', $params['tags']);
1293 1293
             }
1294 1294
             $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,"));
@@ -1310,13 +1310,13 @@  discard block
 block discarded – undo
1310 1310
         unset($atts['pageno']);
1311 1311
     }
1312 1312
 
1313
-    if ( !empty($atts['shortcode_content']) ) {
1313
+    if (!empty($atts['shortcode_content'])) {
1314 1314
         $content = $atts['shortcode_content'];
1315 1315
     }
1316 1316
     $params['shortcode_content'] = trim($content);
1317 1317
     $atts['shortcode_content'] = trim($content);
1318 1318
     
1319
-    $params['shortcode_atts']       = $atts;
1319
+    $params['shortcode_atts'] = $atts;
1320 1320
 
1321 1321
     $output = geodir_sc_gd_listings_output($params);
1322 1322
 
@@ -1388,8 +1388,8 @@  discard block
 block discarded – undo
1388 1388
     // Validate the checkboxes used on the widget
1389 1389
     $params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1390 1390
     $params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1391
-    $params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1392
-    $params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1391
+    $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']);
1392
+    $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']);
1393 1393
 
1394 1394
     if ($params['max_count'] != 'all') {
1395 1395
         $params['max_count'] = absint($params['max_count']);
Please login to merge, or discard this patch.