Test Failed
Pull Request — master (#274)
by Viruthagiri
10:39
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
@@ -45,9 +45,10 @@  discard block
 block discarded – undo
45 45
 $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
46 46
 if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') {
47 47
     $mapzoom = 4;
48
-    if (isset($_REQUEST['add_hood']))
49
-        $mapzoom = 10;
50
-}
48
+    if (isset($_REQUEST['add_hood'])) {
49
+            $mapzoom = 10;
50
+    }
51
+    }
51 52
 
52 53
 /**
53 54
  * Filter the auto change address fields values
@@ -641,8 +642,9 @@  discard block
 block discarded – undo
641 642
 </script>
642 643
 <?php
643 644
 $set_button_class = 'geodir_button';
644
-if (is_admin())
645
-    $set_button_class = 'button-primary';
645
+if (is_admin()) {
646
+    $set_button_class = 'button-primary';
647
+}
646 648
 ?>
647 649
 <input type="button" id="<?php echo $prefix; ?>set_address_button" class="<?php echo $set_button_class; ?>"
648 650
        value="<?php _e($map_title, 'geodirectory'); ?>" style="float:none;"/>
Please login to merge, or discard this patch.
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
 $defaultcity = isset($default_location->city) ? $default_location->city : '';
35 35
 $lat_lng_blank = false;
36 36
 if ($lat == '' && $lng == '') {
37
-    $lat_lng_blank = true;
38
-    $city = $defaultcity;
39
-    $region = isset($default_location->region) ? $default_location->region : '';
40
-    $country = isset($default_location->country) ? $default_location->country : '';
41
-    $lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
42
-    $lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
37
+	$lat_lng_blank = true;
38
+	$city = $defaultcity;
39
+	$region = isset($default_location->region) ? $default_location->region : '';
40
+	$country = isset($default_location->country) ? $default_location->country : '';
41
+	$lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
42
+	$lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
43 43
 }
44 44
 $default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
45 45
 $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
46 46
 if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') {
47
-    $mapzoom = 4;
48
-    if (isset($_REQUEST['add_hood']))
49
-        $mapzoom = 10;
47
+	$mapzoom = 4;
48
+	if (isset($_REQUEST['add_hood']))
49
+		$mapzoom = 10;
50 50
 }
51 51
 
52 52
 /**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 * Fires at the start of the add javascript on the add lsitings map.
68 68
 	 *
69 69
 	 * @since 1.0.0
70
-     * @param string $prefix The prefix for all elements.
70
+	 * @param string $prefix The prefix for all elements.
71 71
 	 */
72 72
 	do_action('geodir_add_listing_js_start', $prefix);
73 73
 	?>
@@ -314,13 +314,13 @@  discard block
 block discarded – undo
314 314
                 getZip = postal_code.long_name;
315 315
             }
316 316
             <?php 
317
-            /**
318
-             * Fires to add javascript variable to use in google map.
319
-             *
320
-             * @since 1.0.0
321
-             */
322
-            do_action('geodir_add_listing_geocode_js_vars');
323
-            ?>
317
+			/**
318
+			 * Fires to add javascript variable to use in google map.
319
+			 *
320
+			 * @since 1.0.0
321
+			 */
322
+			do_action('geodir_add_listing_geocode_js_vars');
323
+			?>
324 324
             <?php if ($is_map_restrict) { ?>
325 325
             if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
326 326
                 alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
@@ -400,15 +400,15 @@  discard block
 block discarded – undo
400 400
             }
401 401
         }
402 402
         <?php
403
-        /**
404
-         * Fires when marker address updated on map.
405
-         *
406
-         * @since 1.0.0
407
-         * @param string $prefix Identifier used as a prefix for field name
408
-         */
409
-        do_action('geodir_update_marker_address', $prefix);
410
-        echo $updateMarkerAddress = ob_get_clean();
411
-        ?>
403
+		/**
404
+		 * Fires when marker address updated on map.
405
+		 *
406
+		 * @since 1.0.0
407
+		 * @param string $prefix Identifier used as a prefix for field name
408
+		 */
409
+		do_action('geodir_update_marker_address', $prefix);
410
+		echo $updateMarkerAddress = ob_get_clean();
411
+		?>
412 412
     }
413 413
     function geodir_codeAddress(set_on_map) {
414 414
         var address = jQuery('#<?php echo $prefix.'address';?>').val();
@@ -435,9 +435,9 @@  discard block
 block discarded – undo
435 435
         }
436 436
         var is_restrict = '<?php echo $is_map_restrict; ?>';
437 437
         <?php ob_start();
438
-        $defaultregion = isset($default_location->region) ? $default_location->region : '';
439
-        $defaultcountry = isset($default_location->country) ? $default_location->country : '';
440
-        ?>
438
+		$defaultregion = isset($default_location->region) ? $default_location->region : '';
439
+		$defaultcountry = isset($default_location->country) ? $default_location->country : '';
440
+		?>
441 441
         if (set_on_map && is_restrict) {
442 442
             if (zip != '' && address != '') {
443 443
                 address = address + ',' + zip;
@@ -446,12 +446,12 @@  discard block
 block discarded – undo
446 446
             if (typeof address === 'undefined')
447 447
                 address = '';
448 448
             <?php
449
-            if(is_admin() && isset($_REQUEST['tab'])){?>
449
+			if(is_admin() && isset($_REQUEST['tab'])){?>
450 450
             if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
451 451
                 address = '';
452 452
             }
453 453
             <?php
454
-               }?>
454
+			   }?>
455 455
 
456 456
             if (ISO2 == 'GB') {
457 457
                 address = address + ',' + city + ',' + country + ',' + zip; // UK is funny with regions
@@ -460,15 +460,15 @@  discard block
 block discarded – undo
460 460
             }
461 461
         }
462 462
         <?php $codeAddress = ob_get_clean();
463
-        /**
464
-         * Filter the address variable
465
-         *
466
-         * @since 1.0.0
467
-         *
468
-         * @param string $codeAddress Row of address to use in google map.
469
-         */
470
-        echo apply_filters('geodir_codeaddress', $codeAddress);
471
-        ?>
463
+		/**
464
+		 * Filter the address variable
465
+		 *
466
+		 * @since 1.0.0
467
+		 *
468
+		 * @param string $codeAddress Row of address to use in google map.
469
+		 */
470
+		echo apply_filters('geodir_codeaddress', $codeAddress);
471
+		?>
472 472
         if (!window.gdMaps) { // No Google Map Loaded
473 473
             return;
474 474
         }
@@ -493,13 +493,13 @@  discard block
 block discarded – undo
493 493
                         updateMarkerPosition(baseMarker.getPosition());
494 494
                         //if(set_on_map && is_restrict) {
495 495
                         <?php 
496
-                        /**
497
-                         * Fires before set geocode position.
498
-                         *
499
-                         * @since 1.0.0
500
-                         */
501
-                        do_action('geodir_add_listing_codeaddress_before_geocode');
502
-                        ?>
496
+						/**
497
+						 * Fires before set geocode position.
498
+						 *
499
+						 * @since 1.0.0
500
+						 */
501
+						do_action('geodir_add_listing_codeaddress_before_geocode');
502
+						?>
503 503
                         geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
504 504
                         //}
505 505
                     } else {
@@ -545,13 +545,13 @@  discard block
 block discarded – undo
545 545
                 updateMarkerPositionOSM(baseMarker.getLatLng());
546 546
             }
547 547
             <?php 
548
-            /**
549
-             * Fires to add javascript variable to use in google map.
550
-             *
551
-             * @since 1.0.0
552
-             */
553
-            do_action('geodir_add_listing_geocode_js_vars');
554
-            ?>
548
+			/**
549
+			 * Fires to add javascript variable to use in google map.
550
+			 *
551
+			 * @since 1.0.0
552
+			 */
553
+			do_action('geodir_add_listing_geocode_js_vars');
554
+			?>
555 555
             <?php if ($is_map_restrict) { ?>
556 556
             if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
557 557
                 alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 <?php
700 700
 $set_button_class = 'geodir_button';
701 701
 if (is_admin())
702
-    $set_button_class = 'button-primary';
702
+	$set_button_class = 'button-primary';
703 703
 ?>
704 704
 <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;"/>
705 705
 <div id="<?php echo $prefix; ?>d_mouseClick"></div>
Please login to merge, or discard this patch.
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -81,16 +81,16 @@  discard block
 block discarded – undo
81 81
     window.gdMaps = window.gdMaps || gdMaps;
82 82
     
83 83
     user_address = false;
84
-    jQuery('#<?php echo $prefix.'address';?>').keypress(function () {
84
+    jQuery('#<?php echo $prefix.'address'; ?>').keypress(function () {
85 85
         user_address = true;
86 86
     });
87 87
 
88 88
     baseMarker = '';
89 89
     geocoder = '';
90
-    var <?php echo $prefix;?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat :  '39.952484'; ?>;
91
-    var <?php echo $prefix;?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng :  '-75.163786'; ?>;
92
-    <?php if($lat_lng_blank){$lat='';$lng='';}?>
93
-    var <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12;?>;
90
+    var <?php echo $prefix; ?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat : '39.952484'; ?>;
91
+    var <?php echo $prefix; ?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng : '-75.163786'; ?>;
92
+    <?php if ($lat_lng_blank) {$lat = ''; $lng = ''; }?>
93
+    var <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12; ?>;
94 94
     var minZoomLevel = <?php echo ($is_map_restrict) ? 5 : 0; ?>;
95 95
     var oldstr_address;
96 96
     var oldstr_zip;
@@ -322,9 +322,9 @@  discard block
 block discarded – undo
322 322
             do_action('geodir_add_listing_geocode_js_vars');
323 323
             ?>
324 324
             <?php if ($is_map_restrict) { ?>
325
-            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
326
-                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
327
-                jQuery("#<?php echo $prefix.'map';?>").goMap();
325
+            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
326
+                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
327
+                jQuery("#<?php echo $prefix.'map'; ?>").goMap();
328 328
                 jQuery.goMap.map.setCenter(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
329 329
                 baseMarker.setPosition(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
330 330
                 updateMarkerPosition(baseMarker.getPosition());
@@ -333,11 +333,11 @@  discard block
 block discarded – undo
333 333
             <?php } ?>
334 334
             updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry);
335 335
         } else {
336
-            updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
336
+            updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
337 337
         }
338 338
     }
339 339
     function centerMap(latlng) {
340
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
340
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
341 341
         if (window.gdMaps == 'google') {
342 342
             jQuery.goMap.map.panTo(baseMarker.getPosition());
343 343
         } else if (window.gdMaps == 'osm') {
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
         }
347 347
     }
348 348
     function centerMarker() {
349
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
349
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
350 350
         var center = jQuery.goMap.map.getCenter();
351 351
         if (window.gdMaps == 'google') {
352 352
             baseMarker.setPosition(center);
@@ -355,47 +355,47 @@  discard block
 block discarded – undo
355 355
         }
356 356
     }
357 357
     function updateMapZoom(zoom) {
358
-        jQuery('#<?php echo $prefix.'mapzoom';?>').val(zoom);
358
+        jQuery('#<?php echo $prefix.'mapzoom'; ?>').val(zoom);
359 359
     }
360 360
     function updateMarkerPosition(markerlatLng) {
361
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
362
-        jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat());
363
-        jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng());
361
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
362
+        jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat());
363
+        jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng());
364 364
     }
365 365
     function updateMarkerPositionOSM(markerlatLng) {
366
-        jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat);
367
-        jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng);
366
+        jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat);
367
+        jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng);
368 368
     }
369 369
     function updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry) {
370
-        var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields);?>';
371
-        <?php ob_start();?>
372
-        var old_country = jQuery("#<?php echo $prefix.'country';?>").val();
373
-        var old_region = jQuery("#<?php echo $prefix.'region';?>").val();
370
+        var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields); ?>';
371
+        <?php ob_start(); ?>
372
+        var old_country = jQuery("#<?php echo $prefix.'country'; ?>").val();
373
+        var old_region = jQuery("#<?php echo $prefix.'region'; ?>").val();
374 374
         
