Test Failed
Push — master ( 63f06b...032663 )
by Stiofan
19:25
created
geodirectory-functions/map-functions/map_on_add_listing_page.php 3 patches
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.
Indentation   +70 added lines, -70 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;
@@ -346,13 +346,13 @@  discard block
 block discarded – undo
346 346
                 getZip = postal_code.long_name;
347 347
             }
348 348
             <?php 
349
-            /**
350
-             * Fires to add javascript variable to use in google map.
351
-             *
352
-             * @since 1.0.0
353
-             */
354
-            do_action('geodir_add_listing_geocode_js_vars');
355
-            ?>
349
+			/**
350
+			 * Fires to add javascript variable to use in google map.
351
+			 *
352
+			 * @since 1.0.0
353
+			 */
354
+			do_action('geodir_add_listing_geocode_js_vars');
355
+			?>
356 356
             <?php if ($is_map_restrict) { ?>
357 357
             if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
358 358
                 alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
@@ -433,15 +433,15 @@  discard block
 block discarded – undo
433 433
             }
434 434
         }
435 435
         <?php
436
-        /**
437
-         * Fires when marker address updated on map.
438
-         *
439
-         * @since 1.0.0
440
-         * @param string $prefix Identifier used as a prefix for field name
441
-         */
442
-        do_action('geodir_update_marker_address', $prefix);
443
-        echo $updateMarkerAddress = ob_get_clean();
444
-        ?>
436
+		/**
437
+		 * Fires when marker address updated on map.
438
+		 *
439
+		 * @since 1.0.0
440
+		 * @param string $prefix Identifier used as a prefix for field name
441
+		 */
442
+		do_action('geodir_update_marker_address', $prefix);
443
+		echo $updateMarkerAddress = ob_get_clean();
444
+		?>
445 445
     }
446 446
     function geodir_codeAddress(set_on_map) {
447 447
         var address = jQuery('#<?php echo $prefix.'address';?>').val();
@@ -456,17 +456,17 @@  discard block
 block discarded – undo
456 456
         }
457 457
         if(!ISO2){
458 458
             <?php
459
-            if(!defined('GEODIRLOCATION_TEXTDOMAIN')){
460
-                global $wpdb;
461
-                $location_result = geodir_get_default_location();
462
-                if(!empty($location_result)){
463
-                    $ISO2 = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s",$location_result->country));
464
-                    echo "ISO2 = '$ISO2';";
465
-                }
466
-            }
459
+			if(!defined('GEODIRLOCATION_TEXTDOMAIN')){
460
+				global $wpdb;
461
+				$location_result = geodir_get_default_location();
462
+				if(!empty($location_result)){
463
+					$ISO2 = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s",$location_result->country));
464
+					echo "ISO2 = '$ISO2';";
465
+				}
466
+			}
467 467
 
468 468
 
469
-            ?>
469
+			?>
470 470
         }
471 471
         if (ISO2 == '--') {
472 472
             ISO2 = '';
@@ -486,9 +486,9 @@  discard block
 block discarded – undo
486 486
         }
487 487
         var is_restrict = '<?php echo $is_map_restrict; ?>';
488 488
         <?php ob_start();
489
-        $defaultregion = isset($default_location->region) ? $default_location->region : '';
490
-        $defaultcountry = isset($default_location->country) ? $default_location->country : '';
491
-        ?>
489
+		$defaultregion = isset($default_location->region) ? $default_location->region : '';
490
+		$defaultcountry = isset($default_location->country) ? $default_location->country : '';
491
+		?>
492 492
         if (set_on_map && is_restrict) {
493 493
             if (zip != '' && address != '') {
494 494
                 address = address + ',' + zip;
@@ -500,12 +500,12 @@  discard block
 block discarded – undo
500 500
             if( address == city || address == region || address == country || address == zip )
501 501
                 address = '';
502 502
             <?php
503
-            if(is_admin() && isset($_REQUEST['tab'])){?>
503
+			if(is_admin() && isset($_REQUEST['tab'])){?>
504 504
             if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
505 505
                 address = '';
506 506
             }
507 507
             <?php
508
-               }?>
508
+			   }?>
509 509
 
510 510
             if (ISO2 == 'GB') {
511 511
                 address = address + ',' + city + ',' + country; // UK is funny with regions
@@ -521,15 +521,15 @@  discard block
 block discarded – undo
521 521
             address =  address.replace(",null,", ",");
522 522
         }
523 523
         <?php $codeAddress = ob_get_clean();
524
-        /**
525
-         * Filter the address variable
526
-         *
527
-         * @since 1.0.0
528
-         *
529
-         * @param string $codeAddress Row of address to use in google map.
530
-         */
531
-        echo apply_filters('geodir_codeaddress', $codeAddress);
532
-        ?>
524
+		/**
525
+		 * Filter the address variable
526
+		 *
527
+		 * @since 1.0.0
528
+		 *
529
+		 * @param string $codeAddress Row of address to use in google map.
530
+		 */
531
+		echo apply_filters('geodir_codeaddress', $codeAddress);
532
+		?>
533 533
         if (!window.gdMaps) { // No Google Map Loaded
534 534
             return;
535 535
         }
@@ -554,13 +554,13 @@  discard block
 block discarded – undo
554 554
                         updateMarkerPosition(baseMarker.getPosition());
555 555
                         //if(set_on_map && is_restrict) {
556 556
                         <?php 
557
-                        /**
558
-                         * Fires before set geocode position.
559
-                         *
560
-                         * @since 1.0.0
561
-                         */
562
-                        do_action('geodir_add_listing_codeaddress_before_geocode');
563
-                        ?>
557
+						/**
558
+						 * Fires before set geocode position.
559
+						 *
560
+						 * @since 1.0.0
561
+						 */
562
+						do_action('geodir_add_listing_codeaddress_before_geocode');
563
+						?>
564 564
                         geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
565 565
                         //}
566 566
                     } else {
@@ -606,13 +606,13 @@  discard block
 block discarded – undo
606 606
                 updateMarkerPositionOSM(baseMarker.getLatLng());
607 607
             }
608 608
             <?php 
609
-            /**
610
-             * Fires to add javascript variable to use in google map.
611
-             *
612
-             * @since 1.0.0
613
-             */
614
-            do_action('geodir_add_listing_geocode_js_vars');
615
-            ?>
609
+			/**
610
+			 * Fires to add javascript variable to use in google map.
611
+			 *
612
+			 * @since 1.0.0
613
+			 */
614
+			do_action('geodir_add_listing_geocode_js_vars');
615
+			?>
616 616
             <?php if ($is_map_restrict) { ?>
617 617
             if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
618 618
                 alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 <?php
762 762
 $set_button_class = 'geodir_button';
763 763
 if (is_admin())
764
-    $set_button_class = 'button-primary';
764
+	$set_button_class = 'button-primary';
765 765
 ?>
766 766
 <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;"/>
767 767
 <div id="<?php echo $prefix; ?>d_mouseClick"></div>
Please login to merge, or discard this patch.
Spacing   +82 added lines, -82 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;
@@ -354,9 +354,9 @@  discard block
 block discarded – undo
354 354
             do_action('geodir_add_listing_geocode_js_vars');
355 355
             ?>
356 356
             <?php if ($is_map_restrict) { ?>
357
-            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
358
-                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
359
-                jQuery("#<?php echo $prefix.'map';?>").goMap();
357
+            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
358
+                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
359
+                jQuery("#<?php echo $prefix.'map'; ?>").goMap();
360 360
                 jQuery.goMap.map.setCenter(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
361 361
                 baseMarker.setPosition(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
362 362
                 updateMarkerPosition(baseMarker.getPosition());
@@ -365,11 +365,11 @@  discard block
 block discarded – undo
365 365
             <?php } ?>
366 366
             updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry);
367 367
         } else {
368
-            updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
368
+            updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
369 369
         }
370 370
     }
371 371
     function centerMap(latlng) {
372
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
372
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
373 373
         if (window.gdMaps == 'google') {
374 374
             jQuery.goMap.map.panTo(baseMarker.getPosition());
375 375
         } else if (window.gdMaps == 'osm') {
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
         }
379 379
     }
380 380
     function centerMarker() {
381
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
381
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
382 382
         var center = jQuery.goMap.map.getCenter();
383 383
         if (window.gdMaps == 'google') {
384 384
             baseMarker.setPosition(center);
@@ -387,48 +387,48 @@  discard block
 block discarded – undo
387 387
         }
388 388
     }
389 389
     function updateMapZoom(zoom) {
390
-        jQuery('#<?php echo $prefix.'mapzoom';?>').val(zoom);
390
+        jQuery('#<?php echo $prefix.'mapzoom'; ?>').val(zoom);
391 391
     }
392 392
     function updateMarkerPosition(markerlatLng) {
393
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
394
-        jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat());
395
-        jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng());
393
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
394
+        jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat());
395
+        jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng());
396 396
     }
397 397
     function updateMarkerPositionOSM(markerlatLng) {
398
-        jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat);
399
-        jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng);
398
+        jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat);
399
+        jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng);
400 400
     }
401 401
     function updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry) {
402
-        var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields);?>';
403
-        <?php ob_start();?>
404
-        var old_country = jQuery("#<?php echo $prefix.'country';?>").val();
405
-        var old_region = jQuery("#<?php echo $prefix.'region';?>").val();
402
+        var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields); ?>';
403
+        <?php ob_start(); ?>
404
+        var old_country = jQuery("#<?php echo $prefix.'country'; ?>").val();
405
+        var old_region = jQuery("#<?php echo $prefix.'region'; ?>").val();
406 406
         