375
-        if (user_address == false || jQuery('#<?php echo $prefix.'address';?>').val() == '') {
376
-            jQuery("#<?php echo $prefix.'address';?>").val(getAddress);
375
+        if (user_address == false || jQuery('#<?php echo $prefix.'address'; ?>').val() == '') {
376
+            jQuery("#<?php echo $prefix.'address'; ?>").val(getAddress);
377 377
         }
378 378
         if (getAddress) {
379 379
             oldstr_address = getAddress;
380 380
         }
381 381
         
382
-        jQuery("#<?php echo $prefix.'zip';?>").val(getZip);
382
+        jQuery("#<?php echo $prefix.'zip'; ?>").val(getZip);
383 383
         if (getZip) {
384 384
             oldstr_zip = getZip;
385 385
         }
386 386
         if (set_map_val_in_fields) {
387 387
             if (getCountry) {
388
-                jQuery('#<?php echo $prefix.'country';?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
389
-                jQuery("#<?php echo $prefix.'country';?>").trigger("chosen:updated");
388
+                jQuery('#<?php echo $prefix.'country'; ?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
389
+                jQuery("#<?php echo $prefix.'country'; ?>").trigger("chosen:updated");
390 390
             }
391 391
             if (getState) {
392
-                if (jQuery('input[id="<?php echo $prefix.'region';?>"]').attr('id')) {
393
-                    jQuery("#<?php echo $prefix.'region';?>").val(getState);
392
+                if (jQuery('input[id="<?php echo $prefix.'region'; ?>"]').attr('id')) {
393
+                    jQuery("#<?php echo $prefix.'region'; ?>").val(getState);
394 394
                 }
395 395
             }
396 396
             if (getCity) {
397
-                if (jQuery('input[id="<?php echo $prefix.'city';?>"]').attr('id')) {
398
-                    jQuery("#<?php echo $prefix.'city';?>").val(getCity);
397
+                if (jQuery('input[id="<?php echo $prefix.'city'; ?>"]').attr('id')) {
398
+                    jQuery("#<?php echo $prefix.'city'; ?>").val(getCity);
399 399
                 }
400 400
             }
401 401
         }
@@ -411,12 +411,12 @@  discard block
 block discarded – undo
411 411
         ?>
412 412
     }
413 413
     function geodir_codeAddress(set_on_map) {
414
-        var address = jQuery('#<?php echo $prefix.'address';?>').val();
415
-        var zip = jQuery('#<?php echo $prefix.'zip';?>').val();
416
-        var city = jQuery('#<?php echo $prefix.'city';?>').val();
417
-        var region = jQuery('#<?php echo $prefix.'region';?>').val();
418
-        var country = jQuery('#<?php echo $prefix.'country';?>').val();
419
-        var country_selected = jQuery('#<?php echo $prefix.'country';?>').find('option:selected');
414
+        var address = jQuery('#<?php echo $prefix.'address'; ?>').val();
415
+        var zip = jQuery('#<?php echo $prefix.'zip'; ?>').val();
416
+        var city = jQuery('#<?php echo $prefix.'city'; ?>').val();
417
+        var region = jQuery('#<?php echo $prefix.'region'; ?>').val();
418
+        var country = jQuery('#<?php echo $prefix.'country'; ?>').val();
419
+        var country_selected = jQuery('#<?php echo $prefix.'country'; ?>').find('option:selected');
420 420
         var ISO2 = country_selected.data('country_code');
421 421
         if (ISO2 == '--') {
422 422
             ISO2 = '';
@@ -425,13 +425,13 @@  discard block
 block discarded – undo
425 425
             zip = '';
426 426
         }
427 427
         if (typeof city == "undefined") {
428
-            city = '<?php echo addslashes_gpc($city);?>';
428
+            city = '<?php echo addslashes_gpc($city); ?>';
429 429
         }
430 430
         if (typeof region == "undefined") {
431
-            region = '<?php echo addslashes_gpc($region);?>';
431
+            region = '<?php echo addslashes_gpc($region); ?>';
432 432
         }
433 433
         if (typeof country == "undefined") {
434
-            country = '<?php echo addslashes_gpc($country);?>';
434
+            country = '<?php echo addslashes_gpc($country); ?>';
435 435
         }
436 436
         var is_restrict = '<?php echo $is_map_restrict; ?>';
437 437
         <?php ob_start();
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
             if (typeof address === 'undefined')
447 447
                 address = '';
448 448
             <?php
449
-            if(is_admin() && isset($_REQUEST['tab'])){?>
449
+            if (is_admin() && isset($_REQUEST['tab'])) {?>
450 450
             if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
451 451
                 address = '';
452 452
             }
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
             geocoder.geocode({'address': address, 'country': ISO2},
487 487
                 function (results, status) {
488 488
                     console.log(status);
489
-                    jQuery("#<?php echo $prefix.'map';?>").goMap();
489
+                    jQuery("#<?php echo $prefix.'map'; ?>").goMap();
490 490
                     if (status == google.maps.GeocoderStatus.OK) {
491 491
                         baseMarker.setPosition(results[0].geometry.location);
492 492
                         jQuery.goMap.map.setCenter(results[0].geometry.location);
@@ -503,21 +503,21 @@  discard block
 block discarded – undo
503 503
                         geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
504 504
                         //}
505 505
                     } else {
506
-                        alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:','geodirectory'));?> ' + status);
506
+                        alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:', 'geodirectory')); ?> ' + status);
507 507
                     }
508 508
                 });
509 509
         }
510 510
     }
511 511
     function gdMaxMap() {
512
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
512
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
513 513
 
514
-        jQuery('#<?php echo $prefix.'map';?>').toggleClass('map-fullscreen');
514
+        jQuery('#<?php echo $prefix.'map'; ?>').toggleClass('map-fullscreen');
515 515
         jQuery('.map_category').toggleClass('map_category_fullscreen');
516
-        jQuery('#<?php echo $prefix;?>trigger').toggleClass('map_category_fullscreen');
516
+        jQuery('#<?php echo $prefix; ?>trigger').toggleClass('map_category_fullscreen');
517 517
         jQuery('body').toggleClass('body_fullscreen');
518
-        jQuery('#<?php echo $prefix;?>loading_div').toggleClass('loading_div_fullscreen');
519
-        jQuery('#<?php echo $prefix;?>advmap_nofound').toggleClass('nofound_fullscreen');
520
-        jQuery('#<?php echo $prefix;?>triggermap').toggleClass('triggermap_fullscreen');
518
+        jQuery('#<?php echo $prefix; ?>loading_div').toggleClass('loading_div_fullscreen');
519
+        jQuery('#<?php echo $prefix; ?>advmap_nofound').toggleClass('nofound_fullscreen');
520
+        jQuery('#<?php echo $prefix; ?>triggermap').toggleClass('triggermap_fullscreen');
521 521
         jQuery('.TopLeft').toggleClass('TopLeft_fullscreen');
522 522
         window.setTimeout(function () {
523 523
             if (window.gdMaps == 'google') {
@@ -553,9 +553,9 @@  discard block
 block discarded – undo
553 553
             do_action('geodir_add_listing_geocode_js_vars');
554 554
             ?>
555 555
             <?php if ($is_map_restrict) { ?>
556
-            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
557
-                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
558
-                jQuery("#<?php echo $prefix.'map';?>").goMap();
556
+            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
557
+                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
558
+                jQuery("#<?php echo $prefix.'map'; ?>").goMap();
559 559
                 centerMap(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
560 560
                 baseMarker.setLatLng(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
561 561
                 updateMarkerPositionOSM(baseMarker.getLatLng());
@@ -564,39 +564,39 @@  discard block
 block discarded – undo
564 564
             <?php } ?>
565 565
             updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry);
566 566
         } else {
567
-            alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
567
+            alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
568 568
         }
569 569
     }
570 570
     
571 571
     jQuery(function ($) {
572
-        $("#<?php echo $prefix.'map';?>").goMap({
573
-            latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT,
574
-            longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG,
575
-            zoom: <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT,
572
+        $("#<?php echo $prefix.'map'; ?>").goMap({
573
+            latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT,
574
+            longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG,
575
+            zoom: <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT,
576 576
             maptype: 'ROADMAP', // Map type - HYBRID, ROADMAP, SATELLITE, TERRAIN
577 577
             streetViewControl: true,
578
-            <?php if(get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,';}?>
578
+            <?php if (get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,'; }?>
579 579
         });
580 580
 
581 581
         if (window.gdMaps) {
582 582
             geocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : [];
583 583
 
584 584
             baseMarker = $.goMap.createMarker({
585
-                latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT,
586
-                longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG,
585
+                latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT,
586
+                longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG,
587 587
                 id: 'baseMarker',
588
-                icon: '<?php echo $marker_icon;?>',
588
+                icon: '<?php echo $marker_icon; ?>',
589 589
                 draggable: true,
590 590
                 addToMap: true, // For OSM
591
-                w: parseFloat('<?php echo $icon_size['w'];?>'),
592
-                h: parseFloat('<?php echo $icon_size['h'];?>'),
591
+                w: parseFloat('<?php echo $icon_size['w']; ?>'),
592
+                h: parseFloat('<?php echo $icon_size['h']; ?>'),
593 593
             });
594 594
         } else {
595
-            jQuery('#<?php echo $prefix.'advmap_nofound';?>').hide();
596
-            jQuery('#<?php echo $prefix.'advmap_notloaded';?>').show();
595
+            jQuery('#<?php echo $prefix.'advmap_nofound'; ?>').hide();
596
+            jQuery('#<?php echo $prefix.'advmap_notloaded'; ?>').show();
597 597
         }
598 598
         
599
-        $("#<?php echo $prefix;?>set_address_button").click(function () {
599
+        $("#<?php echo $prefix; ?>set_address_button").click(function () {
600 600
             var set_on_map = true;
601 601
             geodir_codeAddress(set_on_map);
602 602
         });
@@ -630,14 +630,14 @@  discard block
 block discarded – undo
630 630
                 updateMapZoom($.goMap.map.zoom);
631 631
             });
632 632
 
633
-            var maxMap = document.getElementById('<?php echo $prefix;?>triggermap');
633
+            var maxMap = document.getElementById('<?php echo $prefix; ?>triggermap');
634 634
             google.maps.event.addDomListener(maxMap, 'click', gdMaxMap);
635 635
 
636 636
             <?php if ($is_map_restrict) { ?>
637
-            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country);?>';
637
+            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country); ?>';
638 638
             geocoder.geocode({'address': CITY_ADDRESS},
639 639
                 function (results, status) {
640
-                    $("#<?php echo $prefix.'map';?>").goMap();
640
+                    $("#<?php echo $prefix.'map'; ?>").goMap();
641 641
                     if (status == google.maps.GeocoderStatus.OK) {
642 642
                         // Bounds for North America
643 643
                         var bound_lat_lng = String(results[0].geometry.bounds);
@@ -648,13 +648,13 @@  discard block
 block discarded – undo
648 648
                             new google.maps.LatLng(bound_lat_lng[2], bound_lat_lng[3])
649 649
                         );
650 650
                     } else {
651
-                        alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status);
651
+                        alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
652 652
                     }
653 653
                 });
654 654
             <?php } ?>
655 655
             // Limit the zoom level
656 656
             google.maps.event.addListener($.goMap.map, 'zoom_changed', function () {
657
-                $("#<?php echo $prefix.'map';?>").goMap();
657
+                $("#<?php echo $prefix.'map'; ?>").goMap();
658 658
                 if ($.goMap.map.getZoom() < minZoomLevel) $.goMap.map.setZoom(minZoomLevel);
659 659
             });
660 660
         } else if (window.gdMaps == 'osm') {
@@ -680,10 +680,10 @@  discard block
 block discarded – undo
680 680
                 updateMapZoom($.goMap.map.getZoom());
681 681
             });
682 682
 
683
-            L.DomEvent.addListener($('<?php echo $prefix;?>triggermap'), 'click', gdMaxMap);
683
+            L.DomEvent.addListener($('<?php echo $prefix; ?>triggermap'), 'click', gdMaxMap);
684 684
 
685 685
             <?php if ($is_map_restrict) { ?>
686
-            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country);?>';
686
+            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country); ?>';
687 687
             geocodePositionOSM('', CITY_ADDRESS);
688 688
             <?php } ?>
689 689
             // Limit the zoom level
@@ -706,14 +706,14 @@  discard block
 block discarded – undo
706 706
 <div class="top_banner_section_inn geodir_map_container clearfix" style="margin-top:10px;">
707 707
     <div class="TopLeft"><span id="<?php echo $prefix; ?>triggermap" style="margin-top:-11px;margin-left:-12px;"></span></div>
708 708
     <div class="TopRight"></div>
709
-    <div id="<?php echo $prefix . 'map'; ?>" class="geodir_map" style="height:300px">
709
+    <div id="<?php echo $prefix.'map'; ?>" class="geodir_map" style="height:300px">
710 710
         <!-- new map start -->
711 711
         <div class="iprelative">
712
-            <div id="<?php echo $prefix . 'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div>
712
+            <div id="<?php echo $prefix.'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div>
713 713
             <div id="<?php echo $prefix; ?>loading_div" style="height:300px"></div>
714 714
             <div id="<?php echo $prefix; ?>advmap_counter"></div>
715 715
             <div id="<?php echo $prefix; ?>advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div>
716
-            <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>
716
+            <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>
717 717
         </div>
718 718
         <!-- new map end -->
719 719
     </div>
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/map_template_tags.php 3 patches
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -223,10 +223,11 @@  discard block
 block discarded – undo
223 223
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/>
224 224
                 <?php }
225 225
 
226
-                if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
227
-                    $show_entire_cat_panel = "none";
228
-                else
229
-                    $show_entire_cat_panel = "''";
226
+                if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) {
227
+                                    $show_entire_cat_panel = "none";
228
+                } else {
229
+                                    $show_entire_cat_panel = "''";
230
+                }
230 231
                 ?>
231 232
 
232 233
                 <?php if ($geodir_map_options['enable_map_direction']) { ?>
@@ -288,8 +289,9 @@  discard block
 block discarded – undo
288 289
 				}
289 290
 				
290 291
 				$geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
291
-				if (empty($geodir_default_map_search_pt))
292
-					$geodir_default_map_search_pt = 'gd_place';
292
+				if (empty($geodir_default_map_search_pt)) {
293
+									$geodir_default_map_search_pt = 'gd_place';
294
+				}
293 295
 
294 296
 				/**
295 297
 				 * Filter the post type to retrive data for map
Please login to merge, or discard this patch.
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 
130 130
     if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
131 131
     } else {
132
-        $geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
132
+        $geodir_map_options['height'] = $geodir_map_options['height'].'px';
133 133
     }
134 134
 
135 135
     if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
136 136
     } else {
137
-        $geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
137
+        $geodir_map_options['width'] = $geodir_map_options['width'].'px';
138 138
     }
139 139
 
140 140
     /**
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	$exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map'));
168 168
 
169
-    if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
169
+    if (count((array) $post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
170 170
         // Set default map options
171 171
 
172
-        wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
172
+        wp_enqueue_script('geodir-map-widget', geodir_plugin_url().'/geodirectory-functions/map-functions/js/map.min.js', array(), false, true);
173 173
 
174 174
         wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
175 175
 
@@ -188,41 +188,41 @@  discard block
 block discarded – undo
188 188
 		 */
189 189
 		$map_width = apply_filters('geodir_change_map_width', $map_width);
190 190
         ?>
191
-        <div id="catcher_<?php echo $map_canvas_name;?>"></div>
191
+        <div id="catcher_<?php echo $map_canvas_name; ?>"></div>
192 192
         <div class="stick_trigger_container">
193 193
             <div class="trigger_sticky triggeroff_sticky"></div>
194
-            <div class="top_banner_section geodir_map_container <?php echo $map_class_name;?>"
195
-                 id="sticky_map_<?php echo $map_canvas_name;?>"
196
-                 style="min-height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;">
194
+            <div class="top_banner_section geodir_map_container <?php echo $map_class_name; ?>"
195
+                 id="sticky_map_<?php echo $map_canvas_name; ?>"
196
+                 style="min-height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;">
197 197
 
198 198
                 <div class="map_background">
199 199
                     <div class="top_banner_section_in clearfix">
200
-                        <div class="<?php echo $map_canvas_name;?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name;?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div>
201
-                        <div class="<?php echo $map_canvas_name;?>_TopRight TopRight"></div>
202
-                        <div id="<?php echo $map_canvas_name;?>_wrapper" class="main_map_wrapper"
203
-                             style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;">
200
+                        <div class="<?php echo $map_canvas_name; ?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name; ?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div>
201
+                        <div class="<?php echo $map_canvas_name; ?>_TopRight TopRight"></div>
202
+                        <div id="<?php echo $map_canvas_name; ?>_wrapper" class="main_map_wrapper"
203
+                             style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;">
204 204
                             <!-- new map start -->
205 205
                             <div class="iprelative">
206
-                                <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name;?>"
207
-                                     style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div>
208
-                                <div id="<?php echo $map_canvas_name;?>_loading_div" class="loading_div"
209
-                                     style=" height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div>
206
+                                <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name; ?>"
207
+                                     style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div>
208
+                                <div id="<?php echo $map_canvas_name; ?>_loading_div" class="loading_div"
209
+                                     style=" height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div>
210 210
                                 <!--<div id="home_map_counter"></div>        -->
211
-                                <div id="<?php echo $map_canvas_name;?>_map_nofound"
211
+                                <div id="<?php echo $map_canvas_name; ?>_map_nofound"
212 212
                                      class="advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div>
213
-                                <div id="<?php echo $map_canvas_name;?>_map_notloaded"
213
+                                <div id="<?php echo $map_canvas_name; ?>_map_notloaded"
214 214
                                      class="advmap_notloaded"><?php _e('<h3>Google Map Not Loaded</h3><p>Sorry, unable to load Google Maps API.', 'geodirectory'); ?></div>
215 215
                             </div>
216 216
                             <!-- new map end -->
217 217
                         </div>
218
-                        <div class="<?php echo $map_canvas_name;?>_BottomLeft BottomLeft"></div>
218
+                        <div class="<?php echo $map_canvas_name; ?>_BottomLeft BottomLeft"></div>
219 219
                     </div>
220 220
                 </div>
221 221
                 <?php if ($geodir_map_options['enable_jason_on_load']) { ?>
222
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/>
222
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="1"/>
223 223
                 <?php } else {
224 224
                     ?>
225
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/>
225
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="0"/>
226 226
                 <?php }
227 227
 
228 228
                 if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
                            onclick="calcRoute('<?php echo $map_canvas_name; ?>')"/>
243 243
 
244 244
                     <script>
245
-                        <?php if(geodir_is_page('detail')){?>
245
+                        <?php if (geodir_is_page('detail')) {?>
246 246
                         jQuery(function () {
247 247
                             gd_initialize_ac();
248 248
                         });
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
                                 // Create the autocomplete object, restricting the search
254 254
                                 // to geographical location types.
255 255
                                 autocomplete = new google.maps.places.Autocomplete(
256
-                                    /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name;?>_fromAddress')),
256
+                                    /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name; ?>_fromAddress')),
257 257
                                     {types: ['geocode']});
258 258
                                 // When the user selects an address from the dropdown,
259 259
                                 // populate the address fields in the form.
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 				 */
308 308
 				$map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt);
309 309
 				?>
310
-                <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>">
310
+                <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel; ?>">
311 311
                     <?php
312 312
                     $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
313 313
                     $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
@@ -317,12 +317,12 @@  discard block
 block discarded – undo
317 317
 					}
318 318
                     ?>
319 319
                     <div
320
-                        class="map-category-listing<?php echo $map_cat_class;?>">
320
+                        class="map-category-listing<?php echo $map_cat_class; ?>">
321 321
                         <div class="trigger triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div>
322
-                        <div id="<?php echo $map_canvas_name;?>_cat"
323
-                             class="<?php echo $map_canvas_name;?>_map_category  map_category"
324
-                             <?php if ($child_collapse){ ?>checked="checked" <?php }?>
325
-                             style="max-height:<?php echo $geodir_map_options['height'];?>;">
322
+                        <div id="<?php echo $map_canvas_name; ?>_cat"
323
+                             class="<?php echo $map_canvas_name; ?>_map_category  map_category"
324
+                             <?php if ($child_collapse) { ?>checked="checked" <?php }?>
325
+                             style="max-height:<?php echo $geodir_map_options['height']; ?>;">
326 326
                             <input
327 327
                                 onkeydown="if(event.keyCode == 13){build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false)}"
328 328
                                 type="text"
@@ -334,11 +334,11 @@  discard block
 block discarded – undo
334 334
                                     <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/>
335 335
                                 <?php } else {$child_collapse = "0";
336 336
                                     ?>
337
-                                    <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/>
337
+                                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="0"/>
338 338
                                 <?php } ?>
339 339
                                 <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/>
340 340
                                 <div class="toggle">
341
-                                    <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'),0,true,0,$map_canvas_name,$child_collapse,true); ?>
341
+                                    <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'), 0, true, 0, $map_canvas_name, $child_collapse, true); ?>
342 342
                                     <script>jQuery( document ).ready(function() {
343 343
                                             geodir_show_sub_cat_collapse_button();
344 344
                                         });</script>
@@ -367,21 +367,21 @@  discard block
 block discarded – undo
367 367
 					$city = $country != 'me' ? $city : '';
368 368
                     $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : '';
369 369
                     ?>
370
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/>
371
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country"
372
-                           value="<?php echo $country;?>"/>
373
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_region" name="gd_region"
374
-                           value="<?php echo $region;?>"/>
375
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_city" name="gd_city"
376
-                           value="<?php echo $city;?>"/>
377
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood"
378
-                           value="<?php echo $gd_neighbourhood;?>"/>
370
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="1"/>
371
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_country" name="gd_country"
372
+                           value="<?php echo $country; ?>"/>
373
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_region" name="gd_region"
374
+                           value="<?php echo $region; ?>"/>
375
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_city" name="gd_city"
376
+                           value="<?php echo $city; ?>"/>
377
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_neighbourhood" name="gd_neighbourhood"
378
+                           value="<?php echo $gd_neighbourhood; ?>"/>
379 379
                 <?php } else { //end of location filter
380 380
                     ?>
381
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/>
381
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="0"/>
382 382
                 <?php }?>
383 383
 
384
-                <input type="hidden" id="<?php echo $map_canvas_name;?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt;?>"/>
384
+                <input type="hidden" id="<?php echo $map_canvas_name; ?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt; ?>"/>
385 385
 
386 386
                 <input type="hidden" name="limitstart" value=""/>
387 387
 
@@ -389,10 +389,10 @@  discard block
 block discarded – undo
389 389
 
390 390
                 <?php if ($geodir_map_options['enable_post_type_filters']) {
391 391
                     $post_types = geodir_get_posttypes('object');
392
-                    if (count((array)($post_types)) > 1) {
392
+                    if (count((array) ($post_types)) > 1) {
393 393
                         ?>
394
-                        <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu"
395
-                             style="max-width:<?php echo $map_width;?>!important;">
394
+                        <div class="map-places-listing" id="<?php echo $map_canvas_name; ?>_posttype_menu"
395
+                             style="max-width:<?php echo $map_width; ?>!important;">
396 396
 
397 397
                             <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
398 398
                             <div class="geodir-map-posttype-list"><?php } ?>
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
                                     foreach ($post_types as $post_type => $args) {
404 404
                                         if (!in_array($post_type, $exclude_post_types)) {
405 405
                                             $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
406
-											echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __(ucfirst($args->labels->name), 'geodirectory') . '</a></li>';
406
+											echo '<li id="'.$post_type.'" '.$class.'><a href="javascript:void(0);" onclick="jQuery(\'#'.$map_canvas_name.'_posttype\').val(\''.$post_type.'\');build_map_ajax_search_param(\''.$map_canvas_name.'\', true)">'.__(ucfirst($args->labels->name), 'geodirectory').'</a></li>';
407 407
                                         }
408 408
                                     }
409 409
                                     ?>
@@ -428,9 +428,9 @@  discard block
 block discarded – undo
428 428
         <script type="text/javascript">
429 429
 
430 430
             jQuery(document).ready(function () {
431
-                //initMap('<?php echo $map_canvas_name;?>'); // depreciated, no need to load this twice
432
-                build_map_ajax_search_param('<?php echo $map_canvas_name;?>', false);
433
-                map_sticky('<?php echo $map_canvas_name;?>');
431
+                //initMap('<?php echo $map_canvas_name; ?>'); // depreciated, no need to load this twice
432
+                build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false);
433
+                map_sticky('<?php echo $map_canvas_name; ?>');
434 434
             });
435 435
 
436 436
         </script>
@@ -441,18 +441,18 @@  discard block
 block discarded – undo
441 441
             <script>
442 442
                 (function () {
443 443
                     var screenH = jQuery(window).height();
444
-                    var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']);?>";
444
+                    var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']); ?>";
445 445
 
446 446
                     var ptypeH = '';
447
-                    if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
448
-                        ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
447
+                    if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
448
+                        ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
449 449
                     }
450 450
 
451
-                    jQuery("#sticky_map_<?php echo $map_canvas_name;?>").css("min-height", screenH * (heightVH / 100) + 'px');
452
-                    jQuery("#<?php echo $map_canvas_name;?>_wrapper").height(screenH * (heightVH / 100) + 'px');
453
-                    jQuery("#<?php echo $map_canvas_name;?>").height(screenH * (heightVH / 100) + 'px');
454
-                    jQuery("#<?php echo $map_canvas_name;?>_loading_div").height(screenH * (heightVH / 100) + 'px');
455
-                    jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
451
+                    jQuery("#sticky_map_<?php echo $map_canvas_name; ?>").css("min-height", screenH * (heightVH / 100) + 'px');
452
+                    jQuery("#<?php echo $map_canvas_name; ?>_wrapper").height(screenH * (heightVH / 100) + 'px');
453
+                    jQuery("#<?php echo $map_canvas_name; ?>").height(screenH * (heightVH / 100) + 'px');
454
+                    jQuery("#<?php echo $map_canvas_name; ?>_loading_div").height(screenH * (heightVH / 100) + 'px');
455
+                    jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
456 456
 
457 457
                 }());
458 458
             </script>
@@ -464,13 +464,13 @@  discard block
 block discarded – undo
464 464
             <script>
465 465
                 (function () {
466 466
                     var screenH = jQuery(window).height();
467
-                    var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']);?>";
467
+                    var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']); ?>";
468 468
                     var ptypeH = '';
469
-                    if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
470
-                        ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
469
+                    if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
470
+                        ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
471 471
                     }
472 472
 
473
-                    jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", heightVH - ptypeH + 'px');
473
+                    jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", heightVH - ptypeH + 'px');
474 474
 
475 475
                 }());
476 476
             </script>
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
          * @param array $geodir_map_options Array of map settings.
486 486
          * @param string $map_canvas_name The canvas name and ID for the map.
487 487
          */
488
-        do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
488
+        do_action('geodir_map_after_render', $geodir_map_options, $map_canvas_name);
489 489
 
490 490
 
491 491
     endif; // Exclude posttypes if end
Please login to merge, or discard this patch.
Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -67,77 +67,77 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function geodir_draw_map($map_args = array())
69 69
 {
70
-    global $map_canvas_arr;
71
-    $map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas';
72
-    $map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : '';
73
-
74
-    $default_location = geodir_get_default_location();
75
-
76
-    $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
77
-    $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
78
-    $map_default_zoom = 12;
79
-    // map options default values
80
-    $width = 950;
81
-    $height = 450;
82
-    $child_collapse = '0';
83
-    $sticky = '';
84
-    $enable_cat_filters = false;
85
-    $enable_text_search = false;
86
-    $enable_post_type_filters = false;
87
-    $enable_location_filters = false;
88
-    $enable_jason_on_load = false;
89
-    $enable_map_direction = false;
90
-    $enable_marker_cluster = false;
91
-    $enable_map_resize_button = false;
92
-    $maptype = 'ROADMAP';
93
-
94
-    $geodir_map_options = array(
95
-        'width' => $width,
96
-        'height' => $height,
97
-        'child_collapse' => $child_collapse,
98
-        'sticky' => $sticky,
99
-        'enable_map_resize_button' => $enable_map_resize_button,
100
-        'enable_cat_filters' => $enable_cat_filters,
101
-        'enable_text_search' => $enable_text_search,
102
-        'enable_post_type_filters' => $enable_post_type_filters,
103
-        'enable_location_filters' => $enable_location_filters,
104
-        'enable_jason_on_load' => $enable_jason_on_load,
105
-        'enable_map_direction' => $enable_map_direction,
106
-        'enable_marker_cluster' => $enable_marker_cluster,
107
-        'ajax_url' => geodir_get_ajax_url(),
108
-        'map_canvas_name' => $map_canvas_name,
109
-        'inputText' => __('Title or Keyword', 'geodirectory'),
110
-        'latitude' => $map_default_lat,
111
-        'longitude' => $map_default_lng,
112
-        'zoom' => $map_default_zoom,
113
-        'scrollwheel' => true,
114
-        'streetViewControl' => true,
115
-        'maptype' => $maptype,
116
-        'showPreview' => '0',
117
-        'maxZoom' => 21,
118
-        'autozoom' => true,
119
-        'bubble_size' => 'small',
120
-        'token' => '68f48005e256696074e1da9bf9f67f06',
121
-        'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN')
122
-    );
123
-
124
-    if (!empty($map_args)) {
125
-        foreach ($map_args as $map_option_key => $map_option_value) {
126
-            $geodir_map_options[$map_option_key] = $map_option_value;
127
-        }
128
-    }
129
-
130
-    if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
131
-    } else {
132
-        $geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
133
-    }
134
-
135
-    if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
136
-    } else {
137
-        $geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
138
-    }
139
-
140
-    /**
70
+	global $map_canvas_arr;
71
+	$map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas';
72
+	$map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : '';
73
+
74
+	$default_location = geodir_get_default_location();
75
+
76
+	$map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
77
+	$map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
78
+	$map_default_zoom = 12;
79
+	// map options default values
80
+	$width = 950;
81
+	$height = 450;
82
+	$child_collapse = '0';
83
+	$sticky = '';
84
+	$enable_cat_filters = false;
85
+	$enable_text_search = false;
86
+	$enable_post_type_filters = false;
87
+	$enable_location_filters = false;
88
+	$enable_jason_on_load = false;
89
+	$enable_map_direction = false;
90
+	$enable_marker_cluster = false;
91
+	$enable_map_resize_button = false;
92
+	$maptype = 'ROADMAP';
93
+
94
+	$geodir_map_options = array(
95
+		'width' => $width,
96
+		'height' => $height,
97
+		'child_collapse' => $child_collapse,
98
+		'sticky' => $sticky,
99
+		'enable_map_resize_button' => $enable_map_resize_button,
100
+		'enable_cat_filters' => $enable_cat_filters,
101
+		'enable_text_search' => $enable_text_search,
102
+		'enable_post_type_filters' => $enable_post_type_filters,
103
+		'enable_location_filters' => $enable_location_filters,
104
+		'enable_jason_on_load' => $enable_jason_on_load,
105
+		'enable_map_direction' => $enable_map_direction,
106
+		'enable_marker_cluster' => $enable_marker_cluster,
107
+		'ajax_url' => geodir_get_ajax_url(),
108
+		'map_canvas_name' => $map_canvas_name,
109
+		'inputText' => __('Title or Keyword', 'geodirectory'),
110
+		'latitude' => $map_default_lat,
111
+		'longitude' => $map_default_lng,
112
+		'zoom' => $map_default_zoom,
113
+		'scrollwheel' => true,
114
+		'streetViewControl' => true,
115
+		'maptype' => $maptype,
116
+		'showPreview' => '0',
117
+		'maxZoom' => 21,
118
+		'autozoom' => true,
119
+		'bubble_size' => 'small',
120
+		'token' => '68f48005e256696074e1da9bf9f67f06',
121
+		'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN')
122
+	);
123
+
124
+	if (!empty($map_args)) {
125
+		foreach ($map_args as $map_option_key => $map_option_value) {
126
+			$geodir_map_options[$map_option_key] = $map_option_value;
127
+		}
128
+	}
129
+
130
+	if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
131
+	} else {
132
+		$geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
133
+	}
134
+
135
+	if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
136
+	} else {
137
+		$geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
138
+	}
139
+
140
+	/**
141 141
 	 * Filter the options to use in google map.
142 142
 	 *
143 143
 	 * @since 1.0.0
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	$geodir_map_options = apply_filters("geodir_map_options_{$map_canvas_name}", $geodir_map_options);
148 148
 
149
-    $map_canvas_arr[$map_canvas_name] = array();
149
+	$map_canvas_arr[$map_canvas_name] = array();
150 150
 
151
-    /**
151
+	/**
152 152
 	 * Filter the post types to display data on map.
153 153
 	 *
154 154
 	 * @since 1.0.0
@@ -166,20 +166,20 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	$exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map'));
168 168
 
169
-    if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
170
-        // Set default map options
169
+	if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
170
+		// Set default map options
171 171
 
172
-        wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
172
+		wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
173 173
 
174
-        wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
174
+		wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
175 175
 
176
-        if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
177
-            $map_width = '100%';
178
-        } else {
179
-            $map_width = $geodir_map_options['width'];
180
-        }
176
+		if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
177
+			$map_width = '100%';
178
+		} else {
179
+			$map_width = $geodir_map_options['width'];
180
+		}
181 181
 
182
-        /**
182
+		/**
183 183
 		 * Filter the width of map.
184 184
 		 *
185 185
 		 * @since 1.0.0
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 		 * @param int $map_width Width of map box, eg: gd_place.
188 188
 		 */