407
-        if (user_address == false || jQuery('#<?php echo $prefix.'address';?>').val() == '') {
408
-            jQuery("#<?php echo $prefix.'address';?>").val(getAddress);
407
+        if (user_address == false || jQuery('#<?php echo $prefix.'address'; ?>').val() == '') {
408
+            jQuery("#<?php echo $prefix.'address'; ?>").val(getAddress);
409 409
         }
410 410
         if (getAddress) {
411 411
             oldstr_address = getAddress;
412 412
         }
413 413
 
414
-        jQuery("#<?php echo $prefix.'zip';?>").val(getZip);
414
+        jQuery("#<?php echo $prefix.'zip'; ?>").val(getZip);
415 415
         if (getZip) {
416 416
             oldstr_zip = getZip;
417 417
         }
418 418
         if (set_map_val_in_fields) {
419 419
             if (getCountry) {
420
-                jQuery('#<?php echo $prefix .'country'; ?> option[value=""]').attr("selected",false);
421
-                jQuery('#<?php echo $prefix.'country';?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
422
-                jQuery("#<?php echo $prefix.'country';?>").trigger("chosen:updated");
420
+                jQuery('#<?php echo $prefix.'country'; ?> option[value=""]').attr("selected",false);
421
+                jQuery('#<?php echo $prefix.'country'; ?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
422
+                jQuery("#<?php echo $prefix.'country'; ?>").trigger("chosen:updated");
423 423
             }
424 424
             if (getState) {
425
-                if (jQuery('input[id="<?php echo $prefix.'region';?>"]').attr('id')) {
426
-                    jQuery("#<?php echo $prefix.'region';?>").val(getState);
425
+                if (jQuery('input[id="<?php echo $prefix.'region'; ?>"]').attr('id')) {
426
+                    jQuery("#<?php echo $prefix.'region'; ?>").val(getState);
427 427
                 }
428 428
             }
429 429
             if (getCity) {
430
-                if (jQuery('input[id="<?php echo $prefix.'city';?>"]').attr('id')) {
431
-                    jQuery("#<?php echo $prefix.'city';?>").val(getCity);
430
+                if (jQuery('input[id="<?php echo $prefix.'city'; ?>"]').attr('id')) {
431
+                    jQuery("#<?php echo $prefix.'city'; ?>").val(getCity);
432 432
                 }
433 433
             }
434 434
         }
@@ -444,23 +444,23 @@  discard block
 block discarded – undo
444 444
         ?>
445 445
     }
446 446
     function geodir_codeAddress(set_on_map) {
447
-        var address = jQuery('#<?php echo $prefix.'address';?>').val();
448
-        var zip = jQuery('#<?php echo $prefix.'zip';?>').val();
449
-        var city = jQuery('#<?php echo $prefix.'city';?>').val();
450
-        var region = jQuery('#<?php echo $prefix.'region';?>').val();
451
-        var country = jQuery('#<?php echo $prefix.'country';?>').val();
452
-        var country_selected = jQuery('#<?php echo $prefix.'country';?>').find('option:selected');
447
+        var address = jQuery('#<?php echo $prefix.'address'; ?>').val();
448
+        var zip = jQuery('#<?php echo $prefix.'zip'; ?>').val();
449
+        var city = jQuery('#<?php echo $prefix.'city'; ?>').val();
450
+        var region = jQuery('#<?php echo $prefix.'region'; ?>').val();
451
+        var country = jQuery('#<?php echo $prefix.'country'; ?>').val();
452
+        var country_selected = jQuery('#<?php echo $prefix.'country'; ?>').find('option:selected');
453 453
         var ISO2 = country_selected.data('country_code');
454
-        if (!ISO2 && jQuery('#<?php echo $prefix.'country';?>').data('country_code')) {
455
-            ISO2 = jQuery('#<?php echo $prefix.'country';?>').data('country_code');
454
+        if (!ISO2 && jQuery('#<?php echo $prefix.'country'; ?>').data('country_code')) {
455
+            ISO2 = jQuery('#<?php echo $prefix.'country'; ?>').data('country_code');
456 456
         }
457 457
         if(!ISO2){
458 458
             <?php
459
-            if(!defined('GEODIRLOCATION_TEXTDOMAIN')){
459
+            if (!defined('GEODIRLOCATION_TEXTDOMAIN')) {
460 460
                 global $wpdb;
461 461
                 $location_result = geodir_get_default_location();
462
-                if(!empty($location_result)){
463
-                    $ISO2 = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s",$location_result->country));
462
+                if (!empty($location_result)) {
463
+                    $ISO2 = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country=%s", $location_result->country));
464 464
                     echo "ISO2 = '$ISO2';";
465 465
                 }
466 466
             }
@@ -476,13 +476,13 @@  discard block
 block discarded – undo
476 476
             zip = '';
477 477
         }
478 478
         if (typeof city == "undefined") {
479
-            city = '<?php echo addslashes_gpc($city);?>';
479
+            city = '<?php echo addslashes_gpc($city); ?>';
480 480
         }
481 481
         if (typeof region == "undefined") {
482
-            region = '<?php echo addslashes_gpc($region);?>';
482
+            region = '<?php echo addslashes_gpc($region); ?>';
483 483
         }
484 484
         if (typeof country == "undefined") {
485
-            country = '<?php echo addslashes_gpc($country);?>';
485
+            country = '<?php echo addslashes_gpc($country); ?>';
486 486
         }
487 487
         var is_restrict = '<?php echo $is_map_restrict; ?>';
488 488
         <?php ob_start();
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
             if( address == city || address == region || address == country || address == zip )
501 501
                 address = '';
502 502
             <?php
503
-            if(is_admin() && isset($_REQUEST['tab'])){?>
503
+            if (is_admin() && isset($_REQUEST['tab'])) {?>
504 504
             if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
505 505
                 address = '';
506 506
             }
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
             geocoder.geocode({'address': address, 'country': ISO2},
548 548
                 function (results, status) {
549 549
                     console.log(status);
550
-                    jQuery("#<?php echo $prefix.'map';?>").goMap();
550
+                    jQuery("#<?php echo $prefix.'map'; ?>").goMap();
551 551
                     if (status == google.maps.GeocoderStatus.OK) {
552 552
                         baseMarker.setPosition(results[0].geometry.location);
553 553
                         jQuery.goMap.map.setCenter(results[0].geometry.location);
@@ -564,21 +564,21 @@  discard block
 block discarded – undo
564 564
                         geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
565 565
                         //}
566 566
                     } else {
567
-                        alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:','geodirectory'));?> ' + status);
567
+                        alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:', 'geodirectory')); ?> ' + status);
568 568
                     }
569 569
                 });
570 570
         }
571 571
     }
572 572
     function gdMaxMap() {
573
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
573
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
574 574
 
575
-        jQuery('#<?php echo $prefix.'map';?>').toggleClass('map-fullscreen');
575
+        jQuery('#<?php echo $prefix.'map'; ?>').toggleClass('map-fullscreen');
576 576
         jQuery('.map_category').toggleClass('map_category_fullscreen');
577
-        jQuery('#<?php echo $prefix;?>trigger').toggleClass('map_category_fullscreen');
577
+        jQuery('#<?php echo $prefix; ?>trigger').toggleClass('map_category_fullscreen');
578 578
         jQuery('body').toggleClass('body_fullscreen');
579
-        jQuery('#<?php echo $prefix;?>loading_div').toggleClass('loading_div_fullscreen');
580
-        jQuery('#<?php echo $prefix;?>advmap_nofound').toggleClass('nofound_fullscreen');
581
-        jQuery('#<?php echo $prefix;?>triggermap').toggleClass('triggermap_fullscreen');
579
+        jQuery('#<?php echo $prefix; ?>loading_div').toggleClass('loading_div_fullscreen');
580
+        jQuery('#<?php echo $prefix; ?>advmap_nofound').toggleClass('nofound_fullscreen');
581
+        jQuery('#<?php echo $prefix; ?>triggermap').toggleClass('triggermap_fullscreen');
582 582
         jQuery('.TopLeft').toggleClass('TopLeft_fullscreen');
583 583
         window.setTimeout(function () {
584 584
             if (window.gdMaps == 'google') {
@@ -614,9 +614,9 @@  discard block
 block discarded – undo
614 614
             do_action('geodir_add_listing_geocode_js_vars');
615 615
             ?>
616 616
             <?php if ($is_map_restrict) { ?>
617
-            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
618
-                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
619
-                jQuery("#<?php echo $prefix.'map';?>").goMap();
617
+            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
618
+                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
619
+                jQuery("#<?php echo $prefix.'map'; ?>").goMap();
620 620
                 centerMap(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
621 621
                 baseMarker.setLatLng(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
622 622
                 updateMarkerPositionOSM(baseMarker.getLatLng());
@@ -625,39 +625,39 @@  discard block
 block discarded – undo
625 625
             <?php } ?>
626 626
             updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry);
627 627
         } else {
628
-            alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
628
+            alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
629 629
         }
630 630
     }
631 631
     
632 632
     jQuery(function ($) {
633
-        $("#<?php echo $prefix.'map';?>").goMap({
634
-            latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT,
635
-            longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG,
636
-            zoom: <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT,
633
+        $("#<?php echo $prefix.'map'; ?>").goMap({
634
+            latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT,
635
+            longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG,
636
+            zoom: <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT,
637 637
             maptype: 'ROADMAP', // Map type - HYBRID, ROADMAP, SATELLITE, TERRAIN
638 638
             streetViewControl: true,
639
-            <?php if(get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,';}?>
639
+            <?php if (get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,'; }?>
640 640
         });
641 641
 
642 642
         if (window.gdMaps) {
643 643
             geocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : [];
644 644
 
645 645
             baseMarker = $.goMap.createMarker({
646
-                latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT,
647
-                longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG,
646
+                latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT,
647
+                longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG,
648 648
                 id: 'baseMarker',
649
-                icon: '<?php echo $marker_icon;?>',
649
+                icon: '<?php echo $marker_icon; ?>',
650 650
                 draggable: true,
651 651
                 addToMap: true, // For OSM
652
-                w: parseFloat('<?php echo $icon_size['w'];?>'),
653
-                h: parseFloat('<?php echo $icon_size['h'];?>'),
652
+                w: parseFloat('<?php echo $icon_size['w']; ?>'),
653
+                h: parseFloat('<?php echo $icon_size['h']; ?>'),
654 654
             });
655 655
         } else {
656
-            jQuery('#<?php echo $prefix.'advmap_nofound';?>').hide();
657
-            jQuery('#<?php echo $prefix.'advmap_notloaded';?>').show();
656
+            jQuery('#<?php echo $prefix.'advmap_nofound'; ?>').hide();
657
+            jQuery('#<?php echo $prefix.'advmap_notloaded'; ?>').show();
658 658
         }
659 659
         
660
-        $("#<?php echo $prefix;?>set_address_button").click(function () {
660
+        $("#<?php echo $prefix; ?>set_address_button").click(function () {
661 661
             var set_on_map = true;
662 662
             geodir_codeAddress(set_on_map);
663 663
         });
@@ -692,14 +692,14 @@  discard block
 block discarded – undo
692 692
                 updateMapZoom($.goMap.map.zoom);
693 693
             });
694 694
 
695
-            var maxMap = document.getElementById('<?php echo $prefix;?>triggermap');
695
+            var maxMap = document.getElementById('<?php echo $prefix; ?>triggermap');
696 696
             google.maps.event.addDomListener(maxMap, 'click', gdMaxMap);
697 697
 
698 698
             <?php if ($is_map_restrict) { ?>
699
-            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country);?>';
699
+            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country); ?>';
700 700
             geocoder.geocode({'address': CITY_ADDRESS},
701 701
                 function (results, status) {
702
-                    $("#<?php echo $prefix.'map';?>").goMap();
702
+                    $("#<?php echo $prefix.'map'; ?>").goMap();
703 703
                     if (status == google.maps.GeocoderStatus.OK) {
704 704
                         // Bounds for North America
705 705
                         var bound_lat_lng = String(results[0].geometry.bounds);
@@ -710,13 +710,13 @@  discard block
 block discarded – undo
710 710
                             new google.maps.LatLng(bound_lat_lng[2], bound_lat_lng[3])
711 711
                         );
712 712
                     } else {
713
-                        alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status);
713
+                        alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
714 714
                     }
715 715
                 });
716 716
             <?php } ?>
717 717
             // Limit the zoom level
718 718
             google.maps.event.addListener($.goMap.map, 'zoom_changed', function () {
719
-                $("#<?php echo $prefix.'map';?>").goMap();
719
+                $("#<?php echo $prefix.'map'; ?>").goMap();
720 720
                 if ($.goMap.map.getZoom() < minZoomLevel) $.goMap.map.setZoom(minZoomLevel);
721 721
             });
722 722
         } else if (window.gdMaps == 'osm') {
@@ -742,10 +742,10 @@  discard block
 block discarded – undo
742 742
                 updateMapZoom($.goMap.map.getZoom());
743 743
             });
744 744
 
745
-            L.DomEvent.addListener($('<?php echo $prefix;?>triggermap'), 'click', gdMaxMap);
745
+            L.DomEvent.addListener($('<?php echo $prefix; ?>triggermap'), 'click', gdMaxMap);
746 746
 
747 747
             <?php if ($is_map_restrict) { ?>
748
-            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country);?>';
748
+            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country); ?>';
749 749
             geocodePositionOSM('', CITY_ADDRESS);
750 750
             <?php } ?>
751 751
             // Limit the zoom level
@@ -768,14 +768,14 @@  discard block
 block discarded – undo
768 768
 <div class="top_banner_section_inn geodir_map_container clearfix" style="margin-top:10px;">
769 769
     <div class="TopLeft"><span id="<?php echo $prefix; ?>triggermap" style="margin-top:-11px;margin-left:-12px;"></span></div>
770 770
     <div class="TopRight"></div>
771
-    <div id="<?php echo $prefix . 'map'; ?>" class="geodir_map" style="height:300px">
771
+    <div id="<?php echo $prefix.'map'; ?>" class="geodir_map" style="height:300px">
772 772
         <!-- new map start -->
773 773
         <div class="iprelative">
774
-            <div id="<?php echo $prefix . 'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div>
774
+            <div id="<?php echo $prefix.'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div>
775 775
             <div id="<?php echo $prefix; ?>loading_div" style="height:300px"></div>
776 776
             <div id="<?php echo $prefix; ?>advmap_counter"></div>
777 777
             <div id="<?php echo $prefix; ?>advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div>
778
-            <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>
778
+            <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>
779 779
         </div>
780 780
         <!-- new map end -->
781 781
     </div>
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/general_settings_array.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
     ),
99 99
     array('type' => 'sectionend', 'id' => 'general_options'),
100 100
 
101
-));/* General Options End*/
101
+)); /* General Options End*/
102 102
 
103 103
 /**
104 104
  * Filter GD Google Analytic Settings array.
Please login to merge, or discard this patch.
Indentation   +273 added lines, -273 removed lines patch added patch discarded remove patch
@@ -16,92 +16,92 @@  discard block
 block discarded – undo
16 16
  */
17 17
 $general_options = apply_filters('geodir_general_options', array(
18 18
 
19
-    array('name' => __('General', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'general_options'),
20
-
21
-    array('name' => __('General Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'general_options'),
22
-
23
-    array(
24
-        'name' => __('Sender name', 'geodirectory'),
25
-        'desc' => __('(Name that will be shown as email sender when users receive emails from this site)', 'geodirectory'),
26
-        'id' => 'site_email_name',
27
-        'type' => 'text',
28
-        'css' => 'min-width:300px;',
29
-        'std' => get_bloginfo('name') // Default value for the page title - changed in settings
30
-    ),
31
-
32
-    array(
33
-        'name' => __('Email address', 'geodirectory'),
34
-        'desc' => __('(Emails to users will be sent via this mail ID)', 'geodirectory'),
35
-        'id' => 'site_email',
36
-        'type' => 'text',
37
-        'css' => 'min-width:300px;',
38
-        'std' => get_bloginfo('admin_email') // Default value for the page title - changed in settings
39
-    ),
40
-    array(
41
-        'name' => __('Allow user to see wp-admin area', 'geodirectory'),
42
-        'desc' => __('Yes', 'geodirectory'),
43
-        'id' => 'geodir_allow_wpadmin',
44
-        'std' => '1',
45
-        'type' => 'radio',
46
-        'value' => '1',
47
-        'radiogroup' => 'start'
48
-    ),
49
-    array(
50
-        'name' => __('Allow user to see wp-admin area', 'geodirectory'),
51
-        'desc' => __('No', 'geodirectory'),
52
-        'id' => 'geodir_allow_wpadmin',
53
-        'std' => '0',
54
-        'type' => 'radio',
55
-        'value' => '0',
56
-        'radiogroup' => 'end'
57
-    ),
58
-
59
-    array(
60
-        'name' => __('Allow user to choose own password', 'geodirectory'),
61
-        'desc' => __('Yes', 'geodirectory'),
62
-        'id' => 'geodir_allow_cpass',
63
-        'std' => '1',
64
-        'type' => 'radio',
65
-        'value' => '1',
66
-        'radiogroup' => 'start'
67
-    ),
68
-    array(
69
-        'name' => __('Allow user to choose own password', 'geodirectory'),
70
-        'desc' => __('No', 'geodirectory'),
71
-        'id' => 'geodir_allow_cpass',
72
-        'std' => '0',
73
-        'type' => 'radio',
74
-        'value' => '0',
75
-        'radiogroup' => 'end'
76
-    ),
77
-    array(
78
-        'name' => __('Disable review stars for CPT', 'geodirectory'),
79
-        'desc' => __('Disable review stars for certain CPT without disabling comments on listings.', 'geodirectory'),
80
-        'tip' => '',
81
-        'id' => 'geodir_disable_rating_cpt',
82
-        'css' => 'min-width:300px;',
83
-        'std' => '',
84
-        'type' => 'multiselect',
85
-        'placeholder_text' => __('Select post types', 'geodirectory'),
86
-        'class' => 'chosen_select',
87
-        'options' => array_unique(geodir_post_type_setting_fun())
88
-    ),
89
-    array(
90
-        'name' => __('User deleted posts go to trash', 'geodirectory'),
91
-        'desc' => __('If checked a user deleted post will go to trash, otherwise it will be permanently deleted', 'geodirectory'),
92
-        'id' => 'geodir_disable_perm_delete',
93
-        'type' => 'checkbox',
94
-        'std' => '1'
95
-    ),
96
-    array(
97
-        'name' => __('Max upload file size(in mb)', 'geodirectory'),
98
-        'desc' => __('(Maximum upload file size in MB, 1 MB = 1024 KB. Must be greater then 0(ZERO), for ex: 2. This setting will overwrite the max upload file size limit in image/file upload & import listings for entire GeoDirectory core + GeoDirectory plugins.)', 'geodirectory'),
99
-        'id' => 'geodir_upload_max_filesize',
100
-        'type' => 'text',
101
-        'css' => 'min-width:300px;',
102
-        'std' => '2'
103
-    ),
104
-    array('type' => 'sectionend', 'id' => 'general_options'),
19
+	array('name' => __('General', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'general_options'),
20
+
21
+	array('name' => __('General Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'general_options'),
22
+
23
+	array(
24
+		'name' => __('Sender name', 'geodirectory'),
25
+		'desc' => __('(Name that will be shown as email sender when users receive emails from this site)', 'geodirectory'),
26
+		'id' => 'site_email_name',
27
+		'type' => 'text',
28
+		'css' => 'min-width:300px;',
29
+		'std' => get_bloginfo('name') // Default value for the page title - changed in settings
30
+	),
31
+
32
+	array(
33
+		'name' => __('Email address', 'geodirectory'),
34
+		'desc' => __('(Emails to users will be sent via this mail ID)', 'geodirectory'),
35
+		'id' => 'site_email',
36
+		'type' => 'text',
37
+		'css' => 'min-width:300px;',
38
+		'std' => get_bloginfo('admin_email') // Default value for the page title - changed in settings
39
+	),
40
+	array(
41
+		'name' => __('Allow user to see wp-admin area', 'geodirectory'),
42
+		'desc' => __('Yes', 'geodirectory'),
43
+		'id' => 'geodir_allow_wpadmin',
44
+		'std' => '1',
45
+		'type' => 'radio',
46
+		'value' => '1',
47
+		'radiogroup' => 'start'
48
+	),
49
+	array(
50
+		'name' => __('Allow user to see wp-admin area', 'geodirectory'),
51
+		'desc' => __('No', 'geodirectory'),
52
+		'id' => 'geodir_allow_wpadmin',
53
+		'std' => '0',
54
+		'type' => 'radio',
55
+		'value' => '0',
56
+		'radiogroup' => 'end'
57
+	),
58
+
59
+	array(
60
+		'name' => __('Allow user to choose own password', 'geodirectory'),
61
+		'desc' => __('Yes', 'geodirectory'),
62
+		'id' => 'geodir_allow_cpass',
63
+		'std' => '1',
64
+		'type' => 'radio',
65
+		'value' => '1',
66
+		'radiogroup' => 'start'
67
+	),
68
+	array(
69
+		'name' => __('Allow user to choose own password', 'geodirectory'),
70
+		'desc' => __('No', 'geodirectory'),
71
+		'id' => 'geodir_allow_cpass',
72
+		'std' => '0',
73
+		'type' => 'radio',
74
+		'value' => '0',
75
+		'radiogroup' => 'end'
76
+	),
77
+	array(
78
+		'name' => __('Disable review stars for CPT', 'geodirectory'),
79
+		'desc' => __('Disable review stars for certain CPT without disabling comments on listings.', 'geodirectory'),
80
+		'tip' => '',
81
+		'id' => 'geodir_disable_rating_cpt',
82
+		'css' => 'min-width:300px;',
83
+		'std' => '',
84
+		'type' => 'multiselect',
85
+		'placeholder_text' => __('Select post types', 'geodirectory'),
86
+		'class' => 'chosen_select',
87
+		'options' => array_unique(geodir_post_type_setting_fun())
88
+	),
89
+	array(
90
+		'name' => __('User deleted posts go to trash', 'geodirectory'),
91
+		'desc' => __('If checked a user deleted post will go to trash, otherwise it will be permanently deleted', 'geodirectory'),
92
+		'id' => 'geodir_disable_perm_delete',
93
+		'type' => 'checkbox',
94
+		'std' => '1'
95
+	),
96
+	array(
97
+		'name' => __('Max upload file size(in mb)', 'geodirectory'),
98
+		'desc' => __('(Maximum upload file size in MB, 1 MB = 1024 KB. Must be greater then 0(ZERO), for ex: 2. This setting will overwrite the max upload file size limit in image/file upload & import listings for entire GeoDirectory core + GeoDirectory plugins.)', 'geodirectory'),
99
+		'id' => 'geodir_upload_max_filesize',
100
+		'type' => 'text',
101
+		'css' => 'min-width:300px;',
102
+		'std' => '2'
103
+	),
104
+	array('type' => 'sectionend', 'id' => 'general_options'),
105 105
 
106 106
 ));/* General Options End*/
107 107
 
@@ -113,104 +113,104 @@  discard block
 block discarded – undo
113 113
  */
114 114
 $google_analytic_settings = apply_filters('geodir_google_analytic_settings', array(
115 115
 
116
-    array('name' => __('Google Analytics', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'google_analytic_settings'),
117
-
118
-    array('name' => __('Google Analytic Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'google_analytic_settings'),
119
-
120
-
121
-
122
-    array(
123
-        'name' => __('Show business owner google analytics stats?', 'geodirectory'),
124
-        'desc' => __('Yes', 'geodirectory'),
125
-        'id' => 'geodir_ga_stats',
126
-        'std' => '0',
127
-        'type' => 'radio',
128
-        'value' => '1',
129
-        'radiogroup' => 'start'
130
-    ),
131
-    array(
132
-        'name' => __('Show business owner Google Analytics stats?', 'geodirectory'),
133
-        'desc' => __('No', 'geodirectory'),
134
-        'id' => 'geodir_ga_stats',
135
-        'std' => '1',
136
-        'type' => 'radio',
137
-        'value' => '0',
138
-        'radiogroup' => 'end'
139
-    ),
140
-
141
-    array(
142
-        'name' => __('Google analytics access', 'geodirectory'),
143
-        'desc' => '',
144
-        'id' => 'geodir_ga_token',
145
-        'type' => 'google_analytics',
146
-        'css' => 'min-width:300px;',
147
-        'std' => '' // Default value for the page title - changed in settings
148
-    ),
149
-
150
-    array(
151
-        'name' => __('Google analytics Auth Code', 'geodirectory'),
152
-        'desc' => __('You must save this setting before accounts will show.', 'geodirectory'),
153
-        'id' => 'geodir_ga_auth_code',
154
-        'type' => 'text',
155
-        'css' => 'min-width:300px;',
156
-        'std' => '' // Default value for the page title - changed in settings
157
-    ),
158
-
159
-    array(
160
-        'name' => __('Analytics Account', 'geodirectory'),
161
-        'desc' => __('Select the account that you setup for this site.', 'geodirectory'),
162
-        'id' => 'geodir_ga_account_id',
163
-        'css' => 'min-width:300px;',
164
-        'std' => 'gridview_onehalf',
165
-        'type' => 'select',
166
-        'class' => 'chosen_select',
167
-        'options' => geodir_gd_accounts()
168
-    ),
169
-
170
-
171
-    array(
172
-        'name' => __('Add Google analytics tracking code to site?', 'geodirectory'),
173
-        'desc' => __('Yes <small>(this will automatically add the correct tracking code to your site)</small>', 'geodirectory'),
174
-        'id' => 'geodir_ga_add_tracking_code',
175
-        'std' => '0',
176
-        'type' => 'radio',
177
-        'value' => '1',
178
-        'radiogroup' => 'start'
179
-    ),
180
-    array(
181
-        'name' => __('Add Google analytics tracking code to site?', 'geodirectory'),
182
-        'desc' => __('No <small>(if you already have tracking code added you should not add it again)</small>', 'geodirectory'),
183
-        'id' => 'geodir_ga_add_tracking_code',
184
-        'std' => '1',
185
-        'type' => 'radio',
186
-        'value' => '0',
187
-        'radiogroup' => 'end'
188
-    ),
189
-
190
-    array(
191
-        'name' => __('Anonymize user IP?', 'geodirectory'),
192
-        'desc' => __('In most cases this is not required, this is to comply with certain country laws such as Germany.', 'geodirectory'),
193
-        'id' => 'geodir_ga_anonymize_ip',
194
-        'type' => 'checkbox',
195
-        'std' => '0'
196
-    ),
197
-
198
-    array(
199
-        'name' => __('Auto refresh active users?', 'geodirectory'),
200
-        'desc' => __('If ticked it uses the auto refresh time below, if not it never refreshes unless the refresh button is clicked.', 'geodirectory'),
201
-        'id' => 'geodir_ga_auto_refresh',
202
-        'type' => 'checkbox',
203
-        'std' => '0'
204
-    ),
205
-    array(
206
-        'name' => __('Time interval for auto refresh active users', 'geodirectory'),
207
-        'desc' => __('Time interval in seconds to auto refresh active users. The active users will be auto refreshed after this time interval. Leave blank or use 0(zero) to disable auto refresh. Default: 5', 'geodirectory'),
208
-        'id' => 'geodir_ga_refresh_time',
209
-        'type' => 'text',
210
-        'std' => '5'
211
-    ),
212
-
213
-    array('type' => 'sectionend', 'id' => 'google_analytic_settings'),
116
+	array('name' => __('Google Analytics', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'google_analytic_settings'),
117
+
118
+	array('name' => __('Google Analytic Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'google_analytic_settings'),
119
+
120
+
121
+
122
+	array(
123
+		'name' => __('Show business owner google analytics stats?', 'geodirectory'),
124
+		'desc' => __('Yes', 'geodirectory'),
125
+		'id' => 'geodir_ga_stats',
126
+		'std' => '0',
127
+		'type' => 'radio',
128
+		'value' => '1',
129
+		'radiogroup' => 'start'
130
+	),
131
+	array(
132
+		'name' => __('Show business owner Google Analytics stats?', 'geodirectory'),
133
+		'desc' => __('No', 'geodirectory'),
134
+		'id' => 'geodir_ga_stats',
135
+		'std' => '1',
136
+		'type' => 'radio',
137
+		'value' => '0',
138
+		'radiogroup' => 'end'
139
+	),
140
+
141
+	array(
142
+		'name' => __('Google analytics access', 'geodirectory'),
143
+		'desc' => '',
144
+		'id' => 'geodir_ga_token',
145
+		'type' => 'google_analytics',
146
+		'css' => 'min-width:300px;',
147
+		'std' => '' // Default value for the page title - changed in settings
148
+	),
149
+
150
+	array(
151
+		'name' => __('Google analytics Auth Code', 'geodirectory'),
152
+		'desc' => __('You must save this setting before accounts will show.', 'geodirectory'),
153
+		'id' => 'geodir_ga_auth_code',
154
+		'type' => 'text',
155
+		'css' => 'min-width:300px;',
156
+		'std' => '' // Default value for the page title - changed in settings
157
+	),
158
+
159
+	array(
160
+		'name' => __('Analytics Account', 'geodirectory'),
161
+		'desc' => __('Select the account that you setup for this site.', 'geodirectory'),
162
+		'id' => 'geodir_ga_account_id',
163
+		'css' => 'min-width:300px;',
164
+		'std' => 'gridview_onehalf',
165
+		'type' => 'select',
166
+		'class' => 'chosen_select',
167
+		'options' => geodir_gd_accounts()
168
+	),
169
+
170
+
171
+	array(
172
+		'name' => __('Add Google analytics tracking code to site?', 'geodirectory'),
173
+		'desc' => __('Yes <small>(this will automatically add the correct tracking code to your site)</small>', 'geodirectory'),
174
+		'id' => 'geodir_ga_add_tracking_code',
175
+		'std' => '0',
176
+		'type' => 'radio',
177
+		'value' => '1',
178
+		'radiogroup' => 'start'
179
+	),
180
+	array(
181
+		'name' => __('Add Google analytics tracking code to site?', 'geodirectory'),
182
+		'desc' => __('No <small>(if you already have tracking code added you should not add it again)</small>', 'geodirectory'),
183
+		'id' => 'geodir_ga_add_tracking_code',
184
+		'std' => '1',
185
+		'type' => 'radio',
186
+		'value' => '0',
187
+		'radiogroup' => 'end'
188
+	),
189
+
190
+	array(
191
+		'name' => __('Anonymize user IP?', 'geodirectory'),
192
+		'desc' => __('In most cases this is not required, this is to comply with certain country laws such as Germany.', 'geodirectory'),
193
+		'id' => 'geodir_ga_anonymize_ip',
194
+		'type' => 'checkbox',
195
+		'std' => '0'
196
+	),
197
+
198
+	array(
199
+		'name' => __('Auto refresh active users?', 'geodirectory'),
200
+		'desc' => __('If ticked it uses the auto refresh time below, if not it never refreshes unless the refresh button is clicked.', 'geodirectory'),
201
+		'id' => 'geodir_ga_auto_refresh',
202
+		'type' => 'checkbox',
203
+		'std' => '0'
204
+	),
205
+	array(
206
+		'name' => __('Time interval for auto refresh active users', 'geodirectory'),
207
+		'desc' => __('Time interval in seconds to auto refresh active users. The active users will be auto refreshed after this time interval. Leave blank or use 0(zero) to disable auto refresh. Default: 5', 'geodirectory'),
208
+		'id' => 'geodir_ga_refresh_time',
209
+		'type' => 'text',
210
+		'std' => '5'
211
+	),
212
+
213
+	array('type' => 'sectionend', 'id' => 'google_analytic_settings'),
214 214
 
215 215
 )); // google_analytic_settings End
216 216
 
@@ -222,84 +222,84 @@  discard block
 block discarded – undo
222 222
  */
223 223
 $search_settings = apply_filters('geodir_search_settings', array(
224 224
 
225
-    array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'search_settings'),
226
-
227
-    array('name' => __('Search Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'search_settings'),
228
-
229
-    array(
230
-        'name' => __('Limit squared distance area to X miles (helps improve search speed)', 'geodirectory'),
231
-        'desc' => __('Enter whole number only ex. 40 (Tokyo is largest city in the world @40 sq miles) LEAVE BLANK FOR NO DISTANCE LIMIT', 'geodirectory'),
232
-        'id' => 'geodir_search_dist',
233
-        'type' => 'text',
234
-        'css' => 'min-width:300px;',
235
-        'std' => '40' // Default value for the page title - changed in settings
236
-    ),
237
-
238
-    array(
239
-        'name' => __('Show search distances in miles or km', 'geodirectory'),
240
-        'desc' => __('Miles', 'geodirectory'),
241
-        'id' => 'geodir_search_dist_1',
242
-        'std' => 'miles',
243
-        'type' => 'radio',
244
-        'value' => 'miles',
245
-        'radiogroup' => 'start'
246
-    ),
247
-    array(
248
-        'name' => __('Show search distances in miles or km', 'geodirectory'),
249
-        'desc' => __('Kilometers', 'geodirectory'),
250
-        'id' => 'geodir_search_dist_1',
251
-        'std' => 'miles',
252
-        'type' => 'radio',
253
-        'value' => 'km',
254
-        'radiogroup' => 'end'
255
-    ),
256
-
257
-    array(
258
-        'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
259
-        'desc' => __('Meters', 'geodirectory'),
260
-        'id' => 'geodir_search_dist_2',
261
-        'std' => 'meters',
262
-        'type' => 'radio',
263
-        'value' => 'meters',
264
-        'radiogroup' => 'start'
265
-    ),
266
-
267
-    array(
268
-        'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
269
-        'desc' => __('Feet', 'geodirectory'),
270
-        'id' => 'geodir_search_dist_2',
271
-        'std' => 'meters',
272
-        'type' => 'radio',
273
-        'value' => 'feet',
274
-        'radiogroup' => 'end'
275
-    ),
276
-
277
-    array(
278
-        'name' => __('Add location specific text to (Near) search for Google', 'geodirectory'),
279
-        'desc' => __('This is usefull if your directory is limted to one location such as: New York or Australia (this setting should be blank if using default country, regions etc with multilocation addon as it will automatically add them)', 'geodirectory'),
280
-        'id' => 'geodir_search_near_addition',
281
-        'type' => 'text',
282
-        'css' => 'min-width:300px;',
283
-        'std' => ''
284
-    ),
285
-    array(
286
-        'name' => __('Individual word search limit', 'geodirectory'),
287
-        'desc' => __('With this option you can limit individual words being searched for, for example searching for `Jo Brown` would return results with words like `Jones`, you can exclude these types of small character words if you wish.', 'geodirectory'),
288
-        'id' => 'geodir_search_word_limit',
289
-        'css' => 'min-width:300px;',
290
-        'std' => 'gridview_onehalf',
291
-        'type' => 'select',
292
-        'class' => 'chosen_select',
293
-        'options' => array_unique(array(
294
-            '0' => __('Disabled', 'geodirectory'),
295
-            '1' => __('1 Character words excluded', 'geodirectory'),
296
-            '2' => __('2 Character words and less excluded', 'geodirectory'),
297
-            '3' => __('3 Character words and less excluded', 'geodirectory'),
298
-        ))
299
-    ),
300
-
301
-
302
-    array('type' => 'sectionend', 'id' => 'search_settings'),
225
+	array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'search_settings'),
226
+
227
+	array('name' => __('Search Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'search_settings'),
228
+
229
+	array(
230
+		'name' => __('Limit squared distance area to X miles (helps improve search speed)', 'geodirectory'),
231
+		'desc' => __('Enter whole number only ex. 40 (Tokyo is largest city in the world @40 sq miles) LEAVE BLANK FOR NO DISTANCE LIMIT', 'geodirectory'),
232
+		'id' => 'geodir_search_dist',
233
+		'type' => 'text',
234
+		'css' => 'min-width:300px;',
235
+		'std' => '40' // Default value for the page title - changed in settings
236
+	),
237
+
238
+	array(
239
+		'name' => __('Show search distances in miles or km', 'geodirectory'),
240
+		'desc' => __('Miles', 'geodirectory'),
241
+		'id' => 'geodir_search_dist_1',
242
+		'std' => 'miles',
243
+		'type' => 'radio',
244
+		'value' => 'miles',
245
+		'radiogroup' => 'start'
246
+	),
247
+	array(
248
+		'name' => __('Show search distances in miles or km', 'geodirectory'),
249
+		'desc' => __('Kilometers', 'geodirectory'),
250
+		'id' => 'geodir_search_dist_1',
251
+		'std' => 'miles',
252
+		'type' => 'radio',
253
+		'value' => 'km',
254
+		'radiogroup' => 'end'
255
+	),
256
+
257
+	array(
258
+		'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
259
+		'desc' => __('Meters', 'geodirectory'),
260
+		'id' => 'geodir_search_dist_2',
261
+		'std' => 'meters',
262
+		'type' => 'radio',
263
+		'value' => 'meters',
264
+		'radiogroup' => 'start'
265
+	),
266
+
267
+	array(
268
+		'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
269
+		'desc' => __('Feet', 'geodirectory'),
270
+		'id' => 'geodir_search_dist_2',
271
+		'std' => 'meters',
272
+		'type' => 'radio',
273
+		'value' => 'feet',
274
+		'radiogroup' => 'end'
275
+	),
276
+
277
+	array(
278
+		'name' => __('Add location specific text to (Near) search for Google', 'geodirectory'),
279
+		'desc' => __('This is usefull if your directory is limted to one location such as: New York or Australia (this setting should be blank if using default country, regions etc with multilocation addon as it will automatically add them)', 'geodirectory'),
280
+		'id' => 'geodir_search_near_addition',
281
+		'type' => 'text',
282
+		'css' => 'min-width:300px;',
283
+		'std' => ''
284
+	),
285
+	array(
286
+		'name' => __('Individual word search limit', 'geodirectory'),
287
+		'desc' => __('With this option you can limit individual words being searched for, for example searching for `Jo Brown` would return results with words like `Jones`, you can exclude these types of small character words if you wish.', 'geodirectory'),
288
+		'id' => 'geodir_search_word_limit',
289
+		'css' => 'min-width:300px;',
290
+		'std' => 'gridview_onehalf',
291
+		'type' => 'select',
292
+		'class' => 'chosen_select',
293
+		'options' => array_unique(array(
294
+			'0' => __('Disabled', 'geodirectory'),
295
+			'1' => __('1 Character words excluded', 'geodirectory'),
296
+			'2' => __('2 Character words and less excluded', 'geodirectory'),
297
+			'3' => __('3 Character words and less excluded', 'geodirectory'),
298
+		))
299
+	),
300
+
301
+
302
+	array('type' => 'sectionend', 'id' => 'search_settings'),
303 303
 
304 304
 )); //search_settings End
305 305
 
@@ -311,17 +311,17 @@  discard block
 block discarded – undo
311 311
  */
312 312
 $dummy_data_settings = apply_filters('geodir_dummy_data_settings', array(
313 313
 
314
-    array('name' => __('Dummy Data', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'dummy_data_settings'),
315
-
316
-    array(
317
-        'name' => '',
318
-        'desc' => '',
319
-        'id' => 'geodir_dummy_data_installer',
320
-        'type' => 'dummy_installer',
321
-        'css' => 'min-width:300px;',
322
-        'std' => '40' // Default value for the page title - changed in settings
323
-    ),
324
-    array('type' => 'sectionend', 'id' => 'geodir_dummy_data_settings'),
314
+	array('name' => __('Dummy Data', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'dummy_data_settings'),
315
+
316
+	array(
317
+		'name' => '',
318
+		'desc' => '',
319
+		'id' => 'geodir_dummy_data_installer',
320
+		'type' => 'dummy_installer',
321
+		'css' => 'min-width:300px;',
322
+		'std' => '40' // Default value for the page title - changed in settings
323
+	),
324
+	array('type' => 'sectionend', 'id' => 'geodir_dummy_data_settings'),
325 325
 
326 326
 )); //dummy_data_settings End
327 327
 
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/Google/Task/Retryable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
  */
17 17
 
18 18
 if (!class_exists('Google_Client')) {
19
-  require_once dirname(__FILE__) . '/../autoload.php';
19
+  require_once dirname(__FILE__).'/../autoload.php';
20 20
 }
21 21
 
22 22
 /**
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/Google/Auth/Abstract.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
  */
17 17
 
18 18
 if (!class_exists('Google_Client')) {
19
-  require_once dirname(__FILE__) . '/../autoload.php';
19
+  require_once dirname(__FILE__).'/../autoload.php';
20 20
 }
21 21
 
22 22
 /**
Please login to merge, or discard this patch.
geodirectory-functions/comments_functions.php 3 patches
Braces   +60 added lines, -48 removed lines patch added patch discarded remove patch
@@ -278,8 +278,9 @@  discard block
 block discarded – undo
278 278
 
279 279
     $post_id = isset($comment_info->comment_post_ID) ? $comment_info->comment_post_ID : '';
280 280
 
281
-    if (!empty($comment_info))
282
-        $status = $comment_info->comment_approved;
281
+    if (!empty($comment_info)) {
282
+            $status = $comment_info->comment_approved;
283
+    }
283 284
 
284 285
     if ($status == 'approve' || $status == 1) {
285 286
         $status = 1;
@@ -418,12 +419,14 @@  discard block
 block discarded – undo
418 419
         }
419 420
     } else {
420 421
         $rating = 0;
421
-        if (!empty($comment))
422
-            $rating = geodir_get_commentoverall($comment->comment_ID);
422
+        if (!empty($comment)) {
423
+                    $rating = geodir_get_commentoverall($comment->comment_ID);
424
+        }
423 425
         if ($rating != 0 && !is_admin()) {
424 426
             return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>';
425
-        } else
426
-            return $content;
427
+        } else {
428
+                    return $content;
429
+        }
427 430
     }
428 431
 }
429 432
 
@@ -512,11 +515,12 @@  discard block
 block discarded – undo
512 515
         $post_ratings = get_post_meta($post_id, 'overall_rating');
513 516
     }
514 517
 
515
-    if ($post_ratings)
516
-        return $post_ratings;
517
-    else
518
-        return false;
519
-}
518
+    if ($post_ratings) {
519
+            return $post_ratings;
520
+    } else {
521
+            return false;
522
+    }
523
+    }
520 524
 
521 525
 
522 526
 /**
@@ -541,11 +545,12 @@  discard block
 block discarded – undo
541 545
         )
542 546
     );
543 547
 
544
-    if (!empty($reatings))
545
-        return $reatings;
546
-    else
547
-        return false;
548
-}
548
+    if (!empty($reatings)) {
549
+            return $reatings;
550
+    } else {
551
+            return false;
552
+    }
553
+    }
549 554
 
550 555
 /**
551 556
  * Get review total of a Post.
@@ -569,11 +574,12 @@  discard block
 block discarded – undo
569 574
         )
570 575
     );
571 576
 
572
-    if (!empty($results))
573
-        return $results;
574
-    else
575
-        return false;
576
-}
577
+    if (!empty($results)) {
578
+            return $results;
579
+    } else {
580
+            return false;
581
+    }
582
+    }
577 583
 
578 584
 /**
579 585
  * Get review count by user ID.
@@ -596,11 +602,12 @@  discard block
 block discarded – undo
596 602
         )
597 603
     );
598 604
 
599
-    if (!empty($results))
600
-        return $results;
601
-    else
602
-        return false;
603
-}
605
+    if (!empty($results)) {
606
+            return $results;
607
+    } else {
608
+            return false;
609
+    }
610
+    }
604 611
 
605 612
 /**
606 613
  * Get average overall rating of a Post.
@@ -634,11 +641,12 @@  discard block
 block discarded – undo
634 641
         )
635 642
     );
636 643
 
637
-    if (!empty($results))
638
-        return $results;
639
-    else
640
-        return false;
641
-}
644
+    if (!empty($results)) {
645
+            return $results;
646
+    } else {
647
+            return false;
648
+    }
649
+    }
642 650
 
643 651
 /**
644 652
  * Get review count of a Post.
@@ -662,11 +670,12 @@  discard block
 block discarded – undo
662 670
         )
663 671
     );
664 672
 
665
-    if (!empty($results))
666
-        return $results;
667
-    else
668
-        return false;
669
-}
673
+    if (!empty($results)) {
674
+            return $results;
675
+    } else {
676
+            return false;
677
+    }
678
+    }
670 679
 
671 680
 /**
672 681
  * Get comments count of a Post.
@@ -692,11 +701,12 @@  discard block
 block discarded – undo
692 701
     );
693 702
 
694 703
 
695
-    if (!empty($results))
696
-        return $results;
697
-    else
698
-        return false;
699
-}
704
+    if (!empty($results)) {
705
+            return $results;
706
+    } else {
707
+            return false;
708
+    }
709
+    }
700 710
 
701 711
 /**
702 712
  * Get overall rating of a comment.
@@ -720,11 +730,12 @@  discard block
 block discarded – undo
720 730
         )
721 731
     );
722 732
 
723
-    if ($reatings)
724
-        return $reatings;
725
-    else
726
-        return false;
727
-}
733
+    if ($reatings) {
734
+            return $reatings;
735
+    } else {
736
+            return false;
737
+    }
738
+    }
728 739
 
729 740
 /**
730 741
  * Returns average overall rating of a Post. Depreciated since ver 1.3.6.
@@ -970,8 +981,9 @@  discard block
 block discarded – undo
970 981
     $active_tabs = get_option('geodir_detail_page_tabs_excluded');
971 982
 
972 983
     $is_display = true;
973
-    if (!empty($active_tabs) && in_array('reviews', $active_tabs))
974
-        $is_display = false;
984
+    if (!empty($active_tabs) && in_array('reviews', $active_tabs)) {
985
+            $is_display = false;
986
+    }
975 987
 
976 988
     /**
977 989
      * Filter to change display value.
Please login to merge, or discard this patch.
Indentation   +453 added lines, -453 removed lines patch added patch discarded remove patch
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function geodir_comment_meta_row_action($a)
33 33
 {
34
-    global $comment;
34
+	global $comment;
35 35
 
36
-    $rating = geodir_get_commentoverall($comment->comment_ID);
37
-    if ($rating != 0) {
38
-        echo geodir_get_rating_stars($rating, $comment->comment_ID);
39
-    }
40
-    return $a;
36
+	$rating = geodir_get_commentoverall($comment->comment_ID);
37
+	if ($rating != 0) {
38
+		echo geodir_get_rating_stars($rating, $comment->comment_ID);
39
+	}
40
+	return $a;
41 41
 }
42 42
 
43 43
 add_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
  */
53 53
 function geodir_comment_add_meta_box($comment)
54 54
 {
55
-    add_meta_box('gd-comment-rating', __('Comment Rating', 'geodirectory'), 'geodir_comment_rating_meta', 'comment', 'normal', 'high');
55
+	add_meta_box('gd-comment-rating', __('Comment Rating', 'geodirectory'), 'geodir_comment_rating_meta', 'comment', 'normal', 'high');
56 56
 }
57 57
 
58 58
 /**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
  * @param object $comment The comment object.
67 67
  */
68 68
 function geodir_comment_rating_meta($comment) {
69
-    $post_type = get_post_type($comment->comment_post_ID);
69
+	$post_type = get_post_type($comment->comment_post_ID);
70 70
 	if (in_array($post_type, (array)geodir_get_posttypes()) && (int)$comment->comment_parent == 0 && !(!empty($post_type) && geodir_cpt_has_rating_disabled($post_type))) {
71 71
 		$rating = geodir_get_commentoverall($comment->comment_ID);
72 72
 		
@@ -106,24 +106,24 @@  discard block
 block discarded – undo
106 106
  * @global object $post The post object.
107 107
  */
108 108
 function geodir_comment_rating_fields() {
109
-    global $post;
109
+	global $post;
110 110
 
111
-    $post_types = geodir_get_posttypes();
111
+	$post_types = geodir_get_posttypes();
112 112
 
113
-    if (!empty($post->post_type) && in_array($post->post_type, $post_types) && !(!empty($post->post_type) && geodir_cpt_has_rating_disabled($post->post_type))) {
114
-        $star_texts = array();
115
-        $star_texts[] = __('Terrible', 'geodirectory');
116
-        $star_texts[] = __('Poor', 'geodirectory');
117
-        $star_texts[] = __('Average', 'geodirectory');
118
-        $star_texts[] = __('Very Good', 'geodirectory');
119
-        $star_texts[] = __('Excellent', 'geodirectory');
113
+	if (!empty($post->post_type) && in_array($post->post_type, $post_types) && !(!empty($post->post_type) && geodir_cpt_has_rating_disabled($post->post_type))) {
114
+		$star_texts = array();
115
+		$star_texts[] = __('Terrible', 'geodirectory');
116
+		$star_texts[] = __('Poor', 'geodirectory');
117
+		$star_texts[] = __('Average', 'geodirectory');
118
+		$star_texts[] = __('Very Good', 'geodirectory');
119
+		$star_texts[] = __('Excellent', 'geodirectory');
120 120
         
121
-        $gd_rating_html = apply_filters('gd_rating_form_html', '<div class="gd_rating" data-average="0" data-id="5"></div>', $star_texts);
122
-        echo $gd_rating_html;
123
-        ?>
121
+		$gd_rating_html = apply_filters('gd_rating_form_html', '<div class="gd_rating" data-average="0" data-id="5"></div>', $star_texts);
122
+		echo $gd_rating_html;
123
+		?>
124 124
         <input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="0"/>
125 125
         <?php
126
-    }
126
+	}
127 127
 }
128 128
 
129 129
 add_filter('comment_reply_link', 'geodir_comment_replaylink');
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
 function geodir_comment_replaylink($link)
140 140
 {
141 141
 
142
-    if (strpos($link, 'wp-login.php?') !== false) {
143
-        $link = str_replace(wp_login_url(),geodir_login_url(),$link);
144
-    }
145
-    $link = '<div class="gd_comment_replaylink">' . $link . '</div>';
142
+	if (strpos($link, 'wp-login.php?') !== false) {
143
+		$link = str_replace(wp_login_url(),geodir_login_url(),$link);
144
+	}
145
+	$link = '<div class="gd_comment_replaylink">' . $link . '</div>';
146 146
 
147
-    return $link;
147
+	return $link;
148 148
 }
149 149
 
150 150
 add_filter('cancel_comment_reply_link', 'geodir_cancle_replaylink');
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
 function geodir_cancle_replaylink($link)
160 160
 {
161 161
 
162
-    $link = '<span class="gd-cancel-replaylink">' . $link . '</span>';
162
+	$link = '<span class="gd-cancel-replaylink">' . $link . '</span>';
163 163
 
164
-    return $link;
164
+	return $link;
165 165
 }
166 166
 
167 167
 add_action('comment_post', 'geodir_save_rating');
@@ -177,32 +177,32 @@  discard block
 block discarded – undo
177 177
  */
178 178
 function geodir_save_rating($comment = 0)
179 179
 {
180
-    global $wpdb, $user_ID, $plugin_prefix;
180
+	global $wpdb, $user_ID, $plugin_prefix;
181 181
 
182
-    $comment_info = get_comment($comment);
182
+	$comment_info = get_comment($comment);
183 183
 
184
-    $post_id = $comment_info->comment_post_ID;
185
-    $status = $comment_info->comment_approved;
186
-    $rating_ip = getenv("REMOTE_ADDR");
184
+	$post_id = $comment_info->comment_post_ID;
185
+	$status = $comment_info->comment_approved;
186
+	$rating_ip = getenv("REMOTE_ADDR");
187 187
 	
188
-    $post = geodir_get_post_info($post_id);
189
-    if (empty($post)) {
190
-        return;
191
-    }
192
-
193
-    if ($post->post_status == 'publish') {
194
-        $post_status = '1';
195
-    } else {
196
-        $post_status = '0';
197
-    }
188
+	$post = geodir_get_post_info($post_id);
189
+	if (empty($post)) {
190
+		return;
191
+	}
192
+
193
+	if ($post->post_status == 'publish') {
194
+		$post_status = '1';
195
+	} else {
196
+		$post_status = '0';
197
+	}
198 198
 	
199
-    if (isset($_REQUEST['geodir_overallrating'])) {
200
-        $overall_rating = $_REQUEST['geodir_overallrating'];
199
+	if (isset($_REQUEST['geodir_overallrating'])) {
200
+		$overall_rating = $_REQUEST['geodir_overallrating'];
201 201
         
202 202
 		if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
203
-            $overall_rating = $overall_rating > 0 ? $overall_rating : '0';
203
+			$overall_rating = $overall_rating > 0 ? $overall_rating : '0';
204 204
 
205
-            $sqlqry = $wpdb->prepare("INSERT INTO " . GEODIR_REVIEW_TABLE . " SET
205
+			$sqlqry = $wpdb->prepare("INSERT INTO " . GEODIR_REVIEW_TABLE . " SET
206 206
 					post_id		= %d,
207 207
 					post_type = %s,
208 208
 					post_title	= %s,
@@ -220,35 +220,35 @@  discard block
 block discarded – undo
220 220
 					post_latitude	= %s,
221 221
 					comment_content	= %s 
222 222
 					",
223
-                array($post_id, $post->post_type, $post->post_title, $user_ID, $comment, $rating_ip, $overall_rating, $status, $post_status, date_i18n('Y-m-d H:i:s', current_time('timestamp')), $post->post_city, $post->post_region, $post->post_country, $post->post_latitude, $post->post_longitude, $comment_info->comment_content)
224
-            );
225
-
226
-            $wpdb->query($sqlqry);
227
-
228
-            /**
229
-             * Called after saving the comment.
230
-             *
231
-             * @since 1.0.0
232
-             * @package GeoDirectory
233
-             * @param array $_REQUEST {
234
-             *    Attributes of the $_REQUEST variable.
235
-             *
236
-             *    @type string $geodir_overallrating Overall rating.
237
-             *    @type string $comment Comment text.
238
-             *    @type string $submit Submit button text.
239
-             *    @type string $comment_post_ID Comment post ID.
240
-             *    @type string $comment_parent Comment Parent ID.
241
-             *    @type string $_wp_unfiltered_html_comment Unfiltered html comment string.
242
-             *
243
-             * }
244
-             */
245
-            do_action('geodir_after_save_comment', $_REQUEST, 'Comment Your Post');
246
-
247
-            if ($status) {
248
-                geodir_update_postrating($post_id);
249
-            }
250
-        }
251
-    }
223
+				array($post_id, $post->post_type, $post->post_title, $user_ID, $comment, $rating_ip, $overall_rating, $status, $post_status, date_i18n('Y-m-d H:i:s', current_time('timestamp')), $post->post_city, $post->post_region, $post->post_country, $post->post_latitude, $post->post_longitude, $comment_info->comment_content)
224
+			);
225
+
226
+			$wpdb->query($sqlqry);
227
+
228
+			/**
229
+			 * Called after saving the comment.
230
+			 *
231
+			 * @since 1.0.0
232
+			 * @package GeoDirectory
233
+			 * @param array $_REQUEST {
234
+			 *    Attributes of the $_REQUEST variable.
235
+			 *
236
+			 *    @type string $geodir_overallrating Overall rating.
237
+			 *    @type string $comment Comment text.
238
+			 *    @type string $submit Submit button text.
239
+			 *    @type string $comment_post_ID Comment post ID.
240
+			 *    @type string $comment_parent Comment Parent ID.
241
+			 *    @type string $_wp_unfiltered_html_comment Unfiltered html comment string.
242
+			 *
243
+			 * }
244
+			 */
245
+			do_action('geodir_after_save_comment', $_REQUEST, 'Comment Your Post');
246
+
247
+			if ($status) {
248
+				geodir_update_postrating($post_id);
249
+			}
250
+		}
251
+	}
252 252
 }
253 253
 
254 254
 
@@ -266,51 +266,51 @@  discard block
 block discarded – undo
266 266
  */
267 267
 function geodir_update_rating_status_change($comment_id, $status)
268 268
 {
269
-    if ($status == 'delete') {
270
-        return;
271
-    }
272
-    global $wpdb, $plugin_prefix, $user_ID;
269
+	if ($status == 'delete') {
270
+		return;
271
+	}
272
+	global $wpdb, $plugin_prefix, $user_ID;
273 273
 
274
-    $comment_info = get_comment($comment_id);
274
+	$comment_info = get_comment($comment_id);
275 275
 
276
-    $post_id = isset($comment_info->comment_post_ID) ? $comment_info->comment_post_ID : '';
276
+	$post_id = isset($comment_info->comment_post_ID) ? $comment_info->comment_post_ID : '';
277 277
 
278
-    if (!empty($comment_info))
279
-        $status = $comment_info->comment_approved;
278
+	if (!empty($comment_info))
279
+		$status = $comment_info->comment_approved;
280 280
 
281
-    if ($status == 'approve' || $status == 1) {
282
-        $status = 1;
283
-    } else {
284
-        $status = 0;
285
-    }
281
+	if ($status == 'approve' || $status == 1) {
282
+		$status = 1;
283
+	} else {
284
+		$status = 0;
285
+	}
286 286
 
287
-    $comment_info_ID = isset($comment_info->comment_ID) ? $comment_info->comment_ID : '';
288
-    $old_rating = geodir_get_commentoverall($comment_info_ID);
287
+	$comment_info_ID = isset($comment_info->comment_ID) ? $comment_info->comment_ID : '';
288
+	$old_rating = geodir_get_commentoverall($comment_info_ID);
289 289
 
290
-    $post_type = get_post_type($post_id);
290
+	$post_type = get_post_type($post_id);
291 291
 
292
-    $detail_table = $plugin_prefix . $post_type . '_detail';
292
+	$detail_table = $plugin_prefix . $post_type . '_detail';
293 293
 
294
-    if ($comment_id) {
294
+	if ($comment_id) {
295 295
 
296
-        $overall_rating = $old_rating;
296
+		$overall_rating = $old_rating;
297 297
 
298
-        if (isset($old_rating)) {
298
+		if (isset($old_rating)) {
299 299
 
300
-            $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
300
+			$sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
301 301
 						overall_rating = %f,
302 302
 						status		= %s,
303 303
 						comment_content = %s 
304 304
 						WHERE comment_id = %d ", array($overall_rating, $status, $comment_info->comment_content, $comment_id));
305 305
 
306
-            $wpdb->query($sqlqry);
306
+			$wpdb->query($sqlqry);
307 307
 
308
-            //update rating
309
-            geodir_update_postrating($post_id, $post_type);
308
+			//update rating
309
+			geodir_update_postrating($post_id, $post_type);
310 310
 
311
-        }
311
+		}
312 312
 
313
-    }
313
+	}
314 314
 
315 315
 }
316 316
 
@@ -329,41 +329,41 @@  discard block
 block discarded – undo
329 329
 function geodir_update_rating($comment_id = 0)
330 330
 {
331 331
 
332
-    global $wpdb, $plugin_prefix, $user_ID;
332
+	global $wpdb, $plugin_prefix, $user_ID;
333 333
 
334
-    $comment_info = get_comment($comment_id);
334
+	$comment_info = get_comment($comment_id);
335 335
 
336
-    $post_id = $comment_info->comment_post_ID;
337
-    $status = $comment_info->comment_approved;
338
-    $old_rating = geodir_get_commentoverall($comment_info->comment_ID);
336
+	$post_id = $comment_info->comment_post_ID;
337
+	$status = $comment_info->comment_approved;
338
+	$old_rating = geodir_get_commentoverall($comment_info->comment_ID);
339 339
 
340
-    $post_type = get_post_type($post_id);
340
+	$post_type = get_post_type($post_id);
341 341
 
342
-    $detail_table = $plugin_prefix . $post_type . '_detail';
342
+	$detail_table = $plugin_prefix . $post_type . '_detail';
343 343
 
344
-    if (isset($_REQUEST['geodir_overallrating'])) {
344
+	if (isset($_REQUEST['geodir_overallrating'])) {
345 345
 
346
-        $overall_rating = $_REQUEST['geodir_overallrating'];
346
+		$overall_rating = $_REQUEST['geodir_overallrating'];
347 347
 
348
-        if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
349
-            $overall_rating = $overall_rating > 0 ? $overall_rating : '0';
348
+		if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
349
+			$overall_rating = $overall_rating > 0 ? $overall_rating : '0';
350 350
 
351
-            if (isset($old_rating)) {
351
+			if (isset($old_rating)) {
352 352
 
353
-                $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
353
+				$sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
354 354
 						overall_rating = %f,
355 355
 						status		= %s,
356 356
 						comment_content	= %s 
357 357
 						WHERE comment_id = %d ", array($overall_rating, $status, $comment_info->comment_content, $comment_id));
358 358
 
359
-                $wpdb->query($sqlqry);
359
+				$wpdb->query($sqlqry);
360 360
 
361
-                //update rating
362
-                geodir_update_postrating($post_id, $post_type);
361
+				//update rating
362
+				geodir_update_postrating($post_id, $post_type);
363 363
 
364
-            }
365
-        }
366
-    }
364
+			}
365
+		}
366
+	}
367 367
 
368 368
 
369 369
 }
@@ -379,19 +379,19 @@  discard block
 block discarded – undo
379 379
  */
380 380
 function geodir_comment_delete_comment($comment_id)
381 381
 {
382
-    global $wpdb;
382
+	global $wpdb;
383 383
 
384
-    $review_info = geodir_get_review($comment_id);
385
-    if ($review_info) {
386
-        geodir_update_postrating($review_info->post_id);
387
-    }
384
+	$review_info = geodir_get_review($comment_id);
385
+	if ($review_info) {
386
+		geodir_update_postrating($review_info->post_id);
387
+	}
388 388
 
389
-    $wpdb->query(
390
-        $wpdb->prepare(
391
-            "DELETE FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d",
392
-            array($comment_id)
393
-        )
394
-    );
389
+	$wpdb->query(
390
+		$wpdb->prepare(
391
+			"DELETE FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d",
392
+			array($comment_id)
393
+		)
394
+	);
395 395
 
396 396
 }
397 397
 
@@ -407,21 +407,21 @@  discard block
 block discarded – undo
407 407
  * @return string The comment content.
408 408
  */
409 409
 function geodir_wrap_comment_text($content, $comment = '') {
410
-    if (!empty($comment->comment_post_ID) && geodir_cpt_has_rating_disabled((int)$comment->comment_post_ID)) {
411
-        if (!is_admin()) {
412
-            return '<div class="description">' . $content . '</div>';
413
-        } else {
414
-            return $content;
415
-        }
416
-    } else {
417
-        $rating = 0;
418
-        if (!empty($comment))
419
-            $rating = geodir_get_commentoverall($comment->comment_ID);
420
-        if ($rating != 0 && !is_admin()) {
421
-            return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>';
422
-        } else
423
-            return $content;
424
-    }
410
+	if (!empty($comment->comment_post_ID) && geodir_cpt_has_rating_disabled((int)$comment->comment_post_ID)) {
411
+		if (!is_admin()) {
412
+			return '<div class="description">' . $content . '</div>';
413
+		} else {
414
+			return $content;
415
+		}
416
+	} else {
417
+		$rating = 0;
418
+		if (!empty($comment))
419
+			$rating = geodir_get_commentoverall($comment->comment_ID);
420
+		if ($rating != 0 && !is_admin()) {
421
+			return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>';
422
+		} else
423
+			return $content;
424
+	}
425 425
 }
426 426
 
427 427
 
@@ -438,41 +438,41 @@  discard block
 block discarded – undo
438 438
  */
439 439
 function geodir_update_postrating($post_id = 0, $post_type = '', $delete = false)
440 440
 {
441
-    global $wpdb, $plugin_prefix, $comment;
442
-    if (!$post_type) {
443
-        $post_type = get_post_type($post_id);
444
-    }
445
-    $detail_table = $plugin_prefix . $post_type . '_detail';
446
-    $post_newrating = geodir_get_post_rating($post_id, 1);
447
-    $post_newrating_count = geodir_get_review_count_total($post_id);
441
+	global $wpdb, $plugin_prefix, $comment;
442
+	if (!$post_type) {
443
+		$post_type = get_post_type($post_id);
444
+	}
445
+	$detail_table = $plugin_prefix . $post_type . '_detail';
446
+	$post_newrating = geodir_get_post_rating($post_id, 1);
447
+	$post_newrating_count = geodir_get_review_count_total($post_id);
448 448
 
449 449
 
450
-    //$post_newrating = ( (float)$post_oldrating - (float)$old_rating ) + (float)$overall_rating ;
450
+	//$post_newrating = ( (float)$post_oldrating - (float)$old_rating ) + (float)$overall_rating ;
451 451
 
452
-    if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
452
+	if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
453 453
 
454
-        $wpdb->query(
455
-            $wpdb->prepare(
456
-                "UPDATE " . $detail_table . " SET
454
+		$wpdb->query(
455
+			$wpdb->prepare(
456
+				"UPDATE " . $detail_table . " SET
457 457
 						overall_rating = %f,
458 458
 						rating_count = %f
459 459
 						where post_id = %d",
460
-                array($post_newrating, $post_newrating_count, $post_id)
461
-            )
462
-        );
463
-
464
-        update_post_meta($post_id, 'overall_rating', $post_newrating);
465
-        update_post_meta($post_id, 'rating_count', $post_newrating_count);
466
-    }
467
-    /**
468
-     * Called after Updating post overall rating and rating count.
469
-     *
470
-     * @since 1.0.0
471
-     * @since 1.4.3 Added `$post_id` param.
472
-     * @package GeoDirectory
473
-     * @param int $post_id The post ID.
474
-     */
475
-    do_action('geodir_update_postrating',$post_id);
460
+				array($post_newrating, $post_newrating_count, $post_id)
461
+			)
462
+		);
463
+
464
+		update_post_meta($post_id, 'overall_rating', $post_newrating);
465
+		update_post_meta($post_id, 'rating_count', $post_newrating_count);
466
+	}
467
+	/**
468
+	 * Called after Updating post overall rating and rating count.
469
+	 *
470
+	 * @since 1.0.0
471
+	 * @since 1.4.3 Added `$post_id` param.
472
+	 * @package GeoDirectory
473
+	 * @param int $post_id The post ID.
474
+	 */
475
+	do_action('geodir_update_postrating',$post_id);
476 476
 
477 477
 }
478 478
 
@@ -490,29 +490,29 @@  discard block
 block discarded – undo
490 490
  */
491 491
 function geodir_get_postoverall($post_id = 0)
492 492
 {
493
-    global $wpdb, $plugin_prefix;
493
+	global $wpdb, $plugin_prefix;
494 494
 
495
-    $post_type = get_post_type($post_id);
496
-    $detail_table = $plugin_prefix . $post_type . '_detail';
495
+	$post_type = get_post_type($post_id);
496
+	$detail_table = $plugin_prefix . $post_type . '_detail';
497 497
 
498
-    if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
498
+	if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
499 499
 
500
-        $post_ratings = $wpdb->get_var(
501
-            $wpdb->prepare(
502
-                "SELECT overall_rating FROM " . $detail_table . " WHERE post_id = %d",
503
-                array($post_id)
504
-            )
505
-        );
500
+		$post_ratings = $wpdb->get_var(
501
+			$wpdb->prepare(
502
+				"SELECT overall_rating FROM " . $detail_table . " WHERE post_id = %d",
503
+				array($post_id)
504
+			)
505
+		);
506 506
 
507 507
 
508
-    } else {
509
-        $post_ratings = get_post_meta($post_id, 'overall_rating');
510
-    }
508
+	} else {
509
+		$post_ratings = get_post_meta($post_id, 'overall_rating');
510
+	}
511 511
 
512
-    if ($post_ratings)
513
-        return $post_ratings;
514
-    else
515
-        return false;
512
+	if ($post_ratings)
513
+		return $post_ratings;
514
+	else
515
+		return false;
516 516
 }
517 517
 
518 518
 
@@ -529,19 +529,19 @@  discard block
 block discarded – undo
529 529
  */
530 530
 function geodir_get_review($comment_id = 0)
531 531
 {
532
-    global $wpdb;
533
-
534
-    $reatings = $wpdb->get_row(
535
-        $wpdb->prepare(
536
-            "SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
537
-            array($comment_id)
538
-        )
539
-    );
540
-
541
-    if (!empty($reatings))
542
-        return $reatings;
543
-    else
544
-        return false;
532
+	global $wpdb;
533
+
534
+	$reatings = $wpdb->get_row(
535
+		$wpdb->prepare(
536
+			"SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
537
+			array($comment_id)
538
+		)
539
+	);
540
+
541
+	if (!empty($reatings))
542
+		return $reatings;
543
+	else
544
+		return false;
545 545
 }
546 546
 
547 547
 /**
@@ -557,19 +557,19 @@  discard block
 block discarded – undo
557 557
  */
558 558
 function geodir_get_review_total($post_id = 0)
559 559
 {
560
-    global $wpdb;
561
-
562
-    $results = $wpdb->get_var(
563
-        $wpdb->prepare(
564
-            "SELECT SUM(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
565
-            array($post_id)
566
-        )
567
-    );
568
-
569
-    if (!empty($results))
570
-        return $results;
571
-    else
572
-        return false;
560
+	global $wpdb;
561
+
562
+	$results = $wpdb->get_var(
563
+		$wpdb->prepare(
564
+			"SELECT SUM(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
565
+			array($post_id)
566
+		)
567
+	);
568
+
569
+	if (!empty($results))
570
+		return $results;
571
+	else
572
+		return false;
573 573
 }
574 574
 
575 575
 /**
@@ -585,18 +585,18 @@  discard block
 block discarded – undo
585 585
  */
586 586
 function geodir_get_review_count_by_user_id($user_id = 0)
587 587
 {
588
-    global $wpdb;
589
-    $results = $wpdb->get_var(
590
-        $wpdb->prepare(
591
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d AND status=1 AND overall_rating>0",
592
-            array($user_id)
593
-        )
594
-    );
595
-
596
-    if (!empty($results))
597
-        return $results;
598
-    else
599
-        return false;
588
+	global $wpdb;
589
+	$results = $wpdb->get_var(
590
+		$wpdb->prepare(
591
+			"SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d AND status=1 AND overall_rating>0",
592
+			array($user_id)
593
+		)
594
+	);
595
+
596
+	if (!empty($results))
597
+		return $results;
598
+	else
599
+		return false;
600 600
 }
601 601
 
602 602
 /**
@@ -614,27 +614,27 @@  discard block
 block discarded – undo
614 614
  */
615 615
 function geodir_get_post_rating($post_id = 0, $force_query = 0)
616 616
 {
617
-    global $wpdb, $post;
618
-
619
-    if (isset($post->ID) && $post->ID == $post_id && !$force_query) {
620
-        if (isset($post->rating_count) && $post->rating_count > 0 && isset($post->overall_rating) && $post->overall_rating > 0) {
621
-            return $post->overall_rating;
622
-        } else {
623
-            return 0;
624
-        }
625
-    }
626
-
627
-    $results = $wpdb->get_var(
628
-        $wpdb->prepare(
629
-            "SELECT COALESCE(avg(overall_rating),0) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
630
-            array($post_id)
631
-        )
632
-    );
633
-
634
-    if (!empty($results))
635
-        return $results;
636
-    else
637
-        return false;
617
+	global $wpdb, $post;
618
+
619
+	if (isset($post->ID) && $post->ID == $post_id && !$force_query) {
620
+		if (isset($post->rating_count) && $post->rating_count > 0 && isset($post->overall_rating) && $post->overall_rating > 0) {
621
+			return $post->overall_rating;
622
+		} else {
623
+			return 0;
624
+		}
625
+	}
626
+
627
+	$results = $wpdb->get_var(
628
+		$wpdb->prepare(
629
+			"SELECT COALESCE(avg(overall_rating),0) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
630
+			array($post_id)
631
+		)
632
+	);
633
+
634
+	if (!empty($results))
635
+		return $results;
636
+	else
637
+		return false;
638 638
 }
639 639
 
640 640
 /**
@@ -650,19 +650,19 @@  discard block
 block discarded – undo
650 650
  */
651 651
 function geodir_get_review_count_total($post_id = 0)
652 652
 {
653
-    global $wpdb;
654
-
655
-    $results = $wpdb->get_var(
656
-        $wpdb->prepare(
657
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
658
-            array($post_id)
659
-        )
660
-    );
661
-
662
-    if (!empty($results))
663
-        return $results;
664
-    else
665
-        return false;
653
+	global $wpdb;
654
+
655
+	$results = $wpdb->get_var(
656
+		$wpdb->prepare(
657
+			"SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
658
+			array($post_id)
659
+		)
660
+	);
661
+
662
+	if (!empty($results))
663
+		return $results;
664
+	else
665
+		return false;
666 666
 }
667 667
 
668 668
 /**
@@ -679,20 +679,20 @@  discard block
 block discarded – undo
679 679
  */
680 680
 function geodir_get_comments_number($post_id = 0)
681 681
 {
682
-    global $wpdb;
682
+	global $wpdb;
683 683
 
684
-    $results = $wpdb->get_var(
685
-        $wpdb->prepare(
686
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
687
-            array($post_id)
688
-        )
689
-    );
684
+	$results = $wpdb->get_var(
685
+		$wpdb->prepare(
686
+			"SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
687
+			array($post_id)
688
+		)
689
+	);
690 690
 
691 691
 
692
-    if (!empty($results))
693
-        return $results;
694
-    else
695
-        return false;
692
+	if (!empty($results))
693
+		return $results;
694
+	else
695
+		return false;
696 696
 }
697 697
 
698 698
 /**
@@ -708,19 +708,19 @@  discard block
 block discarded – undo
708 708
  */
709 709
 function geodir_get_commentoverall($comment_id = 0)
710 710
 {
711
-    global $wpdb;
712
-
713
-    $reatings = $wpdb->get_var(
714
-        $wpdb->prepare(
715
-            "SELECT overall_rating FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
716
-            array($comment_id)
717
-        )
718
-    );
719
-
720
-    if ($reatings)
721
-        return $reatings;
722
-    else
723
-        return false;
711
+	global $wpdb;
712
+
713
+	$reatings = $wpdb->get_var(
714
+		$wpdb->prepare(
715
+			"SELECT overall_rating FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
716
+			array($comment_id)
717
+		)
718
+	);
719
+
720
+	if ($reatings)
721
+		return $reatings;
722
+	else
723
+		return false;
724 724
 }
725 725
 
726 726
 /**
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
  */
735 735
 function geodir_get_commentoverall_number($post_id = 0)
736 736
 {
737
-    return geodir_get_post_rating($post_id);
737
+	return geodir_get_post_rating($post_id);
738 738
 }
739 739
 
740 740
 
@@ -752,102 +752,102 @@  discard block
 block discarded – undo
752 752
  */
753 753
 function geodir_comment_template($comment_template)
754 754
 {
755
-    global $post;
755
+	global $post;
756 756
 
757
-    $post_types = geodir_get_posttypes();
757
+	$post_types = geodir_get_posttypes();
758 758
 
759
-    if (!(is_singular() && (have_comments() || (isset($post->comment_status) && 'open' == $post->comment_status)))) {
760
-        return;
761
-    }
762
-    if (in_array($post->post_type, $post_types)) { // assuming there is a post type called business
763
-        if (geodir_cpt_has_rating_disabled($post->post_type)) {
764
-            return $comment_template;
765
-        }
759
+	if (!(is_singular() && (have_comments() || (isset($post->comment_status) && 'open' == $post->comment_status)))) {
760
+		return;
761
+	}
762
+	if (in_array($post->post_type, $post_types)) { // assuming there is a post type called business
763
+		if (geodir_cpt_has_rating_disabled($post->post_type)) {
764
+			return $comment_template;
765
+		}
766 766
         
767
-        $template = locate_template(array("geodirectory/reviews.php")); // Use theme template if available
768
-        if (!$template) {
769
-            $template = dirname(__FILE__) . '/reviews.php';
770
-        }
771
-        return $template;
772
-    }
767
+		$template = locate_template(array("geodirectory/reviews.php")); // Use theme template if available
768
+		if (!$template) {
769
+			$template = dirname(__FILE__) . '/reviews.php';
770
+		}
771
+		return $template;
772
+	}
773 773
 }
774 774
 
775 775
 add_filter("comments_template", "geodir_comment_template");
776 776
 
777 777
 
778 778
 if (!function_exists('geodir_comment')) {
779
-    /**
780
-     * Comment HTML markup.
781
-     *
782
-     * @since 1.0.0
783
-     * @package GeoDirectory
784
-     * @global object $post The current post object.
785
-     * @param object $comment The comment object.
786
-     * @param string|array $args {
787
-     *     Optional. Formatting options.
788
-     *
789
-     *     @type object $walker            Instance of a Walker class to list comments. Default null.
790
-     *     @type int    $max_depth         The maximum comments depth. Default empty.
791
-     *     @type string $style             The style of list ordering. Default 'ul'. Accepts 'ul', 'ol'.
792
-     *     @type string $callback          Callback function to use. Default null.
793
-     *     @type string $end-callback      Callback function to use at the end. Default null.
794
-     *     @type string $type              Type of comments to list.
795
-     *                                     Default 'all'. Accepts 'all', 'comment', 'pingback', 'trackback', 'pings'.
796
-     *     @type int    $page              Page ID to list comments for. Default empty.
797
-     *     @type int    $per_page          Number of comments to list per page. Default empty.
798
-     *     @type int    $avatar_size       Height and width dimensions of the avatar size. Default 32.
799
-     *     @type string $reverse_top_level Ordering of the listed comments. Default null. Accepts 'desc', 'asc'.
800
-     *     @type bool   $reverse_children  Whether to reverse child comments in the list. Default null.
801
-     *     @type string $format            How to format the comments list.
802
-     *                                     Default 'html5' if the theme supports it. Accepts 'html5', 'xhtml'.
803
-     *     @type bool   $short_ping        Whether to output short pings. Default false.
804
-     *     @type bool   $echo              Whether to echo the output or return it. Default true.
805
-     * }
806
-     * @param int $depth Depth of comment.
807
-     */
808
-    function geodir_comment($comment, $args, $depth)
809
-    {
810
-        $GLOBALS['comment'] = $comment;
811
-        switch ($comment->comment_type) :
812
-            case 'pingback' :
813
-            case 'trackback' :
814
-                // Display trackbacks differently than normal comments.
815
-                ?>
779
+	/**
780
+	 * Comment HTML markup.
781
+	 *
782
+	 * @since 1.0.0
783
+	 * @package GeoDirectory
784
+	 * @global object $post The current post object.
785
+	 * @param object $comment The comment object.
786
+	 * @param string|array $args {
787
+	 *     Optional. Formatting options.
788
+	 *
789
+	 *     @type object $walker            Instance of a Walker class to list comments. Default null.
790
+	 *     @type int    $max_depth         The maximum comments depth. Default empty.
791
+	 *     @type string $style             The style of list ordering. Default 'ul'. Accepts 'ul', 'ol'.
792
+	 *     @type string $callback          Callback function to use. Default null.
793
+	 *     @type string $end-callback      Callback function to use at the end. Default null.
794
+	 *     @type string $type              Type of comments to list.
795
+	 *                                     Default 'all'. Accepts 'all', 'comment', 'pingback', 'trackback', 'pings'.
796
+	 *     @type int    $page              Page ID to list comments for. Default empty.
797
+	 *     @type int    $per_page          Number of comments to list per page. Default empty.
798
+	 *     @type int    $avatar_size       Height and width dimensions of the avatar size. Default 32.
799
+	 *     @type string $reverse_top_level Ordering of the listed comments. Default null. Accepts 'desc', 'asc'.
800
+	 *     @type bool   $reverse_children  Whether to reverse child comments in the list. Default null.
801
+	 *     @type string $format            How to format the comments list.
802
+	 *                                     Default 'html5' if the theme supports it. Accepts 'html5', 'xhtml'.
803
+	 *     @type bool   $short_ping        Whether to output short pings. Default false.
804
+	 *     @type bool   $echo              Whether to echo the output or return it. Default true.
805
+	 * }
806
+	 * @param int $depth Depth of comment.
807
+	 */
808
+	function geodir_comment($comment, $args, $depth)
809
+	{
810
+		$GLOBALS['comment'] = $comment;
811
+		switch ($comment->comment_type) :
812
+			case 'pingback' :
813
+			case 'trackback' :
814
+				// Display trackbacks differently than normal comments.
815
+				?>
816 816
                 <li <?php comment_class('geodir-comment'); ?> id="comment-<?php comment_ID(); ?>">
817 817
                 <p><?php _e('Pingback:', 'geodirectory'); ?> <?php comment_author_link(); ?> <?php edit_comment_link(__('(Edit)', 'geodirectory'), '<span class="edit-link">', '</span>'); ?></p>
818 818
                 <?php
819
-                break;
820
-            default :
821
-                // Proceed with normal comments.
822
-                global $post;
823
-                ?>
819
+				break;
820
+			default :
821
+				// Proceed with normal comments.
822
+				global $post;
823
+				?>
824 824
             <li <?php comment_class('geodir-comment'); ?> id="li-comment-<?php comment_ID(); ?>">
825 825
                 <article id="comment-<?php comment_ID(); ?>" class="comment">
826 826
                     <header class="comment-meta comment-author vcard">
827 827
                         <?php
828
-                        /**
829
-                         * Filter to modify comment avatar size
830
-                         *
831
-                         * You can use this filter to change comment avatar size.
832
-                         *
833
-                         * @since 1.0.0
834
-                         * @package GeoDirectory
835
-                         */
836
-                        $avatar_size = apply_filters('geodir_comment_avatar_size', 44);
837
-                        echo get_avatar($comment, $avatar_size);
838
-                        printf('<cite><b class="reviewer">%1$s</b> %2$s</cite>',
839
-                            get_comment_author_link(),
840
-                            // If current post author is also comment author, make it known visually.
841
-                            ($comment->user_id === $post->post_author) ? '<span>' . __('Post author', 'geodirectory') . '</span>' : ''
842
-                        );
843
-                        echo "<span class='item'><small><span class='fn'>$post->post_title</span></small></span>";
844
-                        printf('<a href="%1$s"><time datetime="%2$s" class="dtreviewed">%3$s<span class="value-title" title="%2$s"></span></time></a>',
845
-                            esc_url(get_comment_link($comment->comment_ID)),
846
-                            get_comment_time('c'),
847
-                            /* translators: 1: date, 2: time */
848
-                            sprintf(__('%1$s at %2$s', 'geodirectory'), get_comment_date(), get_comment_time())
849
-                        );
850
-                        ?>
828
+						/**
829
+						 * Filter to modify comment avatar size
830
+						 *
831
+						 * You can use this filter to change comment avatar size.
832
+						 *
833
+						 * @since 1.0.0
834
+						 * @package GeoDirectory
835
+						 */
836
+						$avatar_size = apply_filters('geodir_comment_avatar_size', 44);
837
+						echo get_avatar($comment, $avatar_size);
838
+						printf('<cite><b class="reviewer">%1$s</b> %2$s</cite>',
839
+							get_comment_author_link(),
840
+							// If current post author is also comment author, make it known visually.
841
+							($comment->user_id === $post->post_author) ? '<span>' . __('Post author', 'geodirectory') . '</span>' : ''
842
+						);
843
+						echo "<span class='item'><small><span class='fn'>$post->post_title</span></small></span>";
844
+						printf('<a href="%1$s"><time datetime="%2$s" class="dtreviewed">%3$s<span class="value-title" title="%2$s"></span></time></a>',
845
+							esc_url(get_comment_link($comment->comment_ID)),
846
+							get_comment_time('c'),
847
+							/* translators: 1: date, 2: time */
848
+							sprintf(__('%1$s at %2$s', 'geodirectory'), get_comment_date(), get_comment_time())
849
+						);
850
+						?>
851 851
                     </header>
852 852
                     <!-- .comment-meta -->
853 853
 
@@ -871,47 +871,47 @@  discard block
 block discarded – undo
871 871
                 </article>
872 872
                 <!-- #comment-## -->
873 873
                 <?php
874
-                break;
875
-        endswitch; // end comment_type check
876
-    }
874
+				break;
875
+		endswitch; // end comment_type check
876
+	}
877 877
 }
878 878
 
879 879
 
880 880
 add_filter('get_comments_number', 'geodir_fix_comment_count', 10, 2);
881 881
 if (!function_exists('geodir_fix_comment_count')) {
882
-    /**
883
-     * Fix comment count by not listing replies as reviews
884
-     *
885
-     * @since 1.0.0
886
-     * @package GeoDirectory
887
-     * @global object $post The current post object.
888
-     * @param int $count The comment count.
889
-     * @param int $post_id The post ID.
890
-     * @todo $post is unreachable since the function return the count before that variable.
891
-     * @return bool|null|string The comment count.
892
-     */
893
-    function geodir_fix_comment_count($count, $post_id)
894
-    {
895
-        if (!is_admin() || strpos($_SERVER['REQUEST_URI'], 'admin-ajax.php')) {
896
-            global $post;
897
-            $post_types = geodir_get_posttypes();
898
-
899
-            if (in_array(get_post_type($post_id), $post_types) && !geodir_cpt_has_rating_disabled((int)$post_id)) {
900
-                $review_count = geodir_get_review_count_total($post_id);
901
-                return $review_count;
902
-
903
-                if ($post && isset($post->rating_count)) {
904
-                    return $post->rating_count;
905
-                } else {
906
-                    return geodir_get_comments_number($post_id);
907
-                }
908
-            } else {
909
-                return $count;
910
-            }
911
-        } else {
912
-            return $count;
913
-        }
914
-    }
882
+	/**
883
+	 * Fix comment count by not listing replies as reviews
884
+	 *
885
+	 * @since 1.0.0
886
+	 * @package GeoDirectory
887
+	 * @global object $post The current post object.
888
+	 * @param int $count The comment count.
889
+	 * @param int $post_id The post ID.
890
+	 * @todo $post is unreachable since the function return the count before that variable.
891
+	 * @return bool|null|string The comment count.
892
+	 */
893
+	function geodir_fix_comment_count($count, $post_id)
894
+	{
895
+		if (!is_admin() || strpos($_SERVER['REQUEST_URI'], 'admin-ajax.php')) {
896
+			global $post;
897
+			$post_types = geodir_get_posttypes();
898
+
899
+			if (in_array(get_post_type($post_id), $post_types) && !geodir_cpt_has_rating_disabled((int)$post_id)) {
900
+				$review_count = geodir_get_review_count_total($post_id);
901
+				return $review_count;
902
+
903
+				if ($post && isset($post->rating_count)) {
904
+					return $post->rating_count;
905
+				} else {
906
+					return geodir_get_comments_number($post_id);
907
+				}
908
+			} else {
909
+				return $count;
910
+			}
911
+		} else {
912
+			return $count;
913
+		}
914
+	}
915 915
 }
916 916
 
917 917
 /**
@@ -929,14 +929,14 @@  discard block
 block discarded – undo
929 929
  */
930 930
 function geodir_get_rating_stars($rating, $post_id, $small = false)
931 931
 {
932
-    if (!empty($post_id) && geodir_cpt_has_rating_disabled((int)$post_id)) {
933
-        return NULL;
934
-    }
935
-    $a_rating = $rating / 5 * 100;
936
-
937
-    if ($small) {
938
-        $r_html = '<div class="rating"><div class="gd_rating_map" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star_small"></div></div></div>';
939
-    } else {
932
+	if (!empty($post_id) && geodir_cpt_has_rating_disabled((int)$post_id)) {
933
+		return NULL;
934
+	}
935
+	$a_rating = $rating / 5 * 100;
936
+
937
+	if ($small) {
938
+		$r_html = '<div class="rating"><div class="gd_rating_map" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star_small"></div></div></div>';
939
+	} else {
940 940
 		if (function_exists('geodir_reviewrating_draw_overall_rating')) {
941 941
 			// Show rating stars from review rating manager
942 942
 			$r_html = geodir_reviewrating_draw_overall_rating($rating);
@@ -953,8 +953,8 @@  discard block
 block discarded – undo
953 953
 			}
954 954
 			$r_html = '<div class="geodir-rating" style="' . $attach_style . '"><div class="gd_rating_show" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingAverage" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star">' . $rating_img . $rating_img . $rating_img . $rating_img . $rating_img . '</div></div></div>';
955 955
 		}
956
-    }
957
-    return apply_filters('geodir_get_rating_stars_html', $r_html, $rating, 5);
956
+	}
957
+	return apply_filters('geodir_get_rating_stars_html', $r_html, $rating, 5);
958 958
 }
959 959
 
960 960
 /**
@@ -968,23 +968,23 @@  discard block
 block discarded – undo
968 968
 function geodir_is_reviews_show($pageview = '')
969 969
 {
970 970
 
971
-    $active_tabs = get_option('geodir_detail_page_tabs_excluded');
972
-
973
-    $is_display = true;
974
-    if (!empty($active_tabs) && in_array('reviews', $active_tabs))
975
-        $is_display = false;
976
-
977
-    /**
978
-     * Filter to change display value.
979
-     *
980
-     * You can use this filter to change the is_display value.
981
-     *
982
-     * @since 1.0.0
983
-     * @package GeoDirectory
984
-     * @param bool $is_display Display ratings when set to true.
985
-     * @param string $pageview The view template. Ex: listview, gridview etc.
986
-     */
987
-    return apply_filters('geodir_is_reviews_show', $is_display, $pageview);
971
+	$active_tabs = get_option('geodir_detail_page_tabs_excluded');
972
+
973
+	$is_display = true;
974
+	if (!empty($active_tabs) && in_array('reviews', $active_tabs))
975
+		$is_display = false;
976
+
977
+	/**
978
+	 * Filter to change display value.
979
+	 *
980
+	 * You can use this filter to change the is_display value.
981
+	 *
982
+	 * @since 1.0.0
983
+	 * @package GeoDirectory
984
+	 * @param bool $is_display Display ratings when set to true.
985
+	 * @param string $pageview The view template. Ex: listview, gridview etc.
986
+	 */
987
+	return apply_filters('geodir_is_reviews_show', $is_display, $pageview);
988 988
 }
989 989
 
990 990
 
@@ -992,9 +992,9 @@  discard block
 block discarded – undo
992 992
  * If Disqus plugin is active, do some fixes to show on blogs but no on GD post types
993 993
  */
994 994
 if(function_exists('dsq_can_replace')) {
995
-    remove_filter('comments_template', 'dsq_comments_template');
996
-    add_filter('comments_template', 'dsq_comments_template', 100);
997
-    add_filter('pre_option_disqus_active', 'geodir_option_disqus_active',10,1);
995
+	remove_filter('comments_template', 'dsq_comments_template');
996
+	add_filter('comments_template', 'dsq_comments_template', 100);
997
+	add_filter('pre_option_disqus_active', 'geodir_option_disqus_active',10,1);
998 998
 }
999 999
 
1000 1000
 
@@ -1008,14 +1008,14 @@  discard block
 block discarded – undo
1008 1008
  * @return string `1` if active `0` if disabled.
1009 1009
  */
1010 1010
 function geodir_option_disqus_active($disqus_active){
1011
-    global $post;
1012
-    $all_postypes = geodir_get_posttypes();
1011
+	global $post;
1012
+	$all_postypes = geodir_get_posttypes();
1013 1013
 
1014
-    if(isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type,$all_postypes)){
1015
-        $disqus_active = '0';
1016
-    }
1014
+	if(isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type,$all_postypes)){
1015
+		$disqus_active = '0';
1016
+	}
1017 1017
 
1018
-    return $disqus_active;
1018
+	return $disqus_active;
1019 1019
 }
1020 1020
 
1021 1021
 /**
@@ -1029,22 +1029,22 @@  discard block
 block discarded – undo
1029 1029
  * @return array Modified tabs array.
1030 1030
  */
1031 1031
 function geodir_detail_reviews_tab_title($tabs_arr) {
1032
-    $post_type = geodir_get_current_posttype();
1032
+	$post_type = geodir_get_current_posttype();
1033 1033
 
1034
-    if (!empty($tabs_arr) && !empty($tabs_arr['reviews']) && isset($tabs_arr['reviews']['heading_text']) && $post_type != '' && geodir_cpt_has_rating_disabled($post_type)) {
1035
-        $label_reviews = __('Comments', 'geodirectory');
1034
+	if (!empty($tabs_arr) && !empty($tabs_arr['reviews']) && isset($tabs_arr['reviews']['heading_text']) && $post_type != '' && geodir_cpt_has_rating_disabled($post_type)) {
1035
+		$label_reviews = __('Comments', 'geodirectory');
1036 1036
         
1037
-        if (defined('GEODIR_CP_VERSION')) {
1038
-            $post_types = geodir_get_posttypes('array');
1037
+		if (defined('GEODIR_CP_VERSION')) {
1038
+			$post_types = geodir_get_posttypes('array');
1039 1039
             
1040
-            if (!empty($post_types[$post_type]['labels']['label_reviews'])) {
1041
-                $label_reviews = stripslashes(__($post_types[$post_type]['labels']['label_reviews'], 'geodirectory'));
1042
-            }
1043
-        }
1040
+			if (!empty($post_types[$post_type]['labels']['label_reviews'])) {
1041
+				$label_reviews = stripslashes(__($post_types[$post_type]['labels']['label_reviews'], 'geodirectory'));
1042
+			}
1043
+		}
1044 1044
         
1045
-        $tabs_arr['reviews']['heading_text'] = $label_reviews;
1046
-    }
1045
+		$tabs_arr['reviews']['heading_text'] = $label_reviews;
1046
+	}
1047 1047
     
1048
-    return $tabs_arr;
1048
+	return $tabs_arr;
1049 1049
 }
1050 1050
 add_filter('geodir_detail_page_tab_list_extend', 'geodir_detail_reviews_tab_title', 1000, 1);
1051 1051
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function geodir_comment_rating_meta($comment) {
69 69
     $post_type = get_post_type($comment->comment_post_ID);
70
-	if (in_array($post_type, (array)geodir_get_posttypes()) && (int)$comment->comment_parent == 0 && !(!empty($post_type) && geodir_cpt_has_rating_disabled($post_type))) {
70
+	if (in_array($post_type, (array) geodir_get_posttypes()) && (int) $comment->comment_parent == 0 && !(!empty($post_type) && geodir_cpt_has_rating_disabled($post_type))) {
71 71
 		$rating = geodir_get_commentoverall($comment->comment_ID);
72 72
 		
73
-		if ((int)get_option('geodir_reviewrating_enable_font_awesome') == 1) {
73
+		if ((int) get_option('geodir_reviewrating_enable_font_awesome') == 1) {
74 74
 			$star_texts = array();
75 75
 			$star_texts[] = __('Terrible', 'geodirectory');
76 76
 			$star_texts[] = __('Poor', 'geodirectory');
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
 			echo geodir_font_awesome_rating_form_html('', $star_texts, $rating);
82 82
 		} else {			
83 83
 			if ($rating) {
84
-				echo '<div class="gd_rating" data-average="' . $rating . '" data-id="5">';
84
+				echo '<div class="gd_rating" data-average="'.$rating.'" data-id="5">';
85 85
 
86 86
 			} else {
87 87
 				echo '<div class="gd_rating" data-average="0" data-id="5"></div>';
88 88
 			}
89 89
 		}
90
-		echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="' . $rating . '"  />';
90
+		echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="'.$rating.'"  />';
91 91
 	}
92 92
 }
93 93
 
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
 {
141 141
 
142 142
     if (strpos($link, 'wp-login.php?') !== false) {
143
-        $link = str_replace(wp_login_url(),geodir_login_url(),$link);
143
+        $link = str_replace(wp_login_url(), geodir_login_url(), $link);
144 144
     }
145
-    $link = '<div class="gd_comment_replaylink">' . $link . '</div>';
145
+    $link = '<div class="gd_comment_replaylink">'.$link.'</div>';
146 146
 
147 147
     return $link;
148 148
 }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 function geodir_cancle_replaylink($link)
160 160
 {
161 161
 
162
-    $link = '<span class="gd-cancel-replaylink">' . $link . '</span>';
162
+    $link = '<span class="gd-cancel-replaylink">'.$link.'</span>';
163 163
 
164 164
     return $link;
165 165
 }
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
     if (isset($_REQUEST['geodir_overallrating'])) {
200 200
         $overall_rating = $_REQUEST['geodir_overallrating'];
201 201
         
202
-		if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
202
+		if (isset($comment_info->comment_parent) && (int) $comment_info->comment_parent == 0) {
203 203
             $overall_rating = $overall_rating > 0 ? $overall_rating : '0';
204 204
 
205
-            $sqlqry = $wpdb->prepare("INSERT INTO " . GEODIR_REVIEW_TABLE . " SET
205
+            $sqlqry = $wpdb->prepare("INSERT INTO ".GEODIR_REVIEW_TABLE." SET
206 206
 					post_id		= %d,
207 207
 					post_type = %s,
208 208
 					post_title	= %s,
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 
290 290
     $post_type = get_post_type($post_id);
291 291
 
292
-    $detail_table = $plugin_prefix . $post_type . '_detail';
292
+    $detail_table = $plugin_prefix.$post_type.'_detail';
293 293
 
294 294
     if ($comment_id) {
295 295
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 
298 298
         if (isset($old_rating)) {
299 299
 
300
-            $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
300
+            $sqlqry = $wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." SET
301 301
 						overall_rating = %f,
302 302
 						status		= %s,
303 303
 						comment_content = %s 
@@ -339,18 +339,18 @@  discard block
 block discarded – undo
339 339
 
340 340
     $post_type = get_post_type($post_id);
341 341
 
342
-    $detail_table = $plugin_prefix . $post_type . '_detail';
342
+    $detail_table = $plugin_prefix.$post_type.'_detail';
343 343
 
344 344
     if (isset($_REQUEST['geodir_overallrating'])) {
345 345
 
346 346
         $overall_rating = $_REQUEST['geodir_overallrating'];
347 347
 
348
-        if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
348
+        if (isset($comment_info->comment_parent) && (int) $comment_info->comment_parent == 0) {
349 349
             $overall_rating = $overall_rating > 0 ? $overall_rating : '0';
350 350
 
351 351
             if (isset($old_rating)) {
352 352
 
353
-                $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
353
+                $sqlqry = $wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." SET
354 354
 						overall_rating = %f,
355 355
 						status		= %s,
356 356
 						comment_content	= %s 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 
389 389
     $wpdb->query(
390 390
         $wpdb->prepare(
391
-            "DELETE FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d",
391
+            "DELETE FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d",
392 392
             array($comment_id)
393 393
         )
394 394
     );
@@ -407,9 +407,9 @@  discard block
 block discarded – undo
407 407
  * @return string The comment content.
408 408
  */
409 409
 function geodir_wrap_comment_text($content, $comment = '') {
410
-    if (!empty($comment->comment_post_ID) && geodir_cpt_has_rating_disabled((int)$comment->comment_post_ID)) {
410
+    if (!empty($comment->comment_post_ID) && geodir_cpt_has_rating_disabled((int) $comment->comment_post_ID)) {
411 411
         if (!is_admin()) {
412
-            return '<div class="description">' . $content . '</div>';
412
+            return '<div class="description">'.$content.'</div>';
413 413
         } else {
414 414
             return $content;
415 415
         }
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
         if (!empty($comment))
419 419
             $rating = geodir_get_commentoverall($comment->comment_ID);
420 420
         if ($rating != 0 && !is_admin()) {
421
-            return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>';
421
+            return '<div><div class="gd-rating-text">'.__('Overall Rating', 'geodirectory').': <div class="rating">'.$rating.'</div></div>'.geodir_get_rating_stars($rating, $comment->comment_ID).'</div><div class="description">'.$content.'</div>';
422 422
         } else
423 423
             return $content;
424 424
     }
@@ -442,18 +442,18 @@  discard block
 block discarded – undo
442 442
     if (!$post_type) {
443 443
         $post_type = get_post_type($post_id);
444 444
     }
445
-    $detail_table = $plugin_prefix . $post_type . '_detail';
445
+    $detail_table = $plugin_prefix.$post_type.'_detail';
446 446
     $post_newrating = geodir_get_post_rating($post_id, 1);
447 447
     $post_newrating_count = geodir_get_review_count_total($post_id);
448 448
 
449 449
 
450 450
     //$post_newrating = ( (float)$post_oldrating - (float)$old_rating ) + (float)$overall_rating ;
451 451
 
452
-    if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
452
+    if ($wpdb->get_var("SHOW TABLES LIKE '".$detail_table."'") == $detail_table) {
453 453
 
454 454
         $wpdb->query(
455 455
             $wpdb->prepare(
456
-                "UPDATE " . $detail_table . " SET
456
+                "UPDATE ".$detail_table." SET
457 457
 						overall_rating = %f,
458 458
 						rating_count = %f
459 459
 						where post_id = %d",
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
      * @package GeoDirectory
473 473
      * @param int $post_id The post ID.
474 474
      */
475
-    do_action('geodir_update_postrating',$post_id);
475
+    do_action('geodir_update_postrating', $post_id);
476 476
 
477 477
 }
478 478
 
@@ -493,13 +493,13 @@  discard block
 block discarded – undo
493 493
     global $wpdb, $plugin_prefix;
494 494
 
495 495
     $post_type = get_post_type($post_id);
496
-    $detail_table = $plugin_prefix . $post_type . '_detail';
496
+    $detail_table = $plugin_prefix.$post_type.'_detail';
497 497
 
498
-    if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
498
+    if ($wpdb->get_var("SHOW TABLES LIKE '".$detail_table."'") == $detail_table) {
499 499
 
500 500
         $post_ratings = $wpdb->get_var(
501 501
             $wpdb->prepare(
502
-                "SELECT overall_rating FROM " . $detail_table . " WHERE post_id = %d",
502
+                "SELECT overall_rating FROM ".$detail_table." WHERE post_id = %d",
503 503
                 array($post_id)
504 504
             )
505 505
         );
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 
534 534
     $reatings = $wpdb->get_row(
535 535
         $wpdb->prepare(
536
-            "SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
536
+            "SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id = %d",
537 537
             array($comment_id)
538 538
         )
539 539
     );
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 
562 562
     $results = $wpdb->get_var(
563 563
         $wpdb->prepare(
564
-            "SELECT SUM(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
564
+            "SELECT SUM(overall_rating) FROM ".GEODIR_REVIEW_TABLE." WHERE post_id = %d AND status=1 AND overall_rating>0",
565 565
             array($post_id)
566 566
         )
567 567
     );
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
     global $wpdb;
589 589
     $results = $wpdb->get_var(
590 590
         $wpdb->prepare(
591
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d AND status=1 AND overall_rating>0",
591
+            "SELECT COUNT(overall_rating) FROM ".GEODIR_REVIEW_TABLE." WHERE user_id = %d AND status=1 AND overall_rating>0",
592 592
             array($user_id)
593 593
         )
594 594
     );
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 
627 627
     $results = $wpdb->get_var(
628 628
         $wpdb->prepare(
629
-            "SELECT COALESCE(avg(overall_rating),0) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
629
+            "SELECT COALESCE(avg(overall_rating),0) FROM ".GEODIR_REVIEW_TABLE." WHERE post_id = %d AND status=1 AND overall_rating>0",
630 630
             array($post_id)
631 631
         )
632 632
     );
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 
655 655
     $results = $wpdb->get_var(
656 656
         $wpdb->prepare(
657
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
657
+            "SELECT COUNT(overall_rating) FROM ".GEODIR_REVIEW_TABLE." WHERE post_id = %d AND status=1 AND overall_rating>0",
658 658
             array($post_id)
659 659
         )
660 660
     );
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
 
684 684
     $results = $wpdb->get_var(
685 685
         $wpdb->prepare(
686
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
686
+            "SELECT COUNT(overall_rating) FROM ".GEODIR_REVIEW_TABLE." WHERE post_id = %d AND status=1 AND overall_rating>0",
687 687
             array($post_id)
688 688
         )
689 689
     );
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 
713 713
     $reatings = $wpdb->get_var(
714 714
         $wpdb->prepare(
715
-            "SELECT overall_rating FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
715
+            "SELECT overall_rating FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id = %d",
716 716
             array($comment_id)
717 717
         )
718 718
     );
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
         
767 767
         $template = locate_template(array("geodirectory/reviews.php")); // Use theme template if available
768 768
         if (!$template) {
769
-            $template = dirname(__FILE__) . '/reviews.php';
769
+            $template = dirname(__FILE__).'/reviews.php';
770 770
         }
771 771
         return $template;
772 772
     }
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
                         printf('<cite><b class="reviewer">%1$s</b> %2$s</cite>',
839 839
                             get_comment_author_link(),
840 840
                             // If current post author is also comment author, make it known visually.
841
-                            ($comment->user_id === $post->post_author) ? '<span>' . __('Post author', 'geodirectory') . '</span>' : ''
841
+                            ($comment->user_id === $post->post_author) ? '<span>'.__('Post author', 'geodirectory').'</span>' : ''
842 842
                         );
843 843
                         echo "<span class='item'><small><span class='fn'>$post->post_title</span></small></span>";
844 844
                         printf('<a href="%1$s"><time datetime="%2$s" class="dtreviewed">%3$s<span class="value-title" title="%2$s"></span></time></a>',
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
             global $post;
897 897
             $post_types = geodir_get_posttypes();
898 898
 
899
-            if (in_array(get_post_type($post_id), $post_types) && !geodir_cpt_has_rating_disabled((int)$post_id)) {
899
+            if (in_array(get_post_type($post_id), $post_types) && !geodir_cpt_has_rating_disabled((int) $post_id)) {
900 900
                 $review_count = geodir_get_review_count_total($post_id);
901 901
                 return $review_count;
902 902
 
@@ -929,29 +929,29 @@  discard block
 block discarded – undo
929 929
  */
930 930
 function geodir_get_rating_stars($rating, $post_id, $small = false)
931 931
 {
932
-    if (!empty($post_id) && geodir_cpt_has_rating_disabled((int)$post_id)) {
932
+    if (!empty($post_id) && geodir_cpt_has_rating_disabled((int) $post_id)) {
933 933
         return NULL;
934 934
     }
935 935
     $a_rating = $rating / 5 * 100;
936 936
 
937 937
     if ($small) {
938
-        $r_html = '<div class="rating"><div class="gd_rating_map" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star_small"></div></div></div>';
938
+        $r_html = '<div class="rating"><div class="gd_rating_map" data-average="'.$rating.'" data-id="'.$post_id.'"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: '.$a_rating.'%;"></div><div class="geodir_Star_small"></div></div></div>';
939 939
     } else {
940 940
 		if (function_exists('geodir_reviewrating_draw_overall_rating')) {
941 941
 			// Show rating stars from review rating manager
942 942
 			$r_html = geodir_reviewrating_draw_overall_rating($rating);
943 943
 		} else {
944
-			$rating_img = '<img alt="rating icon" src="' . get_option('geodir_default_rating_star_icon') . '" />';
944
+			$rating_img = '<img alt="rating icon" src="'.get_option('geodir_default_rating_star_icon').'" />';
945 945
 			
946 946
 			/* fix rating star for safari */
947 947
 			$star_width = 23 * 5;
948 948
 			
949 949
 			if ($star_width > 0) {
950
-				$attach_style = 'max-width:' . $star_width . 'px';
950
+				$attach_style = 'max-width:'.$star_width.'px';
951 951
 			} else {
952 952
 				$attach_style = '';
953 953
 			}
954
-			$r_html = '<div class="geodir-rating" style="' . $attach_style . '"><div class="gd_rating_show" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingAverage" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star">' . $rating_img . $rating_img . $rating_img . $rating_img . $rating_img . '</div></div></div>';
954
+			$r_html = '<div class="geodir-rating" style="'.$attach_style.'"><div class="gd_rating_show" data-average="'.$rating.'" data-id="'.$post_id.'"><div class="geodir_RatingAverage" style="width: '.$a_rating.'%;"></div><div class="geodir_Star">'.$rating_img.$rating_img.$rating_img.$rating_img.$rating_img.'</div></div></div>';
955 955
 		}
956 956
     }
957 957
     return apply_filters('geodir_get_rating_stars_html', $r_html, $rating, 5);
@@ -991,10 +991,10 @@  discard block
 block discarded – undo
991 991
 /*
992 992
  * If Disqus plugin is active, do some fixes to show on blogs but no on GD post types
993 993
  */
994
-if(function_exists('dsq_can_replace')) {
994
+if (function_exists('dsq_can_replace')) {
995 995
     remove_filter('comments_template', 'dsq_comments_template');
996 996
     add_filter('comments_template', 'dsq_comments_template', 100);
997
-    add_filter('pre_option_disqus_active', 'geodir_option_disqus_active',10,1);
997
+    add_filter('pre_option_disqus_active', 'geodir_option_disqus_active', 10, 1);
998 998
 }
999 999
 
1000 1000
 
@@ -1007,11 +1007,11 @@  discard block
 block discarded – undo
1007 1007
  * @param string $disqus_active Hook called before DB call for option so this is empty.
1008 1008
  * @return string `1` if active `0` if disabled.
1009 1009
  */
1010
-function geodir_option_disqus_active($disqus_active){
1010
+function geodir_option_disqus_active($disqus_active) {
1011 1011
     global $post;
1012 1012
     $all_postypes = geodir_get_posttypes();
1013 1013
 
1014
-    if(isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type,$all_postypes)){
1014
+    if (isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
1015 1015
         $disqus_active = '0';
1016 1016
     }
1017 1017
 
Please login to merge, or discard this patch.
geodirectory_template_tags.php 3 patches
Braces   +34 added lines, -19 removed lines patch added patch discarded remove patch
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         </script>
253 253
 
254 254
         <?php
255
-    }elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
255
+    } elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
256 256
         echo stripslashes(get_option('geodir_ga_tracking_code'));
257 257
     }
258 258
 }
@@ -291,13 +291,14 @@  discard block
 block discarded – undo
291 291
  */
292 292
 function geodir_add_async_forscript($url)
293 293
 {
294
-    if (strpos($url, '#asyncload')===false)
295
-        return $url;
296
-    else if (is_admin())
297
-        return str_replace('#asyncload', '', $url);
298
-    else
299
-        return str_replace('#asyncload', '', $url)."' async='async";
300
-}
294
+    if (strpos($url, '#asyncload')===false) {
295
+            return $url;
296
+    } else if (is_admin()) {
297
+            return str_replace('#asyncload', '', $url);
298
+    } else {
299
+            return str_replace('#asyncload', '', $url)."' async='async";
300
+    }
301
+    }
301 302
 add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
302 303
 
303 304
 /**
@@ -364,8 +365,10 @@  discard block
 block discarded – undo
364 365
 
365 366
     $half_pages_to_show = round($pages_to_show / 2);
366 367
 
367
-    if (geodir_is_page('home')) // dont apply default  pagination for geodirectory home page.
368
-        return;
368
+    if (geodir_is_page('home')) {
369
+    	// dont apply default  pagination for geodirectory home page.
370
+        return;
371
+    }
369 372
 
370 373
     if (!is_single()) {
371 374
         if (function_exists('geodir_location_geo_home_link')) {
@@ -485,11 +488,21 @@  discard block
 block discarded – undo
485 488
     }
486 489
     $dist_dif = 1000;
487 490
 
488
-    if ($dist <= 5000) $dist_dif = 500;
489
-    if ($dist <= 1000) $dist_dif = 100;
490
-    if ($dist <= 500) $dist_dif = 50;
491
-    if ($dist <= 100) $dist_dif = 10;
492
-    if ($dist <= 50) $dist_dif = 5;
491
+    if ($dist <= 5000) {
492
+    	$dist_dif = 500;
493
+    }
494
+    if ($dist <= 1000) {
495
+    	$dist_dif = 100;
496
+    }
497
+    if ($dist <= 500) {
498
+    	$dist_dif = 50;
499
+    }
500
+    if ($dist <= 100) {
501
+    	$dist_dif = 10;
502
+    }
503
+    if ($dist <= 50) {
504
+    	$dist_dif = 5;
505
+    }
493 506
 
494 507
     ?>
495 508
     <script type="text/javascript">
@@ -550,12 +563,14 @@  discard block
 block discarded – undo
550 563
  */
551 564
 function geodir_add_sharelocation_scripts() {
552 565
     $default_search_for_text = SEARCH_FOR_TEXT;
553
-    if (get_option('geodir_search_field_default_text'))
554
-        $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
566
+    if (get_option('geodir_search_field_default_text')) {
567
+            $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
568
+    }
555 569
 
556 570
     $default_near_text = NEAR_TEXT;
557
-    if (get_option('geodir_near_field_default_text'))
558
-        $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
571
+    if (get_option('geodir_near_field_default_text')) {
572
+            $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
573
+    }
559 574
     
560 575
     $search_location = geodir_get_default_location();
561 576
     
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -38,21 +38,21 @@  discard block
 block discarded – undo
38 38
     $is_detail_page = false;
39 39
     $geodir_map_name = geodir_map_name();
40 40
 
41
-    if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
41
+    if ((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview'))) {
42 42
         $is_detail_page = true;
43 43
     }
44 44
 
45 45
     wp_enqueue_script('jquery');
46 46
 
47
-    wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
47
+    wp_register_script('geodirectory-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
48 48
     wp_enqueue_script('geodirectory-script');
49 49
 
50 50
     $geodir_vars_data = array(
51 51
         'siteurl' => get_option('siteurl'),
52 52
         'geodir_plugin_url' => geodir_plugin_url(),
53
-        'geodir_lazy_load' => get_option('geodir_lazy_load',1),
53
+        'geodir_lazy_load' => get_option('geodir_lazy_load', 1),
54 54
         'geodir_ajax_url' => geodir_get_ajax_url(),
55
-        'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
55
+        'geodir_gd_modal' => (int) get_option('geodir_disable_gb_modal'),
56 56
         'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
57 57
     );
58 58
 
@@ -73,24 +73,24 @@  discard block
 block discarded – undo
73 73
      *
74 74
      * }
75 75
      */
76
-    $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
76
+    $geodir_vars_data = apply_filters('geodir_vars_data', $geodir_vars_data);
77 77
 
78 78
     wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
79 79
 
80
-    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
81
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
80
+    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION, true);
81
+    if ($is_detail_page) {wp_enqueue_script('geodirectory-jquery-flexslider-js'); }
82 82
 
83
-    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
83
+    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url().'/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION, true);
84 84
     wp_enqueue_script('geodirectory-lightbox-jquery');
85 85
 
86
-    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
86
+    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url().'/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION, true);
87 87
     if ($is_detail_page) {
88 88
         wp_enqueue_script('geodirectory-jquery-simplemodal');
89 89
     }
90 90
 
91 91
     if (in_array($geodir_map_name, array('auto', 'google'))) {
92
-        $map_lang = "&language=" . geodir_get_map_default_language();
93
-        $map_key = "&key=" . geodir_get_map_api_key();
92
+        $map_lang = "&language=".geodir_get_map_default_language();
93
+        $map_key = "&key=".geodir_get_map_api_key();
94 94
         /**
95 95
          * Filter the variables that are added to the end of the google maps script call.
96 96
          *
@@ -100,55 +100,55 @@  discard block
 block discarded – undo
100 100
          * @param string $var The string to filter, default is empty string.
101 101
          */
102 102
         $map_extra = apply_filters('geodir_googlemap_script_extra', '');
103
-        wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL);
103
+        wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?'.$map_lang.$map_key.$map_extra, '', NULL);
104 104
         
105 105
         // Overlapping Marker Spiderfier
106
-        wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
106
+        wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
107 107
         wp_enqueue_script('geodirectory-g-overlappingmarker-script');
108 108
     }
109 109
     
110 110
     if ($geodir_map_name == 'osm') {
111 111
         // Leaflet OpenStreetMap
112
-        wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
112
+        wp_register_style('geodirectory-leaflet-style', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
113 113
         wp_enqueue_style('geodirectory-leaflet-style');
114 114
             
115
-        wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
115
+        wp_register_script('geodirectory-leaflet-script', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
116 116
         wp_enqueue_script('geodirectory-leaflet-script');
117 117
         
118
-        wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION);
118
+        wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url().'/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION);
119 119
         wp_enqueue_script('geodirectory-leaflet-geo-script');
120 120
         
121 121
         if ($is_detail_page) {
122
-            wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
122
+            wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
123 123
             wp_enqueue_style('geodirectory-leaflet-routing-style');
124 124
                 
125
-            wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION);
125
+            wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION);
126 126
             wp_enqueue_script('geodirectory-leaflet-routing-script');
127 127
         }
128 128
         
129 129
         // Overlapping Marker Spiderfier Leaflet
130
-        wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
130
+        wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
131 131
         wp_enqueue_script('geodirectory-o-overlappingmarker-script');
132 132
     }
133
-    wp_enqueue_script( 'jquery-ui-autocomplete' );
133
+    wp_enqueue_script('jquery-ui-autocomplete');
134 134
     
135
-    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
135
+    wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
136 136
     wp_enqueue_script('geodirectory-goMap-script');
137 137
 
138
-    wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
138
+    wp_register_script('chosen', geodir_plugin_url().'/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
139 139
     wp_enqueue_script('chosen');
140 140
 
141
-    wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
141
+    wp_register_script('geodirectory-choose-ajax', geodir_plugin_url().'/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
142 142
     wp_enqueue_script('geodirectory-choose-ajax');
143 143
 
144
-    wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
144
+    wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
145 145
 
146 146
     if (is_page() && geodir_is_page('add-listing')) {
147 147
         // SCRIPT FOR UPLOAD
148 148
         wp_enqueue_script('plupload-all');
149 149
         wp_enqueue_script('jquery-ui-sortable');
150 150
 
151
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
151
+        wp_register_script('geodirectory-plupload-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
152 152
         wp_enqueue_script('geodirectory-plupload-script');
153 153
         // SCRIPT FOR UPLOAD END
154 154
 
@@ -195,27 +195,27 @@  discard block
 block discarded – undo
195 195
 
196 196
         wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
197 197
 
198
-        wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
198
+        wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url().'/geodirectory-assets/js/listing_validation.min.js#asyncload');
199 199
     } // End if for add place page
200 200
 
201
-    wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
201
+    wp_register_script('geodirectory-post-custom-js', geodir_plugin_url().'/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
202 202
     if ($is_detail_page) {
203 203
 		wp_enqueue_script('geodirectory-post-custom-js');
204 204
 	}
205 205
 
206 206
     // font awesome rating script
207 207
 	if (get_option('geodir_reviewrating_enable_font_awesome')) {
208
-		wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
208
+		wp_register_script('geodir-barrating-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
209 209
 		wp_enqueue_script('geodir-barrating-js');
210 210
 	} else { // default rating script
211
-		wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true);
211
+		wp_register_script('geodir-jRating-js', geodir_plugin_url().'/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true);
212 212
 		wp_enqueue_script('geodir-jRating-js');
213 213
 	}
214 214
 
215
-    wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
215
+    wp_register_script('geodir-on-document-load', geodir_plugin_url().'/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
216 216
     wp_enqueue_script('geodir-on-document-load');
217 217
 
218
-    wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
218
+    wp_register_script('google-geometa', geodir_plugin_url().'/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
219 219
     wp_enqueue_script('google-geometa');
220 220
 }
221 221
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
  */
231 231
 function geodir_header_scripts()
232 232
 {
233
-    echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
233
+    echo '<style>'.stripslashes(get_option('geodir_coustem_css')).'</style>';
234 234
     echo stripslashes(get_option('geodir_header_scripts'));
235 235
 }
236 236
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
  */
245 245
 function geodir_google_analytics_tracking_code()
246 246
 {
247
-    if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?>
247
+    if (get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')) {?>
248 248
 
249 249
         <script>
250 250
             (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@@ -252,14 +252,14 @@  discard block
 block discarded – undo
252 252
                 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
253 253
             })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
254 254
 
255
-            ga('create', '<?php echo esc_attr(get_option('geodir_ga_account_id'));?>', 'auto');
256
-            <?php if(get_option('geodir_ga_anonymize_ip')){echo "ga('set', 'anonymizeIP', true);";}?>
255
+            ga('create', '<?php echo esc_attr(get_option('geodir_ga_account_id')); ?>', 'auto');
256
+            <?php if (get_option('geodir_ga_anonymize_ip')) {echo "ga('set', 'anonymizeIP', true);"; }?>
257 257
             ga('send', 'pageview');
258 258
 
259 259
         </script>
260 260
 
261 261
         <?php
262
-    }elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
262
+    }elseif (get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')) {
263 263
         echo stripslashes(get_option('geodir_ga_tracking_code'));
264 264
     }
265 265
 }
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
      *
283 283
      * Flexbox wont wrap on ios for search form items
284 284
      */
285
-    if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) {
285
+    if (!empty($_SERVER['HTTP_USER_AGENT']) && preg_match('/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'])) {
286 286
         echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>";
287 287
     }
288 288
 }
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
  */
299 299
 function geodir_add_async_forscript($url)
300 300
 {
301
-    if (strpos($url, '#asyncload')===false)
301
+    if (strpos($url, '#asyncload') === false)
302 302
         return $url;
303 303
     else if (is_admin())
304 304
         return str_replace('#asyncload', '', $url);
@@ -316,12 +316,12 @@  discard block
 block discarded – undo
316 316
 function geodir_templates_styles()
317 317
 {
318 318
 
319
-    wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
319
+    wp_register_style('geodir-core-scss', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
320 320
     wp_enqueue_style('geodir-core-scss');
321
-    wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
321
+    wp_register_style('geodir-core-scss-footer', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
322 322
 
323
-    if(is_rtl()){
324
-    wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
323
+    if (is_rtl()) {
324
+    wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url().'/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
325 325
     wp_enqueue_style('geodirectory-frontend-rtl-style');
326 326
     }
327 327
 
@@ -395,18 +395,18 @@  discard block
 block discarded – undo
395 395
                 $term_id = get_queried_object_id();
396 396
                 $taxonomy = get_query_var('taxonomy');
397 397
 
398
-                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
399
-                    $term = get_term($term_id, $post_type . 'category');
398
+                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type.'category') {
399
+                    $term = get_term($term_id, $post_type.'category');
400 400
                 }
401 401
             }
402 402
             
403
-            if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
404
-                $taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
403
+            if (geodir_is_page('search') && !empty($_REQUEST['s'.$post_type.'category'])) {
404
+                $taxonomy_search = $_REQUEST['s'.$post_type.'category'];
405 405
                 
406 406
                 if (!is_array($taxonomy_search)) {
407
-                    $term = get_term((int)$taxonomy_search, $post_type . 'category');
408
-                } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
409
-                    $term = get_term((int)$taxonomy_search[0], $post_type . 'category');
407
+                    $term = get_term((int) $taxonomy_search, $post_type.'category');
408
+                } else if (is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
409
+                    $term = get_term((int) $taxonomy_search[0], $post_type.'category');
410 410
                 }
411 411
             }
412 412
             
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
         if ($max_page > 1 || $always_show) {            
419 419
             // Extra pagination info
420 420
             $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
421
-            $start_no = ( $paged - 1 ) * $posts_per_page + 1;
421
+            $start_no = ($paged - 1) * $posts_per_page + 1;
422 422
             $end_no = min($paged * $posts_per_page, $numposts);
423 423
 
424 424
             if ($geodir_pagination_more_info != '') {
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
                 } else {
429 429
                     $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
430 430
                 }
431
-                $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
431
+                $pagination_info = '<div class="gd-pagination-details">'.$pegination_desc.'</div>';
432 432
                 /**
433 433
                  * Adds an extra pagination info above/under pagination.
434 434
                  *
@@ -444,15 +444,15 @@  discard block
 block discarded – undo
444 444
                 $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
445 445
                 
446 446
                 if ($geodir_pagination_more_info == 'before') {
447
-                    $before = $before . $pagination_info;
447
+                    $before = $before.$pagination_info;
448 448
                 } else if ($geodir_pagination_more_info == 'after') {
449
-                    $after = $pagination_info . $after;
449
+                    $after = $pagination_info.$after;
450 450
                 }
451 451
             }
452 452
             
453 453
             echo "$before <div class='Navi gd-navi'>";
454 454
             if ($paged >= ($pages_to_show - 1)) {
455
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
455
+                echo '<a href="'.str_replace('&paged', '&amp;paged', get_pagenum_link()).'">&laquo;</a>';
456 456
             }
457 457
             previous_posts_link($prelabel);
458 458
             for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
@@ -460,13 +460,13 @@  discard block
 block discarded – undo
460 460
                     if ($i == $paged) {
461 461
                         echo "<strong class='on'>$i</strong>";
462 462
                     } else {
463
-                        echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
463
+                        echo ' <a href="'.str_replace('&paged', '&amp;paged', get_pagenum_link($i)).'">'.$i.'</a> ';
464 464
                     }
465 465
                 }
466 466
             }
467 467
             next_posts_link($nxtlabel, $max_page);
468 468
             if (($paged + $half_pages_to_show) < ($max_page)) {
469
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
469
+                echo '<a href="'.str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)).'">&raquo;</a>';
470 470
             }
471 471
             echo "</div> $after";
472 472
         }
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
         jQuery(function ($) {
505 505
             $("#distance_slider").slider({
506 506
                 range: true,
507
-                values: [0, <?php echo ($_REQUEST['sdist']!='') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>],
507
+                values: [0, <?php echo ($_REQUEST['sdist'] != '') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>],
508 508
                 min: 0,
509 509
                 max: <?php echo $dist; ?>,
510 510
                 step: <?php echo $dist_dif; ?>,
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
     $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : '';
572 572
     ?>
573 573
     <script type="text/javascript">
574
-        var default_location = '<?php echo $city ;?>';
574
+        var default_location = '<?php echo $city; ?>';
575 575
         var latlng;
576 576
         var address;
577 577
         var dist = 0;
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 				var $form = jQuery(this).closest('form');
588 588
 
589 589
 				if (jQuery("#sdist input[type='radio']:checked").length != 0) dist = jQuery("#sdist input[type='radio']:checked").val();
590
-				if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text;?>') jQuery('.search_text', $form).val(s);
590
+				if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text; ?>') jQuery('.search_text', $form).val(s);
591 591
 				
592 592
 				// Disable location based search for disabled location post type.
593 593
 				if (jQuery('.search_by_post', $form).val() != '' && typeof gd_cpt_no_location == 'function') {
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 					}
602 602
 				}
603 603
 				
604
-				if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text;?>')) {
604
+				if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text; ?>')) {
605 605
 					geodir_setsearch($form);
606 606
 				} else {
607 607
 					jQuery(".snear", $form).val('');
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
         });
620 620
         
621 621
 		function geodir_setsearch($form) {
622
-			if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text;?>')) jQuery(".snear", $form).val(default_location);
622
+			if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text; ?>')) jQuery(".snear", $form).val(default_location);
623 623
 			geocodeAddress($form);
624 624
 		}
625 625
 
@@ -638,15 +638,15 @@  discard block
 block discarded – undo
638 638
             // Call the geocode function
639 639
             Sgeocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : null;
640 640
 
641
-            if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != ''  ) || jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) {
642
-                if (jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) {
641
+            if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != ''  ) || jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) {
642
+                if (jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) {
643 643
                     jQuery(".snear", $form).val('');
644 644
                 }
645 645
                 jQuery($form).submit();
646 646
             } else {
647 647
                 var address = jQuery(".snear", $form).val();
648 648
 
649
-                if (jQuery('.snear', $form).val() == '<?php echo $default_near_text;?>') {
649
+                if (jQuery('.snear', $form).val() == '<?php echo $default_near_text; ?>') {
650 650
                     initialise2();
651 651
                 } else {
652 652
                     <?php
@@ -659,12 +659,12 @@  discard block
 block discarded – undo
659 659
                     $near_add2 = apply_filters('geodir_search_near_addition', '');
660 660
                     ?>
661 661
                     if (window.gdMaps === 'google') {
662
-                        Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>},
662
+                        Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", '.$near_add.'"' : '').$near_add2; ?>},
663 663
                             function (results, status) {
664 664
                                 if (status == google.maps.GeocoderStatus.OK) {
665 665
                                     updateSearchPosition(results[0].geometry.location, $form);
666 666
                                 } else {
667
-                                    alert("<?php esc_attr_e('Search was not successful for the following reason :', 'geodirectory');?>" + status);
667
+                                    alert("<?php esc_attr_e('Search was not successful for the following reason :', 'geodirectory'); ?>" + status);
668 668
                                 }
669 669
                             });
670 670
                     } else if (window.gdMaps === 'osm') {
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
                                 if (typeof geo !== 'undefined' && geo.lat && geo.lon) {
674 674
                                     updateSearchPosition(geo, $form);
675 675
                                 } else {
676
-                                    alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory');?>");
676
+                                    alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory'); ?>");
677 677
                                 }
678 678
                             });
679 679
                     } else {
@@ -719,19 +719,19 @@  discard block
 block discarded – undo
719 719
             var msg;
720 720
             switch (err.code) {
721 721
                 case err.UNKNOWN_ERROR:
722
-                    msg = "<?php _e('Unable to find your location','geodirectory');?>";
722
+                    msg = "<?php _e('Unable to find your location', 'geodirectory'); ?>";
723 723
                     break;
724 724
                 case err.PERMISSION_DENINED:
725
-                    msg = "<?php _e('Permission denied in finding your location','geodirectory');?>";
725
+                    msg = "<?php _e('Permission denied in finding your location', 'geodirectory'); ?>";
726 726
                     break;
727 727
                 case err.POSITION_UNAVAILABLE:
728
-                    msg = "<?php _e('Your location is currently unknown','geodirectory');?>";
728
+                    msg = "<?php _e('Your location is currently unknown', 'geodirectory'); ?>";
729 729
                     break;
730 730
                 case err.BREAK:
731
-                    msg = "<?php _e('Attempt to find location took too long','geodirectory');?>";
731
+                    msg = "<?php _e('Attempt to find location took too long', 'geodirectory'); ?>";
732 732
                     break;
733 733
                 default:
734
-                    msg = "<?php _e('Location detection not supported in browser','geodirectory');?>";
734
+                    msg = "<?php _e('Location detection not supported in browser', 'geodirectory'); ?>";
735 735
             }
736 736
             jQuery('#info').html(msg);
737 737
         }
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
              * @param object $post The post object.
782 782
              * @param string $link The link to the post.
783 783
              */
784
-            $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
784
+            $return = apply_filters('geodir_featured_badge_on_image', '<a href="'.$link.'"><span class="geodir_featured_img">&nbsp;</span></a>', $post, $link);
785 785
             break;
786 786
         case 'new' :
787 787
             /**
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
              * @param object $post The post object.
792 792
              * @param string $link The link to the post.
793 793
              */
794
-            $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
794
+            $return = apply_filters('geodir_new_badge_on_image', '<a href="'.$link.'"><span class="geodir_new_listing">&nbsp;</span></a>', $post, $link);
795 795
             break;
796 796
 
797 797
     }
Please login to merge, or discard this patch.
Indentation   +342 added lines, -342 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function geodir_core_dequeue_script()
24 24
 {
25
-    wp_dequeue_script('flexslider');
25
+	wp_dequeue_script('flexslider');
26 26
 }
27 27
 
28 28
 add_action('wp_print_scripts', 'geodir_core_dequeue_script', 100);
@@ -35,175 +35,175 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function geodir_templates_scripts()
37 37
 {
38
-    $is_detail_page = false;
39
-    $geodir_map_name = geodir_map_name();
38
+	$is_detail_page = false;
39
+	$geodir_map_name = geodir_map_name();
40 40
 
41
-    if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
42
-        $is_detail_page = true;
43
-    }
44
-
45
-    wp_enqueue_script('jquery');
46
-
47
-    wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
48
-    wp_enqueue_script('geodirectory-script');
49
-
50
-    $geodir_vars_data = array(
51
-        'siteurl' => get_option('siteurl'),
52
-        'geodir_plugin_url' => geodir_plugin_url(),
53
-        'geodir_lazy_load' => get_option('geodir_lazy_load',1),
54
-        'geodir_ajax_url' => geodir_get_ajax_url(),
55
-        'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
56
-        'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
57
-    );
58
-
59
-    /**
60
-     * Filter the `geodir_var` data array that outputs the  wp_localize_script() translations and variables.
61
-     *
62
-     * This is used by addons to add JS translatable variables.
63
-     *
64
-     * @since 1.4.4
65
-     * @param array $geodir_vars_data {
66
-     *    geodir var data used by addons to add JS translatable variables.
67
-     *
68
-     *    @type string $siteurl Site url.
69
-     *    @type string $geodir_plugin_url Geodirectory core plugin url.
70
-     *    @type string $geodir_ajax_url Geodirectory plugin ajax url.
71
-     *    @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?.
72
-     *    @type int $is_rtl Checks if current locale is RTL.
73
-     *
74
-     * }
75
-     */
76
-    $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
77
-
78
-    wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
79
-
80
-    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
81
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
82
-
83
-    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
84
-    wp_enqueue_script('geodirectory-lightbox-jquery');
41
+	if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
42
+		$is_detail_page = true;
43
+	}
85 44
 
86
-    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
87
-    if ($is_detail_page) {
88
-        wp_enqueue_script('geodirectory-jquery-simplemodal');
89
-    }
45
+	wp_enqueue_script('jquery');
46
+
47
+	wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION);
48
+	wp_enqueue_script('geodirectory-script');
49
+
50
+	$geodir_vars_data = array(
51
+		'siteurl' => get_option('siteurl'),
52
+		'geodir_plugin_url' => geodir_plugin_url(),
53
+		'geodir_lazy_load' => get_option('geodir_lazy_load',1),
54
+		'geodir_ajax_url' => geodir_get_ajax_url(),
55
+		'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
56
+		'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
57
+	);
58
+
59
+	/**
60
+	 * Filter the `geodir_var` data array that outputs the  wp_localize_script() translations and variables.
61
+	 *
62
+	 * This is used by addons to add JS translatable variables.
63
+	 *
64
+	 * @since 1.4.4
65
+	 * @param array $geodir_vars_data {
66
+	 *    geodir var data used by addons to add JS translatable variables.
67
+	 *
68
+	 *    @type string $siteurl Site url.
69
+	 *    @type string $geodir_plugin_url Geodirectory core plugin url.
70
+	 *    @type string $geodir_ajax_url Geodirectory plugin ajax url.
71
+	 *    @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?.
72
+	 *    @type int $is_rtl Checks if current locale is RTL.
73
+	 *
74
+	 * }
75
+	 */
76
+	$geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
77
+
78
+	wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
79
+
80
+	wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
81
+	if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
82
+
83
+	wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
84
+	wp_enqueue_script('geodirectory-lightbox-jquery');
85
+
86
+	wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
87
+	if ($is_detail_page) {
88
+		wp_enqueue_script('geodirectory-jquery-simplemodal');
89
+	}
90 90
 
91
-    if (in_array($geodir_map_name, array('auto', 'google'))) {
92
-        $map_lang = "&language=" . geodir_get_map_default_language();
93
-        $map_key = "&key=" . geodir_get_map_api_key();
94
-        /**
95
-         * Filter the variables that are added to the end of the google maps script call.
96
-         *
97
-         * This i used to change things like google maps language etc.
98
-         *
99
-         * @since 1.0.0
100
-         * @param string $var The string to filter, default is empty string.
101
-         */
102
-        $map_extra = apply_filters('geodir_googlemap_script_extra', '');
103
-        wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL);
91
+	if (in_array($geodir_map_name, array('auto', 'google'))) {
92
+		$map_lang = "&language=" . geodir_get_map_default_language();
93
+		$map_key = "&key=" . geodir_get_map_api_key();
94
+		/**
95
+		 * Filter the variables that are added to the end of the google maps script call.
96
+		 *
97
+		 * This i used to change things like google maps language etc.
98
+		 *
99
+		 * @since 1.0.0
100
+		 * @param string $var The string to filter, default is empty string.
101
+		 */
102
+		$map_extra = apply_filters('geodir_googlemap_script_extra', '');
103
+		wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL);
104 104
         
105
-        // Overlapping Marker Spiderfier
106
-        wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
107
-        wp_enqueue_script('geodirectory-g-overlappingmarker-script');
108
-    }
105
+		// Overlapping Marker Spiderfier
106
+		wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
107
+		wp_enqueue_script('geodirectory-g-overlappingmarker-script');
108
+	}
109 109
     
110
-    if ($geodir_map_name == 'osm') {
111
-        // Leaflet OpenStreetMap
112
-        wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
113
-        wp_enqueue_style('geodirectory-leaflet-style');
110
+	if ($geodir_map_name == 'osm') {
111
+		// Leaflet OpenStreetMap
112
+		wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
113
+		wp_enqueue_style('geodirectory-leaflet-style');
114 114
             
115
-        wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
116
-        wp_enqueue_script('geodirectory-leaflet-script');
115
+		wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
116
+		wp_enqueue_script('geodirectory-leaflet-script');
117 117
         
118
-        wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION);
119
-        wp_enqueue_script('geodirectory-leaflet-geo-script');
118
+		wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION);
119
+		wp_enqueue_script('geodirectory-leaflet-geo-script');
120 120
         
121
-        if ($is_detail_page) {
122
-            wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
123
-            wp_enqueue_style('geodirectory-leaflet-routing-style');
121
+		if ($is_detail_page) {
122
+			wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION);
123
+			wp_enqueue_style('geodirectory-leaflet-routing-style');
124 124
                 
125
-            wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION);
126
-            wp_enqueue_script('geodirectory-leaflet-routing-script');
127
-        }
125
+			wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION);
126
+			wp_enqueue_script('geodirectory-leaflet-routing-script');
127
+		}
128 128
         
129
-        // Overlapping Marker Spiderfier Leaflet
130
-        wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
131
-        wp_enqueue_script('geodirectory-o-overlappingmarker-script');
132
-    }
133
-    wp_enqueue_script( 'jquery-ui-autocomplete' );
129
+		// Overlapping Marker Spiderfier Leaflet
130
+		wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
131
+		wp_enqueue_script('geodirectory-o-overlappingmarker-script');
132
+	}
133
+	wp_enqueue_script( 'jquery-ui-autocomplete' );
134 134
     
135
-    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
136
-    wp_enqueue_script('geodirectory-goMap-script');
137
-
138
-    wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
139
-    wp_enqueue_script('chosen');
140
-
141
-    wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
142
-    wp_enqueue_script('geodirectory-choose-ajax');
143
-
144
-    wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
145
-
146
-    if (is_page() && geodir_is_page('add-listing')) {
147
-        // SCRIPT FOR UPLOAD
148
-        wp_enqueue_script('plupload-all');
149
-        wp_enqueue_script('jquery-ui-sortable');
150
-
151
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
152
-        wp_enqueue_script('geodirectory-plupload-script');
153
-        // SCRIPT FOR UPLOAD END
154
-
155
-        // check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
156
-        if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
157
-            $ajax_url = admin_url('admin-ajax.php');
158
-        } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
159
-            $ajax_url = admin_url('admin-ajax.php');
160
-        } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
161
-            $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
162
-        } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
163
-            $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
164
-        } else {
165
-            $ajax_url = admin_url('admin-ajax.php');
166
-        }
135
+	wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
136
+	wp_enqueue_script('geodirectory-goMap-script');
137
+
138
+	wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION);
139
+	wp_enqueue_script('chosen');
140
+
141
+	wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION);
142
+	wp_enqueue_script('geodirectory-choose-ajax');
143
+
144
+	wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true);
145
+
146
+	if (is_page() && geodir_is_page('add-listing')) {
147
+		// SCRIPT FOR UPLOAD
148
+		wp_enqueue_script('plupload-all');
149
+		wp_enqueue_script('jquery-ui-sortable');
150
+
151
+		wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
152
+		wp_enqueue_script('geodirectory-plupload-script');
153
+		// SCRIPT FOR UPLOAD END
154
+
155
+		// check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
156
+		if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
157
+			$ajax_url = admin_url('admin-ajax.php');
158
+		} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
159
+			$ajax_url = admin_url('admin-ajax.php');
160
+		} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
161
+			$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
162
+		} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
163
+			$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
164
+		} else {
165
+			$ajax_url = admin_url('admin-ajax.php');
166
+		}
167 167
 
168
-        // place js config array for plupload
169
-        $plupload_init = array(
170
-            'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4',
171
-            'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
172
-            'container' => 'plupload-upload-ui', // will be adjusted per uploader
173
-            'drop_element' => 'dropbox', // will be adjusted per uploader
174
-            'file_data_name' => 'async-upload', // will be adjusted per uploader
175
-            'multiple_queues' => true,
176
-            'max_file_size' => geodir_max_upload_size(),
177
-            'url' => $ajax_url,
178
-            'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
179
-            'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
180
-            'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
181
-            'multipart' => true,
182
-            'urlstream_upload' => true,
183
-            'multi_selection' => false, // will be added per uploader
184
-            // additional post data to send to our ajax hook
185
-            'multipart_params' => array(
186
-                '_ajax_nonce' => "", // will be added per uploader
187
-                'action' => 'plupload_action', // the ajax action name
188
-                'imgid' => 0 // will be added per uploader
189
-            )
190
-        );
191
-        $base_plupload_config = json_encode($plupload_init);
192
-
193
-        $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
194
-            'upload_img_size' => geodir_max_upload_size());
195
-
196
-        wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
197
-
198
-        wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
199
-    } // End if for add place page
200
-
201
-    wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
202
-    if ($is_detail_page) {
168
+		// place js config array for plupload
169
+		$plupload_init = array(
170
+			'runtimes' => 'html5,silverlight,flash,browserplus,gears,html4',
171
+			'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
172
+			'container' => 'plupload-upload-ui', // will be adjusted per uploader
173
+			'drop_element' => 'dropbox', // will be adjusted per uploader
174
+			'file_data_name' => 'async-upload', // will be adjusted per uploader
175
+			'multiple_queues' => true,
176
+			'max_file_size' => geodir_max_upload_size(),
177
+			'url' => $ajax_url,
178
+			'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
179
+			'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
180
+			'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
181
+			'multipart' => true,
182
+			'urlstream_upload' => true,
183
+			'multi_selection' => false, // will be added per uploader
184
+			// additional post data to send to our ajax hook
185
+			'multipart_params' => array(
186
+				'_ajax_nonce' => "", // will be added per uploader
187
+				'action' => 'plupload_action', // the ajax action name
188
+				'imgid' => 0 // will be added per uploader
189
+			)
190
+		);
191
+		$base_plupload_config = json_encode($plupload_init);
192
+
193
+		$gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
194
+			'upload_img_size' => geodir_max_upload_size());
195
+
196
+		wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
197
+
198
+		wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload');
199
+	} // End if for add place page
200
+
201
+	wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
202
+	if ($is_detail_page) {
203 203
 		wp_enqueue_script('geodirectory-post-custom-js');
204 204
 	}
205 205
 
206
-    // font awesome rating script
206
+	// font awesome rating script
207 207
 	if (get_option('geodir_reviewrating_enable_font_awesome')) {
208 208
 		wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
209 209
 		wp_enqueue_script('geodir-barrating-js');
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
 		wp_enqueue_script('geodir-jRating-js');
213 213
 	}
214 214
 
215
-    wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
216
-    wp_enqueue_script('geodir-on-document-load');
215
+	wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
216
+	wp_enqueue_script('geodir-on-document-load');
217 217
 
218
-    wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
219
-    wp_enqueue_script('google-geometa');
218
+	wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
219
+	wp_enqueue_script('google-geometa');
220 220
 }
221 221
 
222 222
 /**
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
  */
231 231
 function geodir_header_scripts()
232 232
 {
233
-    echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
234
-    echo stripslashes(get_option('geodir_header_scripts'));
233
+	echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>';
234
+	echo stripslashes(get_option('geodir_header_scripts'));
235 235
 }
236 236
 
237 237
 /**
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
  */
245 245
 function geodir_google_analytics_tracking_code()
246 246
 {
247
-    if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?>
247
+	if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?>
248 248
 
249 249
         <script>
250 250
             (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@@ -259,9 +259,9 @@  discard block
 block discarded – undo
259 259
         </script>
260 260
 
261 261
         <?php
262
-    }elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
263
-        echo stripslashes(get_option('geodir_ga_tracking_code'));
264
-    }
262
+	}elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
263
+		echo stripslashes(get_option('geodir_ga_tracking_code'));
264
+	}
265 265
 }
266 266
 
267 267
 /**
@@ -275,16 +275,16 @@  discard block
 block discarded – undo
275 275
 function geodir_footer_scripts()
276 276
 {
277 277
 
278
-    echo stripslashes(get_option('geodir_footer_scripts'));
278
+	echo stripslashes(get_option('geodir_footer_scripts'));
279 279
 
280
-    /*
280
+	/*
281 281
      * Apple suck and can't/won't fix bugs: https://bugs.webkit.org/show_bug.cgi?id=136041
282 282
      *
283 283
      * Flexbox wont wrap on ios for search form items
284 284
      */
285
-    if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) {
286
-        echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>";
287
-    }
285
+	if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) {
286
+		echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>";
287
+	}
288 288
 }