189 189
 		$map_width = apply_filters('geodir_change_map_width', $map_width);
190
-        ?>
190
+		?>
191 191
         <div id="catcher_<?php echo $map_canvas_name;?>"></div>
192 192
         <div class="stick_trigger_container">
193 193
             <div class="trigger_sticky triggeroff_sticky"></div>
@@ -221,15 +221,15 @@  discard block
 block discarded – undo
221 221
                 <?php if ($geodir_map_options['enable_jason_on_load']) { ?>
222 222
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/>
223 223
                 <?php } else {
224
-                    ?>
224
+					?>
225 225
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/>
226 226
                 <?php }
227 227
 
228
-                if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
229
-                    $show_entire_cat_panel = "none";
230
-                else
231
-                    $show_entire_cat_panel = "''";
232
-                ?>
228
+				if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
229
+					$show_entire_cat_panel = "none";
230
+				else
231
+					$show_entire_cat_panel = "''";
232
+				?>
233 233
 
234 234
                 <?php if ($geodir_map_options['enable_map_direction']) { ?>
235 235
 
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
                         <select id="travel-units" onchange="calcRoute('<?php echo $map_canvas_name; ?>')">
286 286
                             <option value="miles"><?php _e('Miles', 'geodirectory'); ?></option>
287 287
                             <option <?php if (get_option('geodir_search_dist_1') == 'km') {
288
-                                echo 'selected="selected"';
289
-                            } ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option>
288
+								echo 'selected="selected"';
289
+							} ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option>
290 290
                         </select>
291 291
                     </div>
292 292
 
@@ -298,12 +298,12 @@  discard block
 block discarded – undo
298 298
 				if (empty($geodir_default_map_search_pt))
299 299
 					$geodir_default_map_search_pt = 'gd_place';
300 300
 
301
-                global $gd_session;
302
-                $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
301
+				global $gd_session;
302
+				$homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
303 303
 
304
-                if ($homemap_catlist_ptype) {
305
-                    $geodir_default_map_search_pt = $homemap_catlist_ptype;
306
-                }
304
+				if ($homemap_catlist_ptype) {
305
+					$geodir_default_map_search_pt = $homemap_catlist_ptype;
306
+				}
307 307
 
308 308
 				/**
309 309
 				 * Filter the post type to retrive data for map
@@ -316,13 +316,13 @@  discard block
 block discarded – undo
316 316
 				?>
317 317
                 <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>">
318 318
                     <?php
319
-                    $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
320
-                    $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
319
+					$exclude_post_types = get_option('geodir_exclude_post_type_on_map');
320
+					$geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
321 321
 					$map_cat_class = '';
322 322
 					if ($geodir_map_options['enable_post_type_filters']) {
323 323
 						$map_cat_class = $geodir_available_pt_on_map > 1 ? ' map-cat-ptypes' : ' map-cat-floor';
324 324
 					}
325
-                    ?>
325
+					?>
326 326
                     <div
327 327
                         class="map-category-listing<?php echo $map_cat_class;?>">
328 328
                         <div class="trigger triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div>
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
                                 <?php if ($geodir_map_options['child_collapse']) { $child_collapse = "1"; ?>
341 341
                                     <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/>
342 342
                                 <?php } else {$child_collapse = "0";
343
-                                    ?>
343
+									?>
344 344
                                     <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/>
345 345
                                 <?php } ?>
346 346
                                 <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/>
@@ -362,17 +362,17 @@  discard block
 block discarded – undo
362 362
                 <!-- map-category-listings-->
363 363
 
364 364
                 <?php
365
-                if ($geodir_map_options['enable_location_filters']) {
365
+				if ($geodir_map_options['enable_location_filters']) {
366 366
 					$country = get_query_var('gd_country');
367 367
 					$region = get_query_var('gd_region');
368 368
 					$city = get_query_var('gd_city');
369 369
                     
370
-                    //fix for location/me page
371
-                    $country = $country != 'me' ? $country : '';
370
+					//fix for location/me page
371
+					$country = $country != 'me' ? $country : '';
372 372
 					$region = $region != 'me' ? $region : '';
373 373
 					$city = $country != 'me' ? $city : '';
374
-                    $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : '';
375
-                    ?>
374
+					$gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : '';
375
+					?>
376 376
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/>
377 377
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country"
378 378
                            value="<?php echo $country;?>"/>
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood"
384 384
                            value="<?php echo $gd_neighbourhood;?>"/>
385 385
                 <?php } else { //end of location filter
386
-                    ?>
386
+					?>
387 387
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/>
388 388
                 <?php }?>
389 389
 
@@ -394,9 +394,9 @@  discard block
 block discarded – undo
394 394
 
395 395
 
396 396
                 <?php if ($geodir_map_options['enable_post_type_filters']) {
397
-                    $post_types = geodir_get_posttypes('object');
398
-                    if (count((array)($post_types)) > 1) {
399
-                        ?>
397
+					$post_types = geodir_get_posttypes('object');
398
+					if (count((array)($post_types)) > 1) {
399
+						?>
400 400
                         <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu"
401 401
                              style="max-width:<?php echo $map_width;?>!important;">
402 402
 
@@ -404,15 +404,15 @@  discard block
 block discarded – undo
404 404
                             <div class="geodir-map-posttype-list"><?php } ?>
405 405
                                 <ul class="clearfix place-list">
406 406
                                     <?php
407
-                                    $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
407
+									$exclude_post_types = get_option('geodir_exclude_post_type_on_map');
408 408
 
409
-                                    foreach ($post_types as $post_type => $args) {
410
-                                        if (!in_array($post_type, $exclude_post_types)) {
411
-                                            $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
409
+									foreach ($post_types as $post_type => $args) {
410
+										if (!in_array($post_type, $exclude_post_types)) {
411
+											$class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
412 412
 											echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __(ucfirst($args->labels->name), 'geodirectory') . '</a></li>';
413
-                                        }
414
-                                    }
415
-                                    ?>
413
+										}
414
+									}
415
+									?>
416 416
                                 </ul>
417 417
                                 <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
418 418
                             </div><?php } ?>
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
 
427 427
                         </div> <!-- map-places-listings-->
428 428
                     <?php }
429
-                } // end of post type filter if
430
-                ?>
429
+				} // end of post type filter if
430
+				?>
431 431
 
432 432
             </div>
433 433
         </div> <!--end of stick trigger container-->
@@ -442,8 +442,8 @@  discard block
 block discarded – undo
442 442
         </script>
443 443
         <?php
444 444
 
445
-        if (strpos($geodir_map_options['height'], 'vh')) {
446
-            ?>
445
+		if (strpos($geodir_map_options['height'], 'vh')) {
446
+			?>
447 447
             <script>
448 448
                 (function () {
449 449
                     var screenH = jQuery(window).height();
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
 
466 466
         <?php
467 467
 
468
-        } elseif (strpos($geodir_map_options['height'], 'px')) {
469
-            ?>
468
+		} elseif (strpos($geodir_map_options['height'], 'px')) {
469
+			?>
470 470
             <script>
471 471
                 (function () {
472 472
                     var screenH = jQuery(window).height();
@@ -481,20 +481,20 @@  discard block
 block discarded – undo
481 481
                 }());
482 482
             </script>
483 483
         <?php
484
-        }
484
+		}
485 485
 
486
-        /**
487
-         * Action that runs after all the map code has been output;
488
-         *
489
-         * @since 1.5.3
490
-         *
491
-         * @param array $geodir_map_options Array of map settings.
492
-         * @param string $map_canvas_name The canvas name and ID for the map.
493
-         */
494
-        do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
486
+		/**
487
+		 * Action that runs after all the map code has been output;
488
+		 *
489
+		 * @since 1.5.3
490
+		 *
491
+		 * @param array $geodir_map_options Array of map settings.
492
+		 * @param string $map_canvas_name The canvas name and ID for the map.
493
+		 */
494
+		do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
495 495
 
496 496
 
497
-    endif; // Exclude posttypes if end
497
+	endif; // Exclude posttypes if end
498 498
 }
499 499
 
500 500
 ?>
501 501
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/reviews.php 3 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,9 @@
 block discarded – undo
16 16
  * the visitor has not yet entered the password we will
17 17
  * return early without loading the comments.
18 18
  */
19
-if (post_password_required())
20
-    return;
19
+if (post_password_required()) {
20
+    return;
21
+}
21 22
 ?>
22 23
 
23 24
 <div id="comments" class="comments-area">
Please login to merge, or discard this patch.
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  * return early without loading the comments.
18 18
  */
19 19
 if (post_password_required())
20
-    return;
20
+	return;
21 21
 ?>
22 22
 
23 23
 <div id="comments" class="comments-area">
@@ -25,35 +25,35 @@  discard block
 block discarded – undo
25 25
     <?php // You can start editing here -- including this comment! ?>
26 26
 
27 27
     <?php
28
-    /**
29
-     * Called before displaying reviews.
30
-     *
31
-     * If you would like to wrap reviews inside a div this is the place to print your open div. @see geodir_before_review_form to print your closing div.
32
-     *
33
-     * @since 1.5.7
34
-     */
35
-    do_action('geodir_before_review_list'); ?>
28
+	/**
29
+	 * Called before displaying reviews.
30
+	 *
31
+	 * If you would like to wrap reviews inside a div this is the place to print your open div. @see geodir_before_review_form to print your closing div.
32
+	 *
33
+	 * @since 1.5.7
34
+	 */
35
+	do_action('geodir_before_review_list'); ?>
36 36
 
37 37
     <?php if (have_comments()) : ?>
38 38
         <h2 class="comments-title">
39 39
             <?php
40
-            printf(_n('1 Review <span class="r-title-on">on</span> <span class="r-title">&ldquo;%2$s&rdquo;</span>', '%1$s Reviews <span>on</span> <span class="r-title"> &ldquo;%2$s&rdquo;</span>', get_comments_number(), 'geodirectory'),
41
-                number_format_i18n(get_comments_number()), get_the_title());
42
-            ?>
40
+			printf(_n('1 Review <span class="r-title-on">on</span> <span class="r-title">&ldquo;%2$s&rdquo;</span>', '%1$s Reviews <span>on</span> <span class="r-title"> &ldquo;%2$s&rdquo;</span>', get_comments_number(), 'geodirectory'),
41
+				number_format_i18n(get_comments_number()), get_the_title());
42
+			?>
43 43
         </h2>
44 44
 
45 45
         <?php
46
-        /**
47
-         * Called after displaying review listing title.
48
-         *
49
-         * @since 1.5.7
50
-         */
51
-        do_action('geodir_after_review_list_title'); ?>
46
+		/**
47
+		 * Called after displaying review listing title.
48
+		 *
49
+		 * @since 1.5.7
50
+		 */
51
+		do_action('geodir_after_review_list_title'); ?>
52 52
 
53 53
         <ol class="commentlist">
54 54
             <?php $reverse_top_level = is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php') ? false : null; ?>
55 55
 			<?php wp_list_comments(array('callback' => 'geodir_comment', 'reverse_top_level' => $reverse_top_level, 'style' => 'ol'));
56
-            ?>
56
+			?>
57 57
         </ol><!-- .commentlist -->
58 58
 
59 59
         <?php if (get_comment_pages_count() > 1 && get_option('page_comments')) : // are there comments to navigate through ?>
@@ -68,51 +68,51 @@  discard block
 block discarded – undo
68 68
         <?php endif; // check for comment navigation ?>
69 69
 
70 70
         <?php
71
-        /* If there are no comments and comments are closed, let's leave a note.
71
+		/* If there are no comments and comments are closed, let's leave a note.
72 72
          * But we only want the note on posts and pages that had comments in the first place.
73 73
          */
74
-        if (!comments_open() && get_comments_number()) : ?>
74
+		if (!comments_open() && get_comments_number()) : ?>
75 75
             <p class="nocomments"><?php _e('Reviews are closed.', 'geodirectory'); ?></p>
76 76
         <?php endif; ?>
77 77
 
78 78
     <?php endif; // have_comments() ?>
79 79
 
80 80
     <?php
81
-    /**
82
-     * Called before displaying "Leave a review form".
83
-     *
84
-     * If you would like to wrap "review form" inside a div this is the best place to hook your open div. @see geodir_after_review_form to print your closing div.
85
-     * Also If you would like to wrap "reviews" inside a div this is the best place to print your closing div. @see geodir_before_review_list to print your open div.
86
-     *
87
-     * @since 1.5.7
88
-     */
89
-    do_action('geodir_before_review_form'); ?>
81
+	/**
82
+	 * Called before displaying "Leave a review form".
83
+	 *
84
+	 * If you would like to wrap "review form" inside a div this is the best place to hook your open div. @see geodir_after_review_form to print your closing div.
85
+	 * Also If you would like to wrap "reviews" inside a div this is the best place to print your closing div. @see geodir_before_review_list to print your open div.
86
+	 *
87
+	 * @since 1.5.7
88
+	 */
89
+	do_action('geodir_before_review_form'); ?>
90 90
 
91 91
     <?php
92
-    /**
93
-     * Filters comment form args
94
-     *
95
-     * If you would like to modify your comment form args, use this filter. @see https://codex.wordpress.org/Function_Reference/comment_form for accepted args.
96
-     *
97
-     * @since 1.0.0
98
-     */
99
-    $args = apply_filters('geodir_review_form_args', array(
100
-        'title_reply' => __('Leave a Review', 'geodirectory'),
101
-        'label_submit' => __('Post Review', 'geodirectory'),
102
-        'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Review text', 'geodirectory') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
103
-        'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()) . '</p>'
104
-    ));
105
-    comment_form($args);
106
-    ?>
92
+	/**
93
+	 * Filters comment form args
94
+	 *
95
+	 * If you would like to modify your comment form args, use this filter. @see https://codex.wordpress.org/Function_Reference/comment_form for accepted args.
96
+	 *
97
+	 * @since 1.0.0
98
+	 */
99
+	$args = apply_filters('geodir_review_form_args', array(
100
+		'title_reply' => __('Leave a Review', 'geodirectory'),
101
+		'label_submit' => __('Post Review', 'geodirectory'),
102
+		'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Review text', 'geodirectory') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
103
+		'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()) . '</p>'
104
+	));
105
+	comment_form($args);
106
+	?>
107 107
 
108 108
     <?php
109
-    /**
110
-     * Called after displaying "Leave a review form".
111
-     *
112
-     * If you would like to wrap "review form" inside a div this is the best place to print your closing div. @see geodir_before_review_form to print your open div.
113
-     *
114
-     * @since 1.5.7
115
-     */
116
-    do_action('geodir_after_review_form'); ?>
109
+	/**
110
+	 * Called after displaying "Leave a review form".
111
+	 *
112
+	 * If you would like to wrap "review form" inside a div this is the best place to print your closing div. @see geodir_before_review_form to print your open div.
113
+	 *
114
+	 * @since 1.5.7
115
+	 */
116
+	do_action('geodir_after_review_form'); ?>
117 117
 
118 118
 </div><!-- #comments .comments-area -->
119 119
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -99,8 +99,8 @@
 block discarded – undo
99 99
     $args = apply_filters('geodir_review_form_args', array(
100 100
         'title_reply' => __('Leave a Review', 'geodirectory'),
101 101
         'label_submit' => __('Post Review', 'geodirectory'),
102
-        'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Review text', 'geodirectory') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
103
-        'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()) . '</p>'
102
+        'comment_field' => '<p class="comment-form-comment"><label for="comment">'.__('Review text', 'geodirectory').'</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
103
+        'must_log_in' => '<p class="must-log-in">'.sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()).'</p>'
104 104
     ));
105 105
     comment_form($args);
106 106
     ?>
Please login to merge, or discard this patch.
geodirectory-functions/wp-session/wp-session.php 2 patches
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) exit;
14
+if (!defined('ABSPATH')) exit;
15 15
 
16 16
 /**
17 17
  * Return the current cache expire setting.
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
  *
37 37
  * @param string $data
38 38
  */
39
-function wp_session_decode( $data ) {
39
+function wp_session_decode($data) {
40 40
 	$wp_session = WP_Session::get_instance();
41 41
 
42
-	return $wp_session->json_in( $data );
42
+	return $wp_session->json_in($data);
43 43
 }
44 44
 
45 45
 /**
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
  *
61 61
  * @return bool
62 62
  */
63
-function wp_session_regenerate_id( $delete_old_session = false ) {
63
+function wp_session_regenerate_id($delete_old_session = false) {
64 64
 	$wp_session = WP_Session::get_instance();
65 65
 
66
-	$wp_session->regenerate_id( $delete_old_session );
66
+	$wp_session->regenerate_id($delete_old_session);
67 67
 
68 68
 	return true;
69 69
 }
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
  */
78 78
 function wp_session_start() {
79 79
 	$wp_session = WP_Session::get_instance();
80
-	do_action( 'wp_session_start' );
80
+	do_action('wp_session_start');
81 81
 
82 82
 	return $wp_session->session_started();
83 83
 }
84
-add_action( 'plugins_loaded', 'wp_session_start' );
84
+add_action('plugins_loaded', 'wp_session_start');
85 85
 
86 86
 /**
87 87
  * Return the current session status.
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 function wp_session_status() {
92 92
 	$wp_session = WP_Session::get_instance();
93 93
 
94
-	if ( $wp_session->session_started() ) {
94
+	if ($wp_session->session_started()) {
95 95
 		return PHP_SESSION_ACTIVE;
96 96
 	}
97 97
 
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 	$wp_session = WP_Session::get_instance();
115 115
 
116 116
 	$wp_session->write_data();
117
-	do_action( 'wp_session_commit' );
117
+	do_action('wp_session_commit');
118 118
 }
119
-add_action( 'shutdown', 'wp_session_write_close' );
119
+add_action('shutdown', 'wp_session_write_close');
120 120
 
121 121
 /**
122 122
  * Clean up expired sessions by removing data and their expiration entries from
@@ -128,51 +128,51 @@  discard block
 block discarded – undo
128 128
 function wp_session_cleanup() {
129 129
 	global $wpdb;
130 130
 
131
-	if ( defined( 'WP_SETUP_CONFIG' ) ) {
131
+	if (defined('WP_SETUP_CONFIG')) {
132 132
 		return;
133 133
 	}
134 134
 
135
-	if ( ! defined( 'WP_INSTALLING' ) ) {
136
-		$expiration_keys = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wp_session_expires_%'" );
135
+	if (!defined('WP_INSTALLING')) {
136
+		$expiration_keys = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wp_session_expires_%'");
137 137
 
138
-		$now = current_time( 'timestamp' );
138
+		$now = current_time('timestamp');
139 139
 		$expired_sessions = array();
140 140
 
141
-		foreach( $expiration_keys as $expiration ) {
141
+		foreach ($expiration_keys as $expiration) {
142 142
 
143 143
 			// If the session has expired
144
-			if ( $now > intval( $expiration->option_value ) ) {
144
+			if ($now > intval($expiration->option_value)) {
145 145
 
146 146
 				// Get the session ID by parsing the option_name
147
-				$session_id = substr( $expiration->option_name, 20 );
147
+				$session_id = substr($expiration->option_name, 20);
148 148
 
149
-				if( (int) -1 === (int) $session_id || ! preg_match( '/^[a-f0-9]{32}$/', $session_id ) ) {
149
+				if ((int) -1 === (int) $session_id || !preg_match('/^[a-f0-9]{32}$/', $session_id)) {
150 150
 					continue;
151 151
 				}
152 152
 
153 153
 				$expired_sessions[] = $expiration->option_name;
154
-				$expired_sessions[] = esc_sql( "_wp_session_$session_id" );
154
+				$expired_sessions[] = esc_sql("_wp_session_$session_id");
155 155
 			}
156 156
 		}
157 157
 
158 158
 		// Delete all expired sessions in a single query
159
-		if ( ! empty( $expired_sessions ) ) {
160
-			$option_names = implode( "','", $expired_sessions );
161
-			$wpdb->query( "DELETE FROM $wpdb->options WHERE option_name IN ('$option_names')"  );
159
+		if (!empty($expired_sessions)) {
160
+			$option_names = implode("','", $expired_sessions);
161
+			$wpdb->query("DELETE FROM $wpdb->options WHERE option_name IN ('$option_names')");
162 162
 		}
163 163
 	}
164 164
 
165 165
 	// Allow other plugins to hook in to the garbage collection process.
166
-	do_action( 'wp_session_cleanup' );
166
+	do_action('wp_session_cleanup');
167 167
 }
168
-add_action( 'wp_session_garbage_collection', 'wp_session_cleanup' );
168
+add_action('wp_session_garbage_collection', 'wp_session_cleanup');
169 169
 
170 170
 /**
171 171
  * Register the garbage collector as a twice daily event.
172 172
  */
173 173
 function wp_session_register_garbage_collection() {
174
-	if ( ! wp_next_scheduled( 'wp_session_garbage_collection' ) ) {
175
-		wp_schedule_event( current_time( 'timestamp' ), 'twicedaily', 'wp_session_garbage_collection' );
174
+	if (!wp_next_scheduled('wp_session_garbage_collection')) {
175
+		wp_schedule_event(current_time('timestamp'), 'twicedaily', 'wp_session_garbage_collection');
176 176
 	}
177 177
 }
178
-add_action( 'wp', 'wp_session_register_garbage_collection' );
178
+add_action('wp', 'wp_session_register_garbage_collection');
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,9 @@
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) exit;
14
+if ( ! defined( 'ABSPATH' ) ) {
15
+	exit;
16
+}
15 17
 
16 18
 /**
17 19
  * Return the current cache expire setting.
Please login to merge, or discard this patch.
geodirectory-templates/listing-filter-form.php 3 patches
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,16 +50,19 @@
 block discarded – undo
50 50
                 <?php
51 51
 
52 52
                 $default_search_for_text = SEARCH_FOR_TEXT;
53
-                if (get_option('geodir_search_field_default_text'))
54
-                    $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
53
+                if (get_option('geodir_search_field_default_text')) {
54
+                                    $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
55
+                }
55 56
 
56 57
                 $default_near_text = NEAR_TEXT;
57
-                if (get_option('geodir_near_field_default_text'))
58
-                    $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
58
+                if (get_option('geodir_near_field_default_text')) {
59
+                                    $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
60
+                }
59 61
 
60 62
                 $default_search_button_label = __('Search', 'geodirectory');
61
-                if (get_option('geodir_search_button_label'))
62
-                    $default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
63
+                if (get_option('geodir_search_button_label')) {
64
+                                    $default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
65
+                }
63 66
 
64 67
                 $post_types = geodir_get_posttypes('object');
65 68
 
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
                 $post_types = geodir_get_posttypes('object');
65 65
 
66
-                if (!empty($post_types) && count((array)$post_types) > 1):
66
+                if (!empty($post_types) && count((array) $post_types) > 1):
67 67
                     ?>
68 68
                     <select name="stype" class="search_by_post">
69 69
                         <?php foreach ($post_types as $post_type => $info):
@@ -75,19 +75,19 @@  discard block
 block discarded – undo
75 75
                             }
76 76
                             ?>
77 77
 
78
-                            <option data-label="<?php echo get_post_type_archive_link($post_type);?>"
79
-                                    value="<?php echo $post_type;?>" <?php if (isset($_REQUEST['stype'])) {
78
+                            <option data-label="<?php echo get_post_type_archive_link($post_type); ?>"
79
+                                    value="<?php echo $post_type; ?>" <?php if (isset($_REQUEST['stype'])) {
80 80
                                 if ($post_type == $_REQUEST['stype']) {
81 81
                                     echo 'selected="selected"';
82 82
                                 }
83 83
                             } elseif ($curr_post_type == $post_type) {
84 84
                                 echo 'selected="selected"';
85
-                            }?>><?php _e(ucfirst($info->labels->name), 'geodirectory');?></option>
85
+                            }?>><?php _e(ucfirst($info->labels->name), 'geodirectory'); ?></option>
86 86
 
87 87
                         <?php endforeach; ?>
88 88
                     </select>
89 89
                 <?php elseif (!empty($post_types)):
90
-                    echo '<input type="hidden" name="stype" value="' . key($post_types) . '"  />';
90
+                    echo '<input type="hidden" name="stype" value="'.key($post_types).'"  />';
91 91
                 endif; ?>
92 92
 
93 93
                 <input class="search_text" name="s"
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                  * @since 1.5.5
158 158
                  * @param string $default_search_button_label The current search button text.
159 159
                  */
160
-                $default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);?>
160
+                $default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label); ?>
161 161
 				<input type="button" value="<?php esc_attr_e($default_search_button_label); ?>" class="geodir_submit_search" />
162 162
                 <?php
163 163
                 /**
Please login to merge, or discard this patch.
Indentation   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
 
15 15
 $curr_post_type = geodir_get_current_posttype();
16 16
 if (function_exists('geodir_location_geo_home_link')) {
17
-    remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
17
+	remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
18 18
 }
19 19
 $search_url = trailingslashit(get_home_url());
20 20
 if (function_exists('geodir_location_geo_home_link')) {
21
-    add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
21
+	add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
22 22
 }
23 23
 ?>
24 24
 
@@ -37,104 +37,104 @@  discard block
 block discarded – undo
37 37
     <div class="geodir-loc-bar">
38 38
 
39 39
         <?php
40
-        /**
41
-         * Called inside the search form but before any of the fields.
42
-         *
43
-         * @since 1.0.0
44
-         */
45
-        do_action('geodir_before_search_form') ?>
40
+		/**
41
+		 * Called inside the search form but before any of the fields.
42
+		 *
43
+		 * @since 1.0.0
44
+		 */
45
+		do_action('geodir_before_search_form') ?>
46 46
 
47 47
         <div class="clearfix geodir-loc-bar-in">
48 48
             <div class="geodir-search">
49 49
 
50 50
                 <?php
51 51
 
52
-                $default_search_for_text = SEARCH_FOR_TEXT;
53
-                if (get_option('geodir_search_field_default_text'))
54
-                    $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
52
+				$default_search_for_text = SEARCH_FOR_TEXT;
53
+				if (get_option('geodir_search_field_default_text'))
54
+					$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
55 55
 
56
-                $default_near_text = NEAR_TEXT;
57
-                if (get_option('geodir_near_field_default_text'))
58
-                    $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
56
+				$default_near_text = NEAR_TEXT;
57
+				if (get_option('geodir_near_field_default_text'))
58
+					$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
59 59
 
60
-                $default_search_button_label = __('Search', 'geodirectory');
61
-                if (get_option('geodir_search_button_label'))
62
-                    $default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
60
+				$default_search_button_label = __('Search', 'geodirectory');
61
+				if (get_option('geodir_search_button_label'))
62
+					$default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
63 63
 
64
-                $post_types = apply_filters('geodir_search_form_post_types', geodir_get_posttypes('object'));
64
+				$post_types = apply_filters('geodir_search_form_post_types', geodir_get_posttypes('object'));
65 65
 
66
-                if (!empty($post_types) && count((array)$post_types) > 1):
67
-                    ?>
66
+				if (!empty($post_types) && count((array)$post_types) > 1):
67
+					?>
68 68
                     <select name="stype" class="search_by_post">
69 69
                         <?php foreach ($post_types as $post_type => $info):
70
-                            global $wpdb;
71
-                            $has_posts = '';
72
-                            $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
73
-                            if (!$has_posts) {
74
-                                continue;
75
-                            }
76
-                            ?>
70
+							global $wpdb;
71
+							$has_posts = '';
72
+							$has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
73
+							if (!$has_posts) {
74
+								continue;
75
+							}
76
+							?>
77 77
 
78 78
                             <option data-label="<?php echo get_post_type_archive_link($post_type);?>"
79 79
                                     value="<?php echo $post_type;?>" <?php if (isset($_REQUEST['stype'])) {
80
-                                if ($post_type == $_REQUEST['stype']) {
81
-                                    echo 'selected="selected"';
82
-                                }
83
-                            } elseif ($curr_post_type == $post_type) {
84
-                                echo 'selected="selected"';
85
-                            }?>><?php _e(ucfirst($info->labels->name), 'geodirectory');?></option>
80
+								if ($post_type == $_REQUEST['stype']) {
81
+									echo 'selected="selected"';
82
+								}
83
+							} elseif ($curr_post_type == $post_type) {
84
+								echo 'selected="selected"';
85
+							}?>><?php _e(ucfirst($info->labels->name), 'geodirectory');?></option>
86 86
 
87 87
                         <?php endforeach; ?>
88 88
                     </select>
89 89
                 <?php elseif (!empty($post_types)):
90
-                    echo '<input type="hidden" name="stype" value="' . key($post_types) . '"  />';
91
-                endif; ?>
90
+					echo '<input type="hidden" name="stype" value="' . key($post_types) . '"  />';
91
+				endif; ?>
92 92
 
93 93
                 <input class="search_text" name="s"
94 94
                        value="<?php if (isset($_REQUEST['s']) && trim($_REQUEST['s']) != '') {
95
-                           echo esc_attr(stripslashes_deep($_REQUEST['s']));
96
-                       } else {
97
-                           echo $default_search_for_text;
98
-                       } ?>" type="text"
95
+						   echo esc_attr(stripslashes_deep($_REQUEST['s']));
96
+					   } else {
97
+						   echo $default_search_for_text;
98
+					   } ?>" type="text"
99 99
                        onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql($default_search_for_text); ?>';}"
100 100
                        onfocus="if (this.value == '<?php echo esc_sql($default_search_for_text); ?>') {this.value = '';}"
101 101
                        onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);">
102 102
 
103 103
 
104 104
                 <?php
105
-                if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') {
106
-                    $near = esc_attr(stripslashes_deep($_REQUEST['snear']));
107
-                } else {
108
-                    $near = $default_near_text;
109
-                }
110
-                /**
111
-                 * Filter the "Near" text value for the search form.
112
-                 *
113
-                 * This is the input "value" attribute and can change depending on what the user searches and is not always the default value.
114
-                 *
115
-                 * @since 1.0.0
116
-                 * @param string $near The current near value.
117
-                 * @param string $default_near_text The default near value.
118
-                 */
119
-                $near = apply_filters('geodir_search_near_text', $near, $default_near_text);
120
-                /**
121
-                 * Filter the default "Near" text value for the search form.
122
-                 *
123
-                 * This is the default value if nothing has been searched.
124
-                 *
125
-                 * @since 1.0.0
126
-                 * @param string $near The current near value.
127
-                 * @param string $default_near_text The default near value.
128
-                 */
129
-                $default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near);
130
-                /**
131
-                 * Filter the class for the near search input.
132
-                 *
133
-                 * @since 1.0.0
134
-                 * @param string $class The class for the HTML near input, default is blank.
135
-                 */
136
-                $near_class = apply_filters('geodir_search_near_class', '');
137
-                ?>
105
+				if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') {
106
+					$near = esc_attr(stripslashes_deep($_REQUEST['snear']));
107
+				} else {
108
+					$near = $default_near_text;
109
+				}
110
+				/**
111
+				 * Filter the "Near" text value for the search form.
112
+				 *
113
+				 * This is the input "value" attribute and can change depending on what the user searches and is not always the default value.
114
+				 *
115
+				 * @since 1.0.0
116
+				 * @param string $near The current near value.
117
+				 * @param string $default_near_text The default near value.
118
+				 */
119
+				$near = apply_filters('geodir_search_near_text', $near, $default_near_text);
120
+				/**
121
+				 * Filter the default "Near" text value for the search form.
122
+				 *
123
+				 * This is the default value if nothing has been searched.
124
+				 *
125
+				 * @since 1.0.0
126
+				 * @param string $near The current near value.
127
+				 * @param string $default_near_text The default near value.
128
+				 */
129
+				$default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near);
130
+				/**
131
+				 * Filter the class for the near search input.
132
+				 *
133
+				 * @since 1.0.0
134
+				 * @param string $class The class for the HTML near input, default is blank.
135
+				 */
136
+				$near_class = apply_filters('geodir_search_near_class', '');
137
+				?>
138 138
 
139 139
                 <input name="snear" class="snear <?php echo $near_class; ?>" type="text" value="<?php echo $near; ?>"
140 140
                        onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql($near); ?>' != '' ? '<?php echo esc_sql($near); ?>' : '<?php echo $default_near_text; ?>');}"
@@ -142,42 +142,42 @@  discard block
 block discarded – undo
142 142
                        onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);"/>
143 143
 
144 144
                 <?php
145
-                /**
146
-                 * Called on the GD search form just before the search button.
147
-                 *
148
-                 * @since 1.0.0
149
-                 */
150
-                do_action('geodir_before_search_button');
151
-
152
-                /**
153
-                 * Filter the default search button text value for the search form.
154
-                 *
155
-                 * This text can be changed via an option in settings, this is a last resort.
156
-                 *
157
-                 * @since 1.5.5
158
-                 * @param string $default_search_button_label The current search button text.
159
-                 */
160
-                $default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);?>
145
+				/**
146
+				 * Called on the GD search form just before the search button.
147
+				 *
148
+				 * @since 1.0.0
149
+				 */
150
+				do_action('geodir_before_search_button');
151
+
152
+				/**
153
+				 * Filter the default search button text value for the search form.
154
+				 *
155
+				 * This text can be changed via an option in settings, this is a last resort.
156
+				 *
157
+				 * @since 1.5.5
158
+				 * @param string $default_search_button_label The current search button text.
159
+				 */
160
+				$default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);?>
161 161
 				<input type="button" value="<?php esc_attr_e($default_search_button_label); ?>" class="geodir_submit_search" />
162 162
                 <?php
163
-                /**
164
-                 * Called on the GD search form just after the search button.
165
-                 *
166
-                 * @since 1.0.0
167
-                 */
168
-                do_action('geodir_after_search_button'); ?>
163
+				/**
164
+				 * Called on the GD search form just after the search button.
165
+				 *
166
+				 * @since 1.0.0
167
+				 */
168
+				do_action('geodir_after_search_button'); ?>
169 169
             </div>
170 170
 
171 171
 
172 172
         </div>
173 173
 
174 174
         <?php
175
-        /**
176
-         * Called inside the search form but after all the input fields.
177
-         *
178
-         * @since 1.0.0
179
-         */
180
-        do_action('geodir_after_search_form') ?>
175
+		/**
176
+		 * Called inside the search form but after all the input fields.
177
+		 *
178
+		 * @since 1.0.0
179
+		 */
180
+		do_action('geodir_after_search_form') ?>
181 181
 
182 182
 
183 183
     </div>
Please login to merge, or discard this patch.
geodirectory-templates/login_frm.php 3 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@
 block discarded – undo
54 54
         echo "<p class=\"error_msg\"> " . INVALID_USER_PW_MSG . " </p>";
55 55
     }
56 56
 
57
-    if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm')
58
-        echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>';
57
+    if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm') {
58
+            echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>';
59
+    }
59 60
 
60 61
     ?>
61 62
     <form name="cus_loginform" id="cus_loginform" action="<?php echo esc_url(geodir_curPageURL()); ?>"
Please login to merge, or discard this patch.
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 if (isset($_GET['redirect_to']) && $_GET['redirect_to'] != '') {
13
-    $redirect_to = $_GET['redirect_to'];
13
+	$redirect_to = $_GET['redirect_to'];
14 14
 } else {
15
-    //echo $_SERVER['HTTP_HOST'] ;
16
-    $redirect_to = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
17
-    if (strpos($redirect_to, $_SERVER['HTTP_HOST']) === false) {
18
-        $redirect_to = home_url();
19
-    }
15
+	//echo $_SERVER['HTTP_HOST'] ;
16
+	$redirect_to = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
17
+	if (strpos($redirect_to, $_SERVER['HTTP_HOST']) === false) {
18
+		$redirect_to = home_url();
19
+	}
20 20
 
21 21
 }
22 22
 
@@ -38,36 +38,36 @@  discard block
 block discarded – undo
38 38
     <h4>
39 39
         <?php
40 40
 
41
-            /**
42
-             * Filter the `SIGN_IN_PAGE_TITLE` title text on login form template.
43
-             *
44
-             * @since 1.0.0
45
-             */
46
-            echo apply_filters('geodir_login_page_title', SIGN_IN_PAGE_TITLE);
41
+			/**
42
+			 * Filter the `SIGN_IN_PAGE_TITLE` title text on login form template.
43
+			 *
44
+			 * @since 1.0.0
45
+			 */
46
+			echo apply_filters('geodir_login_page_title', SIGN_IN_PAGE_TITLE);
47 47
 
48
-        ?>
48
+		?>
49 49
     </h4>
50 50
     <?php
51
-    if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'fw') {
52
-        echo "<p class=\"error_msg\"> " . INVALID_USER_FPW_MSG . " </p>";
53
-    } elseif (isset($_REQUEST['logemsg']) && $_REQUEST['logemsg'] == 1) {
54
-        echo "<p class=\"error_msg\"> " . INVALID_USER_PW_MSG . " </p>";
55
-    }
51
+	if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'fw') {
52
+		echo "<p class=\"error_msg\"> " . INVALID_USER_FPW_MSG . " </p>";
53
+	} elseif (isset($_REQUEST['logemsg']) && $_REQUEST['logemsg'] == 1) {
54
+		echo "<p class=\"error_msg\"> " . INVALID_USER_PW_MSG . " </p>";
55
+	}
56 56
 
57
-    if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm')
58
-        echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>';
57
+	if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm')
58
+		echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>';
59 59
 
60
-    ?>
60
+	?>
61 61
     <form name="cus_loginform" id="cus_loginform" action="<?php echo esc_url(geodir_curPageURL()); ?>"
62 62
           method="post">
63 63
 
64 64
         <div class="form_row clearfix">
65 65
             <input placeholder='<?php echo USERNAME_TEXT; ?>' type="text" name="log" id="user_login"
66 66
                    value="<?php global $user_login;
67
-                   if (!isset($user_login)) {
68
-                       $user_login = '';
69
-                   }
70
-                   echo esc_attr($user_login); ?>" size="20" class="textfield"/>
67
+				   if (!isset($user_login)) {
68
+					   $user_login = '';
69
+				   }
70
+				   echo esc_attr($user_login); ?>" size="20" class="textfield"/>
71 71
             <span class="user_loginInfo"></span>
72 72
         </div>
73 73
 
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
         </div>
79 79
 
80 80
         <?php
81
-        /**
82
-         * This is a default WordPress action that calls any additional elements needed for any login forms.
83
-         *
84
-         * We use this action before the remember me checkbox on the sigin form.
85
-         *
86
-         * @since 1.0.0
87
-         */
88
-        do_action('login_form'); ?>
81
+		/**
82
+		 * This is a default WordPress action that calls any additional elements needed for any login forms.
83
+		 *
84
+		 * We use this action before the remember me checkbox on the sigin form.
85
+		 *
86
+		 * @since 1.0.0
87
+		 */
88
+		do_action('login_form'); ?>
89 89
         <p class="rember">
90 90
             <input name="rememberme" type="checkbox" id="rememberme" value="forever" class="fl"/>
91 91
             <?php echo REMEMBER_ON_COMPUTER_TEXT; ?>
@@ -109,12 +109,12 @@  discard block
 block discarded – undo
109 109
                 <input placeholder='<?php echo USERNAME_EMAIL_TEXT; ?>' type="text" name="user_login"
110 110
                        value="<?php echo esc_attr($user_login); ?>" size="20" class="user_login1 textfield"/>
111 111
                 <?php
112
-                /**
113
-                 * Called before the get new password button in the login box template.
114
-                 *
115
-                 * @since 1.0.0
116
-                 */
117
-                do_action('lostpassword_form'); ?>
112
+				/**
113
+				 * Called before the get new password button in the login box template.
114
+				 *
115
+				 * @since 1.0.0
116
+				 */
117
+				do_action('lostpassword_form'); ?>
118 118
             </div>
119 119
             <input type="submit" name="get_new_password" value="<?php echo GET_NEW_PW_TEXT; ?>" class="geodir_button"/>
120 120
         </form>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,13 +49,13 @@
 block discarded – undo
49 49
     </h4>
50 50
     <?php
51 51
     if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'fw') {
52
-        echo "<p class=\"error_msg\"> " . INVALID_USER_FPW_MSG . " </p>";
52
+        echo "<p class=\"error_msg\"> ".INVALID_USER_FPW_MSG." </p>";
53 53
     } elseif (isset($_REQUEST['logemsg']) && $_REQUEST['logemsg'] == 1) {
54
-        echo "<p class=\"error_msg\"> " . INVALID_USER_PW_MSG . " </p>";
54
+        echo "<p class=\"error_msg\"> ".INVALID_USER_PW_MSG." </p>";
55 55
     }
56 56
 
57 57
     if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm')
58
-        echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>';
58
+        echo '<p class="sucess_msg">'.PW_SEND_CONFIRM_MSG.'</p>';
59 59
 
60 60
     ?>
61 61
     <form name="cus_loginform" id="cus_loginform" action="<?php echo esc_url(geodir_curPageURL()); ?>"
Please login to merge, or discard this patch.
geodirectory-templates/preview-buttons.php 3 patches
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -61,10 +61,11 @@
 block discarded – undo
61 61
                 ob_start();
62 62
                 echo '<h5 class="geodir_information">';
63 63
 
64
-                if (!isset($_REQUEST['pid']))
65
-                    printf(GOING_TO_FREE_MSG, $type_title, $alive_days);
66
-                else
67
-                    printf(GOING_TO_UPDATE_MSG, $type_title, $alive_days);
64
+                if (!isset($_REQUEST['pid'])) {
65
+                                    printf(GOING_TO_FREE_MSG, $type_title, $alive_days);
66
+                } else {
67
+                                    printf(GOING_TO_UPDATE_MSG, $type_title, $alive_days);
68
+                }
68 69
 
69 70
                 echo '</h5>';
70 71
                 $publish_listing_form_message = ob_get_clean();
Please login to merge, or discard this patch.
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@  discard block
 block discarded – undo
15 15
 $post_type = $post->listing_type;
16 16
 
17 17
 if (isset($_REQUEST['preview']) && $_REQUEST['preview'] && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
18
-    $form_action_url = geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=update&listing_type=' . $post_type;
18
+	$form_action_url = geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=update&listing_type=' . $post_type;
19 19
 } elseif (isset($_REQUEST['preview']) && $_REQUEST['preview']) {
20
-    $form_action_url = geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=publish&listing_type=' . $post_type;
20
+	$form_action_url = geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=publish&listing_type=' . $post_type;
21 21
 }
22 22
 
23 23
 /**
@@ -45,48 +45,48 @@  discard block
 block discarded – undo
45 45
         <form action="<?php echo $form_action_url; ?>" name="publish_listing" id="publish_listing" method="post">
46 46
             <div class="clearfix">
47 47
                 <input type="hidden" name="pid" value="<?php if (isset($post->pid)) {
48
-                    echo $post->pid;
49
-                } ?>">
48
+					echo $post->pid;
49
+				} ?>">
50 50
                 <?php
51
-                /**
52
-                 * Called on the add listing preview page inside the publish listings form, before the publish message.
53
-                 *
54
-                 * @since 1.0.0
55
-                 * @see 'geodir_publish_listing_form_after_msg'
56
-                 */
57
-                do_action('geodir_publish_listing_form_before_msg'); ?>
51
+				/**
52
+				 * Called on the add listing preview page inside the publish listings form, before the publish message.
53
+				 *
54
+				 * @since 1.0.0
55
+				 * @see 'geodir_publish_listing_form_after_msg'
56
+				 */
57
+				do_action('geodir_publish_listing_form_before_msg'); ?>
58 58
                 <?php