289 289
 
290 290
 
@@ -298,12 +298,12 @@  discard block
 block discarded – undo
298 298
  */
299 299
 function geodir_add_async_forscript($url)
300 300
 {
301
-    if (strpos($url, '#asyncload')===false)
302
-        return $url;
303
-    else if (is_admin())
304
-        return str_replace('#asyncload', '', $url);
305
-    else
306
-        return str_replace('#asyncload', '', $url)."' async='async";
301
+	if (strpos($url, '#asyncload')===false)
302
+		return $url;
303
+	else if (is_admin())
304
+		return str_replace('#asyncload', '', $url);
305
+	else
306
+		return str_replace('#asyncload', '', $url)."' async='async";
307 307
 }
308 308
 add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
309 309
 
@@ -316,17 +316,17 @@  discard block
 block discarded – undo
316 316
 function geodir_templates_styles()
317 317
 {
318 318
 
319
-    wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
320
-    wp_enqueue_style('geodir-core-scss');
321
-    wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
319
+	wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
320
+	wp_enqueue_style('geodir-core-scss');
321
+	wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION);
322 322
 
323
-    if(is_rtl()){
324
-    wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
325
-    wp_enqueue_style('geodirectory-frontend-rtl-style');
326
-    }
323
+	if(is_rtl()){
324
+	wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
325
+	wp_enqueue_style('geodirectory-frontend-rtl-style');
326
+	}
327 327
 