59
-                $alive_days = UNLIMITED;
60
-                $type_title = '';
61
-                ob_start();
62
-                echo '<h5 class="geodir_information">';
63
-
64
-                if (!isset($_REQUEST['pid']))
65
-                    printf(GOING_TO_FREE_MSG, $type_title, $alive_days);
66
-                else
67
-                    printf(GOING_TO_UPDATE_MSG, $type_title, $alive_days);
68
-
69
-                echo '</h5>';
70
-                $publish_listing_form_message = ob_get_clean();
71
-                /**
72
-                 * Filter the publish listing message on the preview page.
73
-                 *
74
-                 * @since 1.0.0
75
-                 * @param string $publish_listing_form_message The message to be filtered.
76
-                 */
77
-                $publish_listing_form_message = apply_filters('geodir_publish_listing_form_message', $publish_listing_form_message);
78
-                echo $publish_listing_form_message;
79
-
80
-                /**
81
-                 * Called on the add listing preview page inside the publish listings form, after the publish message.
82
-                 *
83
-                 * @since 1.0.0
84
-                 * @see 'geodir_publish_listing_form_before_msg'
85
-                 */
86
-                do_action('geodir_publish_listing_form_after_msg');
87
-
88
-                ob_start(); // start action button buffering
89
-                ?>
59
+				$alive_days = UNLIMITED;
60
+				$type_title = '';
61
+				ob_start();
62
+				echo '<h5 class="geodir_information">';
63
+
64
+				if (!isset($_REQUEST['pid']))
65
+					printf(GOING_TO_FREE_MSG, $type_title, $alive_days);
66
+				else
67
+					printf(GOING_TO_UPDATE_MSG, $type_title, $alive_days);
68
+
69
+				echo '</h5>';
70
+				$publish_listing_form_message = ob_get_clean();
71
+				/**
72
+				 * Filter the publish listing message on the preview page.
73
+				 *
74
+				 * @since 1.0.0
75
+				 * @param string $publish_listing_form_message The message to be filtered.
76
+				 */
77
+				$publish_listing_form_message = apply_filters('geodir_publish_listing_form_message', $publish_listing_form_message);
78
+				echo $publish_listing_form_message;
79
+
80
+				/**
81
+				 * Called on the add listing preview page inside the publish listings form, after the publish message.
82
+				 *
83
+				 * @since 1.0.0
84
+				 * @see 'geodir_publish_listing_form_before_msg'
85
+				 */
86
+				do_action('geodir_publish_listing_form_after_msg');
87
+
88
+				ob_start(); // start action button buffering
89
+				?>
90 90
                 <?php if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { ?>
91 91
 
92 92
                     <input type="submit" name="Submit and Pay" value="<?php echo PRO_UPDATE_BUTTON; ?>"
@@ -95,46 +95,46 @@  discard block
 block discarded – undo
95 95
                     <input type="submit" name="Submit and Pay" value="<?php echo PRO_SUBMIT_BUTTON; ?>"
96 96
                            class=" geodir_button geodir_publish_button"/>
97 97
                 <?php
98
-                }
99
-                $publish_listing_form_button = ob_get_clean();
100
-                /**
101
-                 * Filter the HTML button for publishing the listing on the preview page.
102
-                 *
103
-                 * @since 1.0.0
104
-                 * @param string $publish_listing_form_button The HTML for the submit button.
105
-                 */
106
-                $publish_listing_form_button = apply_filters('geodir_publish_listing_form_button', $publish_listing_form_button);
107
-                echo $publish_listing_form_button;
108
-
109
-                $post_id = '';
110
-                if (isset($post->pid)) {
111
-                    $post_id = $post->pid;
112
-                } else if (isset($_REQUEST['pid'])) {
113
-                    $post_id = (int)$_REQUEST['pid'];
114
-                }
115
-
116
-                $postlink = get_permalink(geodir_add_listing_page_id());
117
-                $postlink = geodir_getlink($postlink, array('pid' => $post_id, 'backandedit' => '1', 'listing_type' => $post_type), false);
118
-
119
-                ob_start(); // start go back and edit / cancel buffering
120
-                ?>
98
+				}
99
+				$publish_listing_form_button = ob_get_clean();
100
+				/**
101
+				 * Filter the HTML button for publishing the listing on the preview page.
102
+				 *
103
+				 * @since 1.0.0
104
+				 * @param string $publish_listing_form_button The HTML for the submit button.
105
+				 */
106
+				$publish_listing_form_button = apply_filters('geodir_publish_listing_form_button', $publish_listing_form_button);
107
+				echo $publish_listing_form_button;
108
+
109
+				$post_id = '';
110
+				if (isset($post->pid)) {
111
+					$post_id = $post->pid;
112
+				} else if (isset($_REQUEST['pid'])) {
113
+					$post_id = (int)$_REQUEST['pid'];
114
+				}
115
+
116
+				$postlink = get_permalink(geodir_add_listing_page_id());
117
+				$postlink = geodir_getlink($postlink, array('pid' => $post_id, 'backandedit' => '1', 'listing_type' => $post_type), false);
118
+
119
+				ob_start(); // start go back and edit / cancel buffering
120
+				?>
121 121
                 <a href="<?php echo esc_url($postlink); ?>" class="geodir_goback"><?php echo PRO_BACK_AND_EDIT_TEXT; ?></a>
122 122
                 <input type="button" name="Cancel" value="<?php echo(PRO_CANCEL_BUTTON); ?>"
123 123
                        class="geodir_button geodir_cancle_button"
124 124
                        onclick="window.location.href='<?php echo geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=cancel&pid=' . $post_id . '&listing_type=' . $post_type; ?>'"/>
125 125
                 <?php
126 126
 
127
-                $publish_listing_form_go_back = ob_get_clean();
128
-                /**
129
-                 * Filter the cancel and go back and edit HTML on the preview page.
130
-                 *
131
-                 * @since 1.0.0
132
-                 * @param string $publish_listing_form_go_back The HTML for the cancel and go back and edit button/link.
133
-                 */
134
-                $publish_listing_form_go_back = apply_filters('geodir_publish_listing_form_go_back', $publish_listing_form_go_back);
135
-                echo $publish_listing_form_go_back;
136
-
137
-                ?>
127
+				$publish_listing_form_go_back = ob_get_clean();
128
+				/**
129
+				 * Filter the cancel and go back and edit HTML on the preview page.
130
+				 *
131
+				 * @since 1.0.0
132
+				 * @param string $publish_listing_form_go_back The HTML for the cancel and go back and edit button/link.
133
+				 */
134
+				$publish_listing_form_go_back = apply_filters('geodir_publish_listing_form_go_back', $publish_listing_form_go_back);
135
+				echo $publish_listing_form_go_back;
136
+
137
+				?>
138 138
             </div>
139 139
         </form>
140 140
     </div>
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@  discard block
 block discarded – undo
15 15
 $post_type = $post->listing_type;
16 16
 
17 17
 if (isset($_REQUEST['preview']) && $_REQUEST['preview'] && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
18
-    $form_action_url = geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=update&listing_type=' . $post_type;
18
+    $form_action_url = geodir_get_ajax_url().'&geodir_ajax=add_listing&ajax_action=update&listing_type='.$post_type;
19 19
 } elseif (isset($_REQUEST['preview']) && $_REQUEST['preview']) {
20
-    $form_action_url = geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=publish&listing_type=' . $post_type;
20
+    $form_action_url = geodir_get_ajax_url().'&geodir_ajax=add_listing&ajax_action=publish&listing_type='.$post_type;
21 21
 }
22 22
 
23 23
 /**
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
                 if (isset($post->pid)) {
111 111
                     $post_id = $post->pid;
112 112
                 } else if (isset($_REQUEST['pid'])) {
113
-                    $post_id = (int)$_REQUEST['pid'];
113
+                    $post_id = (int) $_REQUEST['pid'];
114 114
                 }
115 115
 
116 116
                 $postlink = get_permalink(geodir_add_listing_page_id());
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                 <a href="<?php echo esc_url($postlink); ?>" class="geodir_goback"><?php echo PRO_BACK_AND_EDIT_TEXT; ?></a>
122 122
                 <input type="button" name="Cancel" value="<?php echo(PRO_CANCEL_BUTTON); ?>"
123 123
                        class="geodir_button geodir_cancle_button"
124
-                       onclick="window.location.href='<?php echo geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=cancel&pid=' . $post_id . '&listing_type=' . $post_type; ?>'"/>
124
+                       onclick="window.location.href='<?php echo geodir_get_ajax_url().'&geodir_ajax=add_listing&ajax_action=cancel&pid='.$post_id.'&listing_type='.$post_type; ?>'"/>
125 125
                 <?php
126 126
 
127 127
                 $publish_listing_form_go_back = ob_get_clean();
Please login to merge, or discard this patch.
geodirectory-widgets/geodirectory_cpt_categories_widget.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -353,7 +353,7 @@
 block discarded – undo
353 353
 
354 354
     if(!$cpt_left){
355 355
         $cpt_left = "gd-cpt-flat";
356
-    }else{
356
+    } else{
357 357
         $cpt_left = '';
358 358
     }
359 359
 
Please login to merge, or discard this patch.
Indentation   +424 added lines, -424 removed lines patch added patch discarded remove patch
@@ -13,241 +13,241 @@  discard block
 block discarded – undo
13 13
  */
14 14
 class geodir_cpt_categories_widget extends WP_Widget {
15 15
 
16
-    /**
17
-     * Register the cpt categories with WordPress.
18
-     *
19
-     * @since 1.5.4
20
-     */
21
-    public function __construct() {
22
-        $widget_ops = array('classname' => 'geodir_cpt_categories_widget', 'description' => __('A list of GeoDirectory CPT categories.', 'geodirectory'));
23
-        parent::__construct('geodir_cpt_categories_widget', __('GD > CPT Categories', 'geodirectory'), $widget_ops);
24
-    }
25
-
26
-    /**
27
-     * Front-end display content for cpt categories widget.
28
-     *
29
-     * @since 1.5.4
30
-     * @since 1.6.6 New parameters $no_cpt_filter &no_cat_filter added.
31
-     *
32
-     * @param array $args Widget arguments.
33
-     * @param array $instance Saved values from database.
34
-     */
35
-    public function widget($args, $instance) {
36
-        $params = array();
37
-        /**
38
-         * Filter the widget title.
39
-         *
40
-         * @since 1.5.4
41
-         *
42
-         * @param string $title The widget title. Default empty.
43
-         * @param array  $instance An array of the widget's settings.
44
-         * @param mixed  $id_base The widget ID.
45
-         */
46
-        $params['title'] = apply_filters('geodir_cpt_categories_widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
47
-
48
-        /**
49
-         * Filter the widget setting post type.
50
-         *
51
-         * @since 1.5.4
52
-         *
53
-         * @param array $post_type The post types to display categories.
54
-         * @param array $instance An array of the widget's settings.
55
-         * @param mixed $id_base The widget ID.
56
-         */
57
-        $params['post_type'] = apply_filters('geodir_cpt_categories_widget_post_type', empty($instance['post_type']) ? array() : $instance['post_type'], $instance, $this->id_base);
58
-
59
-        /**
60
-         * Filter the widget setting to hide empty categories.
61
-         *
62
-         * @since 1.5.4
63
-         *
64
-         * @param bool  $hide_empty If true then empty category will be not displayed.
65
-         * @param array $instance An array of the widget's settings.
66
-         * @param mixed $id_base The widget ID.
67
-         */
68
-        $params['hide_empty'] = apply_filters('geodir_cpt_categories_widget_hide_empty', empty($instance['hide_empty']) ? 0 : 1, $instance, $this->id_base);
69
-
70
-        /**
71
-         * Filter the widget setting to show/hide category count.
72
-         *
73
-         * @since 1.5.4
74
-         *
75
-         * @param bool  $show_count If true then category count will be displayed.
76
-         * @param array $instance An array of the widget's settings.
77
-         * @param mixed $id_base The widget ID.
78
-         */
79
-        $params['show_count'] = apply_filters('geodir_cpt_categories_widget_show_count', empty($instance['show_count']) ? 0 : 1, $instance, $this->id_base);
80
-
81
-        /**
82
-         * Filter the widget setting to show/hide category icon.
83
-         *
84
-         * @since 1.5.4
85
-         *
86
-         * @param bool  $hide_icon If true then category icon will be not displayed.
87
-         * @param array $instance An array of the widget's settings.
88
-         * @param mixed $id_base The widget ID.
89
-         */
90
-        $params['hide_icon'] = apply_filters('geodir_cpt_categories_widget_hide_icon', empty($instance['hide_icon']) ? 0 : 1, $instance, $this->id_base);
91
-
92
-        /**
93
-         * Filter the widget setting to show CPT inline or not.
94
-         *
95
-         * @since 1.5.4
96
-         *
97
-         * @param bool  $cpt_left If true then CPT will be displayed inline.
98
-         * @param array $instance An array of the widget's settings.
99
-         * @param mixed $id_base The widget ID.
100
-         */
101
-        $params['cpt_left'] = apply_filters('geodir_cpt_categories_widget_cpt_left', empty($instance['cpt_left']) ? 0 : 1, $instance, $this->id_base);
102
-
103
-        /**
104
-         * Filter the widget categories sorting order settings.
105
-         *
106
-         * @since 1.5.4
107
-         *
108
-         * @param string $max_count Widget max no of sub-categories count. Default 'count'.
109
-         * @param array       $instance An array of the widget's settings.
110
-         * @param mixed       $id_base The widget ID.
111
-         */
112
-        $params['sort_by'] = apply_filters('geodir_cpt_categories_widget_sort_by', isset($instance['sort_by']) && in_array($instance['sort_by'], array('az', 'count')) ? $instance['sort_by'] : 'count', $instance, $this->id_base);
113
-
114
-        /**
115
-         * Filter the widget max no of sub-categories count.
116
-         *
117
-         * @since 1.5.4
118
-         *
119
-         * @param bool|string $max_count Widget max no of sub-categories count.
120
-         * @param array       $instance An array of the widget's settings.
121
-         * @param mixed       $id_base The widget ID.
122
-         */
123
-        $params['max_count'] = apply_filters('geodir_cpt_categories_widget_max_count', !isset($instance['max_count']) ? 'all' : strip_tags($instance['max_count']), $instance, $this->id_base);
124
-
125
-        /**
126
-         * Filter the widget max sub-categories depth.
127
-         *
128
-         * @since 1.5.4
129
-         *
130
-         * @param bool|string $max_level Widget max sub-categories depth.
131
-         * @param array       $instance An array of the widget's settings.
132
-         * @param mixed       $id_base The widget ID.
133
-         */
134
-        $params['max_level'] = apply_filters('geodir_cpt_categories_widget_max_level', !isset($instance['max_level']) ? 'all' : strip_tags($instance['max_level']), $instance, $this->id_base);
16
+	/**
17
+	 * Register the cpt categories with WordPress.
18
+	 *
19
+	 * @since 1.5.4
20
+	 */
21
+	public function __construct() {
22
+		$widget_ops = array('classname' => 'geodir_cpt_categories_widget', 'description' => __('A list of GeoDirectory CPT categories.', 'geodirectory'));
23
+		parent::__construct('geodir_cpt_categories_widget', __('GD > CPT Categories', 'geodirectory'), $widget_ops);
24
+	}
25
+
26
+	/**
27
+	 * Front-end display content for cpt categories widget.
28
+	 *
29
+	 * @since 1.5.4
30
+	 * @since 1.6.6 New parameters $no_cpt_filter &no_cat_filter added.
31
+	 *
32
+	 * @param array $args Widget arguments.
33
+	 * @param array $instance Saved values from database.
34
+	 */
35
+	public function widget($args, $instance) {
36
+		$params = array();
37
+		/**
38
+		 * Filter the widget title.
39
+		 *
40
+		 * @since 1.5.4
41
+		 *
42
+		 * @param string $title The widget title. Default empty.
43
+		 * @param array  $instance An array of the widget's settings.
44
+		 * @param mixed  $id_base The widget ID.
45
+		 */
46
+		$params['title'] = apply_filters('geodir_cpt_categories_widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
47
+
48
+		/**
49
+		 * Filter the widget setting post type.
50
+		 *
51
+		 * @since 1.5.4
52
+		 *
53
+		 * @param array $post_type The post types to display categories.
54
+		 * @param array $instance An array of the widget's settings.
55
+		 * @param mixed $id_base The widget ID.
56
+		 */
57
+		$params['post_type'] = apply_filters('geodir_cpt_categories_widget_post_type', empty($instance['post_type']) ? array() : $instance['post_type'], $instance, $this->id_base);
58
+
59
+		/**
60
+		 * Filter the widget setting to hide empty categories.
61
+		 *
62
+		 * @since 1.5.4
63
+		 *
64
+		 * @param bool  $hide_empty If true then empty category will be not displayed.
65
+		 * @param array $instance An array of the widget's settings.
66
+		 * @param mixed $id_base The widget ID.
67
+		 */
68
+		$params['hide_empty'] = apply_filters('geodir_cpt_categories_widget_hide_empty', empty($instance['hide_empty']) ? 0 : 1, $instance, $this->id_base);
69
+
70
+		/**
71
+		 * Filter the widget setting to show/hide category count.
72
+		 *
73
+		 * @since 1.5.4
74
+		 *
75
+		 * @param bool  $show_count If true then category count will be displayed.
76
+		 * @param array $instance An array of the widget's settings.
77
+		 * @param mixed $id_base The widget ID.
78
+		 */
79
+		$params['show_count'] = apply_filters('geodir_cpt_categories_widget_show_count', empty($instance['show_count']) ? 0 : 1, $instance, $this->id_base);
80
+
81
+		/**
82
+		 * Filter the widget setting to show/hide category icon.
83
+		 *
84
+		 * @since 1.5.4
85
+		 *
86
+		 * @param bool  $hide_icon If true then category icon will be not displayed.
87
+		 * @param array $instance An array of the widget's settings.
88
+		 * @param mixed $id_base The widget ID.
89
+		 */
90
+		$params['hide_icon'] = apply_filters('geodir_cpt_categories_widget_hide_icon', empty($instance['hide_icon']) ? 0 : 1, $instance, $this->id_base);
91
+
92
+		/**
93
+		 * Filter the widget setting to show CPT inline or not.
94
+		 *
95
+		 * @since 1.5.4
96
+		 *
97
+		 * @param bool  $cpt_left If true then CPT will be displayed inline.
98
+		 * @param array $instance An array of the widget's settings.
99
+		 * @param mixed $id_base The widget ID.
100
+		 */
101
+		$params['cpt_left'] = apply_filters('geodir_cpt_categories_widget_cpt_left', empty($instance['cpt_left']) ? 0 : 1, $instance, $this->id_base);
102
+
103
+		/**
104
+		 * Filter the widget categories sorting order settings.
105
+		 *
106
+		 * @since 1.5.4
107
+		 *
108
+		 * @param string $max_count Widget max no of sub-categories count. Default 'count'.
109
+		 * @param array       $instance An array of the widget's settings.
110
+		 * @param mixed       $id_base The widget ID.
111
+		 */
112
+		$params['sort_by'] = apply_filters('geodir_cpt_categories_widget_sort_by', isset($instance['sort_by']) && in_array($instance['sort_by'], array('az', 'count')) ? $instance['sort_by'] : 'count', $instance, $this->id_base);
113
+
114
+		/**
115
+		 * Filter the widget max no of sub-categories count.
116
+		 *
117
+		 * @since 1.5.4
118
+		 *
119
+		 * @param bool|string $max_count Widget max no of sub-categories count.
120
+		 * @param array       $instance An array of the widget's settings.
121
+		 * @param mixed       $id_base The widget ID.
122
+		 */
123
+		$params['max_count'] = apply_filters('geodir_cpt_categories_widget_max_count', !isset($instance['max_count']) ? 'all' : strip_tags($instance['max_count']), $instance, $this->id_base);
124
+
125
+		/**
126
+		 * Filter the widget max sub-categories depth.
127
+		 *
128
+		 * @since 1.5.4
129
+		 *
130
+		 * @param bool|string $max_level Widget max sub-categories depth.
131
+		 * @param array       $instance An array of the widget's settings.
132
+		 * @param mixed       $id_base The widget ID.
133
+		 */
134
+		$params['max_level'] = apply_filters('geodir_cpt_categories_widget_max_level', !isset($instance['max_level']) ? 'all' : strip_tags($instance['max_level']), $instance, $this->id_base);
135 135
         
136
-        /**
137
-         * Filter the widget setting to disable filter current viewing post type.
138
-         *
139
-         * @since 1.6.6
140
-         *
141
-         * @param bool  $no_cpt_filter If true then it doesn't filter current viewing post type.
142
-         * @param array $instance An array of the widget's settings.
143
-         * @param mixed $id_base The widget ID.
144
-         */
145
-        $params['no_cpt_filter'] = apply_filters('geodir_cpt_categories_widget_no_cpt_filter', empty($instance['no_cpt_filter']) ? 0 : 1, $instance, $this->id_base);
136
+		/**
137
+		 * Filter the widget setting to disable filter current viewing post type.
138
+		 *
139
+		 * @since 1.6.6
140
+		 *
141
+		 * @param bool  $no_cpt_filter If true then it doesn't filter current viewing post type.
142
+		 * @param array $instance An array of the widget's settings.
143
+		 * @param mixed $id_base The widget ID.
144
+		 */
145
+		$params['no_cpt_filter'] = apply_filters('geodir_cpt_categories_widget_no_cpt_filter', empty($instance['no_cpt_filter']) ? 0 : 1, $instance, $this->id_base);
146 146
         
147
-        /**
148
-         * Filter the widget setting to disable current viewing category.
149
-         *
150
-         * @since 1.6.6
151
-         *
152
-         * @param bool  $no_cat_filter If true then it doesn't filter current viewing category.
153
-         * @param array $instance An array of the widget's settings.
154
-         * @param mixed $id_base The widget ID.
155
-         */
156
-        $params['no_cat_filter'] = apply_filters('geodir_cpt_categories_widget_no_cat_filter', empty($instance['no_cat_filter']) ? 0 : 1, $instance, $this->id_base);
157
-
158
-        /**
159
-         * Filter the widget parameters.
160
-         *
161
-         * @since 1.5.4
162
-         *
163
-         * @param array $params The widget parameters.
164
-         * @param array $instance An array of the widget's settings.
165
-         * @param mixed $id_base The widget ID.
166
-         */
167
-        $params = apply_filters('geodir_cpt_categories_widget_params', $params, $instance, $this->id_base);
168
-
169
-        $output = geodir_cpt_categories_output($params);
170
-
171
-        echo $args['before_widget'];
172
-        if ( $params['title'] ) {
173
-            echo '<div class="geodir_list_heading clearfix">';
174
-            echo $args['before_title'] . $params['title'] . $args['after_title'];
175
-            echo '</div>';
176
-        }
177
-        echo '<div class="gd-cptcats-widget">';
178
-        echo $output;
179
-        echo '</div>';
180
-        echo $args['after_widget'];
181
-    }
182
-
183
-    /**
184
-     * Sanitize cpt categories widget values as they are saved.
185
-     *
186
-     * @since 1.5.4
187
-     * @since 1.6.6 New parameters $no_cpt_filter &no_cat_filter added.
188
-     *
189
-     * @param array $new_instance Values just sent to be saved.
190
-     * @param array $old_instance Previously saved values from database.
191
-     *
192
-     * @return array Updated safe values to be saved.
193
-     */
194
-    public function update($new_instance, $old_instance) {
195
-        $new_instance['post_type'] = is_array($new_instance['post_type']) && in_array('0', $new_instance['post_type']) ? array('0') : $new_instance['post_type'];
196
-        $instance = $old_instance;
197
-        $instance['title'] = strip_tags($new_instance['title']);
198
-        $instance['post_type'] = isset($new_instance['post_type']) ? $new_instance['post_type'] : array('0');
199
-        $instance['hide_empty'] = !empty($new_instance['hide_empty']) ? 1 : 0;
200
-        $instance['show_count'] = !empty($new_instance['show_count']) ? 1 : 0;
201
-        $instance['hide_icon'] = !empty($new_instance['hide_icon']) ? 1 : 0;
202
-        $instance['cpt_left'] = !empty($new_instance['cpt_left']) ? 1 : 0;
203
-        $instance['sort_by'] = isset($new_instance['sort_by']) && in_array($new_instance['sort_by'], array('az', 'count')) ? $new_instance['sort_by'] : 'count';
204
-        $instance['max_count'] = strip_tags($new_instance['max_count']);
205
-        $instance['max_level'] = strip_tags($new_instance['max_level']);
206
-        $instance['no_cpt_filter'] = !empty($new_instance['no_cpt_filter']) ? 1 : 0;
207
-        $instance['no_cat_filter'] = !empty($new_instance['no_cat_filter']) ? 1 : 0;
208
-
209
-        return $instance;
210
-    }
211
-
212
-    /**
213
-     * Back-end cpt categories settings form.
214
-     *
215
-     * @since 1.5.4
216
-     * @since 1.6.6 New parameters $no_cpt_filter &no_cat_filter added.
217
-     *
218
-     * @param array $instance Previously saved values from database.
219
-     */
220
-    public function form($instance) {
221
-        $instance = wp_parse_args( (array)$instance,
222
-            array(
223
-                'title' => '',
224
-                'post_type' => array(), // NULL for all
225
-                'hide_empty' => '',
226
-                'show_count' => '',
227
-                'hide_icon' => '',
228
-                'cpt_left' => '',
229
-                'sort_by' => 'count',
230
-                'max_count' => 'all',
231
-                'max_level' => '1',
232
-                'no_cpt_filter' => '',
233
-                'no_cat_filter' => '',
234
-            )
235
-        );
236
-
237
-        $title = strip_tags($instance['title']);
238
-        $post_type = $instance['post_type'];
239
-        $hide_empty = !empty($instance['hide_empty']) ? true : false;
240
-        $show_count = !empty($instance['show_count']) ? true : false;
241
-        $hide_icon = !empty($instance['hide_icon']) ? true : false;
242
-        $cpt_left = !empty($instance['cpt_left']) ? true : false;
243
-        $max_count = strip_tags($instance['max_count']);
244
-        $max_level = strip_tags($instance['max_level']);
245
-        $sort_by = isset($instance['sort_by']) && in_array($instance['sort_by'], array('az', 'count')) ? $instance['sort_by'] : 'count';
246
-        $no_cpt_filter = !empty($instance['no_cpt_filter']) ? true : false;
247
-        $no_cat_filter = !empty($instance['no_cat_filter']) ? true : false;
248
-
249
-        $post_type_options = geodir_get_posttypes('options');
250
-        ?>
147
+		/**
148
+		 * Filter the widget setting to disable current viewing category.
149
+		 *
150
+		 * @since 1.6.6
151
+		 *
152
+		 * @param bool  $no_cat_filter If true then it doesn't filter current viewing category.
153
+		 * @param array $instance An array of the widget's settings.
154
+		 * @param mixed $id_base The widget ID.
155
+		 */
156
+		$params['no_cat_filter'] = apply_filters('geodir_cpt_categories_widget_no_cat_filter', empty($instance['no_cat_filter']) ? 0 : 1, $instance, $this->id_base);
157
+
158
+		/**
159
+		 * Filter the widget parameters.
160
+		 *
161
+		 * @since 1.5.4
162
+		 *
163
+		 * @param array $params The widget parameters.
164
+		 * @param array $instance An array of the widget's settings.
165
+		 * @param mixed $id_base The widget ID.
166
+		 */
167
+		$params = apply_filters('geodir_cpt_categories_widget_params', $params, $instance, $this->id_base);
168
+
169
+		$output = geodir_cpt_categories_output($params);
170
+
171
+		echo $args['before_widget'];
172
+		if ( $params['title'] ) {
173
+			echo '<div class="geodir_list_heading clearfix">';
174
+			echo $args['before_title'] . $params['title'] . $args['after_title'];
175
+			echo '</div>';
176
+		}
177
+		echo '<div class="gd-cptcats-widget">';
178
+		echo $output;
179
+		echo '</div>';
180
+		echo $args['after_widget'];
181
+	}
182
+
183
+	/**
184
+	 * Sanitize cpt categories widget values as they are saved.
185
+	 *
186
+	 * @since 1.5.4
187
+	 * @since 1.6.6 New parameters $no_cpt_filter &no_cat_filter added.
188
+	 *
189
+	 * @param array $new_instance Values just sent to be saved.
190
+	 * @param array $old_instance Previously saved values from database.
191
+	 *
192
+	 * @return array Updated safe values to be saved.
193
+	 */
194
+	public function update($new_instance, $old_instance) {
195
+		$new_instance['post_type'] = is_array($new_instance['post_type']) && in_array('0', $new_instance['post_type']) ? array('0') : $new_instance['post_type'];
196
+		$instance = $old_instance;
197
+		$instance['title'] = strip_tags($new_instance['title']);
198
+		$instance['post_type'] = isset($new_instance['post_type']) ? $new_instance['post_type'] : array('0');
199
+		$instance['hide_empty'] = !empty($new_instance['hide_empty']) ? 1 : 0;
200
+		$instance['show_count'] = !empty($new_instance['show_count']) ? 1 : 0;
201
+		$instance['hide_icon'] = !empty($new_instance['hide_icon']) ? 1 : 0;
202
+		$instance['cpt_left'] = !empty($new_instance['cpt_left']) ? 1 : 0;
203
+		$instance['sort_by'] = isset($new_instance['sort_by']) && in_array($new_instance['sort_by'], array('az', 'count')) ? $new_instance['sort_by'] : 'count';
204
+		$instance['max_count'] = strip_tags($new_instance['max_count']);
205
+		$instance['max_level'] = strip_tags($new_instance['max_level']);
206
+		$instance['no_cpt_filter'] = !empty($new_instance['no_cpt_filter']) ? 1 : 0;
207
+		$instance['no_cat_filter'] = !empty($new_instance['no_cat_filter']) ? 1 : 0;
208
+
209
+		return $instance;
210
+	}
211
+
212
+	/**
213
+	 * Back-end cpt categories settings form.
214
+	 *
215
+	 * @since 1.5.4
216
+	 * @since 1.6.6 New parameters $no_cpt_filter &no_cat_filter added.
217
+	 *
218
+	 * @param array $instance Previously saved values from database.
219
+	 */
220
+	public function form($instance) {
221
+		$instance = wp_parse_args( (array)$instance,
222
+			array(
223
+				'title' => '',
224
+				'post_type' => array(), // NULL for all
225
+				'hide_empty' => '',
226
+				'show_count' => '',
227
+				'hide_icon' => '',
228
+				'cpt_left' => '',
229
+				'sort_by' => 'count',
230
+				'max_count' => 'all',
231
+				'max_level' => '1',
232
+				'no_cpt_filter' => '',
233
+				'no_cat_filter' => '',
234
+			)
235
+		);
236
+
237
+		$title = strip_tags($instance['title']);
238
+		$post_type = $instance['post_type'];
239
+		$hide_empty = !empty($instance['hide_empty']) ? true : false;
240
+		$show_count = !empty($instance['show_count']) ? true : false;
241
+		$hide_icon = !empty($instance['hide_icon']) ? true : false;
242
+		$cpt_left = !empty($instance['cpt_left']) ? true : false;
243
+		$max_count = strip_tags($instance['max_count']);
244
+		$max_level = strip_tags($instance['max_level']);
245
+		$sort_by = isset($instance['sort_by']) && in_array($instance['sort_by'], array('az', 'count')) ? $instance['sort_by'] : 'count';
246
+		$no_cpt_filter = !empty($instance['no_cpt_filter']) ? true : false;
247
+		$no_cat_filter = !empty($instance['no_cat_filter']) ? true : false;
248
+
249
+		$post_type_options = geodir_get_posttypes('options');
250
+		?>
251 251
         <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
252 252
         <p>
253 253
             <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Select CPT:', 'geodirectory'); ?></label>
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
             <label for="<?php echo $this->get_field_id('no_cat_filter'); ?>"><?php _e( 'Don\'t filter for current viewing category', 'geodirectory' ); ?></label>
299 299
         </p>
300 300
     <?php
301
-    }
301
+	}
302 302
 } // class geodir_cpt_categories_widget
303 303
 
304 304
 register_widget('geodir_cpt_categories_widget');
@@ -313,153 +313,153 @@  discard block
 block discarded – undo
313 313
  * @return string CPT categories content.
314 314
  */
315 315
 function geodir_cpt_categories_output($params) {
316
-    $args = wp_parse_args((array)$params,
317
-        array(
318
-            'title' => '',
319
-            'post_type' => array(), // NULL for all
320
-            'hide_empty' => '',
321
-            'show_count' => '',
322
-            'hide_icon' => '',
323
-            'cpt_left' => '',
324
-            'sort_by' => 'count',
325
-            'max_count' => 'all',
326
-            'max_level' => '1',
327
-            'no_cpt_filter' => '',
328
-            'no_cat_filter' => '',
329
-        )
330
-    );
331
-
332
-    $sort_by = isset($args['sort_by']) && in_array($args['sort_by'], array('az', 'count')) ? $args['sort_by'] : 'count';
333
-    $cpt_filter = empty($args['no_cpt_filter']) ? true : false;
334
-    $cat_filter = empty($args['no_cat_filter']) ? true : false;
335
-
336
-    $gd_post_types = geodir_get_posttypes('array');
337
-
338
-    $post_type_arr = !is_array($args['post_type']) ? explode(',', $args['post_type']) : $args['post_type'];
339
-    $current_posttype = geodir_get_current_posttype();
340
-
341
-    $is_listing = false;
342
-    $is_category = false;
343
-    if (geodir_is_page('listing')) {
344
-        $current_posttype = geodir_get_current_posttype();
345
-
346
-        if ($current_posttype != '' && isset($gd_post_types[$current_posttype])) {
347
-            $is_listing = true;
348
-
349
-            if (is_tax()) { // category page
350
-                $current_term_id = get_queried_object_id();
351
-                $current_taxonomy = get_query_var('taxonomy');
352
-                $current_posttype = geodir_get_current_posttype();
353
-
354
-                if ($current_term_id && $current_posttype && get_query_var('taxonomy') == $current_posttype . 'category') {
355
-                    $is_category = true;
356
-                }
357
-            }
358
-        }
359
-    }
360
-
361
-    $parent_category = 0;
362
-    if ($is_listing && $cpt_filter) {
363
-        $post_type_arr = array($current_posttype);
364
-    }
365
-
366
-    $post_types = array();
367
-    if (!empty($post_type_arr)) {
368
-        if (in_array('0', $post_type_arr)) {
369
-            $post_types = $gd_post_types;
370
-        } else {
371
-            foreach ($post_type_arr as $cpt) {
372
-                if (isset($gd_post_types[$cpt])) {
373
-                    $post_types[$cpt] = $gd_post_types[$cpt];
374
-                }
375
-            }
376
-        }
377
-    }
378
-
379
-    if (empty($post_type_arr)) {
380
-        $post_types = $gd_post_types;
381
-    }
382
-
383
-    $hide_empty = !empty($args['hide_empty']) ? true : false;
384
-    $max_count = strip_tags($args['max_count']);
385
-    $all_childs = $max_count == 'all' ? true : false;
386
-    $max_count = $max_count > 0 ? (int)$max_count : 0;
387
-    $max_level = strip_tags($args['max_level']);
388
-    $show_count = !empty($args['show_count']) ? true : false;
389
-    $hide_icon = !empty($args['hide_icon']) ? true : false;
390
-    $cpt_left = !empty($args['cpt_left']) ? true : false;
391
-
392
-    if(!$cpt_left){
393
-        $cpt_left = "gd-cpt-flat";
394
-    }else{
395
-        $cpt_left = '';
396
-    }
397
-
398
-    $orderby = 'count';
399
-    $order = 'DESC';
400
-    if ($sort_by == 'az') {
401
-        $orderby = 'name';
402
-        $order = 'ASC';
403
-    }
404
-
405
-    $output = '';
406
-    if (!empty($post_types)) {
407
-        foreach ($post_types as $cpt => $cpt_info) {
408
-            $parent_category = ($is_category && $cat_filter && $cpt == $current_posttype) ? $current_term_id : 0;
409
-            $cat_taxonomy = $cpt . 'category';
410
-            $categories = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_category));
411
-            if ($hide_empty) {
412
-                $categories = geodir_filter_empty_terms($categories);
413
-            }
414
-            if ($sort_by == 'count') {
415
-                $categories = geodir_sort_terms($categories, 'count');
416
-            }
417
-
418
-            if (!empty($categories)) {
419
-                $term_icons = !$hide_icon ? geodir_get_term_icon() : array();
420
-                $row_class = '';
421
-
422
-                if ($is_listing) {
423
-                    $row_class = $is_category ? ' gd-cptcat-categ' : ' gd-cptcat-listing';
424
-                }
425
-                $cpt_row = '<div class="gd-cptcat-row gd-cptcat-' . $cpt . $row_class . ' '.$cpt_left.'">';
426
-
427
-                if ($is_category && $cat_filter && $cpt == $current_posttype) {
428
-                    $term_info = get_term($current_term_id, $cat_taxonomy);
429
-
430
-                    $term_icon_url = !empty($term_icons) && isset($term_icons[$term_info->term_id]) ? $term_icons[$term_info->term_id] : '';
431
-                    $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($term_info->name) . ' icon" src="' . $term_icon_url . '" /> ' : '';
432
-
433
-                    $count = $show_count ? ' <span class="gd-cptcat-count">(' . $term_info->count . ')</span>' : '';
434
-                    $cpt_row .= '<h2 class="gd-cptcat-title">' . $term_icon_url . $term_info->name . $count . '</h2>';
435
-                } else {
436
-                    $cpt_row .= '<h2 class="gd-cptcat-title">' . __($cpt_info['labels']['name'], 'geodirectory') . '</h2>';
437
-                }
438
-                foreach ($categories as $category) {
439
-                    $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : '';
440
-                    $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : '';
441
-
442
-                    $term_link = get_term_link( $category, $category->taxonomy );
443
-                    /** Filter documented in geodirectory-functions/general_functions.php **/
444
-                    $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt );
445
-
446
-                    $cpt_row .= '<ul class="gd-cptcat-ul gd-cptcat-parent  '.$cpt_left.'">';
447
-                    $cpt_row .= '<li class="gd-cptcat-li gd-cptcat-li-main">';
448
-                    $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : '';
449
-                    $cpt_row .= '<h3 class="gd-cptcat-cat"><a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">'  .$term_icon_url . $category->name . $count . '</a></h3>';
450
-                    if (($all_childs || $max_count > 0) && ($max_level == 'all' || (int)$max_level > 0)) {
451
-                        $cpt_row .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons);
452
-                    }
453
-                    $cpt_row .= '</li>';
454
-                    $cpt_row .= '</ul>';
455
-                }
456
-                $cpt_row .= '</ul></div>';
457
-
458
-                $output .= $cpt_row;
459
-            }
460
-        }
461
-    }
462
-    return $output;
316
+	$args = wp_parse_args((array)$params,
317
+		array(
318
+			'title' => '',
319
+			'post_type' => array(), // NULL for all
320
+			'hide_empty' => '',
321
+			'show_count' => '',
322
+			'hide_icon' => '',
323
+			'cpt_left' => '',
324
+			'sort_by' => 'count',
325
+			'max_count' => 'all',
326
+			'max_level' => '1',
327
+			'no_cpt_filter' => '',
328
+			'no_cat_filter' => '',
329
+		)
330
+	);
331
+
332
+	$sort_by = isset($args['sort_by']) && in_array($args['sort_by'], array('az', 'count')) ? $args['sort_by'] : 'count';
333
+	$cpt_filter = empty($args['no_cpt_filter']) ? true : false;
334
+	$cat_filter = empty($args['no_cat_filter']) ? true : false;
335
+
336
+	$gd_post_types = geodir_get_posttypes('array');
337
+
338
+	$post_type_arr = !is_array($args['post_type']) ? explode(',', $args['post_type']) : $args['post_type'];
339
+	$current_posttype = geodir_get_current_posttype();
340
+
341
+	$is_listing = false;
342
+	$is_category = false;
343
+	if (geodir_is_page('listing')) {
344
+		$current_posttype = geodir_get_current_posttype();
345
+
346
+		if ($current_posttype != '' && isset($gd_post_types[$current_posttype])) {
347
+			$is_listing = true;
348
+
349
+			if (is_tax()) { // category page
350
+				$current_term_id = get_queried_object_id();
351
+				$current_taxonomy = get_query_var('taxonomy');
352
+				$current_posttype = geodir_get_current_posttype();
353
+
354
+				if ($current_term_id && $current_posttype && get_query_var('taxonomy') == $current_posttype . 'category') {
355
+					$is_category = true;
356
+				}
357
+			}
358
+		}
359
+	}
360
+
361
+	$parent_category = 0;
362
+	if ($is_listing && $cpt_filter) {
363
+		$post_type_arr = array($current_posttype);
364
+	}
365
+
366
+	$post_types = array();
367
+	if (!empty($post_type_arr)) {
368
+		if (in_array('0', $post_type_arr)) {
369
+			$post_types = $gd_post_types;
370
+		} else {
371
+			foreach ($post_type_arr as $cpt) {
372
+				if (isset($gd_post_types[$cpt])) {
373
+					$post_types[$cpt] = $gd_post_types[$cpt];
374
+				}
375
+			}
376
+		}
377
+	}
378
+
379
+	if (empty($post_type_arr)) {
380
+		$post_types = $gd_post_types;
381
+	}
382
+
383
+	$hide_empty = !empty($args['hide_empty']) ? true : false;
384
+	$max_count = strip_tags($args['max_count']);
385
+	$all_childs = $max_count == 'all' ? true : false;
386
+	$max_count = $max_count > 0 ? (int)$max_count : 0;
387
+	$max_level = strip_tags($args['max_level']);
388
+	$show_count = !empty($args['show_count']) ? true : false;
389
+	$hide_icon = !empty($args['hide_icon']) ? true : false;
390
+	$cpt_left = !empty($args['cpt_left']) ? true : false;
391
+
392
+	if(!$cpt_left){
393
+		$cpt_left = "gd-cpt-flat";
394
+	}else{
395
+		$cpt_left = '';
396
+	}
397
+
398
+	$orderby = 'count';
399
+	$order = 'DESC';
400
+	if ($sort_by == 'az') {
401
+		$orderby = 'name';
402
+		$order = 'ASC';
403
+	}
404
+
405
+	$output = '';
406
+	if (!empty($post_types)) {
407
+		foreach ($post_types as $cpt => $cpt_info) {
408
+			$parent_category = ($is_category && $cat_filter && $cpt == $current_posttype) ? $current_term_id : 0;
409
+			$cat_taxonomy = $cpt . 'category';
410
+			$categories = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_category));
411
+			if ($hide_empty) {
412
+				$categories = geodir_filter_empty_terms($categories);
413
+			}
414
+			if ($sort_by == 'count') {
415
+				$categories = geodir_sort_terms($categories, 'count');
416
+			}
417
+
418
+			if (!empty($categories)) {
419
+				$term_icons = !$hide_icon ? geodir_get_term_icon() : array();
420
+				$row_class = '';
421
+
422
+				if ($is_listing) {
423
+					$row_class = $is_category ? ' gd-cptcat-categ' : ' gd-cptcat-listing';
424
+				}
425
+				$cpt_row = '<div class="gd-cptcat-row gd-cptcat-' . $cpt . $row_class . ' '.$cpt_left.'">';
426
+
427
+				if ($is_category && $cat_filter && $cpt == $current_posttype) {
428
+					$term_info = get_term($current_term_id, $cat_taxonomy);
429
+
430
+					$term_icon_url = !empty($term_icons) && isset($term_icons[$term_info->term_id]) ? $term_icons[$term_info->term_id] : '';
431
+					$term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($term_info->name) . ' icon" src="' . $term_icon_url . '" /> ' : '';
432
+
433
+					$count = $show_count ? ' <span class="gd-cptcat-count">(' . $term_info->count . ')</span>' : '';
434
+					$cpt_row .= '<h2 class="gd-cptcat-title">' . $term_icon_url . $term_info->name . $count . '</h2>';
435
+				} else {
436
+					$cpt_row .= '<h2 class="gd-cptcat-title">' . __($cpt_info['labels']['name'], 'geodirectory') . '</h2>';
437
+				}
438
+				foreach ($categories as $category) {
439
+					$term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : '';
440
+					$term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : '';
441
+
442
+					$term_link = get_term_link( $category, $category->taxonomy );
443
+					/** Filter documented in geodirectory-functions/general_functions.php **/
444
+					$term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt );
445
+
446
+					$cpt_row .= '<ul class="gd-cptcat-ul gd-cptcat-parent  '.$cpt_left.'">';
447
+					$cpt_row .= '<li class="gd-cptcat-li gd-cptcat-li-main">';
448
+					$count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : '';
449
+					$cpt_row .= '<h3 class="gd-cptcat-cat"><a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">'  .$term_icon_url . $category->name . $count . '</a></h3>';
450
+					if (($all_childs || $max_count > 0) && ($max_level == 'all' || (int)$max_level > 0)) {
451
+						$cpt_row .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons);
452
+					}
453
+					$cpt_row .= '</li>';
454
+					$cpt_row .= '</ul>';
455
+				}
456
+				$cpt_row .= '</ul></div>';
457
+
458
+				$output .= $cpt_row;
459
+			}
460
+		}
461
+	}
462
+	return $output;
463 463
 }