328
-    wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
329
-    wp_enqueue_style('font-awesome');
328
+	wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
329
+	wp_enqueue_style('font-awesome');
330 330
 
331 331
 
332 332
 }
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
  */
341 341
 function geodir_get_sidebar()
342 342
 {
343
-    get_sidebar('geodirectory');
343
+	get_sidebar('geodirectory');
344 344
 }
345 345
 
346 346
 /**
@@ -359,122 +359,122 @@  discard block
 block discarded – undo
359 359
  * @param bool $always_show Do you want to show the pagination always? Default: false.
360 360
  */
361 361
 function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) {
362
-    global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
362
+	global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
363 363
 
364
-    if (empty($prelabel)) {
365
-        $prelabel = '<strong>&lt;</strong>';
366
-    }
364
+	if (empty($prelabel)) {
365
+		$prelabel = '<strong>&lt;</strong>';
366
+	}
367 367
 
368
-    if (empty($nxtlabel)) {
369
-        $nxtlabel = '<strong>&gt;</strong>';
370
-    }
368
+	if (empty($nxtlabel)) {
369
+		$nxtlabel = '<strong>&gt;</strong>';
370
+	}
371 371
 
372
-    $half_pages_to_show = round($pages_to_show / 2);
372
+	$half_pages_to_show = round($pages_to_show / 2);
373 373
 
374
-    if (geodir_is_page('home')) // dont apply default  pagination for geodirectory home page.
375
-        return;
374
+	if (geodir_is_page('home')) // dont apply default  pagination for geodirectory home page.
375
+		return;
376 376
 
377
-    if (!is_single()) {
378
-        if (function_exists('geodir_location_geo_home_link')) {
379
-            remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
380
-        }
381
-        $numposts = $wp_query->found_posts;
377
+	if (!is_single()) {
378
+		if (function_exists('geodir_location_geo_home_link')) {
379
+			remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
380
+		}
381
+		$numposts = $wp_query->found_posts;
382 382
 
383
-        $max_page = ceil($numposts / $posts_per_page);
383
+		$max_page = ceil($numposts / $posts_per_page);
384 384
 
385
-        if (empty($paged)) {
386
-            $paged = 1;
387
-        }
385
+		if (empty($paged)) {
386
+			$paged = 1;
387
+		}
388 388
         
389
-        $post_type = geodir_get_current_posttype();
390
-        $listing_type_name = get_post_type_plural_label($post_type);
391
-        if (geodir_is_page('listing') || geodir_is_page('search')) {            
392
-            $term = array();
389
+		$post_type = geodir_get_current_posttype();
390
+		$listing_type_name = get_post_type_plural_label($post_type);
391
+		if (geodir_is_page('listing') || geodir_is_page('search')) {            
392
+			$term = array();
393 393
             
394
-            if (is_tax()) {
395
-                $term_id = get_queried_object_id();
396
-                $taxonomy = get_query_var('taxonomy');
394
+			if (is_tax()) {
395
+				$term_id = get_queried_object_id();
396
+				$taxonomy = get_query_var('taxonomy');
397 397
 
398
-                if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
399
-                    $term = get_term($term_id, $post_type . 'category');
400
-                }
401
-            }
398
+				if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) {
399
+					$term = get_term($term_id, $post_type . 'category');
400
+				}
401
+			}
402 402
             
403
-            if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
404
-                $taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
403
+			if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) {
404
+				$taxonomy_search = $_REQUEST['s' . $post_type . 'category'];
405 405
                 
406
-                if (!is_array($taxonomy_search)) {
407
-                    $term = get_term((int)$taxonomy_search, $post_type . 'category');
408
-                } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
409
-                    $term = get_term((int)$taxonomy_search[0], $post_type . 'category');
410
-                }
411
-            }
406
+				if (!is_array($taxonomy_search)) {
407
+					$term = get_term((int)$taxonomy_search, $post_type . 'category');
408
+				} else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search
409
+					$term = get_term((int)$taxonomy_search[0], $post_type . 'category');
410
+				}
411
+			}
412 412
             
413
-            if (!empty($term) && !is_wp_error($term)) {
414
-                $listing_type_name = $term->name;
415
-            }
416
-        }
413
+			if (!empty($term) && !is_wp_error($term)) {
414
+				$listing_type_name = $term->name;
415
+			}
416
+		}
417 417
 
418
-        if ($max_page > 1 || $always_show) {            
419
-            // Extra pagination info
420
-            $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
421
-            $start_no = ( $paged - 1 ) * $posts_per_page + 1;
422
-            $end_no = min($paged * $posts_per_page, $numposts);
418
+		if ($max_page > 1 || $always_show) {            
419
+			// Extra pagination info
420
+			$geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
421
+			$start_no = ( $paged - 1 ) * $posts_per_page + 1;
422
+			$end_no = min($paged * $posts_per_page, $numposts);
423 423
 
424
-            if ($geodir_pagination_more_info != '') {
425
-                if ($listing_type_name) {
426
-                    $listing_type_name = __($listing_type_name, 'geodirectory');
427
-                    $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts);
428
-                } else {
429
-                    $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
430
-                }
431
-                $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
432
-                /**
433
-                 * Adds an extra pagination info above/under pagination.
434
-                 *
435
-                 * @since 1.5.9
436
-                 *
437
-                 * @param string $pagination_info Extra pagination info content.
438
-                 * @param string $listing_type_name Listing results type.
439
-                 * @param string $start_no First result number.
440
-                 * @param string $end_no Last result number.
441
-                 * @param string $numposts Total number of listings.
442
-                 * @param string $post_type The post type.
443
-                 */
444
-                $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
424
+			if ($geodir_pagination_more_info != '') {
425
+				if ($listing_type_name) {
426
+					$listing_type_name = __($listing_type_name, 'geodirectory');
427
+					$pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts);
428
+				} else {
429
+					$pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts);
430
+				}
431
+				$pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>';
432
+				/**
433
+				 * Adds an extra pagination info above/under pagination.
434
+				 *
435
+				 * @since 1.5.9
436
+				 *
437
+				 * @param string $pagination_info Extra pagination info content.
438
+				 * @param string $listing_type_name Listing results type.
439
+				 * @param string $start_no First result number.
440
+				 * @param string $end_no Last result number.
441
+				 * @param string $numposts Total number of listings.
442
+				 * @param string $post_type The post type.
443
+				 */
444
+				$pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type);
445 445
                 