464 464
 
465 465
 /**
@@ -479,48 +479,48 @@  discard block
 block discarded – undo
479 479
  * @return string Html content.
480 480
  */
481 481
 function geodir_cpt_categories_child_cats($parent_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth = 1) {
482
-    $cat_taxonomy = $cpt . 'category';
483
-
484
-    $orderby = 'count';
485
-    $order = 'DESC';
486
-    if ($sort_by == 'az') {
487
-        $orderby = 'name';
488
-        $order = 'ASC';
489
-    }
490
-
491
-    if ($max_level != 'all' && $depth > (int)$max_level ) {
492
-        return '';
493
-    }
494
-
495
-    $child_cats = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_id, 'number' => $max_count));
496
-    if ($hide_empty) {
497
-        $child_cats = geodir_filter_empty_terms($child_cats);
498
-    }
499
-
500
-    if (empty($child_cats)) {
501
-        return '';
502
-    }
503
-
504
-    if ($sort_by == 'count') {
505
-        $child_cats = geodir_sort_terms($child_cats, 'count');
506
-    }
507
-
508
-    $content = '<li class="gd-cptcat-li gd-cptcat-li-sub"><ul class="gd-cptcat-ul gd-cptcat-sub gd-cptcat-sub-' . $depth . '">';
509
-    $depth++;
510
-    foreach ($child_cats as $category) {
511
-        $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : '';
512
-        $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : '';
513
-        $term_link = get_term_link( $category, $category->taxonomy );
514
-        /** Filter documented in geodirectory-functions/general_functions.php **/
515
-        $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt );
516
-        $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : '';
517
-
518
-        $content .= '<li class="gd-cptcat-li gd-cptcat-li-sub">';
519
-        $content .= '<a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' . $term_icon_url . $category->name . $count . '</a></li>';
520
-        $content .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth);
521
-    }
522
-    $content .= '</li></ul>';
523
-
524
-    return $content;
482
+	$cat_taxonomy = $cpt . 'category';
483
+
484
+	$orderby = 'count';
485
+	$order = 'DESC';
486
+	if ($sort_by == 'az') {
487
+		$orderby = 'name';
488
+		$order = 'ASC';
489
+	}
490
+
491
+	if ($max_level != 'all' && $depth > (int)$max_level ) {
492
+		return '';
493
+	}
494
+
495
+	$child_cats = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_id, 'number' => $max_count));
496
+	if ($hide_empty) {
497
+		$child_cats = geodir_filter_empty_terms($child_cats);
498
+	}
499
+
500
+	if (empty($child_cats)) {
501
+		return '';
502
+	}
503
+
504
+	if ($sort_by == 'count') {
505
+		$child_cats = geodir_sort_terms($child_cats, 'count');
506
+	}
507
+
508
+	$content = '<li class="gd-cptcat-li gd-cptcat-li-sub"><ul class="gd-cptcat-ul gd-cptcat-sub gd-cptcat-sub-' . $depth . '">';
509
+	$depth++;
510
+	foreach ($child_cats as $category) {
511
+		$term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : '';
512
+		$term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : '';
513
+		$term_link = get_term_link( $category, $category->taxonomy );
514
+		/** Filter documented in geodirectory-functions/general_functions.php **/
515
+		$term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt );
516
+		$count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : '';
517
+
518
+		$content .= '<li class="gd-cptcat-li gd-cptcat-li-sub">';
519
+		$content .= '<a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' . $term_icon_url . $category->name . $count . '</a></li>';
520
+		$content .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth);
521
+	}
522
+	$content .= '</li></ul>';
523
+
524
+	return $content;
525 525
 }
526 526
 ?>
527 527
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
         $output = geodir_cpt_categories_output($params);
170 170
 
171 171
         echo $args['before_widget'];