446
-                if ($geodir_pagination_more_info == 'before') {
447
-                    $before = $before . $pagination_info;
448
-                } else if ($geodir_pagination_more_info == 'after') {
449
-                    $after = $pagination_info . $after;
450
-                }
451
-            }
446
+				if ($geodir_pagination_more_info == 'before') {
447
+					$before = $before . $pagination_info;
448
+				} else if ($geodir_pagination_more_info == 'after') {
449
+					$after = $pagination_info . $after;
450
+				}
451
+			}
452 452
             
453
-            echo "$before <div class='Navi gd-navi'>";
454
-            if ($paged >= ($pages_to_show - 1)) {
455
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
456
-            }
457
-            previous_posts_link($prelabel);
458
-            for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
459
-                if ($i >= 1 && $i <= $max_page) {
460
-                    if ($i == $paged) {
461
-                        echo "<strong class='on'>$i</strong>";
462
-                    } else {
463
-                        echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
464
-                    }
465
-                }
466
-            }
467
-            next_posts_link($nxtlabel, $max_page);
468
-            if (($paged + $half_pages_to_show) < ($max_page)) {
469
-                echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
470
-            }
471
-            echo "</div> $after";
472
-        }
453
+			echo "$before <div class='Navi gd-navi'>";
454
+			if ($paged >= ($pages_to_show - 1)) {
455
+				echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
456
+			}
457
+			previous_posts_link($prelabel);
458
+			for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
459
+				if ($i >= 1 && $i <= $max_page) {
460
+					if ($i == $paged) {
461
+						echo "<strong class='on'>$i</strong>";
462
+					} else {
463
+						echo ' <a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
464
+					}
465
+				}
466
+			}
467
+			next_posts_link($nxtlabel, $max_page);
468
+			if (($paged + $half_pages_to_show) < ($max_page)) {
469
+				echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link($max_page)) . '">&raquo;</a>';
470
+			}
471
+			echo "</div> $after";
472
+		}
473 473
         
474
-        if (function_exists('geodir_location_geo_home_link')) {
475
-            add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
476
-        }
477
-    }
474
+		if (function_exists('geodir_location_geo_home_link')) {
475
+			add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
476
+		}
477
+	}
478 478
 }
479 479
 
480 480
 /**
@@ -485,20 +485,20 @@  discard block
 block discarded – undo
485 485
  */
486 486
 function geodir_listingsearch_scripts()
487 487
 {
488
-    if (get_option('gd_search_dist') != '') {
489
-        $dist = get_option('gd_search_dist');
490
-    } else {
491
-        $dist = 500;
492
-    }
493
-    $dist_dif = 1000;
494
-
495
-    if ($dist <= 5000) $dist_dif = 500;
496
-    if ($dist <= 1000) $dist_dif = 100;
497
-    if ($dist <= 500) $dist_dif = 50;
498
-    if ($dist <= 100) $dist_dif = 10;
499
-    if ($dist <= 50) $dist_dif = 5;
500
-
501
-    ?>
488
+	if (get_option('gd_search_dist') != '') {
489
+		$dist = get_option('gd_search_dist');
490
+	} else {
491
+		$dist = 500;
492
+	}
493
+	$dist_dif = 1000;
494
+
495
+	if ($dist <= 5000) $dist_dif = 500;
496
+	if ($dist <= 1000) $dist_dif = 100;
497
+	if ($dist <= 500) $dist_dif = 50;
498
+	if ($dist <= 100) $dist_dif = 10;
499
+	if ($dist <= 50) $dist_dif = 5;
500
+
501
+	?>
502 502
     <script type="text/javascript">
503 503
 
504 504
         jQuery(function ($) {
@@ -556,20 +556,20 @@  discard block
 block discarded – undo
556 556
  * @package GeoDirectory
557 557
  */
558 558
 function geodir_add_sharelocation_scripts() {
559
-    $default_search_for_text = SEARCH_FOR_TEXT;
560
-    if (get_option('geodir_search_field_default_text'))
561
-        $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
559
+	$default_search_for_text = SEARCH_FOR_TEXT;
560
+	if (get_option('geodir_search_field_default_text'))
561
+		$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
562 562
 
563
-    $default_near_text = NEAR_TEXT;
564
-    if (get_option('geodir_near_field_default_text'))
565
-        $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
563
+	$default_near_text = NEAR_TEXT;
564
+	if (get_option('geodir_near_field_default_text'))
565
+		$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
566 566
     
567
-    $search_location = geodir_get_default_location();
567
+	$search_location = geodir_get_default_location();
568 568
     
569
-    $default_search_for_text = addslashes(stripslashes($default_search_for_text));
570
-    $default_near_text = addslashes(stripslashes($default_near_text));
571
-    $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : '';
572
-    ?>
569
+	$default_search_for_text = addslashes(stripslashes($default_search_for_text));
570
+	$default_near_text = addslashes(stripslashes($default_near_text));
571
+	$city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : '';
572
+	?>
573 573
     <script type="text/javascript">
574 574
         var default_location = '<?php echo $city ;?>';
575 575
         var latlng;
@@ -650,14 +650,14 @@  discard block
 block discarded – undo
650 650
                     initialise2();
651 651
                 } else {
652 652
                     <?php
653
-                    $near_add = get_option('geodir_search_near_addition');
654
-                    /**
655
-                     * Adds any extra info to the near search box query when trying to geolocate it via google api.
656
-                     *
657
-                     * @since 1.0.0
658
-                     */
659
-                    $near_add2 = apply_filters('geodir_search_near_addition', '');
660
-                    ?>
653
+					$near_add = get_option('geodir_search_near_addition');
654
+					/**
655
+					 * Adds any extra info to the near search box query when trying to geolocate it via google api.
656
+					 *
657
+					 * @since 1.0.0
658
+					 */
659
+					$near_add2 = apply_filters('geodir_search_near_addition', '');
660
+					?>
661 661
                     if (window.gdMaps === 'google') {
662 662
                         Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>},
663 663
                             function (results, status) {
@@ -771,30 +771,30 @@  discard block
 block discarded – undo
771 771
  */
772 772
 function geodir_show_badges_on_image($which, $post, $link)
773 773
 {
774
-    $return = '';
775
-    switch ($which) {
776
-        case 'featured':
777
-            /**
778
-             * Filter the featured image badge html that appears in the listings pages over the thumbnail.
779
-             *
780
-             * @since 1.0.0
781
-             * @param object $post The post object.
782
-             * @param string $link The link to the post.
783
-             */
784
-            $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
785
-            break;
786
-        case 'new' :
787
-            /**
788
-             * Filter the new image badge html that appears in the listings pages over the thumbnail.
789
-             *
790
-             * @since 1.0.0
791
-             * @param object $post The post object.
792
-             * @param string $link The link to the post.
793
-             */
794
-            $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
795
-            break;
796
-
797
-    }
774
+	$return = '';
775
+	switch ($which) {
776
+		case 'featured':
777
+			/**
778
+			 * Filter the featured image badge html that appears in the listings pages over the thumbnail.
779
+			 *
780
+			 * @since 1.0.0
781
+			 * @param object $post The post object.
782
+			 * @param string $link The link to the post.
783
+			 */
784
+			$return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
785
+			break;
786
+		case 'new' :
787
+			/**
788
+			 * Filter the new image badge html that appears in the listings pages over the thumbnail.
789
+			 *
790
+			 * @since 1.0.0
791
+			 * @param object $post The post object.
792
+			 * @param string $link The link to the post.
793
+			 */
794
+			$return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
795
+			break;
796
+
797
+	}
798 798
     
799
-    return $return;
799
+	return $return;
800 800
 }
Please login to merge, or discard this patch.
geodirectory-functions/location_functions.php 4 patches
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.
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.
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,71 +326,71 @@  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 = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : $gd_session->get('gd_country');
337
-        if ($country != '' && $country)
338
-            $location_array['gd_country'] = urldecode($country);
336
+		$country = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_country'] : $gd_session->get('gd_country');
337
+		if ($country != '' && $country)
338
+			$location_array['gd_country'] = urldecode($country);
339 339
 
340
-        $region = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : $gd_session->get('gd_region');
341
-        if ($region != '' && $region)
342
-            $location_array['gd_region'] = urldecode($region);
340
+		$region = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_region'] : $gd_session->get('gd_region');
341
+		if ($region != '' && $region)
342
+			$location_array['gd_region'] = urldecode($region);
343 343
 
344
-        $city = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_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 = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_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
 	/**
375 375
 	 * Filter the location terms.
376 376
 	 *
377 377
 	 * @since 1.4.6
378
-     * @package GeoDirectory
378
+	 * @package GeoDirectory
379
+	 *
380
+	 * @param array $location_array {
381
+	 *    Attributes of the location_array.
382
+	 *
383
+	 *    @type string $gd_country The country slug.
384
+	 *    @type string $gd_region The region slug.
385
+	 *    @type string $gd_city The city slug.
379 386
 	 *
380
-     * @param array $location_array {
381
-     *    Attributes of the location_array.
382
-     *
383
-     *    @type string $gd_country The country slug.
384
-     *    @type string $gd_region The region slug.
385
-     *    @type string $gd_city The city slug.
386
-     *
387
-     * }
387
+	 * }
388 388
 	 * @param string $location_array_from Source type of location terms. Default session.
389 389
 	 * @param string $gd_post_type WP post type.
390 390
 	 */
391 391
 	$location_array = apply_filters( 'geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type );
392 392
 
393
-    return $location_array;
393
+	return $location_array;
394 394
 
395 395
 }
396 396
 
@@ -403,24 +403,24 @@  discard block
 block discarded – undo
403 403
  * @return bool|string
404 404
  */
405 405
 function geodir_get_location_link($which_location = 'current') {
406
-    $location_link = get_permalink(geodir_location_page_id());
407
-
408
-    if ($which_location == 'base') {
409
-        return $location_link;
410
-    } else {
411
-        $location_terms = geodir_get_current_location_terms();
412
-
413
-        if (!empty($location_terms)) {
414
-            if (get_option('permalink_structure') != '') {
415
-                $location_terms = implode("/", $location_terms);
416
-                $location_terms = rtrim($location_terms, '/');
417
-                $location_link .= $location_terms;
418
-            } else {
419
-                $location_link = geodir_getlink($location_link, $location_terms);
420
-            }
421
-        }
422
-    }
423
-    return $location_link;
406
+	$location_link = get_permalink(geodir_location_page_id());
407
+
408
+	if ($which_location == 'base') {
409
+		return $location_link;
410
+	} else {
411
+		$location_terms = geodir_get_current_location_terms();
412
+
413
+		if (!empty($location_terms)) {
414
+			if (get_option('permalink_structure') != '') {
415
+				$location_terms = implode("/", $location_terms);
416
+				$location_terms = rtrim($location_terms, '/');
417
+				$location_link .= $location_terms;
418
+			} else {
419
+				$location_link = geodir_getlink($location_link, $location_terms);
420
+			}
421
+		}
422
+	}
423
+	return $location_link;
424 424
 }
425 425
 
426 426
 /**
@@ -433,34 +433,34 @@  discard block
 block discarded – undo
433 433
  * @return array|bool Returns address on success.
434 434
  */
435 435
 function geodir_get_osm_address_by_lat_lan($lat, $lng) {
436
-    $url = is_ssl() ? 'https:' : 'http:';
437
-    $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
438
-
439
-    $ch = curl_init();
440
-    curl_setopt($ch, CURLOPT_URL, $url);
441
-    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
442
-    curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
443
-    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
444
-    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
445
-    $response = curl_exec($ch);
446
-    curl_close($ch);
447
-    $data = json_decode($response);
436
+	$url = is_ssl() ? 'https:' : 'http:';
437
+	$url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
438
+
439
+	$ch = curl_init();
440
+	curl_setopt($ch, CURLOPT_URL, $url);
441
+	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
442
+	curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
443
+	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
444
+	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
445
+	$response = curl_exec($ch);
446
+	curl_close($ch);
447
+	$data = json_decode($response);
448 448
     
449
-    if (!empty($data) && !empty($data->address)) {
450
-        $address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
451
-        $formatted_address = (array)$data->address;
449
+	if (!empty($data) && !empty($data->address)) {
450
+		$address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
451
+		$formatted_address = (array)$data->address;
452 452
         
453
-        foreach ( $data->address as $key => $value ) {
454
-            if (!in_array($key, $address_fields)) {
455
-                unset($formatted_address[$key]);
456
-            }
457
-        }
458
-        $data->formatted_address = !empty($formatted_address) ? implode(', ', $formatted_address) : '';
453
+		foreach ( $data->address as $key => $value ) {
454
+			if (!in_array($key, $address_fields)) {
455
+				unset($formatted_address[$key]);
456
+			}
457
+		}
458
+		$data->formatted_address = !empty($formatted_address) ? implode(', ', $formatted_address) : '';
459 459
         
460
-        return $data;
461
-    } else {
462
-        return false;
463
-    }
460
+		return $data;
461
+	} else {
462
+		return false;
463
+	}
464 464
 }
465 465
 
466 466
 /**
@@ -472,47 +472,47 @@  discard block
 block discarded – undo
472 472
  * @return string Returns the country.
473 473
  */
474 474
 function geodir_get_normal_country($country) {
475
-    global $wpdb;
476
-    if ($result = geodir_get_country_by_name($country)) {
477
-        return $result;
478
-    }
475
+	global $wpdb;
476
+	if ($result = geodir_get_country_by_name($country)) {
477
+		return $result;
478
+	}
479 479
     
480
-    if (defined('POST_LOCATION_TABLE')) {
481
-        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
482
-        if (!empty($rows)) {
483
-            foreach ($rows as $row) {
484
-                $translated = __($row->country, 'geodirectory');
485
-                if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
486
-                    return $result;
487
-                }
488
-            }
489
-        }
480
+	if (defined('POST_LOCATION_TABLE')) {
481
+		$rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
482
+		if (!empty($rows)) {
483
+			foreach ($rows as $row) {
484
+				$translated = __($row->country, 'geodirectory');
485
+				if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
486
+					return $result;
487
+				}
488
+			}
489
+		}
490 490
         
491
-        $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 ) );
492
-        if (!empty($rows)) {
493
-            foreach ($rows as $row) {
494
-                $translated = __($row->country, 'geodirectory');
495
-                if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
496
-                    return $result;
497
-                }
498
-            }
499
-        }
500
-    }
491
+		$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 ) );
492
+		if (!empty($rows)) {
493
+			foreach ($rows as $row) {
494
+				$translated = __($row->country, 'geodirectory');
495
+				if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
496
+					return $result;
497
+				}
498
+			}
499
+		}
500
+	}
501 501
     
502
-    $default_location = geodir_get_default_location();
503
-    if (!empty($default_location->country) && $result = geodir_get_country_by_name($default_location->country)) {
504
-        return $result;
505
-    }
502
+	$default_location = geodir_get_default_location();
503
+	if (!empty($default_location->country) && $result = geodir_get_country_by_name($default_location->country)) {
504
+		return $result;
505
+	}
506 506
     
507
-    if (!empty($default_location->country_slug) && $result = geodir_get_country_by_name($default_location->country_slug)) {
508
-        return $result;
509
-    }
507
+	if (!empty($default_location->country_slug) && $result = geodir_get_country_by_name($default_location->country_slug)) {
508
+		return $result;
509
+	}
510 510
     
511
-    if (!empty($default_location->country_ISO2) && $result = geodir_get_country_by_name($default_location->country_ISO2, true)) {
512
-        return $result;
513
-    }
511
+	if (!empty($default_location->country_ISO2) && $result = geodir_get_country_by_name($default_location->country_ISO2, true)) {
512
+		return $result;
513
+	}
514 514
     
515
-    return $country;
515
+	return $country;
516 516
 }
517 517
 
518 518
 /**
@@ -524,16 +524,16 @@  discard block
 block discarded – undo
524 524
  * @return string Country ISO2 code.
525 525
  */
526 526
 function geodir_get_country_iso2($country) {
527
-    global $wpdb;
527
+	global $wpdb;
528 528
     
529
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
530
-        return $result;
531
-    }
532
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
533
-        return $result;
534
-    }
529
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
530
+		return $result;
531
+	}
532
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
533
+		return $result;
534
+	}
535 535
     
536
-    return $country;
536
+	return $country;
537 537
 }
538 538
 
539 539
 /**
@@ -546,16 +546,16 @@  discard block
 block discarded – undo
546 546
  * @return string|null Country ISO2 code.
547 547
  */
548 548
 function geodir_get_country_by_name($country, $iso2 = false) {
549
-    global $wpdb;
549
+	global $wpdb;
550 550
     
551
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
552
-        return $result;
553
-    }
554
-    if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
555
-        return $result;
556
-    }
551
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
552
+		return $result;
553
+	}
554
+	if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
555
+		return $result;
556
+	}
557 557
     
558
-    return NULL;
558
+	return NULL;
559 559
 }
560 560
 
561 561
 
@@ -575,130 +575,130 @@  discard block
 block discarded – undo
575 575
  */
576 576
 function geodir_replace_location_variables($content, $location_array = array(), $sep = NULL, $gd_page = '') {
577 577
 
578
-    if (empty($content)) {
579
-        return $content;
580
-    }
578
+	if (empty($content)) {
579
+		return $content;
580
+	}
581 581
 
582 582
 
583
-    $location_replace_vars = geodir_location_replace_vars($location_array, $sep, $gd_page);
583
+	$location_replace_vars = geodir_location_replace_vars($location_array, $sep, $gd_page);
584 584
 
585
-    if (!empty($location_replace_vars)) {
586
-        foreach ($location_replace_vars as $search => $replace) {
587
-            if (!empty($search) && strpos($content, $search) !== false) {
588
-                $content = str_replace($search, $replace, $content);
589
-            }
590
-        }
591
-    }
585
+	if (!empty($location_replace_vars)) {
586
+		foreach ($location_replace_vars as $search => $replace) {
587
+			if (!empty($search) && strpos($content, $search) !== false) {
588
+				$content = str_replace($search, $replace, $content);
589
+			}
590
+		}
591
+	}
592 592
 
593
-    return $content;
593
+	return $content;
594 594
 }
595 595
 add_filter('geodir_replace_location_variables', 'geodir_replace_location_variables');
596 596
 
597 597
 
598 598
 function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = ''){
599 599
 
600
-    global $wp;
600
+	global $wp;
601 601
     
602
-    $location_manager = defined('GEODIRLOCATION_VERSION') ? true : false;
603
-
604
-    if (empty($location_array)) {
605
-        $location_array = geodir_get_current_location_terms('query_vars');
606
-    }
607
-
608
-    $location_terms = array();
609
-    $location_terms['gd_neighbourhood'] = !empty($wp->query_vars['gd_neighbourhood']) ? $wp->query_vars['gd_neighbourhood'] : '';
610
-    $location_terms['gd_city'] = !empty($wp->query_vars['gd_city']) ? $wp->query_vars['gd_city'] : '';
611
-    $location_terms['gd_region'] = !empty($wp->query_vars['gd_region']) ? $wp->query_vars['gd_region'] : '';
612
-    $location_terms['gd_country'] = !empty($wp->query_vars['gd_country']) ? $wp->query_vars['gd_country'] : '';
613
-
614
-    $location_names = array();
615
-    foreach ($location_terms as $type => $location) {
616
-        $location_name = $location;
617
-
618
-        if (!empty($location_name)) {
619
-            if ($location_manager) {
620
-                $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
621
-                $location_name = get_actual_location_name($location_type, $location, true);
622
-            } else {
623
-                $location_name = preg_replace( '/-(\d+)$/', '', $location_name);
624
-                $location_name = preg_replace( '/[_-]/', ' ', $location_name );
625
-                $location_name = __(geodir_ucwords($location_name), 'geodirectory');
626
-            }
627
-        }
602
+	$location_manager = defined('GEODIRLOCATION_VERSION') ? true : false;
603
+
604
+	if (empty($location_array)) {
605
+		$location_array = geodir_get_current_location_terms('query_vars');
606
+	}
607
+
608
+	$location_terms = array();
609
+	$location_terms['gd_neighbourhood'] = !empty($wp->query_vars['gd_neighbourhood']) ? $wp->query_vars['gd_neighbourhood'] : '';
610
+	$location_terms['gd_city'] = !empty($wp->query_vars['gd_city']) ? $wp->query_vars['gd_city'] : '';
611
+	$location_terms['gd_region'] = !empty($wp->query_vars['gd_region']) ? $wp->query_vars['gd_region'] : '';
612
+	$location_terms['gd_country'] = !empty($wp->query_vars['gd_country']) ? $wp->query_vars['gd_country'] : '';
613
+
614
+	$location_names = array();
615
+	foreach ($location_terms as $type => $location) {
616
+		$location_name = $location;
617
+
618
+		if (!empty($location_name)) {
619
+			if ($location_manager) {
620
+				$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
621
+				$location_name = get_actual_location_name($location_type, $location, true);
622
+			} else {
623
+				$location_name = preg_replace( '/-(\d+)$/', '', $location_name);
624
+				$location_name = preg_replace( '/[_-]/', ' ', $location_name );
625
+				$location_name = __(geodir_ucwords($location_name), 'geodirectory');
626
+			}
627
+		}
628 628
 
629
-        $location_names[$type] = $location_name;
630
-    }
631
-
632
-    $location_single = '';
633
-    foreach ($location_terms as $type => $location) {
634
-        if (!empty($location)) {
635
-            if (!empty($location_names[$type])) {
636
-                $location_single = $location_names[$type];
637
-            } else {
638
-                if ($location_manager) {
639
-                    $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
640
-                    $location_single = get_actual_location_name($location_type, $location, true);
641
-                } else {
642
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
643
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
644
-                    $location_single = __(geodir_ucwords($location_name), 'geodirectory');
645
-                }
646
-            }
647
-            break;
648
-        }
649
-    }
650
-
651
-    $full_location = array();
652
-    if (!empty($location_array)) {
653
-        $location_array = array_reverse($location_array);
654
-
655
-        foreach ($location_array as $type => $location) {
656
-            if (!empty($location_names[$type])) {
657
-                $location_name = $location_names[$type];
658
-            } else {
659
-                if ($location_manager) {
660
-                    $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
661
-                    $location_name = get_actual_location_name($location_type, $location, true);
662
-                } else {
663
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
664
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
665
-                    $location_name = __(geodir_ucwords($location_name), 'geodirectory');
666
-                }
667
-            }
629
+		$location_names[$type] = $location_name;
630
+	}
631
+
632
+	$location_single = '';
633
+	foreach ($location_terms as $type => $location) {
634
+		if (!empty($location)) {
635
+			if (!empty($location_names[$type])) {
636
+				$location_single = $location_names[$type];
637
+			} else {
638
+				if ($location_manager) {
639
+					$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
640
+					$location_single = get_actual_location_name($location_type, $location, true);
641
+				} else {
642
+					$location_name = preg_replace( '/-(\d+)$/', '', $location);
643
+					$location_name = preg_replace( '/[_-]/', ' ', $location_name );
644
+					$location_single = __(geodir_ucwords($location_name), 'geodirectory');
645
+				}
646
+			}
647
+			break;
648
+		}
649
+	}
650
+
651
+	$full_location = array();
652
+	if (!empty($location_array)) {
653
+		$location_array = array_reverse($location_array);
654
+
655
+		foreach ($location_array as $type => $location) {
656
+			if (!empty($location_names[$type])) {
657
+				$location_name = $location_names[$type];
658
+			} else {
659
+				if ($location_manager) {
660
+					$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
661
+					$location_name = get_actual_location_name($location_type, $location, true);
662
+				} else {
663
+					$location_name = preg_replace( '/-(\d+)$/', '', $location);
664
+					$location_name = preg_replace( '/[_-]/', ' ', $location_name );
665
+					$location_name = __(geodir_ucwords($location_name), 'geodirectory');
666
+				}
667
+			}
668
+
669
+			$full_location[] = $location_name;
670
+		}
668 671
 
669
-            $full_location[] = $location_name;
670
-        }
672
+		if (!empty($full_location)) {
673
+			$full_location = array_unique($full_location);
674
+		}
675
+	}
676
+	$full_location = !empty($full_location) ? implode(', ', $full_location): '';
671 677
 
672
-        if (!empty($full_location)) {
673
-            $full_location = array_unique($full_location);
674
-        }
675
-    }
676
-    $full_location = !empty($full_location) ? implode(', ', $full_location): '';
677
-
678
-    $location_replace_vars = array();
679
-    $location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|';
680
-    $location_replace_vars['%%location%%'] = $full_location;
681
-    $location_replace_vars['%%in_location%%'] = $full_location != '' ? __( 'in', 'geodirectory' ) . ' ' . $full_location : '';
682
-    $location_replace_vars['%%location_single%%'] = $location_single;
683
-    $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? __( 'in', 'geodirectory' ) . ' ' . $location_single : '';
684
-
685
-    foreach ($location_names as $type => $name) {
686
-        $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
687
-
688
-        $location_replace_vars['%%location_' . $location_type . '%%'] = $name;
689
-        $location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? __( 'in', 'geodirectory' ) . ' ' . $name : '';
690
-    }
691
-
692
-    /**
693
-     * Filter the location terms variables to search & replace.
694
-     *
695
-     * @since   1.6.16
696
-     * @package GeoDirectory
697
-     *
698
-     * @param array $location_replace_vars The array of search & replace variables.
699
-     * @param array $location_array The array of location variables.
700
-     * @param string $gd_page       The page being filtered.
701
-     * @param string $sep           The separator.
702
-     */
703
-    return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep );
678
+	$location_replace_vars = array();
679
+	$location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|';
680
+	$location_replace_vars['%%location%%'] = $full_location;
681
+	$location_replace_vars['%%in_location%%'] = $full_location != '' ? __( 'in', 'geodirectory' ) . ' ' . $full_location : '';
682
+	$location_replace_vars['%%location_single%%'] = $location_single;
683
+	$location_replace_vars['%%in_location_single%%'] = $location_single != '' ? __( 'in', 'geodirectory' ) . ' ' . $location_single : '';
684
+
685
+	foreach ($location_names as $type => $name) {
686
+		$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
687
+
688
+		$location_replace_vars['%%location_' . $location_type . '%%'] = $name;
689
+		$location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? __( 'in', 'geodirectory' ) . ' ' . $name : '';
690
+	}
691
+
692
+	/**
693
+	 * Filter the location terms variables to search & replace.
694
+	 *
695
+	 * @since   1.6.16
696
+	 * @package GeoDirectory
697
+	 *
698
+	 * @param array $location_replace_vars The array of search & replace variables.
699
+	 * @param array $location_array The array of location variables.
700
+	 * @param string $gd_page       The page being filtered.
701
+	 * @param string $sep           The separator.
702
+	 */
703
+	return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep );
704 704
 }
705 705
\ No newline at end of file
Please login to merge, or discard this patch.
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 = isset($_REQUEST['gd_country']) ? $_REQUEST['gd_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 = isset($_REQUEST['gd_region']) ? $_REQUEST['gd_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 = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_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.
geodirectory-functions/helper_functions.php 4 patches
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
     if (geodir_is_wpml()){
148 148
         $home_url = icl_get_home_url();
149
-    }else{
149
+    } else{
150 150
         $home_url = home_url();
151 151
     }
152 152
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         $slug = $post->post_name;
160 160
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
161 161
         $login_url = trailingslashit($home_url)."$slug/";
162
-    }else{
162
+    } else{
163 163
         $login_url = trailingslashit($home_url)."?geodir_signup=true";
164 164
     }
165 165
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 
203 203
     if (geodir_is_wpml()){
204 204
         $home_url = icl_get_home_url();
205
-    }else{
205
+    } else{
206 206
         $home_url = home_url();
207 207
     }
208 208
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         $slug = $post->post_name;
216 216
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
217 217
         $info_url = trailingslashit($home_url)."$slug/";
218
-    }else{
218
+    } else{
219 219
         $info_url = trailingslashit($home_url);
220 220
     }
221 221
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1173,7 +1173,7 @@
 block discarded – undo
1173 1173
  *
1174 1174
  * @param string $str The string being decoded.
1175 1175
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1176
- * @return string The width of string.
1176
+ * @return integer The width of string.
1177 1177
  */
1178 1178
 function geodir_utf8_strwidth( $str, $encoding = 'UTF-8' ) {
1179 1179
 	if ( function_exists( 'mb_strwidth' ) ) {
Please login to merge, or discard this patch.
Indentation   +390 added lines, -390 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
  * @return int|null Return the page ID if present or null if not.
15 15
  */
16 16
 function geodir_add_listing_page_id(){
17
-    $gd_page_id = get_option('geodir_add_listing_page');
17
+	$gd_page_id = get_option('geodir_add_listing_page');
18 18
 
19
-    if (function_exists('icl_object_id')) {
20
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
21
-    }
19
+	if (function_exists('icl_object_id')) {
20
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
21
+	}
22 22
 
23
-    return $gd_page_id;
23
+	return $gd_page_id;
24 24
 }
25 25
 
26 26
 /**
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
  * @return int|null Return the page ID if present or null if not.
32 32
  */
33 33
 function geodir_preview_page_id(){
34
-    $gd_page_id = get_option('geodir_preview_page');
34
+	$gd_page_id = get_option('geodir_preview_page');
35 35
 
36
-    if (function_exists('icl_object_id')) {
37
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
38
-    }
36
+	if (function_exists('icl_object_id')) {
37
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
38
+	}
39 39
 
40
-    return $gd_page_id;
40
+	return $gd_page_id;
41 41
 }
42 42
 
43 43
 /**
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
  * @return int|null Return the page ID if present or null if not.
49 49
  */
50 50
 function geodir_success_page_id(){
51
-    $gd_page_id = get_option('geodir_success_page');
51
+	$gd_page_id = get_option('geodir_success_page');
52 52
 
53
-    if (function_exists('icl_object_id')) {
54
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
55
-    }
53
+	if (function_exists('icl_object_id')) {
54
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
55
+	}
56 56
 
57
-    return $gd_page_id;
57
+	return $gd_page_id;
58 58
 }
59 59
 
60 60
 /**
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
  * @return int|null Return the page ID if present or null if not.
66 66
  */
67 67
 function geodir_location_page_id(){
68
-    $gd_page_id = get_option('geodir_location_page');
68
+	$gd_page_id = get_option('geodir_location_page');
69 69
 
70
-    if (function_exists('icl_object_id')) {
71
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
72
-    }
70
+	if (function_exists('icl_object_id')) {
71
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
72
+	}
73 73
 
74
-    return $gd_page_id;
74
+	return $gd_page_id;
75 75
 }
76 76
 
77 77
 /**
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
  * @return int|null Return the page ID if present or null if not.
83 83
  */
84 84
 function geodir_home_page_id(){
85
-    $gd_page_id = get_option('geodir_home_page');
85
+	$gd_page_id = get_option('geodir_home_page');
86 86
 
87
-    if (function_exists('icl_object_id')) {
88
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
89
-    }
87
+	if (function_exists('icl_object_id')) {
88
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
89
+	}
90 90
 
91
-    return $gd_page_id;
91
+	return $gd_page_id;
92 92
 }
93 93
 
94 94
 /**
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
  * @return int|null Return the page ID if present or null if not.
100 100
  */
101 101
 function geodir_info_page_id(){
102
-    $gd_page_id = get_option('geodir_info_page');
102
+	$gd_page_id = get_option('geodir_info_page');
103 103
 
104
-    if (function_exists('icl_object_id')) {
105
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
106
-    }
104
+	if (function_exists('icl_object_id')) {
105
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
106
+	}
107 107
 
108
-    return $gd_page_id;
108
+	return $gd_page_id;
109 109
 }
110 110
 
111 111
 /**
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
  * @return int|null Return the page ID if present or null if not.
117 117
  */
118 118
 function geodir_login_page_id(){
119
-    $gd_page_id = get_option('geodir_login_page');
119
+	$gd_page_id = get_option('geodir_login_page');
120 120
 
121
-    if (function_exists('icl_object_id')) {
122
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
123
-    }
121
+	if (function_exists('icl_object_id')) {
122
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
123
+	}
124 124
 
125
-    return $gd_page_id;
125
+	return $gd_page_id;
126 126
 }
127 127
 
128 128
 
@@ -134,51 +134,51 @@  discard block
 block discarded – undo
134 134
  * @return int|null Return the page ID if present or null if not.
135 135
  */
136 136
 function geodir_login_url($args=array()){
137
-    $gd_page_id = get_option('geodir_login_page');
138
-
139
-    if (function_exists('icl_object_id')) {
140
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
141
-    }
142
-
143
-    if (function_exists('geodir_location_geo_home_link')) {
144
-        remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
145
-    }
146
-
147
-    if (geodir_is_wpml()){
148
-        $home_url = icl_get_home_url();
149
-    }else{
150
-        $home_url = home_url();
151
-    }
152
-
153
-    if (function_exists('geodir_location_geo_home_link')) {
154
-        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
155
-    }
156
-
157
-    if($gd_page_id){
158
-        $post = get_post($gd_page_id);
159
-        $slug = $post->post_name;
160
-        //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
161
-        $login_url = trailingslashit($home_url)."$slug/";
162
-    }else{
163
-        $login_url = trailingslashit($home_url)."?geodir_signup=true";
164
-    }
165
-
166
-    if($args){
167
-        $login_url = add_query_arg($args,$login_url );
168
-    }
169
-
170
-    /**
171
-     * Filter the GeoDirectory login page url.
172
-     *
173
-     * This filter can be used to change the GeoDirectory page url.
174
-     *
175
-     * @since 1.5.3
176
-     * @package GeoDirectory
177
-     * @param string $login_url The url of the login page.
178
-     * @param array $args The array of query args used.
179
-     * @param int $gd_page_id The page id of the GD login page.
180
-     */
181
-	    return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
137
+	$gd_page_id = get_option('geodir_login_page');
138
+
139
+	if (function_exists('icl_object_id')) {
140
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
141
+	}
142
+
143
+	if (function_exists('geodir_location_geo_home_link')) {
144
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
145
+	}
146
+
147
+	if (geodir_is_wpml()){
148
+		$home_url = icl_get_home_url();
149
+	}else{
150
+		$home_url = home_url();
151
+	}
152
+
153
+	if (function_exists('geodir_location_geo_home_link')) {
154
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
155
+	}
156
+
157
+	if($gd_page_id){
158
+		$post = get_post($gd_page_id);
159
+		$slug = $post->post_name;
160
+		//$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
161
+		$login_url = trailingslashit($home_url)."$slug/";
162
+	}else{
163
+		$login_url = trailingslashit($home_url)."?geodir_signup=true";
164
+	}
165
+
166
+	if($args){
167
+		$login_url = add_query_arg($args,$login_url );
168
+	}
169
+
170
+	/**
171
+	 * Filter the GeoDirectory login page url.
172
+	 *
173
+	 * This filter can be used to change the GeoDirectory page url.
174
+	 *
175
+	 * @since 1.5.3
176
+	 * @package GeoDirectory
177
+	 * @param string $login_url The url of the login page.
178
+	 * @param array $args The array of query args used.
179
+	 * @param int $gd_page_id The page id of the GD login page.
180
+	 */
181
+		return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
182 182
 }
183 183
 
184 184
 /**
@@ -190,40 +190,40 @@  discard block
 block discarded – undo
190 190
  * @return string Info page url.
191 191
  */
192 192
 function geodir_info_url($args=array()){
193
-    $gd_page_id = get_option('geodir_info_page');
194
-
195
-    if (function_exists('icl_object_id')) {
196
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
197
-    }
198
-
199
-    if (function_exists('geodir_location_geo_home_link')) {
200
-        remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
201
-    }
202
-
203
-    if (geodir_is_wpml()){
204
-        $home_url = icl_get_home_url();
205
-    }else{
206
-        $home_url = home_url();
207
-    }
208
-
209
-    if (function_exists('geodir_location_geo_home_link')) {
210
-        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
211
-    }
212
-
213
-    if($gd_page_id){
214
-        $post = get_post($gd_page_id);
215
-        $slug = $post->post_name;
216
-        //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
217
-        $info_url = trailingslashit($home_url)."$slug/";
218
-    }else{
219
-        $info_url = trailingslashit($home_url);
220
-    }
221
-
222
-    if($args){
223
-        $info_url = add_query_arg($args,$info_url );
224
-    }
225
-
226
-    return $info_url;
193
+	$gd_page_id = get_option('geodir_info_page');
194
+
195
+	if (function_exists('icl_object_id')) {
196
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
197
+	}
198
+
199
+	if (function_exists('geodir_location_geo_home_link')) {
200
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
201
+	}
202
+
203
+	if (geodir_is_wpml()){
204
+		$home_url = icl_get_home_url();
205
+	}else{
206
+		$home_url = home_url();
207
+	}
208
+
209
+	if (function_exists('geodir_location_geo_home_link')) {
210
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
211
+	}
212
+
213
+	if($gd_page_id){
214
+		$post = get_post($gd_page_id);
215
+		$slug = $post->post_name;
216
+		//$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
217
+		$info_url = trailingslashit($home_url)."$slug/";
218
+	}else{
219
+		$info_url = trailingslashit($home_url);
220
+	}
221
+
222
+	if($args){
223
+		$info_url = add_query_arg($args,$info_url );
224
+	}
225
+
226
+	return $info_url;
227 227
 }
228 228
 
229 229
 /**
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
  * @return string Returns converted string.
240 240
  */
241 241
 function geodir_ucwords($string, $charset='UTF-8') {
242
-    if (function_exists('mb_convert_case')) {
243
-        return mb_convert_case($string, MB_CASE_TITLE, $charset);
244
-    } else {
245
-        return ucwords($string);
246
-    }
242
+	if (function_exists('mb_convert_case')) {
243
+		return mb_convert_case($string, MB_CASE_TITLE, $charset);
244
+	} else {
245
+		return ucwords($string);
246
+	}
247 247
 }
248 248
 
249 249
 /**
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
  * @return string Returns converted string.
260 260
  */
261 261
 function geodir_strtolower($string, $charset='UTF-8') {
262
-    if (function_exists('mb_convert_case')) {
263
-        return mb_convert_case($string, MB_CASE_LOWER, $charset);
264
-    } else {
265
-        return strtolower($string);
266
-    }
262
+	if (function_exists('mb_convert_case')) {
263
+		return mb_convert_case($string, MB_CASE_LOWER, $charset);
264
+	} else {
265
+		return strtolower($string);
266
+	}
267 267
 }
268 268
 
269 269
 /**
@@ -279,11 +279,11 @@  discard block
 block discarded – undo
279 279
  * @return string Returns converted string.
280 280
  */
281 281
 function geodir_strtoupper($string, $charset='UTF-8') {
282
-    if (function_exists('mb_convert_case')) {
283
-        return mb_convert_case($string, MB_CASE_UPPER, $charset);
284
-    } else {
285
-        return strtoupper($string);
286
-    }
282
+	if (function_exists('mb_convert_case')) {
283
+		return mb_convert_case($string, MB_CASE_UPPER, $charset);
284
+	} else {
285
+		return strtoupper($string);
286
+	}
287 287
 }
288 288
 
289 289
 /**
@@ -462,11 +462,11 @@  discard block
 block discarded – undo
462 462
  * @package GeoDirectory
463 463
  */
464 464
 function _gd_die_handler() {
465
-    if ( defined( 'GD_TESTING_MODE' ) ) {
466
-        return '_gd_die_handler';
467
-    } else {
468
-        die();
469
-    }
465
+	if ( defined( 'GD_TESTING_MODE' ) ) {
466
+		return '_gd_die_handler';
467
+	} else {
468
+		die();
469
+	}
470 470
 }
471 471
 
472 472
 /**
@@ -481,9 +481,9 @@  discard block
 block discarded – undo
481 481
  * @param int $status     Optional. Status code.
482 482
  */
483 483
 function gd_die( $message = '', $title = '', $status = 400 ) {
484
-    add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
485
-    add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
486
-    wp_die( $message, $title, array( 'response' => $status ));
484
+	add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
485
+	add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
486
+	wp_die( $message, $title, array( 'response' => $status ));
487 487
 }
488 488
 
489 489
 /*
@@ -652,37 +652,37 @@  discard block
 block discarded – undo
652 652
  * @return string The formatted date.
653 653
  */
654 654
 function geodir_date($date_input, $date_to, $date_from = '') {
655
-    if (empty($date_input) || empty($date_to)) {
656
-        return NULL;
657
-    }
655
+	if (empty($date_input) || empty($date_to)) {
656
+		return NULL;
657
+	}
658 658
     
659
-    $date = '';
660
-    if (!empty($date_from)) {
661
-        $datetime = date_create_from_format($date_from, $date_input);
659
+	$date = '';
660
+	if (!empty($date_from)) {
661
+		$datetime = date_create_from_format($date_from, $date_input);
662 662
         
663
-        if (!empty($datetime)) {
664
-            $date = $datetime->format($date_to);
665
-        }
666
-    }
663
+		if (!empty($datetime)) {
664
+			$date = $datetime->format($date_to);
665
+		}
666
+	}
667 667
     
668
-    if (empty($date)) {
669
-        $date = strpos($date_input, '/') !== false ? str_replace('/', '-', $date_input) : $date_input;
670
-        $date = date_i18n($date_to, strtotime($date));
671
-    }
668
+	if (empty($date)) {
669
+		$date = strpos($date_input, '/') !== false ? str_replace('/', '-', $date_input) : $date_input;
670
+		$date = date_i18n($date_to, strtotime($date));
671
+	}
672 672
     
673
-    $date = geodir_maybe_untranslate_date($date);
674
-    /**
675
-     * Filter the the date format conversion.
676
-     *
677
-     * @since 1.6.7
678
-     * @package GeoDirectory
679
-     *
680
-     * @param string $date The date string.
681
-     * @param string $date_input The date input.
682
-     * @param string $date_to The destination date format.
683
-     * @param string $date_from The source date format.
684
-     */
685
-    return apply_filters('geodir_date', $date, $date_input, $date_to, $date_from);
673
+	$date = geodir_maybe_untranslate_date($date);
674
+	/**
675
+	 * Filter the the date format conversion.
676
+	 *
677
+	 * @since 1.6.7
678
+	 * @package GeoDirectory
679
+	 *
680
+	 * @param string $date The date string.
681
+	 * @param string $date_input The date input.
682
+	 * @param string $date_to The destination date format.
683
+	 * @param string $date_from The source date format.
684
+	 */
685
+	return apply_filters('geodir_date', $date, $date_input, $date_to, $date_from);
686 686
 }
687 687
 
688 688
 /**
@@ -707,91 +707,91 @@  discard block
 block discarded – undo
707 707
  * @return string Trimmed string.
708 708
  */
709 709
 function geodir_excerpt($text, $length = 100, $options = array()) {
710
-    if (!(int)$length > 0) {
711
-        return $text;
712
-    }
713
-    $default = array(
714
-        'ellipsis' => '', 'exact' => true, 'html' => true, 'trimWidth' => false,
710
+	if (!(int)$length > 0) {
711
+		return $text;
712
+	}
713
+	$default = array(
714
+		'ellipsis' => '', 'exact' => true, 'html' => true, 'trimWidth' => false,
715 715
 	);
716
-    if (!empty($options['html']) && function_exists('mb_internal_encoding') && strtolower(mb_internal_encoding()) === 'utf-8') {
717
-        $default['ellipsis'] = "";
718
-    }
719
-    $options += $default;
720
-
721
-    $prefix = '';
722
-    $suffix = $options['ellipsis'];
723
-
724
-    if ($options['html']) {
725
-        $ellipsisLength = geodir_strlen(strip_tags($options['ellipsis']), $options);
726
-
727
-        $truncateLength = 0;
728
-        $totalLength = 0;
729
-        $openTags = array();
730
-        $truncate = '';
731
-
732
-        preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER);
733
-        foreach ($tags as $tag) {
734
-            $contentLength = geodir_strlen($tag[3], $options);
735
-
736
-            if ($truncate === '') {
737
-                if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/i', $tag[2])) {
738
-                    if (preg_match('/<[\w]+[^>]*>/', $tag[0])) {
739
-                        array_unshift($openTags, $tag[2]);
740
-                    } elseif (preg_match('/<\/([\w]+)[^>]*>/', $tag[0], $closeTag)) {
741
-                        $pos = array_search($closeTag[1], $openTags);
742
-                        if ($pos !== false) {
743
-                            array_splice($openTags, $pos, 1);
744
-                        }
745
-                    }
746
-                }
747
-
748
-                $prefix .= $tag[1];
749
-
750
-                if ($totalLength + $contentLength + $ellipsisLength > $length) {
751
-                    $truncate = $tag[3];
752
-                    $truncateLength = $length - $totalLength;
753
-                } else {
754
-                    $prefix .= $tag[3];
755
-                }
756
-            }
757
-
758
-            $totalLength += $contentLength;
759
-            if ($totalLength > $length) {
760
-                break;
761
-            }
762
-        }
763
-
764
-        if ($totalLength <= $length) {
765
-            return $text;
766
-        }
767
-
768
-        $text = $truncate;
769
-        $length = $truncateLength;
770
-
771
-        foreach ($openTags as $tag) {
772
-            $suffix .= '</' . $tag . '>';
773
-        }
774
-    } else {
775
-        if (geodir_strlen($text, $options) <= $length) {
776
-            return $text;
777
-        }
778
-        $ellipsisLength = geodir_strlen($options['ellipsis'], $options);
779
-    }
780
-
781
-    $result = geodir_substr($text, 0, $length - $ellipsisLength, $options);
782
-
783
-    if (!$options['exact']) {
784
-        if (geodir_substr($text, $length - $ellipsisLength, 1, $options) !== ' ') {
785
-            $result = geodir_remove_last_word($result);
786
-        }
787
-
788
-        // Do not need to count ellipsis in the cut, if result is empty.
789
-        if (!strlen($result)) {
790
-            $result = geodir_substr($text, 0, $length, $options);
791
-        }
792
-    }
793
-
794
-    return $prefix . $result . $suffix;
716
+	if (!empty($options['html']) && function_exists('mb_internal_encoding') && strtolower(mb_internal_encoding()) === 'utf-8') {
717
+		$default['ellipsis'] = "";
718
+	}
719
+	$options += $default;
720
+
721
+	$prefix = '';
722
+	$suffix = $options['ellipsis'];
723
+
724
+	if ($options['html']) {
725
+		$ellipsisLength = geodir_strlen(strip_tags($options['ellipsis']), $options);
726
+
727
+		$truncateLength = 0;
728
+		$totalLength = 0;
729
+		$openTags = array();
730
+		$truncate = '';
731
+
732
+		preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER);
733
+		foreach ($tags as $tag) {
734
+			$contentLength = geodir_strlen($tag[3], $options);
735
+
736
+			if ($truncate === '') {
737
+				if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/i', $tag[2])) {
738
+					if (preg_match('/<[\w]+[^>]*>/', $tag[0])) {
739
+						array_unshift($openTags, $tag[2]);
740
+					} elseif (preg_match('/<\/([\w]+)[^>]*>/', $tag[0], $closeTag)) {
741
+						$pos = array_search($closeTag[1], $openTags);
742
+						if ($pos !== false) {
743
+							array_splice($openTags, $pos, 1);
744
+						}
745
+					}
746
+				}
747
+
748
+				$prefix .= $tag[1];
749
+
750
+				if ($totalLength + $contentLength + $ellipsisLength > $length) {
751
+					$truncate = $tag[3];
752
+					$truncateLength = $length - $totalLength;
753
+				} else {
754
+					$prefix .= $tag[3];
755
+				}
756
+			}
757
+
758
+			$totalLength += $contentLength;
759
+			if ($totalLength > $length) {
760
+				break;
761
+			}
762
+		}
763
+
764
+		if ($totalLength <= $length) {
765
+			return $text;
766
+		}
767
+
768
+		$text = $truncate;
769
+		$length = $truncateLength;
770
+
771
+		foreach ($openTags as $tag) {
772
+			$suffix .= '</' . $tag . '>';
773
+		}
774
+	} else {
775
+		if (geodir_strlen($text, $options) <= $length) {
776
+			return $text;
777
+		}
778
+		$ellipsisLength = geodir_strlen($options['ellipsis'], $options);
779
+	}
780
+
781
+	$result = geodir_substr($text, 0, $length - $ellipsisLength, $options);
782
+
783
+	if (!$options['exact']) {
784
+		if (geodir_substr($text, $length - $ellipsisLength, 1, $options) !== ' ') {
785
+			$result = geodir_remove_last_word($result);
786
+		}
787
+
788
+		// Do not need to count ellipsis in the cut, if result is empty.
789
+		if (!strlen($result)) {
790
+			$result = geodir_substr($text, 0, $length, $options);
791
+		}
792
+	}
793
+
794
+	return $prefix . $result . $suffix;
795 795
 }
796 796
 
797 797
 /**
@@ -815,28 +815,28 @@  discard block
 block discarded – undo
815 815
  * @return int
816 816
  */
817 817
 function geodir_strlen($text, array $options) {
818
-    if (empty($options['trimWidth'])) {
819
-        $strlen = 'geodir_utf8_strlen';
820
-    } else {
821
-        $strlen = 'geodir_utf8_strwidth';
822
-    }
823
-
824
-    if (empty($options['html'])) {
825
-        return $strlen($text);
826
-    }
827
-
828
-    $pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i';
829
-    $replace = preg_replace_callback(
830
-        $pattern,
831
-        function ($match) use ($strlen) {
832
-            $utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8');
833
-
834
-            return str_repeat(' ', $strlen($utf8, 'UTF-8'));
835
-        },
836
-        $text
837
-    );
838
-
839
-    return $strlen($replace);
818
+	if (empty($options['trimWidth'])) {
819
+		$strlen = 'geodir_utf8_strlen';
820
+	} else {
821
+		$strlen = 'geodir_utf8_strwidth';
822
+	}
823
+
824
+	if (empty($options['html'])) {
825
+		return $strlen($text);
826
+	}
827
+
828
+	$pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i';
829
+	$replace = preg_replace_callback(
830
+		$pattern,
831
+		function ($match) use ($strlen) {
832
+			$utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8');
833
+
834
+			return str_repeat(' ', $strlen($utf8, 'UTF-8'));
835
+		},
836
+		$text
837
+	);
838
+
839
+	return $strlen($replace);
840 840
 }
841 841
 
842 842
 /**
@@ -857,80 +857,80 @@  discard block
 block discarded – undo
857 857
  * @return string
858 858
  */
859 859
 function geodir_substr($text, $start, $length, array $options) {
860
-    if (empty($options['trimWidth'])) {
861
-        $substr = 'geodir_utf8_substr';
862
-    } else {
863
-        $substr = 'geodir_utf8_strimwidth';
864
-    }
865
-
866
-    $maxPosition = geodir_strlen($text, array('trimWidth' => false) + $options);
867
-    if ($start < 0) {
868
-        $start += $maxPosition;
869
-        if ($start < 0) {
870
-            $start = 0;
871
-        }
872
-    }
873
-    if ($start >= $maxPosition) {
874
-        return '';
875
-    }
876
-
877
-    if ($length === null) {
878
-        $length = geodir_strlen($text, $options);
879
-    }
880
-
881
-    if ($length < 0) {
882
-        $text = geodir_substr($text, $start, null, $options);
883
-        $start = 0;
884
-        $length += geodir_strlen($text, $options);
885
-    }
886
-
887
-    if ($length <= 0) {
888
-        return '';
889
-    }
890
-
891
-    if (empty($options['html'])) {
892
-        return (string)$substr($text, $start, $length);
893
-    }
894
-
895
-    $totalOffset = 0;
896
-    $totalLength = 0;
897
-    $result = '';
898
-
899
-    $pattern = '/(&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};)/i';
900
-    $parts = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
901
-    foreach ($parts as $part) {
902
-        $offset = 0;
903
-
904
-        if ($totalOffset < $start) {
905
-            $len = geodir_strlen($part, array('trimWidth' => false) + $options);
906
-            if ($totalOffset + $len <= $start) {
907
-                $totalOffset += $len;
908
-                continue;
909
-            }
910
-
911
-            $offset = $start - $totalOffset;
912
-            $totalOffset = $start;
913
-        }
914
-
915
-        $len = geodir_strlen($part, $options);
916
-        if ($offset !== 0 || $totalLength + $len > $length) {
917
-            if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) {
918
-                // Entities cannot be passed substr.
919
-                continue;
920
-            }
921
-
922
-            $part = $substr($part, $offset, $length - $totalLength);
923
-            $len = geodir_strlen($part, $options);
924
-        }
925
-
926
-        $result .= $part;
927
-        $totalLength += $len;
928
-        if ($totalLength >= $length) {
929
-            break;
930
-        }
931
-    }
932
-
933
-    return $result;
860
+	if (empty($options['trimWidth'])) {
861
+		$substr = 'geodir_utf8_substr';
862
+	} else {
863
+		$substr = 'geodir_utf8_strimwidth';
864
+	}
865
+
866
+	$maxPosition = geodir_strlen($text, array('trimWidth' => false) + $options);
867
+	if ($start < 0) {
868
+		$start += $maxPosition;
869
+		if ($start < 0) {
870
+			$start = 0;
871
+		}
872
+	}
873
+	if ($start >= $maxPosition) {
874
+		return '';
875
+	}
876
+
877
+	if ($length === null) {
878
+		$length = geodir_strlen($text, $options);
879
+	}
880
+
881
+	if ($length < 0) {
882
+		$text = geodir_substr($text, $start, null, $options);
883
+		$start = 0;
884
+		$length += geodir_strlen($text, $options);
885
+	}
886
+
887
+	if ($length <= 0) {
888
+		return '';
889
+	}
890
+
891
+	if (empty($options['html'])) {
892
+		return (string)$substr($text, $start, $length);
893
+	}
894
+
895
+	$totalOffset = 0;
896
+	$totalLength = 0;
897
+	$result = '';
898
+
899
+	$pattern = '/(&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};)/i';
900
+	$parts = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
901
+	foreach ($parts as $part) {
902
+		$offset = 0;
903
+
904
+		if ($totalOffset < $start) {
905
+			$len = geodir_strlen($part, array('trimWidth' => false) + $options);
906
+			if ($totalOffset + $len <= $start) {
907
+				$totalOffset += $len;
908
+				continue;
909
+			}
910
+
911
+			$offset = $start - $totalOffset;
912
+			$totalOffset = $start;
913
+		}
914
+
915
+		$len = geodir_strlen($part, $options);
916
+		if ($offset !== 0 || $totalLength + $len > $length) {
917
+			if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) {
918
+				// Entities cannot be passed substr.
919
+				continue;
920
+			}
921
+
922
+			$part = $substr($part, $offset, $length - $totalLength);
923
+			$len = geodir_strlen($part, $options);
924
+		}
925
+
926
+		$result .= $part;
927
+		$totalLength += $len;
928
+		if ($totalLength >= $length) {
929
+			break;
930
+		}
931
+	}
932
+
933
+	return $result;
934 934
 }
935 935
 
936 936
 /**
@@ -943,21 +943,21 @@  discard block
 block discarded – undo
943 943
  * @return string
944 944
  */
945 945
 function geodir_remove_last_word($text) {
946
-    $spacepos = geodir_utf8_strrpos($text, ' ');
946
+	$spacepos = geodir_utf8_strrpos($text, ' ');
947 947
 
948
-    if ($spacepos !== false) {
949
-        $lastWord = geodir_utf8_strrpos($text, $spacepos);
948
+	if ($spacepos !== false) {
949
+		$lastWord = geodir_utf8_strrpos($text, $spacepos);
950 950
 
951
-        // Some languages are written without word separation.
952
-        // We recognize a string as a word if it does not contain any full-width characters.
953
-        if (geodir_utf8_strwidth($lastWord) === geodir_utf8_strlen($lastWord)) {
954
-            $text = geodir_utf8_substr($text, 0, $spacepos);
955
-        }
951
+		// Some languages are written without word separation.
952
+		// We recognize a string as a word if it does not contain any full-width characters.
953
+		if (geodir_utf8_strwidth($lastWord) === geodir_utf8_strlen($lastWord)) {
954
+			$text = geodir_utf8_substr($text, 0, $spacepos);
955
+		}
956 956
 
957
-        return $text;
958
-    }
957
+		return $text;
958
+	}
959 959
 
960
-    return '';
960
+	return '';
961 961
 }
962 962
 
963 963
 function geodir_tool_restore_cpt_from_taxonomies(){
@@ -1075,11 +1075,11 @@  discard block
 block discarded – undo
1075 1075
  * @return string
1076 1076
  */
1077 1077
 function geodir_utf8_strimwidth( $str, $start, $width, $trimmaker = '', $encoding = 'UTF-8' ) {
1078
-    if ( function_exists( 'mb_strimwidth' ) ) {
1079
-        return mb_strimwidth( $str, $start, $width, $trimmaker, $encoding );
1080
-    }
1078
+	if ( function_exists( 'mb_strimwidth' ) ) {
1079
+		return mb_strimwidth( $str, $start, $width, $trimmaker, $encoding );
1080
+	}
1081 1081
     
1082
-    return geodir_utf8_substr( $str, $start, $width, $encoding ) . $trimmaker;
1082
+	return geodir_utf8_substr( $str, $start, $width, $encoding ) . $trimmaker;
1083 1083
 }
1084 1084
 
1085 1085
 /**
@@ -1093,11 +1093,11 @@  discard block
 block discarded – undo
1093 1093
  * @return int Returns the number of characters in string.
1094 1094
  */
1095 1095
 function geodir_utf8_strlen( $str, $encoding = 'UTF-8' ) {
1096
-    if ( function_exists( 'mb_strlen' ) ) {
1097
-        return mb_strlen( $str, $encoding );
1098
-    }
1096
+	if ( function_exists( 'mb_strlen' ) ) {
1097
+		return mb_strlen( $str, $encoding );
1098
+	}
1099 1099
         
1100
-    return strlen( $str );
1100
+	return strlen( $str );
1101 1101
 }
1102 1102
 
1103 1103
 /**
@@ -1113,11 +1113,11 @@  discard block
 block discarded – undo
1113 1113
  * @return int Returns the position of the first occurrence of search in the string.
1114 1114
  */
1115 1115
 function geodir_utf8_strpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
1116
-    if ( function_exists( 'mb_strpos' ) ) {
1117
-        return mb_strpos( $str, $find, $offset, $encoding );
1118
-    }
1116
+	if ( function_exists( 'mb_strpos' ) ) {
1117
+		return mb_strpos( $str, $find, $offset, $encoding );
1118
+	}
1119 1119
         
1120
-    return strpos( $str, $find, $offset );
1120
+	return strpos( $str, $find, $offset );
1121 1121
 }
1122 1122
 
1123 1123
 /**
@@ -1133,11 +1133,11 @@  discard block
 block discarded – undo
1133 1133
  * @return int Returns the position of the last occurrence of search.
1134 1134
  */
1135 1135
 function geodir_utf8_strrpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
1136
-    if ( function_exists( 'mb_strrpos' ) ) {
1137
-        return mb_strrpos( $str, $find, $offset, $encoding );
1138
-    }
1136
+	if ( function_exists( 'mb_strrpos' ) ) {
1137
+		return mb_strrpos( $str, $find, $offset, $encoding );
1138
+	}
1139 1139
         
1140
-    return strrpos( $str, $find, $offset );
1140
+	return strrpos( $str, $find, $offset );
1141 1141
 }
1142 1142
 
1143 1143
 /**
@@ -1154,15 +1154,15 @@  discard block
 block discarded – undo
1154 1154
  * @return string
1155 1155
  */
1156 1156
 function geodir_utf8_substr( $str, $start, $length = null, $encoding = 'UTF-8' ) {
1157
-    if ( function_exists( 'mb_substr' ) ) {
1158
-        if ( $length === null ) {
1159
-            return mb_substr( $str, $start, geodir_utf8_strlen( $str, $encoding ), $encoding );
1160
-        } else {
1161
-            return mb_substr( $str, $start, $length, $encoding );
1162
-        }
1163
-    }
1157
+	if ( function_exists( 'mb_substr' ) ) {
1158
+		if ( $length === null ) {
1159
+			return mb_substr( $str, $start, geodir_utf8_strlen( $str, $encoding ), $encoding );
1160
+		} else {
1161
+			return mb_substr( $str, $start, $length, $encoding );
1162
+		}
1163
+	}
1164 1164
         
1165
-    return substr( $str, $start, $length );
1165
+	return substr( $str, $start, $length );
1166 1166
 }
1167 1167
 
1168 1168
 /**
@@ -1195,20 +1195,20 @@  discard block
 block discarded – undo
1195 1195
  * @return string The resulting string.
1196 1196
  */
1197 1197
 function geodir_utf8_ucfirst( $str, $lower_str_end = false, $encoding = 'UTF-8' ) {
1198
-    if ( function_exists( 'mb_strlen' ) ) {
1199
-        $first_letter = geodir_strtoupper( geodir_utf8_substr( $str, 0, 1, $encoding ), $encoding );
1200
-        $str_end = "";
1198
+	if ( function_exists( 'mb_strlen' ) ) {
1199
+		$first_letter = geodir_strtoupper( geodir_utf8_substr( $str, 0, 1, $encoding ), $encoding );
1200
+		$str_end = "";
1201 1201
         
1202
-        if ( $lower_str_end ) {
1203
-            $str_end = geodir_strtolower( geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding ), $encoding );
1204
-        } else {
1205
-            $str_end = geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding );
1206
-        }
1202
+		if ( $lower_str_end ) {
1203
+			$str_end = geodir_strtolower( geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding ), $encoding );
1204
+		} else {
1205
+			$str_end = geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding );
1206
+		}
1207 1207
         