172
-        if ( $params['title'] ) {
172
+        if ($params['title']) {
173 173
             echo '<div class="geodir_list_heading clearfix">';
174
-            echo $args['before_title'] . $params['title'] . $args['after_title'];
174
+            echo $args['before_title'].$params['title'].$args['after_title'];
175 175
             echo '</div>';
176 176
         }
177 177
         echo '<div class="gd-cptcats-widget">';
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
      * @param array $instance Previously saved values from database.
219 219
      */
220 220
     public function form($instance) {
221
-        $instance = wp_parse_args( (array)$instance,
221
+        $instance = wp_parse_args((array) $instance,
222 222
             array(
223 223
                 'title' => '',
224 224
                 'post_type' => array(), // NULL for all
@@ -252,50 +252,50 @@  discard block
 block discarded – undo
252 252
         <p>
253 253
             <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Select CPT:', 'geodirectory'); ?></label>
254 254
             <select name="<?php echo $this->get_field_name('post_type'); ?>[]" id="<?php echo $this->get_field_id('post_type'); ?>" class="widefat" multiple="multiple">
255
-                <option value="0" <?php selected( (empty($post_type) || (is_array($post_type) && in_array('0', $post_type))), true ); ?>><?php _e('All', 'geodirectory'); ?></option>
255
+                <option value="0" <?php selected((empty($post_type) || (is_array($post_type) && in_array('0', $post_type))), true); ?>><?php _e('All', 'geodirectory'); ?></option>
256 256
                 <?php foreach ($post_type_options as $name => $title) { ?>
257
-                    <option value="<?php echo $name;?>" <?php selected( is_array($post_type) && in_array($name, $post_type), true ); ?>><?php echo $title; ?></option>
257
+                    <option value="<?php echo $name; ?>" <?php selected(is_array($post_type) && in_array($name, $post_type), true); ?>><?php echo $title; ?></option>
258 258
                 <?php } ?>
259 259
             </select>
260 260
         </p>
261
-        <p><input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hide_empty'); ?>" name="<?php echo $this->get_field_name('hide_empty'); ?>"<?php checked( $hide_empty ); ?> value="1" />
262
-            <label for="<?php echo $this->get_field_id('hide_empty'); ?>"><?php _e( 'Hide empty categories', 'geodirectory' ); ?></label><br />
263
-            <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_count'); ?>" name="<?php echo $this->get_field_name('show_count'); ?>"<?php checked( $show_count ); ?> value="1" />
264
-            <label for="<?php echo $this->get_field_id('show_count'); ?>"><?php _e( 'Show category count' ); ?></label> <small><?php _e( '( Enabling will slow down page loading for big directories. )', 'geodirectory' ); ?></small><br />
265
-            <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hide_icon'); ?>" name="<?php echo $this->get_field_name('hide_icon'); ?>"<?php checked( $hide_icon ); ?> value="1" />
266
-            <label for="<?php echo $this->get_field_id('hide_icon'); ?>"><?php _e( 'Hide category icon', 'geodirectory' ); ?></label><br />
267
-            <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('cpt_left'); ?>" name="<?php echo $this->get_field_name('cpt_left'); ?>"<?php checked( $cpt_left ); ?> value="1" />
268
-            <label for="<?php echo $this->get_field_id('cpt_left'); ?>"><?php _e( 'Show CPT on same line', 'geodirectory' ); ?></label>
261
+        <p><input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hide_empty'); ?>" name="<?php echo $this->get_field_name('hide_empty'); ?>"<?php checked($hide_empty); ?> value="1" />
262
+            <label for="<?php echo $this->get_field_id('hide_empty'); ?>"><?php _e('Hide empty categories', 'geodirectory'); ?></label><br />
263
+            <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_count'); ?>" name="<?php echo $this->get_field_name('show_count'); ?>"<?php checked($show_count); ?> value="1" />
264
+            <label for="<?php echo $this->get_field_id('show_count'); ?>"><?php _e('Show category count'); ?></label> <small><?php _e('( Enabling will slow down page loading for big directories. )', 'geodirectory'); ?></small><br />
265
+            <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hide_icon'); ?>" name="<?php echo $this->get_field_name('hide_icon'); ?>"<?php checked($hide_icon); ?> value="1" />
266
+            <label for="<?php echo $this->get_field_id('hide_icon'); ?>"><?php _e('Hide category icon', 'geodirectory'); ?></label><br />
267
+            <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('cpt_left'); ?>" name="<?php echo $this->get_field_name('cpt_left'); ?>"<?php checked($cpt_left); ?> value="1" />
268
+            <label for="<?php echo $this->get_field_id('cpt_left'); ?>"><?php _e('Show CPT on same line', 'geodirectory'); ?></label>
269 269
         <p>
270 270
             <label for="<?php echo $this->get_field_id('sort_by'); ?>"><?php _e('Sort by:', 'geodirectory'); ?></label>
271 271
             <select name="<?php echo $this->get_field_name('sort_by'); ?>" id="<?php echo $this->get_field_id('sort_by'); ?>" class="widefat">
272
-                <option value="az" <?php selected( $sort_by, 'az' ); ?>><?php _e('A-Z', 'geodirectory'); ?></option>
273
-                <option value="count" <?php selected( $sort_by, 'count' ); ?>><?php _e('Count', 'geodirectory'); ?></option>
272
+                <option value="az" <?php selected($sort_by, 'az'); ?>><?php _e('A-Z', 'geodirectory'); ?></option>
273
+                <option value="count" <?php selected($sort_by, 'count'); ?>><?php _e('Count', 'geodirectory'); ?></option>
274 274
             </select>
275 275
         </p>
276 276
         <p>
277 277
             <label for="<?php echo $this->get_field_id('max_count'); ?>"><?php _e('Max no of sub-categories:', 'geodirectory'); ?></label>
278 278
             <select name="<?php echo $this->get_field_name('max_count'); ?>" id="<?php echo $this->get_field_id('max_count'); ?>" class="widefat">
279
-                <option value="all" <?php selected( $max_count, 'all' ); ?>><?php _e('All', 'geodirectory'); ?></option>
279
+                <option value="all" <?php selected($max_count, 'all'); ?>><?php _e('All', 'geodirectory'); ?></option>
280 280
                 <?php for ($n = 10; $n >= 0; $n--) { ?>
281
-                    <option value="<?php echo $n;?>" <?php selected( $max_count, $n ); ?>><?php echo $n; ?></option>
281
+                    <option value="<?php echo $n; ?>" <?php selected($max_count, $n); ?>><?php echo $n; ?></option>
282 282
                 <?php } ?>
283 283
             </select>
284 284
         </p>
285 285
         <p>
286 286
             <label for="<?php echo $this->get_field_id('max_level'); ?>"><?php _e('Show max sub-categories depth:', 'geodirectory'); ?></label>
287 287
             <select name="<?php echo $this->get_field_name('max_level'); ?>" id="<?php echo $this->get_field_id('max_level'); ?>" class="widefat">
288
-                <option value="all" <?php selected( $max_level, 'all' ); ?>><?php _e('All', 'geodirectory'); ?></option>
288
+                <option value="all" <?php selected($max_level, 'all'); ?>><?php _e('All', 'geodirectory'); ?></option>
289 289
                 <?php for ($n = 0; $n <= 10; $n++) { ?>
290
-                    <option value="<?php echo $n;?>" <?php selected( $max_level, $n ); ?>><?php echo $n; ?></option>
290
+                    <option value="<?php echo $n; ?>" <?php selected($max_level, $n); ?>><?php echo $n; ?></option>
291 291
                 <?php } ?>
292 292
             </select>
293 293
         </p>
294 294
         <p>
295
-            <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('no_cpt_filter'); ?>" name="<?php echo $this->get_field_name('no_cpt_filter'); ?>"<?php checked( $no_cpt_filter ); ?> value="1" />
296
-            <label for="<?php echo $this->get_field_id('no_cpt_filter'); ?>"><?php _e( 'Don\'t filter for current viewing post type', 'geodirectory' ); ?></label>
297
-            <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('no_cat_filter'); ?>" name="<?php echo $this->get_field_name('no_cat_filter'); ?>"<?php checked( $no_cat_filter ); ?> value="1" />
298
-            <label for="<?php echo $this->get_field_id('no_cat_filter'); ?>"><?php _e( 'Don\'t filter for current viewing category', 'geodirectory' ); ?></label>
295
+            <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('no_cpt_filter'); ?>" name="<?php echo $this->get_field_name('no_cpt_filter'); ?>"<?php checked($no_cpt_filter); ?> value="1" />
296
+            <label for="<?php echo $this->get_field_id('no_cpt_filter'); ?>"><?php _e('Don\'t filter for current viewing post type', 'geodirectory'); ?></label>
297
+            <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('no_cat_filter'); ?>" name="<?php echo $this->get_field_name('no_cat_filter'); ?>"<?php checked($no_cat_filter); ?> value="1" />
298
+            <label for="<?php echo $this->get_field_id('no_cat_filter'); ?>"><?php _e('Don\'t filter for current viewing category', 'geodirectory'); ?></label>
299 299
         </p>
300 300
     <?php
301 301
     }
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
  * @return string CPT categories content.
314 314
  */
315 315
 function geodir_cpt_categories_output($params) {
316
-    $args = wp_parse_args((array)$params,
316
+    $args = wp_parse_args((array) $params,
317 317
         array(
318 318
             'title' => '',
319 319
             'post_type' => array(), // NULL for all
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
                 $current_taxonomy = get_query_var('taxonomy');
352 352
                 $current_posttype = geodir_get_current_posttype();
353 353
 
354
-                if ($current_term_id && $current_posttype && get_query_var('taxonomy') == $current_posttype . 'category') {
354
+                if ($current_term_id && $current_posttype && get_query_var('taxonomy') == $current_posttype.'category') {
355 355
                     $is_category = true;
356 356
                 }
357 357
             }
@@ -383,15 +383,15 @@  discard block
 block discarded – undo
383 383
     $hide_empty = !empty($args['hide_empty']) ? true : false;
384 384
     $max_count = strip_tags($args['max_count']);
385 385
     $all_childs = $max_count == 'all' ? true : false;
386
-    $max_count = $max_count > 0 ? (int)$max_count : 0;
386
+    $max_count = $max_count > 0 ? (int) $max_count : 0;
387 387
     $max_level = strip_tags($args['max_level']);
388 388
     $show_count = !empty($args['show_count']) ? true : false;
389 389
     $hide_icon = !empty($args['hide_icon']) ? true : false;
390 390
     $cpt_left = !empty($args['cpt_left']) ? true : false;
391 391
 
392
-    if(!$cpt_left){
392
+    if (!$cpt_left) {
393 393
         $cpt_left = "gd-cpt-flat";
394
-    }else{
394
+    } else {
395 395
         $cpt_left = '';
396 396
     }
397 397
 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
     if (!empty($post_types)) {
407 407
         foreach ($post_types as $cpt => $cpt_info) {
408 408
             $parent_category = ($is_category && $cat_filter && $cpt == $current_posttype) ? $current_term_id : 0;
409
-            $cat_taxonomy = $cpt . 'category';
409
+            $cat_taxonomy = $cpt.'category';
410 410
             $categories = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_category));
411 411
             if ($hide_empty) {
412 412
                 $categories = geodir_filter_empty_terms($categories);
@@ -422,32 +422,32 @@  discard block
 block discarded – undo
422 422
                 if ($is_listing) {
423 423
                     $row_class = $is_category ? ' gd-cptcat-categ' : ' gd-cptcat-listing';
424 424
                 }
425
-                $cpt_row = '<div class="gd-cptcat-row gd-cptcat-' . $cpt . $row_class . ' '.$cpt_left.'">';
425
+                $cpt_row = '<div class="gd-cptcat-row gd-cptcat-'.$cpt.$row_class.' '.$cpt_left.'">';
426 426
 
427 427
                 if ($is_category && $cat_filter && $cpt == $current_posttype) {
428 428
                     $term_info = get_term($current_term_id, $cat_taxonomy);
429 429
 
430 430
                     $term_icon_url = !empty($term_icons) && isset($term_icons[$term_info->term_id]) ? $term_icons[$term_info->term_id] : '';
431
-                    $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($term_info->name) . ' icon" src="' . $term_icon_url . '" /> ' : '';
431
+                    $term_icon_url = $term_icon_url != '' ? '<img alt="'.esc_attr($term_info->name).' icon" src="'.$term_icon_url.'" /> ' : '';
432 432
 
433
-                    $count = $show_count ? ' <span class="gd-cptcat-count">(' . $term_info->count . ')</span>' : '';
434
-                    $cpt_row .= '<h2 class="gd-cptcat-title">' . $term_icon_url . $term_info->name . $count . '</h2>';
433
+                    $count = $show_count ? ' <span class="gd-cptcat-count">('.$term_info->count.')</span>' : '';
434
+                    $cpt_row .= '<h2 class="gd-cptcat-title">'.$term_icon_url.$term_info->name.$count.'</h2>';
435 435
                 } else {
436
-                    $cpt_row .= '<h2 class="gd-cptcat-title">' . __($cpt_info['labels']['name'], 'geodirectory') . '</h2>';
436
+                    $cpt_row .= '<h2 class="gd-cptcat-title">'.__($cpt_info['labels']['name'], 'geodirectory').'</h2>';
437 437
                 }
438 438
                 foreach ($categories as $category) {
439 439
                     $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : '';
440
-                    $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : '';
440
+                    $term_icon_url = $term_icon_url != '' ? '<img alt="'.esc_attr($category->name).' icon" src="'.$term_icon_url.'" /> ' : '';
441 441
 
442
-                    $term_link = get_term_link( $category, $category->taxonomy );
442
+                    $term_link = get_term_link($category, $category->taxonomy);
443 443
                     /** Filter documented in geodirectory-functions/general_functions.php **/
444
-                    $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt );
444
+                    $term_link = apply_filters('geodir_category_term_link', $term_link, $category->term_id, $cpt);
445 445
 
446 446
                     $cpt_row .= '<ul class="gd-cptcat-ul gd-cptcat-parent  '.$cpt_left.'">';
447 447
                     $cpt_row .= '<li class="gd-cptcat-li gd-cptcat-li-main">';
448
-                    $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : '';
449
-                    $cpt_row .= '<h3 class="gd-cptcat-cat"><a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">'  .$term_icon_url . $category->name . $count . '</a></h3>';
450
-                    if (($all_childs || $max_count > 0) && ($max_level == 'all' || (int)$max_level > 0)) {
448
+                    $count = $show_count ? ' <span class="gd-cptcat-count">('.$category->count.')</span>' : '';
449
+                    $cpt_row .= '<h3 class="gd-cptcat-cat"><a href="'.esc_url($term_link).'" title="'.esc_attr($category->name).'">'.$term_icon_url.$category->name.$count.'</a></h3>';
450
+                    if (($all_childs || $max_count > 0) && ($max_level == 'all' || (int) $max_level > 0)) {
451 451
                         $cpt_row .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons);
452 452
                     }
453 453
                     $cpt_row .= '</li>';
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
  * @return string Html content.
480 480
  */
481 481
 function geodir_cpt_categories_child_cats($parent_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth = 1) {
482
-    $cat_taxonomy = $cpt . 'category';
482
+    $cat_taxonomy = $cpt.'category';
483 483
 
484 484
     $orderby = 'count';
485 485
     $order = 'DESC';
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
         $order = 'ASC';
489 489
     }
490 490
 
491
-    if ($max_level != 'all' && $depth > (int)$max_level ) {
491
+    if ($max_level != 'all' && $depth > (int) $max_level) {
492 492
         return '';
493 493
     }
494 494
 
@@ -505,18 +505,18 @@  discard block
 block discarded – undo
505 505
         $child_cats = geodir_sort_terms($child_cats, 'count');
506 506
     }
507 507
 
508
-    $content = '<li class="gd-cptcat-li gd-cptcat-li-sub"><ul class="gd-cptcat-ul gd-cptcat-sub gd-cptcat-sub-' . $depth . '">';
508
+    $content = '<li class="gd-cptcat-li gd-cptcat-li-sub"><ul class="gd-cptcat-ul gd-cptcat-sub gd-cptcat-sub-'.$depth.'">';
509 509
     $depth++;
510 510
     foreach ($child_cats as $category) {
511 511
         $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : '';
512
-        $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : '';
513
-        $term_link = get_term_link( $category, $category->taxonomy );
512
+        $term_icon_url = $term_icon_url != '' ? '<img alt="'.esc_attr($category->name).' icon" src="'.$term_icon_url.'" /> ' : '';
513
+        $term_link = get_term_link($category, $category->taxonomy);
514 514
         /** Filter documented in geodirectory-functions/general_functions.php **/
515
-        $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt );
516
-        $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : '';
515
+        $term_link = apply_filters('geodir_category_term_link', $term_link, $category->term_id, $cpt);
516
+        $count = $show_count ? ' <span class="gd-cptcat-count">('.$category->count.')</span>' : '';
517 517
 
518 518
         $content .= '<li class="gd-cptcat-li gd-cptcat-li-sub">';
519
-        $content .= '<a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' . $term_icon_url . $category->name . $count . '</a></li>';
519
+        $content .= '<a href="'.esc_url($term_link).'" title="'.esc_attr($category->name).'">'.$term_icon_url.$category->name.$count.'</a></li>';
520 520
         $content .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth);
521 521
     }
522 522
     $content .= '</li></ul>';
Please login to merge, or discard this patch.
geodirectory-widgets/geodirectory_listing_slider_widget.php 3 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     {
91 91
 
92 92
         //widgetform in backend
93
-        $instance = wp_parse_args((array)$instance,
93
+        $instance = wp_parse_args((array) $instance,
94 94
             array('title' => '',
95 95
                 'post_type' => '',
96 96
                 'category' => '',
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         ?>
147 147
 
148 148
         <p>
149
-            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
149
+            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?>
150 150
 
151 151
                 <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
152 152
                        name="<?php echo $this->get_field_name('title'); ?>" type="text"
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
         <p>
158 158
             <label
159
-                for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?>
159
+                for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?>
160 160
 
161 161
                 <?php $postypes = geodir_get_posttypes(); ?>
162 162
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 
181 181
         <p>
182 182
             <label
183
-                for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?>
183
+                for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory'); ?>
184 184
 
185 185
                 <?php
186 186
                 $category_taxonomy = geodir_get_taxonomies('gd_place');
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
         </p>
218 218
         <p>
219 219
             <label
220
-                for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts(total):', 'geodirectory');?>
220
+                for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts(total):', 'geodirectory'); ?>
221 221
                 <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>"
222 222
                        name="<?php echo $this->get_field_name('post_number'); ?>" type="text"
223 223
                        value="<?php echo esc_attr($post_number); ?>"/>
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 
227 227
         <p>
228 228
             <label
229
-                for="<?php echo $this->get_field_id('max_show'); ?>"><?php _e('Number of posts(shown at one time, requires a slide width to be set):', 'geodirectory');?>
229
+                for="<?php echo $this->get_field_id('max_show'); ?>"><?php _e('Number of posts(shown at one time, requires a slide width to be set):', 'geodirectory'); ?>
230 230
                 <input class="widefat" id="<?php echo $this->get_field_id('max_show'); ?>"
231 231
                        name="<?php echo $this->get_field_name('max_show'); ?>" type="text"
232 232
                        value="<?php echo esc_attr($max_show); ?>"/>
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 
236 236
         <p>
237 237
             <label
238
-                for="<?php echo $this->get_field_id('slide_width'); ?>"><?php _e('Slide width(leave blank unless showing more than one slide at a time, ex: 210):', 'geodirectory');?>
238
+                for="<?php echo $this->get_field_id('slide_width'); ?>"><?php _e('Slide width(leave blank unless showing more than one slide at a time, ex: 210):', 'geodirectory'); ?>
239 239
                 <input class="widefat" id="<?php echo $this->get_field_id('slide_width'); ?>"
240 240
                        name="<?php echo $this->get_field_name('slide_width'); ?>" type="text"
241 241
                        value="<?php echo esc_attr($slide_width); ?>"/>
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
         <p>
246 246
             <label
247
-                for="<?php echo $this->get_field_id('animation'); ?>"><?php _e('Animation:', 'geodirectory');?>
247
+                for="<?php echo $this->get_field_id('animation'); ?>"><?php _e('Animation:', 'geodirectory'); ?>
248 248
 
249 249
                 <select class="widefat" id="<?php echo $this->get_field_id('animation'); ?>"
250 250
                         name="<?php echo $this->get_field_name('animation'); ?>">
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 
263 263
         <p>
264 264
             <label
265
-                for="<?php echo $this->get_field_id('slideshowSpeed'); ?>"><?php _e('Slide Show Speed: (milliseconds)', 'geodirectory');?>
265
+                for="<?php echo $this->get_field_id('slideshowSpeed'); ?>"><?php _e('Slide Show Speed: (milliseconds)', 'geodirectory'); ?>
266 266
 
267 267
                 <input class="widefat" id="<?php echo $this->get_field_id('slideshowSpeed'); ?>"
268 268
                        name="<?php echo $this->get_field_name('slideshowSpeed'); ?>" type="text"
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 
273 273
         <p>
274 274
             <label
275
-                for="<?php echo $this->get_field_id('animationSpeed'); ?>"><?php _e('Animation Speed: (milliseconds)', 'geodirectory');?>
275
+                for="<?php echo $this->get_field_id('animationSpeed'); ?>"><?php _e('Animation Speed: (milliseconds)', 'geodirectory'); ?>
276 276
 
277 277
                 <input class="widefat" id="<?php echo $this->get_field_id('animationSpeed'); ?>"
278 278
                        name="<?php echo $this->get_field_name('animationSpeed'); ?>" type="text"
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 
283 283
         <p>
284 284
             <label
285
-                for="<?php echo $this->get_field_id('slideshow'); ?>"><?php _e('SlideShow:', 'geodirectory');?>
285
+                for="<?php echo $this->get_field_id('slideshow'); ?>"><?php _e('SlideShow:', 'geodirectory'); ?>
286 286
 
287 287
                 <input type="checkbox" <?php if ($slideshow) {
288 288
                     echo 'checked="checked"';
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 
295 295
         <p>
296 296
             <label
297
-                for="<?php echo $this->get_field_id('animationLoop'); ?>"><?php _e('AnimationLoop:', 'geodirectory');?>
297
+                for="<?php echo $this->get_field_id('animationLoop'); ?>"><?php _e('AnimationLoop:', 'geodirectory'); ?>
298 298
 
299 299
                 <input type="checkbox" <?php if ($animationLoop) {
300 300
                     echo 'checked="checked"';
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 
307 307
         <p>
308 308
             <label
309
-                for="<?php echo $this->get_field_id('directionNav'); ?>"><?php _e('DirectionNav:', 'geodirectory');?>
309
+                for="<?php echo $this->get_field_id('directionNav'); ?>"><?php _e('DirectionNav:', 'geodirectory'); ?>
310 310
 
311 311
                 <input type="checkbox" <?php if ($directionNav) {
312 312
                     echo 'checked="checked"';
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 
320 320
         <p>
321 321
             <label
322
-                for="<?php echo $this->get_field_id('show_title'); ?>"><?php _e('Show Title:', 'geodirectory');?>
322
+                for="<?php echo $this->get_field_id('show_title'); ?>"><?php _e('Show Title:', 'geodirectory'); ?>
323 323
 
324 324
                 <input type="checkbox" <?php if ($show_title) {
325 325
                     echo 'checked="checked"';
@@ -353,10 +353,10 @@  discard block
 block discarded – undo
353 353
 
354 354
             }
355 355
 
356
-            <?php if(is_active_widget( false, false, $this->id_base, true )){ ?>
356
+            <?php if (is_active_widget(false, false, $this->id_base, true)) { ?>
357 357
             var post_type = jQuery('#<?php echo $this->get_field_id('post_type'); ?>').val();
358 358
 
359
-            geodir_change_category_list(post_type, '<?php echo $category;?>');
359
+            geodir_change_category_list(post_type, '<?php echo $category; ?>');
360 360
             <?php } ?>
361 361
 
362 362
         </script>
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -332,7 +332,10 @@
 block discarded – undo
332 332
             <label
333 333
                 for="<?php echo $this->get_field_id('show_featured_only'); ?>"><?php _e('Show only featured listings:', 'geodirectory'); ?>
334 334
                 <input type="checkbox" id="<?php echo $this->get_field_id('show_featured_only'); ?>"
335
-                       name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"'; ?>
335
+                       name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) {
336
+	echo 'checked="checked"';
337
+}
338
+?>
336 339
                        value="1"/>
337 340
             </label>
338 341
         </p>
Please login to merge, or discard this patch.
Indentation   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -15,40 +15,40 @@  discard block
 block discarded – undo
15 15
 class geodir_listing_slider_widget extends WP_Widget
16 16
 {
17 17
 
18
-    /**
18
+	/**
19 19
 	 * Register the listing slider widget.
20 20
 	 *
21 21
 	 * @since 1.0.0
22
-     * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
22
+	 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
23 23
 	 */
24
-    public function __construct() {
25
-        $widget_ops = array('classname' => 'geodir_listing_slider_view', 'description' => __('GD > Listing Slider', 'geodirectory'));
26
-        parent::__construct(
27
-            'listing_slider_view', // Base ID
28
-            __('GD > Listing Slider', 'geodirectory'), // Name
29
-            $widget_ops// Args
30
-        );
31
-    }
24
+	public function __construct() {
25
+		$widget_ops = array('classname' => 'geodir_listing_slider_view', 'description' => __('GD > Listing Slider', 'geodirectory'));
26
+		parent::__construct(
27
+			'listing_slider_view', // Base ID
28
+			__('GD > Listing Slider', 'geodirectory'), // Name
29
+			$widget_ops// Args
30
+		);
31
+	}
32 32
 	
33 33
 	/**
34 34
 	 * Front-end display content for listing slider widget.
35 35
 	 *
36 36
 	 * @since 1.0.0
37
-     * @since 1.5.1 Declare function public.
37
+	 * @since 1.5.1 Declare function public.
38 38
 	 *
39 39
 	 * @param array $args     Widget arguments.
40 40
 	 * @param array $instance Saved values from database.
41 41
 	 */
42
-    public function widget($args, $instance)
43
-    {
44
-        geodir_listing_slider_widget_output($args, $instance);
45
-    }
42
+	public function widget($args, $instance)
43
+	{
44
+		geodir_listing_slider_widget_output($args, $instance);
45
+	}
46 46
 
47 47
 	/**
48 48
 	 * Sanitize listing slider widget form values as they are saved.
49 49
 	 *
50 50
 	 * @since 1.0.0
51
-     * @since 1.5.1 Declare function public.
51
+	 * @since 1.5.1 Declare function public.
52 52
 	 *
53 53
 	 * @param array $new_instance Values just sent to be saved.
54 54
 	 * @param array $old_instance Previously saved values from database.
@@ -56,94 +56,94 @@  discard block
 block discarded – undo
56 56
 	 * @return array Updated safe values to be saved.
57 57
 	 */
58 58
 	public function update($new_instance, $old_instance)
59
-    {
60
-        //save the widget
61
-        $instance = $old_instance;
62
-        $instance['title'] = strip_tags($new_instance['title']);
63
-        $instance['post_type'] = strip_tags($new_instance['post_type']);
64
-        $instance['category'] = strip_tags($new_instance['category']);
65
-        $instance['post_number'] = strip_tags($new_instance['post_number']);
66
-        $instance['max_show'] = strip_tags($new_instance['max_show']);
67
-        $instance['slide_width'] = strip_tags($new_instance['slide_width']);
68
-        $instance['show_title'] = isset($new_instance['show_title']) ? $new_instance['show_title'] : '';
69
-        $instance['slideshow'] = isset($new_instance['slideshow']) ? $new_instance['slideshow'] : '';
70
-        $instance['animationLoop'] = isset($new_instance['animationLoop']) ? $new_instance['animationLoop'] : '';
71
-        $instance['directionNav'] = isset($new_instance['directionNav']) ? $new_instance['directionNav'] : '';
72
-        $instance['slideshowSpeed'] = $new_instance['slideshowSpeed'];
73
-        $instance['animationSpeed'] = $new_instance['animationSpeed'];
74
-        $instance['animation'] = $new_instance['animation'];
75
-        $instance['list_sort'] = isset($new_instance['list_sort']) ? $new_instance['list_sort'] : '';
76
-        $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0;
77
-
78
-        return $instance;
79
-    }
59
+	{
60
+		//save the widget
61
+		$instance = $old_instance;
62
+		$instance['title'] = strip_tags($new_instance['title']);
63
+		$instance['post_type'] = strip_tags($new_instance['post_type']);
64
+		$instance['category'] = strip_tags($new_instance['category']);
65
+		$instance['post_number'] = strip_tags($new_instance['post_number']);
66
+		$instance['max_show'] = strip_tags($new_instance['max_show']);
67
+		$instance['slide_width'] = strip_tags($new_instance['slide_width']);
68
+		$instance['show_title'] = isset($new_instance['show_title']) ? $new_instance['show_title'] : '';
69
+		$instance['slideshow'] = isset($new_instance['slideshow']) ? $new_instance['slideshow'] : '';
70
+		$instance['animationLoop'] = isset($new_instance['animationLoop']) ? $new_instance['animationLoop'] : '';
71
+		$instance['directionNav'] = isset($new_instance['directionNav']) ? $new_instance['directionNav'] : '';
72
+		$instance['slideshowSpeed'] = $new_instance['slideshowSpeed'];
73
+		$instance['animationSpeed'] = $new_instance['animationSpeed'];
74
+		$instance['animation'] = $new_instance['animation'];
75
+		$instance['list_sort'] = isset($new_instance['list_sort']) ? $new_instance['list_sort'] : '';
76
+		$instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0;
77
+
78
+		return $instance;
79
+	}
80 80
 
81 81
 	/**
82 82
 	 * Back-end listing slider widget settings form.
83 83
 	 *
84 84
 	 * @since 1.0.0
85
-     * @since 1.5.1 Declare function public.
85
+	 * @since 1.5.1 Declare function public.
86 86
 	 *
87 87
 	 * @param array $instance Previously saved values from database.
88 88
 	 */
89 89
 	public function form($instance)
90
-    {
90
+	{
91 91
 
92
-        //widgetform in backend
93
-        $instance = wp_parse_args((array)$instance,
94
-            array('title' => '',
95
-                'post_type' => '',
96
-                'category' => '',
97
-                'post_number' => '5',
98
-                'max_show' => '1',
99
-                'slide_width' => '',
100
-                'show_title' => '',
101
-                'slideshow' => '',
102
-                'animationLoop' => '',
103
-                'directionNav' => '',
104
-                'slideshowSpeed' => 5000,
105
-                'animationSpeed' => 600,
106
-                'animation' => '',
107
-                'list_sort' => 'latest',
108
-                'show_featured_only' => '',
109
-            )
110
-        );
92
+		//widgetform in backend
93
+		$instance = wp_parse_args((array)$instance,
94
+			array('title' => '',
95
+				'post_type' => '',
96
+				'category' => '',
97
+				'post_number' => '5',
98
+				'max_show' => '1',
99
+				'slide_width' => '',
100
+				'show_title' => '',
101
+				'slideshow' => '',
102
+				'animationLoop' => '',
103
+				'directionNav' => '',
104
+				'slideshowSpeed' => 5000,
105
+				'animationSpeed' => 600,
106
+				'animation' => '',
107
+				'list_sort' => 'latest',
108
+				'show_featured_only' => '',
109
+			)
110
+		);
111 111
 
112
-        $title = strip_tags($instance['title']);
112
+		$title = strip_tags($instance['title']);
113 113
 
114
-        $post_type = strip_tags($instance['post_type']);
114
+		$post_type = strip_tags($instance['post_type']);
115 115
 
116
-        $category = strip_tags($instance['category']);
116
+		$category = strip_tags($instance['category']);
117 117
 
118
-        $post_number = strip_tags($instance['post_number']);
118
+		$post_number = strip_tags($instance['post_number']);
119 119
 
120
-        $max_show = strip_tags($instance['max_show']);
120
+		$max_show = strip_tags($instance['max_show']);
121 121
 
122
-        $slide_width = strip_tags($instance['slide_width']);
122
+		$slide_width = strip_tags($instance['slide_width']);
123 123
 
124
-        $show_title = $instance['show_title'];
124
+		$show_title = $instance['show_title'];
125 125
 
126
-        $slideshow = $instance['slideshow'];
126
+		$slideshow = $instance['slideshow'];
127 127
 
128
-        $animationLoop = $instance['animationLoop'];
128
+		$animationLoop = $instance['animationLoop'];
129 129
 
130
-        $directionNav = $instance['directionNav'];
130
+		$directionNav = $instance['directionNav'];
131 131
 
132
-        $slideshowSpeed = $instance['slideshowSpeed'];
132
+		$slideshowSpeed = $instance['slideshowSpeed'];
133 133
 
134
-        $animationSpeed = $instance['animationSpeed'];
134
+		$animationSpeed = $instance['animationSpeed'];
135 135
 
136
-        $animation = $instance['animation'];
137
-        $list_sort = $instance['list_sort'];
138
-        $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false;
136
+		$animation = $instance['animation'];
137
+		$list_sort = $instance['list_sort'];
138
+		$show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false;
139 139
 
140
-        $sort_fields = array();
141
-        $sort_fields[] = array('field' => 'latest', 'label' => __('Latest', 'geodirectory'));
142
-        $sort_fields[] = array('field' => 'featured', 'label' => __('Featured', 'geodirectory'));
143
-        $sort_fields[] = array('field' => 'high_review', 'label' => __('Review', 'geodirectory'));
144
-        $sort_fields[] = array('field' => 'high_rating', 'label' => __('Rating', 'geodirectory'));
145
-        $sort_fields[] = array('field' => 'random', 'label' => __('Random', 'geodirectory'));
146
-        ?>
140
+		$sort_fields = array();
141
+		$sort_fields[] = array('field' => 'latest', 'label' => __('Latest', 'geodirectory'));
142
+		$sort_fields[] = array('field' => 'featured', 'label' => __('Featured', 'geodirectory'));
143
+		$sort_fields[] = array('field' => 'high_review', 'label' => __('Review', 'geodirectory'));
144
+		$sort_fields[] = array('field' => 'high_rating', 'label' => __('Rating', 'geodirectory'));
145
+		$sort_fields[] = array('field' => 'random', 'label' => __('Random', 'geodirectory'));
146
+		?>
147 147
 
148 148
         <p>
149 149
             <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
                     <?php foreach ($postypes as $postypes_obj) { ?>
168 168
 
169 169
                         <option <?php if ($post_type == $postypes_obj) {
170
-                            echo 'selected="selected"';
171
-                        } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
172
-                            echo ucfirst($extvalue[1]); ?></option>
170
+							echo 'selected="selected"';
171
+						} ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
172
+							echo ucfirst($extvalue[1]); ?></option>
173 173
 
174 174
                     <?php } ?>
175 175
 
@@ -183,20 +183,20 @@  discard block
 block discarded – undo
183 183
                 for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?>
184 184
 
185 185
                 <?php
186
-                $category_taxonomy = geodir_get_taxonomies('gd_place');
187
-                $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
188
-                ?>
186
+				$category_taxonomy = geodir_get_taxonomies('gd_place');
187
+				$categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
188
+				?>
189 189
 
190 190
                 <select class="widefat" id="<?php echo $this->get_field_id('category'); ?>"
191 191
                         name="<?php echo $this->get_field_name('category'); ?>">
192 192
                     <option <?php if ($category == '0') {
193
-                        echo 'selected="selected"';
194
-                    } ?> value="0"><?php _e('All', 'geodirectory'); ?></option>
193
+						echo 'selected="selected"';
194
+					} ?> value="0"><?php _e('All', 'geodirectory'); ?></option>
195 195
                     <?php foreach ($categories as $category_obj) { ?>
196 196
 
197 197
                         <option <?php if ($category == $category_obj->term_id) {
198
-                            echo 'selected="selected"';
199
-                        } ?>
198
+							echo 'selected="selected"';
199
+						} ?>
200 200
                             value="<?php echo $category_obj->term_id; ?>"><?php echo ucfirst($category_obj->name); ?></option>
201 201
 
202 202
                     <?php } ?>
@@ -249,12 +249,12 @@  discard block
 block discarded – undo
249 249
                 <select class="widefat" id="<?php echo $this->get_field_id('animation'); ?>"
250 250
                         name="<?php echo $this->get_field_name('animation'); ?>">
251 251
                     <option <?php if ($animation == 'slide') {
252
-                        echo 'selected="selected"';
253
-                    } ?> value="slide">Slide
252
+						echo 'selected="selected"';
253
+					} ?> value="slide">Slide
254 254
                     </option>
255 255
                     <option <?php if ($animation == 'fade') {
256
-                        echo 'selected="selected"';
257
-                    } ?> value="fade">Fade
256
+						echo 'selected="selected"';
257
+					} ?> value="fade">Fade
258 258
                     </option>
259 259
                 </select>
260 260
             </label>
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
                 for="<?php echo $this->get_field_id('slideshow'); ?>"><?php _e('SlideShow:', 'geodirectory');?>
286 286
 
287 287
                 <input type="checkbox" <?php if ($slideshow) {
288
-                    echo 'checked="checked"';
289
-                } ?> id="<?php echo $this->get_field_id('slideshow'); ?>" value="1"
288
+					echo 'checked="checked"';
289
+				} ?> id="<?php echo $this->get_field_id('slideshow'); ?>" value="1"
290 290
                        name="<?php echo $this->get_field_name('slideshow'); ?>"/>
291 291
 
292 292
             </label>
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
                 for="<?php echo $this->get_field_id('animationLoop'); ?>"><?php _e('AnimationLoop:', 'geodirectory');?>
298 298
 
299 299
                 <input type="checkbox" <?php if ($animationLoop) {
300
-                    echo 'checked="checked"';
301
-                } ?> id="<?php echo $this->get_field_id('animationLoop'); ?>" value="1"
300
+					echo 'checked="checked"';
301
+				} ?> id="<?php echo $this->get_field_id('animationLoop'); ?>" value="1"
302 302
                        name="<?php echo $this->get_field_name('animationLoop'); ?>"/>
303 303
 
304 304
             </label>
@@ -309,8 +309,8 @@  discard block
 block discarded – undo
309 309
                 for="<?php echo $this->get_field_id('directionNav'); ?>"><?php _e('DirectionNav:', 'geodirectory');?>
310 310
 
311 311
                 <input type="checkbox" <?php if ($directionNav) {
312
-                    echo 'checked="checked"';
313
-                } ?> id="<?php echo $this->get_field_id('directionNav'); ?>" value="1"
312
+					echo 'checked="checked"';
313
+				} ?> id="<?php echo $this->get_field_id('directionNav'); ?>" value="1"
314 314
                        name="<?php echo $this->get_field_name('directionNav'); ?>"/>
315 315
 
316 316
             </label>
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
                 for="<?php echo $this->get_field_id('show_title'); ?>"><?php _e('Show Title:', 'geodirectory');?>
323 323
 
324 324
                 <input type="checkbox" <?php if ($show_title) {
325
-                    echo 'checked="checked"';
326
-                } ?> id="<?php echo $this->get_field_id('show_title'); ?>" value="1"
325
+					echo 'checked="checked"';
326
+				} ?> id="<?php echo $this->get_field_id('show_title'); ?>" value="1"
327 327
                        name="<?php echo $this->get_field_name('show_title'); ?>"/>
328 328
 
329 329
             </label>
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 
364 364
 
365 365
     <?php
366
-    }
366
+	}
367 367
 } // class geodir_listing_slider_widget
368 368
 
369 369
 register_widget('geodir_listing_slider_widget');
370 370
\ No newline at end of file
Please login to merge, or discard this patch.