1208
-        return $first_letter . $str_end;
1209
-    }
1208
+		return $first_letter . $str_end;
1209
+	}
1210 1210
 
1211
-    return ucfirst( $str );
1211
+	return ucfirst( $str );
1212 1212
 }
1213 1213
 
1214 1214
 function geodir_total_listings_count($post_type = false)
Please login to merge, or discard this patch.
Spacing   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
  * @since 1.4.6
14 14
  * @return int|null Return the page ID if present or null if not.
15 15
  */
16
-function geodir_add_listing_page_id(){
16
+function geodir_add_listing_page_id() {
17 17
     $gd_page_id = get_option('geodir_add_listing_page');
18 18
 
19 19
     if (function_exists('icl_object_id')) {
20
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
20
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
21 21
     }
22 22
 
23 23
     return $gd_page_id;
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
  * @since 1.4.6
31 31
  * @return int|null Return the page ID if present or null if not.
32 32
  */
33
-function geodir_preview_page_id(){
33
+function geodir_preview_page_id() {
34 34
     $gd_page_id = get_option('geodir_preview_page');
35 35
 
36 36
     if (function_exists('icl_object_id')) {
37
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
37
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
38 38
     }
39 39
 
40 40
     return $gd_page_id;
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
  * @since 1.4.6
48 48
  * @return int|null Return the page ID if present or null if not.
49 49
  */
50
-function geodir_success_page_id(){
50
+function geodir_success_page_id() {
51 51
     $gd_page_id = get_option('geodir_success_page');
52 52
 
53 53
     if (function_exists('icl_object_id')) {
54
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
54
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
55 55
     }
56 56
 
57 57
     return $gd_page_id;
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
  * @since 1.4.6
65 65
  * @return int|null Return the page ID if present or null if not.
66 66
  */
67
-function geodir_location_page_id(){
67
+function geodir_location_page_id() {
68 68
     $gd_page_id = get_option('geodir_location_page');
69 69
 
70 70
     if (function_exists('icl_object_id')) {
71
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
71
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
72 72
     }
73 73
 
74 74
     return $gd_page_id;
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
  * @since 1.5.4
82 82
  * @return int|null Return the page ID if present or null if not.
83 83
  */
84
-function geodir_home_page_id(){
84
+function geodir_home_page_id() {
85 85
     $gd_page_id = get_option('geodir_home_page');
86 86
 
87 87
     if (function_exists('icl_object_id')) {
88
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
88
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
89 89
     }
90 90
 
91 91
     return $gd_page_id;
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
  * @since 1.5.3
99 99
  * @return int|null Return the page ID if present or null if not.
100 100
  */
101
-function geodir_info_page_id(){
101
+function geodir_info_page_id() {
102 102
     $gd_page_id = get_option('geodir_info_page');
103 103
 
104 104
     if (function_exists('icl_object_id')) {
105
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
105
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
106 106
     }
107 107
 
108 108
     return $gd_page_id;
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
  * @since 1.5.3
116 116
  * @return int|null Return the page ID if present or null if not.
117 117
  */
118
-function geodir_login_page_id(){
118
+function geodir_login_page_id() {
119 119
     $gd_page_id = get_option('geodir_login_page');
120 120
 
121 121
     if (function_exists('icl_object_id')) {
122
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
122
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
123 123
     }
124 124
 
125 125
     return $gd_page_id;
@@ -133,20 +133,20 @@  discard block
 block discarded – undo
133 133
  * @since 1.5.3
134 134
  * @return int|null Return the page ID if present or null if not.
135 135
  */
136
-function geodir_login_url($args=array()){
136
+function geodir_login_url($args = array()) {
137 137
     $gd_page_id = get_option('geodir_login_page');
138 138
 
139 139
     if (function_exists('icl_object_id')) {
140
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
140
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
141 141
     }
142 142
 
143 143
     if (function_exists('geodir_location_geo_home_link')) {
144 144
         remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
145 145
     }
146 146
 
147
-    if (geodir_is_wpml()){
147
+    if (geodir_is_wpml()) {
148 148
         $home_url = icl_get_home_url();
149
-    }else{
149
+    } else {
150 150
         $home_url = home_url();
151 151
     }
152 152
 
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
155 155
     }
156 156
 
157
-    if($gd_page_id){
157
+    if ($gd_page_id) {
158 158
         $post = get_post($gd_page_id);
159 159
         $slug = $post->post_name;
160 160
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
161 161
         $login_url = trailingslashit($home_url)."$slug/";
162
-    }else{
162
+    } else {
163 163
         $login_url = trailingslashit($home_url)."?geodir_signup=true";
164 164
     }
165 165
 
166
-    if($args){
167
-        $login_url = add_query_arg($args,$login_url );
166
+    if ($args) {
167
+        $login_url = add_query_arg($args, $login_url);
168 168
     }
169 169
 
170 170
     /**
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
      * @param array $args The array of query args used.
179 179
      * @param int $gd_page_id The page id of the GD login page.
180 180
      */
181
-	    return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
181
+	    return apply_filters('geodir_login_url', $login_url, $args, $gd_page_id);
182 182
 }
183 183
 
184 184
 /**
@@ -189,20 +189,20 @@  discard block
 block discarded – undo
189 189
  * @since 1.5.16 Added WPML lang code to url.
190 190
  * @return string Info page url.
191 191
  */
192
-function geodir_info_url($args=array()){
192
+function geodir_info_url($args = array()) {
193 193
     $gd_page_id = get_option('geodir_info_page');
194 194
 
195 195
     if (function_exists('icl_object_id')) {
196
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
196
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
197 197
     }
198 198
 
199 199
     if (function_exists('geodir_location_geo_home_link')) {
200 200
         remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
201 201
     }
202 202
 
203
-    if (geodir_is_wpml()){
203
+    if (geodir_is_wpml()) {
204 204
         $home_url = icl_get_home_url();
205
-    }else{
205
+    } else {
206 206
         $home_url = home_url();
207 207
     }
208 208
 
@@ -210,17 +210,17 @@  discard block
 block discarded – undo
210 210
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
211 211
     }
212 212
 
213
-    if($gd_page_id){
213
+    if ($gd_page_id) {
214 214
         $post = get_post($gd_page_id);
215 215
         $slug = $post->post_name;
216 216
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
217 217
         $info_url = trailingslashit($home_url)."$slug/";
218
-    }else{
218
+    } else {
219 219
         $info_url = trailingslashit($home_url);
220 220
     }
221 221
 
222
-    if($args){
223
-        $info_url = add_query_arg($args,$info_url );
222
+    if ($args) {
223
+        $info_url = add_query_arg($args, $info_url);
224 224
     }
225 225
 
226 226
     return $info_url;
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
  * @param string $charset Character set to use for conversion.
239 239
  * @return string Returns converted string.
240 240
  */
241
-function geodir_ucwords($string, $charset='UTF-8') {
241
+function geodir_ucwords($string, $charset = 'UTF-8') {
242 242
     if (function_exists('mb_convert_case')) {
243 243
         return mb_convert_case($string, MB_CASE_TITLE, $charset);
244 244
     } else {
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
  * @param string $charset Character set to use for conversion.
259 259
  * @return string Returns converted string.
260 260
  */
261
-function geodir_strtolower($string, $charset='UTF-8') {
261
+function geodir_strtolower($string, $charset = 'UTF-8') {
262 262
     if (function_exists('mb_convert_case')) {
263 263
         return mb_convert_case($string, MB_CASE_LOWER, $charset);
264 264
     } else {
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
  * @param string $charset Character set to use for conversion.
279 279
  * @return string Returns converted string.
280 280
  */
281
-function geodir_strtoupper($string, $charset='UTF-8') {
281
+function geodir_strtoupper($string, $charset = 'UTF-8') {
282 282
     if (function_exists('mb_convert_case')) {
283 283
         return mb_convert_case($string, MB_CASE_UPPER, $charset);
284 284
     } else {
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	
310 310
 	$url = trim($parts[0]);
311 311
 	if ($formatted && $url != '') {
312
-		$url = str_replace( ' ', '%20', $url );
312
+		$url = str_replace(' ', '%20', $url);
313 313
 		$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url);
314 314
 		
315 315
 		if (0 !== stripos($url, 'mailto:')) {
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 		
320 320
 		$url = str_replace(';//', '://', $url);
321 321
 		
322
-		if (strpos($url, ':') === false && ! in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) {
323
-			$url = 'http://' . $url;
322
+		if (strpos($url, ':') === false && !in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) {
323
+			$url = 'http://'.$url;
324 324
 		}
325 325
 		
326 326
 		$url = wp_kses_normalize_entities($url);
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
  * @package GeoDirectory
463 463
  */
464 464
 function _gd_die_handler() {
465
-    if ( defined( 'GD_TESTING_MODE' ) ) {
465
+    if (defined('GD_TESTING_MODE')) {
466 466
         return '_gd_die_handler';
467 467
     } else {
468 468
         die();
@@ -480,10 +480,10 @@  discard block
 block discarded – undo
480 480
  * @param string $title   Optional. Error title.
481 481
  * @param int $status     Optional. Status code.
482 482
  */
483
-function gd_die( $message = '', $title = '', $status = 400 ) {
484
-    add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
485
-    add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
486
-    wp_die( $message, $title, array( 'response' => $status ));
483
+function gd_die($message = '', $title = '', $status = 400) {
484
+    add_filter('wp_die_ajax_handler', '_gd_die_handler', 10, 3);
485
+    add_filter('wp_die_handler', '_gd_die_handler', 10, 3);
486
+    wp_die($message, $title, array('response' => $status));
487 487
 }
488 488
 
489 489
 /*
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
  * @param string $php_format The PHP date format.
494 494
  * @return string The jQuery format date string.
495 495
  */
496
-function geodir_date_format_php_to_jqueryui( $php_format ) {
496
+function geodir_date_format_php_to_jqueryui($php_format) {
497 497
 	$symbols = array(
498 498
 		// Day
499 499
 		'd' => 'dd',
@@ -533,27 +533,27 @@  discard block
 block discarded – undo
533 533
 	$jqueryui_format = "";
534 534
 	$escaping = false;
535 535
 
536
-	for ( $i = 0; $i < strlen( $php_format ); $i++ ) {
536
+	for ($i = 0; $i < strlen($php_format); $i++) {
537 537
 		$char = $php_format[$i];
538 538
 
539 539
 		// PHP date format escaping character
540
-		if ( $char === '\\' ) {
540
+		if ($char === '\\') {
541 541
 			$i++;
542 542
 
543
-			if ( $escaping ) {
543
+			if ($escaping) {
544 544
 				$jqueryui_format .= $php_format[$i];
545 545
 			} else {
546
-				$jqueryui_format .= '\'' . $php_format[$i];
546
+				$jqueryui_format .= '\''.$php_format[$i];
547 547
 			}
548 548
 
549 549
 			$escaping = true;
550 550
 		} else {
551
-			if ( $escaping ) {
551
+			if ($escaping) {
552 552
 				$jqueryui_format .= "'";
553 553
 				$escaping = false;
554 554
 			}
555 555
 
556
-			if ( isset( $symbols[$char] ) ) {
556
+			if (isset($symbols[$char])) {
557 557
 				$jqueryui_format .= $symbols[$char];
558 558
 			} else {
559 559
 				$jqueryui_format .= $char;
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
  * @return string The untranslated date string.
573 573
  * @since 1.6.5
574 574
  */
575
-function geodir_maybe_untranslate_date($date){
575
+function geodir_maybe_untranslate_date($date) {
576 576
 	$english_long_months = array(
577 577
 		'January',
578 578
 		'February',
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 		'December',
589 589
 	);
590 590
 
591
-	$non_english_long_months  = array(
591
+	$non_english_long_months = array(
592 592
 		__('January'),
593 593
 		__('February'),
594 594
 		__('March'),
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 		__('November'),
603 603
 		__('December'),
604 604
 	);
605
-	$date = str_replace($non_english_long_months,$english_long_months,$date);
605
+	$date = str_replace($non_english_long_months, $english_long_months, $date);
606 606
 
607 607
 
608 608
 	$english_short_months = array(
@@ -621,21 +621,21 @@  discard block
 block discarded – undo
621 621
 	);
622 622
 
623 623
 	$non_english_short_months = array(
624
-		' '._x( 'Jan', 'January abbreviation' ).' ',
625
-		' '._x( 'Feb', 'February abbreviation' ).' ',
626
-		' '._x( 'Mar', 'March abbreviation' ).' ',
627
-		' '._x( 'Apr', 'April abbreviation' ).' ',
628
-		' '._x( 'May', 'May abbreviation' ).' ',
629
-		' '._x( 'Jun', 'June abbreviation' ).' ',
630
-		' '._x( 'Jul', 'July abbreviation' ).' ',
631
-		' '._x( 'Aug', 'August abbreviation' ).' ',
632
-		' '._x( 'Sep', 'September abbreviation' ).' ',
633
-		' '._x( 'Oct', 'October abbreviation' ).' ',
634
-		' '._x( 'Nov', 'November abbreviation' ).' ',
635
-		' '._x( 'Dec', 'December abbreviation' ).' ',
624
+		' '._x('Jan', 'January abbreviation').' ',
625
+		' '._x('Feb', 'February abbreviation').' ',
626
+		' '._x('Mar', 'March abbreviation').' ',
627
+		' '._x('Apr', 'April abbreviation').' ',
628
+		' '._x('May', 'May abbreviation').' ',
629
+		' '._x('Jun', 'June abbreviation').' ',
630
+		' '._x('Jul', 'July abbreviation').' ',
631
+		' '._x('Aug', 'August abbreviation').' ',
632
+		' '._x('Sep', 'September abbreviation').' ',
633
+		' '._x('Oct', 'October abbreviation').' ',
634
+		' '._x('Nov', 'November abbreviation').' ',
635
+		' '._x('Dec', 'December abbreviation').' ',
636 636
 	);
637 637
 
638
-	$date = str_replace($non_english_short_months,$english_short_months,$date);
638
+	$date = str_replace($non_english_short_months, $english_short_months, $date);
639 639
 
640 640
 
641 641
 	return $date;
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
  * @return string Trimmed string.
708 708
  */
709 709
 function geodir_excerpt($text, $length = 100, $options = array()) {
710
-    if (!(int)$length > 0) {
710
+    if (!(int) $length > 0) {
711 711
         return $text;
712 712
     }
713 713
     $default = array(
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
         $length = $truncateLength;
770 770
 
771 771
         foreach ($openTags as $tag) {
772
-            $suffix .= '</' . $tag . '>';
772
+            $suffix .= '</'.$tag.'>';
773 773
         }
774 774
     } else {
775 775
         if (geodir_strlen($text, $options) <= $length) {
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
         }
792 792
     }
793 793
 
794
-    return $prefix . $result . $suffix;
794
+    return $prefix.$result.$suffix;
795 795
 }
796 796
 
797 797
 /**
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
     $pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i';
829 829
     $replace = preg_replace_callback(
830 830
         $pattern,
831
-        function ($match) use ($strlen) {
831
+        function($match) use ($strlen) {
832 832
             $utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8');
833 833
 
834 834
             return str_repeat(' ', $strlen($utf8, 'UTF-8'));
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
     }
890 890
 
891 891
     if (empty($options['html'])) {
892
-        return (string)$substr($text, $start, $length);
892
+        return (string) $substr($text, $start, $length);
893 893
     }
894 894
 
895 895
     $totalOffset = 0;
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 
915 915
         $len = geodir_strlen($part, $options);
916 916
         if ($offset !== 0 || $totalLength + $len > $length) {
917
-            if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) {
917
+            if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8')) {
918 918
                 // Entities cannot be passed substr.
919 919
                 continue;
920 920
             }
@@ -960,39 +960,39 @@  discard block
 block discarded – undo
960 960
     return '';
961 961
 }
962 962
 
963
-function geodir_tool_restore_cpt_from_taxonomies(){
963
+function geodir_tool_restore_cpt_from_taxonomies() {
964 964
 
965 965
 	$cpts = get_option('geodir_post_types');
966 966
 
967
-	if(!empty($cpts)){return;}
967
+	if (!empty($cpts)) {return; }
968 968
 
969 969
 	$taxonomies = get_option('geodir_taxonomies');
970 970
 
971
-	if(empty($taxonomies)){return;}
971
+	if (empty($taxonomies)) {return; }
972 972
 
973 973
 	$cpts = array();
974 974
 
975
-	foreach($taxonomies as $key => $val){
975
+	foreach ($taxonomies as $key => $val) {
976 976
 
977
-		if(strpos($val['listing_slug'], '/') === false) {
978
-			$cpts[$val['object_type']] = array('cpt'=>$val['object_type'],'slug'=>$val['listing_slug']);
977
+		if (strpos($val['listing_slug'], '/') === false) {
978
+			$cpts[$val['object_type']] = array('cpt'=>$val['object_type'], 'slug'=>$val['listing_slug']);
979 979
 		}
980 980
 
981 981
 	}
982 982
 
983
-	if(empty($cpts)){return;}
983
+	if (empty($cpts)) {return; }
984 984
 
985 985
 
986 986
 	$cpts_restore = $cpts;
987 987
 
988
-	foreach($cpts as $cpt){
988
+	foreach ($cpts as $cpt) {
989 989
 
990 990
 
991
-		$is_custom = $cpt['cpt']=='gd_place' ? 0 : 1;
991
+		$is_custom = $cpt['cpt'] == 'gd_place' ? 0 : 1;
992 992
 
993
-		$cpts_restore[$cpt['cpt']] = array (
993
+		$cpts_restore[$cpt['cpt']] = array(
994 994
 				'labels' =>
995
-					array (
995
+					array(
996 996
 						'name' => $cpt['slug'],
997 997
 						'singular_name' => $cpt['slug'],
998 998
 						'add_new' => 'Add New',
@@ -1020,14 +1020,14 @@  discard block
 block discarded – undo
1020 1020
 				'public' => true,
1021 1021
 				'query_var' => true,
1022 1022
 				'rewrite' =>
1023
-					array (
1023
+					array(
1024 1024
 						'slug' => $cpt['slug'],
1025 1025
 						'with_front' => false,
1026 1026
 						'hierarchical' => true,
1027 1027
 						'feeds' => true,
1028 1028
 					),
1029 1029
 				'supports' =>
1030
-					array (
1030
+					array(
1031 1031
 						0 => 'title',
1032 1032
 						1 => 'editor',
1033 1033
 						2 => 'author',
@@ -1037,14 +1037,14 @@  discard block
 block discarded – undo
1037 1037
 						6 => 'comments',
1038 1038
 					),
1039 1039
 				'taxonomies' =>
1040
-					array (
1040
+					array(
1041 1041
 						0 => $cpt['cpt'].'category',
1042 1042
 						1 => $cpt['cpt'].'_tags',
1043 1043
 					),
1044 1044
 				'is_custom' => $is_custom,
1045 1045
 				'listing_order' => '1',
1046 1046
 				'seo' =>
1047
-					array (
1047
+					array(
1048 1048
 						'meta_keyword' => '',
1049 1049
 						'meta_description' => '',
1050 1050
 					),
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
 	}
1057 1057
 
1058 1058
 
1059
-	update_option('geodir_post_types',$cpts_restore);
1059
+	update_option('geodir_post_types', $cpts_restore);
1060 1060
 
1061 1061
 }
1062 1062
 
@@ -1074,12 +1074,12 @@  discard block
 block discarded – undo
1074 1074
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1075 1075
  * @return string
1076 1076
  */
1077
-function geodir_utf8_strimwidth( $str, $start, $width, $trimmaker = '', $encoding = 'UTF-8' ) {
1078
-    if ( function_exists( 'mb_strimwidth' ) ) {
1079
-        return mb_strimwidth( $str, $start, $width, $trimmaker, $encoding );
1077
+function geodir_utf8_strimwidth($str, $start, $width, $trimmaker = '', $encoding = 'UTF-8') {
1078
+    if (function_exists('mb_strimwidth')) {
1079
+        return mb_strimwidth($str, $start, $width, $trimmaker, $encoding);
1080 1080
     }
1081 1081
     
1082
-    return geodir_utf8_substr( $str, $start, $width, $encoding ) . $trimmaker;
1082
+    return geodir_utf8_substr($str, $start, $width, $encoding).$trimmaker;
1083 1083
 }
1084 1084
 
1085 1085
 /**
@@ -1092,12 +1092,12 @@  discard block
 block discarded – undo
1092 1092
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1093 1093
  * @return int Returns the number of characters in string.
1094 1094
  */
1095
-function geodir_utf8_strlen( $str, $encoding = 'UTF-8' ) {
1096
-    if ( function_exists( 'mb_strlen' ) ) {
1097
-        return mb_strlen( $str, $encoding );
1095
+function geodir_utf8_strlen($str, $encoding = 'UTF-8') {
1096
+    if (function_exists('mb_strlen')) {
1097
+        return mb_strlen($str, $encoding);
1098 1098
     }
1099 1099
         
1100
-    return strlen( $str );
1100
+    return strlen($str);
1101 1101
 }
1102 1102
 
1103 1103
 /**
@@ -1112,12 +1112,12 @@  discard block
 block discarded – undo
1112 1112
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1113 1113
  * @return int Returns the position of the first occurrence of search in the string.
1114 1114
  */
1115
-function geodir_utf8_strpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
1116
-    if ( function_exists( 'mb_strpos' ) ) {
1117
-        return mb_strpos( $str, $find, $offset, $encoding );
1115
+function geodir_utf8_strpos($str, $find, $offset = 0, $encoding = 'UTF-8') {
1116
+    if (function_exists('mb_strpos')) {
1117
+        return mb_strpos($str, $find, $offset, $encoding);
1118 1118
     }
1119 1119
         
1120
-    return strpos( $str, $find, $offset );
1120
+    return strpos($str, $find, $offset);
1121 1121
 }
1122 1122
 
1123 1123
 /**
@@ -1132,12 +1132,12 @@  discard block
 block discarded – undo
1132 1132
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1133 1133
  * @return int Returns the position of the last occurrence of search.
1134 1134
  */
1135
-function geodir_utf8_strrpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
1136
-    if ( function_exists( 'mb_strrpos' ) ) {
1137
-        return mb_strrpos( $str, $find, $offset, $encoding );
1135
+function geodir_utf8_strrpos($str, $find, $offset = 0, $encoding = 'UTF-8') {
1136
+    if (function_exists('mb_strrpos')) {
1137
+        return mb_strrpos($str, $find, $offset, $encoding);
1138 1138
     }
1139 1139
         
1140
-    return strrpos( $str, $find, $offset );
1140
+    return strrpos($str, $find, $offset);
1141 1141
 }
1142 1142
 
1143 1143
 /**
@@ -1153,16 +1153,16 @@  discard block
 block discarded – undo
1153 1153
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1154 1154
  * @return string
1155 1155
  */
1156
-function geodir_utf8_substr( $str, $start, $length = null, $encoding = 'UTF-8' ) {
1157
-    if ( function_exists( 'mb_substr' ) ) {
1158
-        if ( $length === null ) {
1159
-            return mb_substr( $str, $start, geodir_utf8_strlen( $str, $encoding ), $encoding );
1156
+function geodir_utf8_substr($str, $start, $length = null, $encoding = 'UTF-8') {
1157
+    if (function_exists('mb_substr')) {
1158
+        if ($length === null) {
1159
+            return mb_substr($str, $start, geodir_utf8_strlen($str, $encoding), $encoding);
1160 1160
         } else {
1161
-            return mb_substr( $str, $start, $length, $encoding );
1161
+            return mb_substr($str, $start, $length, $encoding);
1162 1162
         }
1163 1163
     }
1164 1164
         
1165
-    return substr( $str, $start, $length );
1165
+    return substr($str, $start, $length);
1166 1166
 }
1167 1167
 
1168 1168
 /**
@@ -1175,12 +1175,12 @@  discard block
 block discarded – undo
1175 1175
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1176 1176
  * @return string The width of string.
1177 1177
  */
1178
-function geodir_utf8_strwidth( $str, $encoding = 'UTF-8' ) {
1179
-	if ( function_exists( 'mb_strwidth' ) ) {
1180
-		return mb_strwidth( $str, $encoding );
1178
+function geodir_utf8_strwidth($str, $encoding = 'UTF-8') {
1179
+	if (function_exists('mb_strwidth')) {
1180
+		return mb_strwidth($str, $encoding);
1181 1181
 	}
1182 1182
 
1183
-	return geodir_utf8_strlen( $str, $encoding );
1183
+	return geodir_utf8_strlen($str, $encoding);
1184 1184
 }
1185 1185
 
1186 1186
 /**
@@ -1194,21 +1194,21 @@  discard block
 block discarded – undo
1194 1194
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1195 1195
  * @return string The resulting string.
1196 1196
  */
1197
-function geodir_utf8_ucfirst( $str, $lower_str_end = false, $encoding = 'UTF-8' ) {
1198
-    if ( function_exists( 'mb_strlen' ) ) {
1199
-        $first_letter = geodir_strtoupper( geodir_utf8_substr( $str, 0, 1, $encoding ), $encoding );
1197
+function geodir_utf8_ucfirst($str, $lower_str_end = false, $encoding = 'UTF-8') {
1198
+    if (function_exists('mb_strlen')) {
1199
+        $first_letter = geodir_strtoupper(geodir_utf8_substr($str, 0, 1, $encoding), $encoding);
1200 1200
         $str_end = "";
1201 1201
         
1202
-        if ( $lower_str_end ) {
1203
-            $str_end = geodir_strtolower( geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding ), $encoding );
1202
+        if ($lower_str_end) {
1203
+            $str_end = geodir_strtolower(geodir_utf8_substr($str, 1, geodir_utf8_strlen($str, $encoding), $encoding), $encoding);
1204 1204
         } else {
1205
-            $str_end = geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding );
1205
+            $str_end = geodir_utf8_substr($str, 1, geodir_utf8_strlen($str, $encoding), $encoding);
1206 1206
         }
1207 1207
         
1208
-        return $first_letter . $str_end;
1208
+        return $first_letter.$str_end;
1209 1209
     }
1210 1210
 
1211
-    return ucfirst( $str );
1211
+    return ucfirst($str);
1212 1212
 }
1213 1213
 
1214 1214
 function geodir_total_listings_count($post_type = false)
@@ -1218,13 +1218,13 @@  discard block
 block discarded – undo
1218 1218
 	$count = 0;
1219 1219
 	
1220 1220
 	if ($post_type) {
1221
-		$count = $count + $wpdb->get_var("select count(post_id) from " . $wpdb->prefix . "geodir_" . $post_type . "_detail");
1221
+		$count = $count + $wpdb->get_var("select count(post_id) from ".$wpdb->prefix."geodir_".$post_type."_detail");
1222 1222
 	} else {
1223 1223
 		$all_postypes = geodir_get_posttypes();
1224 1224
 
1225 1225
 		if (!empty($all_postypes)) {
1226 1226
 			foreach ($all_postypes as $key) {
1227
-				$count = $count + $wpdb->get_var("select count(post_id) from " . $wpdb->prefix . "geodir_" . $key . "_detail");
1227
+				$count = $count + $wpdb->get_var("select count(post_id) from ".$wpdb->prefix."geodir_".$key."_detail");
1228 1228
 			}
1229 1229
 		}	
1230 1230
 	}
Please login to merge, or discard this patch.
geodirectory-templates/listing-filter-form.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -13,26 +13,26 @@  discard block
 block discarded – undo
13 13
 global $wp_query, $current_term, $query;
14 14
 
15 15
 if (function_exists('geodir_location_geo_home_link')) {
16
-    remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
16
+	remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
17 17
 }
18 18
 
19 19
 if (geodir_is_wpml() && defined('DOING_AJAX') && DOING_AJAX){
20
-    $search_url = icl_get_home_url();
20
+	$search_url = icl_get_home_url();
21 21
 } else {
22
-    $search_url = get_home_url();
22
+	$search_url = get_home_url();
23 23
 }
24 24
 
25 25
 $search_url = trailingslashit($search_url);
26 26
 
27 27
 if (function_exists('geodir_location_geo_home_link')) {
28
-    add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
28
+	add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
29 29
 }
30 30
 
31 31
 $new_style = get_option('geodir_show_search_old_search_from') ? false : true;
32 32
 $form_class = 'geodir-listing-search';
33 33
 
34 34
 if($new_style){
35
-    $form_class .= ' gd-search-bar-style';
35
+	$form_class .= ' gd-search-bar-style';
36 36
 }
37 37
 ?>
38 38
 <form class="<?php
@@ -49,56 +49,56 @@  discard block
 block discarded – undo
49 49
     <div class="geodir-loc-bar">
50 50
 
51 51
         <?php
52
-        /**
53
-         * Called inside the search form but before any of the fields.
54
-         *
55
-         * @since 1.0.0
56
-         */
57
-        do_action('geodir_before_search_form') ?>
52
+		/**
53
+		 * Called inside the search form but before any of the fields.
54
+		 *
55
+		 * @since 1.0.0
56
+		 */
57
+		do_action('geodir_before_search_form') ?>
58 58
 
59 59
         <div class="clearfix geodir-loc-bar-in">
60 60
             <div class="geodir-search">
61 61
 
62 62
                 <?php
63 63
 
64
-                /**
65
-                 * Adds the input fields to the search form.
66
-                 *
67
-                 * @since 1.6.9
68
-                 */
69
-                do_action('geodir_search_form_inputs');
64
+				/**
65
+				 * Adds the input fields to the search form.
66
+				 *
67
+				 * @since 1.6.9
68
+				 */
69
+				do_action('geodir_search_form_inputs');
70 70
 
71 71
 
72 72
 
73
-                /**
74
-                 * Called on the GD search form just before the search button.
75
-                 *
76
-                 * @since 1.0.0
77
-                 */
78
-                do_action('geodir_before_search_button');
73
+				/**
74
+				 * Called on the GD search form just before the search button.
75
+				 *
76
+				 * @since 1.0.0
77
+				 */
78
+				do_action('geodir_before_search_button');
79 79
 
80 80
                 
81
-                /**
82
-                 * Called on the GD search form just after the search button.
83
-                 *
84
-                 * @since 1.0.0
85
-                 */
86
-                do_action('geodir_after_search_button');
81
+				/**
82
+				 * Called on the GD search form just after the search button.
83
+				 *
84
+				 * @since 1.0.0
85
+				 */
86
+				do_action('geodir_after_search_button');
87 87
 
88 88
                 
89
-                ?>
89
+				?>
90 90
             </div>
91 91
 
92 92
 
93 93
         </div>
94 94
 
95 95
         <?php
96
-        /**
97
-         * Called inside the search form but after all the input fields.
98
-         *
99
-         * @since 1.0.0
100
-         */
101
-        do_action('geodir_after_search_form') ?>
96
+		/**
97
+		 * Called inside the search form but after all the input fields.
98
+		 *
99
+		 * @since 1.0.0
100
+		 */
101
+		do_action('geodir_after_search_form') ?>
102 102
 
103 103
 
104 104
     </div>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
17 17
 }
18 18
 
19
-if (geodir_is_wpml() && defined('DOING_AJAX') && DOING_AJAX){
19
+if (geodir_is_wpml() && defined('DOING_AJAX') && DOING_AJAX) {
20 20
     $search_url = icl_get_home_url();
21 21
 } else {
22 22
     $search_url = get_home_url();
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 $new_style = get_option('geodir_show_search_old_search_from') ? false : true;
32 32
 $form_class = 'geodir-listing-search';
33 33
 
34
-if($new_style){
34
+if ($new_style) {
35 35
     $form_class .= ' gd-search-bar-style';
36 36
 }
37 37
 ?>
Please login to merge, or discard this patch.