Passed
Pull Request — master (#204)
by Kiran
08:01
created
geodirectory-functions/map-functions/map_functions.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Google Map related functions.
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+     * Google Map related functions.
4
+     *
5
+     * @since 1.0.0
6
+     * @package GeoDirectory
7
+     */
8 8
 
9 9
 /**
10 10
  * Creates a global variable for storing map json data.
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         $title = str_replace($srcharr, $replarr, $post_title);
62 62
 
63 63
         if (is_ssl()) {
64
-            $icon = str_replace("http:","https:",$icon );
64
+            $icon = str_replace("http:", "https:", $icon);
65 65
         }
66 66
 
67 67
         $post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '"}';
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
          * @param string $post_json JSON representation of the post marker info.
74 74
          * @param object $post The post object.
75 75
          */
76
-        $map_jason[] = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
76
+        $map_jason[] = apply_filters('geodir_create_marker_jason_of_posts', $post_json, $post);
77 77
     }
78 78
 }
79 79
 
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
                     }
213 213
                 }
214 214
 
215
-                $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
215
+                $term_check = '<input type="checkbox" ' . $checked . ' id="' . $map_canvas_name . '_tick_cat_' . $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"';
216 216
                 $term_check .= ' name="' . $map_canvas_name . '_cat[]" ';
217 217
                 $term_check .= '  title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">';
218 218
                 $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>';
219
-                $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
219
+                $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name . '_tick_cat_' . $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>';
220 220
 
221 221
             endif;
222 222
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -98,10 +98,11 @@  discard block
 block discarded – undo
98 98
                 unset($cat_content_info);
99 99
                 $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
100 100
                 $totalcount = count(array_unique($map_jason));
101
-                if (!empty($cat_content_info))
102
-                    $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
103
-                else
104
-                    $canvas_jason = '[{"totalcount":"0"}]';
101
+                if (!empty($cat_content_info)) {
102
+                                    $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
103
+                } else {
104
+                                    $canvas_jason = '[{"totalcount":"0"}]';
105
+                }
105 106
 
106 107
                 $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason);
107 108
 
@@ -232,8 +233,9 @@  discard block
 block discarded – undo
232 233
 
233 234
         return $out;
234 235
     } else {
235
-        if ($cat_parent == 0)
236
-            return _e('No category', 'geodirectory');
236
+        if ($cat_parent == 0) {
237
+                    return _e('No category', 'geodirectory');
238
+        }
237 239
     }
238 240
     return;
239 241
 }
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/map_on_add_listing_page.php 3 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
 <script type="text/javascript">
62 62
     /* <![CDATA[ */
63 63
     <?php 
64
-	/**
65
-	 * Fires at the start of the add javascript on the add lsitings map.
66
-	 *
67
-	 * @since 1.0.0
64
+    /**
65
+     * Fires at the start of the add javascript on the add lsitings map.
66
+     *
67
+     * @since 1.0.0
68 68
      * @param string $prefix The prefix for all elements.
69
-	 */
70
-	do_action('geodir_add_listing_js_start', $prefix);
71
-	?>
69
+     */
70
+    do_action('geodir_add_listing_js_start', $prefix);
71
+    ?>
72 72
     user_address = false;
73 73
 
74 74
     jQuery('#<?php echo $prefix.'address';?>').keypress(function () {
@@ -326,13 +326,13 @@  discard block
 block discarded – undo
326 326
                 getZip = postal_code.long_name;
327 327
             }
328 328
             <?php 
329
-			/**
330
-			 * Fires to add javascript variable to use in google map.
331
-			 *
332
-			 * @since 1.0.0
333
-			 */
334
-			do_action('geodir_add_listing_geocode_js_vars');
335
-			?>
329
+            /**
330
+             * Fires to add javascript variable to use in google map.
331
+             *
332
+             * @since 1.0.0
333
+             */
334
+            do_action('geodir_add_listing_geocode_js_vars');
335
+            ?>
336 336
             <?php if($is_map_restrict){ ?>
337 337
             if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
338 338
                 alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
@@ -405,13 +405,13 @@  discard block
 block discarded – undo
405 405
             }
406 406
         }
407 407
         <?php
408
-		/**
409
-		 * Fires when marker address updated on map.
410
-		 *
411
-		 * @since 1.0.0
412
-		 * @param string $prefix Identifier used as a prefix for field name
413
-		 */
414
-		do_action('geodir_update_marker_address', $prefix);
408
+        /**
409
+         * Fires when marker address updated on map.
410
+         *
411
+         * @since 1.0.0
412
+         * @param string $prefix Identifier used as a prefix for field name
413
+         */
414
+        do_action('geodir_update_marker_address', $prefix);
415 415
         echo $updateMarkerAddress = ob_get_clean();
416 416
         ?>
417 417
     }
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
                 address = '';
457 457
             }
458 458
             <?php
459
-               }?>
459
+                }?>
460 460
 
461 461
             if (ISO2 == 'GB') {
462 462
                 address = address + ',' + city + ',' + country + ',' + zip; // UK is funny with regions
@@ -465,13 +465,13 @@  discard block
 block discarded – undo
465 465
             }
466 466
         }
467 467
         <?php $codeAddress = ob_get_clean();
468
-		/**
469
-		 * Filter the address variable
470
-		 *
471
-		 * @since 1.0.0
472
-		 *
473
-		 * @param string $codeAddress Row of address to use in google map.
474
-		 */
468
+        /**
469
+         * Filter the address variable
470
+         *
471
+         * @since 1.0.0
472
+         *
473
+         * @param string $codeAddress Row of address to use in google map.
474
+         */
475 475
         echo apply_filters('geodir_codeaddress', $codeAddress);
476 476
         ?>
477 477
         geocoder.geocode({'address': address, 'country': ISO2},
@@ -486,13 +486,13 @@  discard block
 block discarded – undo
486 486
                     //if(set_on_map && is_restrict){
487 487
                     //geocodePosition({ 'address': address,'country':   ISO2});
488 488
                     <?php 
489
-					/**
490
-					 * Fires before set geocode position.
491
-					 *
492
-					 * @since 1.0.0
493
-					 */
494
-					do_action('geodir_add_listing_codeaddress_before_geocode');
495
-					?>
489
+                    /**
490
+                     * Fires before set geocode position.
491
+                     *
492
+                     * @since 1.0.0
493
+                     */
494
+                    do_action('geodir_add_listing_codeaddress_before_geocode');
495
+                    ?>
496 496
                     geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
497 497
 //}
498 498
                 } else {
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -71,16 +71,16 @@  discard block
 block discarded – undo
71 71
 	?>
72 72
     user_address = false;
73 73
 
74
-    jQuery('#<?php echo $prefix.'address';?>').keypress(function () {
74
+    jQuery('#<?php echo $prefix . 'address'; ?>').keypress(function () {
75 75
         user_address = true;
76 76
     });
77 77
 
78 78
     baseMarker = '';
79 79
     geocoder = '';
80
-    var <?php echo $prefix;?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat :  '39.952484'; ?>;
81
-    var <?php echo $prefix;?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng :  '-75.163786'; ?>;
82
-    <?php if($lat_lng_blank){$lat='';$lng='';}?>
83
-    var <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12;?>;
80
+    var <?php echo $prefix; ?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat : '39.952484'; ?>;
81
+    var <?php echo $prefix; ?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng : '-75.163786'; ?>;
82
+    <?php if ($lat_lng_blank) {$lat = ''; $lng = ''; }?>
83
+    var <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12; ?>;
84 84
     var minZoomLevel = <?php echo ($is_map_restrict) ? 5 : 0; ?>;
85 85
     var oldstr_address;
86 86
     var oldstr_zip;
@@ -333,10 +333,10 @@  discard block
 block discarded – undo
333 333
 			 */
334 334
 			do_action('geodir_add_listing_geocode_js_vars');
335 335
 			?>
336
-            <?php if($is_map_restrict){ ?>
337
-            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
338
-                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
339
-                jQuery("#<?php echo $prefix.'map';?>").goMap();
336
+            <?php if ($is_map_restrict) { ?>
337
+            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
338
+                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
339
+                jQuery("#<?php echo $prefix . 'map'; ?>").goMap();
340 340
                 jQuery.goMap.map.setCenter(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
341 341
                 baseMarker.setPosition(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
342 342
                 updateMarkerPosition(baseMarker.getPosition());
@@ -345,62 +345,62 @@  discard block
 block discarded – undo
345 345
             <?php } ?>
346 346
             updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry);
347 347
         } else {
348
-            updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
348
+            updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
349 349
         }
350 350
 
351 351
 
352 352
     }
353 353
     function centerMap() {
354
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
354
+        jQuery("#<?php echo $prefix . 'map'; ?>").goMap();
355 355
         jQuery.goMap.map.panTo(baseMarker.getPosition());
356 356
     }
357 357
     function centerMarker() {
358
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
358
+        jQuery("#<?php echo $prefix . 'map'; ?>").goMap();
359 359
         var center = jQuery.goMap.map.getCenter();
360 360
         baseMarker.setPosition(center);
361 361
     }
362 362
     function updateMapZoom(zoom) {
363
-        jQuery('#<?php echo $prefix.'mapzoom';?>').val(zoom);
363
+        jQuery('#<?php echo $prefix . 'mapzoom'; ?>').val(zoom);
364 364
     }
365 365
     function updateMarkerPosition(markerlatLng) {
366
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
366
+        jQuery("#<?php echo $prefix . 'map'; ?>").goMap();
367 367
 //$.goMap.setMap({latitude:markerlatLng.lat(), longitude:markerlatLng.lng()}); 
368
-        jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat());
369
-        jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng());
368
+        jQuery('#<?php echo $prefix . 'latitude'; ?>').val(markerlatLng.lat());
369
+        jQuery('#<?php echo $prefix . 'longitude'; ?>').val(markerlatLng.lng());
370 370
     }
371 371
     function updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry) {
372
-        var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields);?>';
373
-        <?php ob_start();?>
374
-        var old_country = jQuery("#<?php echo $prefix.'country';?>").val();
375
-        var old_region = jQuery("#<?php echo $prefix.'region';?>").val();
372
+        var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields); ?>';
373
+        <?php ob_start(); ?>
374
+        var old_country = jQuery("#<?php echo $prefix . 'country'; ?>").val();
375
+        var old_region = jQuery("#<?php echo $prefix . 'region'; ?>").val();
376 376
 //if (getAddress){
377
-        if (user_address == false || jQuery('#<?php echo $prefix.'address';?>').val() == '') {
378
-            jQuery("#<?php echo $prefix.'address';?>").val(getAddress);
377
+        if (user_address == false || jQuery('#<?php echo $prefix . 'address'; ?>').val() == '') {
378
+            jQuery("#<?php echo $prefix . 'address'; ?>").val(getAddress);
379 379
         }
380 380
         if (getAddress) {
381 381
             oldstr_address = getAddress;
382 382
         }
383 383
 // }
384 384
 //if (getZip){
385
-        jQuery("#<?php echo $prefix.'zip';?>").val(getZip);
385
+        jQuery("#<?php echo $prefix . 'zip'; ?>").val(getZip);
386 386
         if (getZip) {
387 387
             oldstr_zip = getZip;
388 388
         }
389 389
 //}	
390 390
         if (set_map_val_in_fields) {
391 391
             if (getCountry) {
392
-                jQuery('#<?php echo $prefix.'country';?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
393
-                jQuery("#<?php echo $prefix.'country';?>").trigger("chosen:updated");
392
+                jQuery('#<?php echo $prefix . 'country'; ?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
393
+                jQuery("#<?php echo $prefix . 'country'; ?>").trigger("chosen:updated");
394 394
 
395 395
             }
396 396
             if (getState) {
397
-                if (jQuery('input[id="<?php echo $prefix.'region';?>"]').attr('id')) {
398
-                    jQuery("#<?php echo $prefix.'region';?>").val(getState);
397
+                if (jQuery('input[id="<?php echo $prefix . 'region'; ?>"]').attr('id')) {
398
+                    jQuery("#<?php echo $prefix . 'region'; ?>").val(getState);
399 399
                 }
400 400
             }
401 401
             if (getCity) {
402
-                if (jQuery('input[id="<?php echo $prefix.'city';?>"]').attr('id')) {
403
-                    jQuery("#<?php echo $prefix.'city';?>").val(getCity);
402
+                if (jQuery('input[id="<?php echo $prefix . 'city'; ?>"]').attr('id')) {
403
+                    jQuery("#<?php echo $prefix . 'city'; ?>").val(getCity);
404 404
                 }
405 405
             }
406 406
         }
@@ -416,12 +416,12 @@  discard block
 block discarded – undo
416 416
         ?>
417 417
     }
418 418
     function geodir_codeAddress(set_on_map) {
419
-        var address = jQuery('#<?php echo $prefix.'address';?>').val();
420
-        var zip = jQuery('#<?php echo $prefix.'zip';?>').val();
421
-        var city = jQuery('#<?php echo $prefix.'city';?>').val();
422
-        var region = jQuery('#<?php echo $prefix.'region';?>').val();
423
-        var country = jQuery('#<?php echo $prefix.'country';?>').val();
424
-        var country_selected = jQuery('#<?php echo $prefix.'country';?>').find('option:selected');
419
+        var address = jQuery('#<?php echo $prefix . 'address'; ?>').val();
420
+        var zip = jQuery('#<?php echo $prefix . 'zip'; ?>').val();
421
+        var city = jQuery('#<?php echo $prefix . 'city'; ?>').val();
422
+        var region = jQuery('#<?php echo $prefix . 'region'; ?>').val();
423
+        var country = jQuery('#<?php echo $prefix . 'country'; ?>').val();
424
+        var country_selected = jQuery('#<?php echo $prefix . 'country'; ?>').find('option:selected');
425 425
         var ISO2 = country_selected.data('country_code');
426 426
         if (ISO2 == '--') {
427 427
             ISO2 = '';
@@ -430,18 +430,18 @@  discard block
 block discarded – undo
430 430
             zip = '';
431 431
         }
432 432
         if (typeof city == "undefined") {
433
-            city = '<?php echo addslashes_gpc($city);?>';
433
+            city = '<?php echo addslashes_gpc($city); ?>';
434 434
         }
435 435
         if (typeof region == "undefined") {
436
-            region = '<?php echo addslashes_gpc($region);?>';
436
+            region = '<?php echo addslashes_gpc($region); ?>';
437 437
         }
438 438
         if (typeof country == "undefined") {
439
-            country = '<?php echo addslashes_gpc($country);?>';
439
+            country = '<?php echo addslashes_gpc($country); ?>';
440 440
         }
441 441
         var is_restrict = '<?php echo $is_map_restrict; ?>';
442 442
         <?php ob_start();
443
-        $defaultregion =isset($default_location->region) ? $default_location->region : '';
444
-        $defaultcountry =isset($default_location->country) ? $default_location->country : '';
443
+        $defaultregion = isset($default_location->region) ? $default_location->region : '';
444
+        $defaultcountry = isset($default_location->country) ? $default_location->country : '';
445 445
         ?>
446 446
         if (set_on_map && is_restrict) {
447 447
             if (zip != '' && address != '') {
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
             if (typeof address === 'undefined')
452 452
                 address = '';
453 453
             <?php
454
-            if(is_admin() && isset($_REQUEST['tab'])){?>
454
+            if (is_admin() && isset($_REQUEST['tab'])) {?>
455 455
             if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
456 456
                 address = '';
457 457
             }
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
             function (results, status) {
479 479
                 //console.log(results);
480 480
                 console.log(status);
481
-                jQuery("#<?php echo $prefix.'map';?>").goMap();
481
+                jQuery("#<?php echo $prefix . 'map'; ?>").goMap();
482 482
                 if (status == google.maps.GeocoderStatus.OK) {
483 483
                     baseMarker.setPosition(results[0].geometry.location);
484 484
                     jQuery.goMap.map.setCenter(results[0].geometry.location);
@@ -496,20 +496,20 @@  discard block
 block discarded – undo
496 496
                     geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
497 497
 //}
498 498
                 } else {
499
-                    alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:','geodirectory'));?> ' + status);
499
+                    alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:', 'geodirectory')); ?> ' + status);
500 500
                 }
501 501
             });
502 502
     }
503 503
     function gdMaxMap() {
504
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
504
+        jQuery("#<?php echo $prefix . 'map'; ?>").goMap();
505 505
 
506
-        jQuery('#<?php echo $prefix.'map';?>').toggleClass('map-fullscreen');
506
+        jQuery('#<?php echo $prefix . 'map'; ?>').toggleClass('map-fullscreen');
507 507
         jQuery('.map_category').toggleClass('map_category_fullscreen');
508
-        jQuery('#<?php echo $prefix;?>trigger').toggleClass('map_category_fullscreen');
508
+        jQuery('#<?php echo $prefix; ?>trigger').toggleClass('map_category_fullscreen');
509 509
         jQuery('body').toggleClass('body_fullscreen');
510
-        jQuery('#<?php echo $prefix;?>loading_div').toggleClass('loading_div_fullscreen');
511
-        jQuery('#<?php echo $prefix;?>advmap_nofound').toggleClass('nofound_fullscreen');
512
-        jQuery('#<?php echo $prefix;?>triggermap').toggleClass('triggermap_fullscreen');
510
+        jQuery('#<?php echo $prefix; ?>loading_div').toggleClass('loading_div_fullscreen');
511
+        jQuery('#<?php echo $prefix; ?>advmap_nofound').toggleClass('nofound_fullscreen');
512
+        jQuery('#<?php echo $prefix; ?>triggermap').toggleClass('triggermap_fullscreen');
513 513
         jQuery('.TopLeft').toggleClass('TopLeft_fullscreen');
514 514
         window.setTimeout(function () {
515 515
 //var center = $.goMap.getCenter(); 
@@ -518,22 +518,22 @@  discard block
 block discarded – undo
518 518
         }, 100);
519 519
     }
520 520
     jQuery(function ($) {
521
-        $("#<?php echo $prefix.'map';?>").goMap({
522
-            latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT,
523
-            longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG,
524
-            zoom: <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT,
521
+        $("#<?php echo $prefix . 'map'; ?>").goMap({
522
+            latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT,
523
+            longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG,
524
+            zoom: <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT,
525 525
             maptype: 'ROADMAP', // Map type - HYBRID, ROADMAP, SATELLITE, TERRAIN
526 526
             <?php /*?>maptype: '<?php echo ($mapview) ? $mapview : 'ROADMAP';?>', <?php */?>
527 527
             streetViewControl: true,
528
-            <?php if(get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,';}?>
528
+            <?php if (get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,'; }?>
529 529
         });
530 530
         geocoder = new google.maps.Geocoder();
531 531
 
532 532
         baseMarker = $.goMap.createMarker({
533
-            latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT,
534
-            longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG,
533
+            latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT,
534
+            longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG,
535 535
             id: 'baseMarker',
536
-            icon: '<?php echo get_option('geodir_default_marker_icon');?>',
536
+            icon: '<?php echo get_option('geodir_default_marker_icon'); ?>',
537 537
             <?php /*?>icon: {
538 538
             image: new google.maps.MarkerImage (
539 539
             '<?php echo get_option('geodir_default_marker_icon');?>',
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
             },<?php */?>
544 544
             draggable: true
545 545
         });
546
-        $("#<?php echo $prefix;?>set_address_button").click(function () {
546
+        $("#<?php echo $prefix; ?>set_address_button").click(function () {
547 547
             var set_on_map = true;
548 548
             geodir_codeAddress(set_on_map);
549 549
         });
@@ -558,14 +558,14 @@  discard block
 block discarded – undo
558 558
         google.maps.event.addListener(baseMarker, 'dragend', function () {
559 559
 // updateMarkerStatus('Drag ended');
560 560
             centerMap();
561
-            <?php if($auto_change_address_fields_pin_move){?>
561
+            <?php if ($auto_change_address_fields_pin_move) {?>
562 562
             geocodePosition(baseMarker.getPosition());
563 563
             <?php }?>
564 564
             updateMarkerPosition(baseMarker.getPosition());
565 565
         });
566 566
         google.maps.event.addListener($.goMap.map, 'dragend', function () {
567 567
 // updateMarkerStatus('Drag ended');
568
-            <?php if($auto_change_address_fields_pin_move){?>
568
+            <?php if ($auto_change_address_fields_pin_move) {?>
569 569
             geocodePosition(baseMarker.getPosition());
570 570
             <?php }?>
571 571
             centerMarker();
@@ -575,17 +575,17 @@  discard block
 block discarded – undo
575 575
             updateMapZoom($.goMap.map.zoom);
576 576
         });
577 577
 
578
-        var maxMap = document.getElementById('<?php echo $prefix;?>triggermap');
578
+        var maxMap = document.getElementById('<?php echo $prefix; ?>triggermap');
579 579
         google.maps.event.addDomListener(maxMap, 'click', gdMaxMap);
580 580
 
581 581
         <?php
582
-        if($is_map_restrict)
582
+        if ($is_map_restrict)
583 583
         {
584 584
         ?>
585
-        var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country);?>';
585
+        var CITY_ADDRESS = '<?php echo addslashes_gpc($city) . ',' . addslashes_gpc($region) . ',' . addslashes_gpc($country); ?>';
586 586
         geocoder.geocode({'address': CITY_ADDRESS},
587 587
             function (results, status) {
588
-                $("#<?php echo $prefix.'map';?>").goMap();
588
+                $("#<?php echo $prefix . 'map'; ?>").goMap();
589 589
                 if (status == google.maps.GeocoderStatus.OK) {
590 590
 // Bounds for North America
591 591
                     var bound_lat_lng = String(results[0].geometry.bounds);
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
                         new google.maps.LatLng(bound_lat_lng[2], bound_lat_lng[3])
597 597
                     );
598 598
                 } else {
599
-                    alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status);
599
+                    alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
600 600
                 }
601 601
             });
602 602
         <?php }?>
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
         });<?php */?>
634 634
 // Limit the zoom level
635 635
         google.maps.event.addListener($.goMap.map, 'zoom_changed', function () {
636
-            $("#<?php echo $prefix.'map';?>").goMap();
636
+            $("#<?php echo $prefix . 'map'; ?>").goMap();
637 637
             if ($.goMap.map.getZoom() < minZoomLevel) $.goMap.map.setZoom(minZoomLevel);
638 638
         });
639 639
     });
Please login to merge, or discard this patch.
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.
geodirectory-functions/map-functions/map_template_tags.php 3 patches
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * All map related templates used by the plugin
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+     * All map related templates used by the plugin
4
+     *
5
+     * @since 1.0.0
6
+     * @package GeoDirectory
7
+     */
8 8
  
9 9
 /**
10 10
  * Contains all map related functions.
@@ -138,33 +138,33 @@  discard block
 block discarded – undo
138 138
     }
139 139
 
140 140
     /**
141
-	 * Filter the options to use in google map.
142
-	 *
143
-	 * @since 1.0.0
144
-	 *
145
-	 * @param array $geodir_map_options {@see geodir_draw_map()} docblock.
146
-	 */
147
-	$geodir_map_options = apply_filters("geodir_map_options_{$map_canvas_name}", $geodir_map_options);
141
+     * Filter the options to use in google map.
142
+     *
143
+     * @since 1.0.0
144
+     *
145
+     * @param array $geodir_map_options {@see geodir_draw_map()} docblock.
146
+     */
147
+    $geodir_map_options = apply_filters("geodir_map_options_{$map_canvas_name}", $geodir_map_options);
148 148
 
149 149
     $map_canvas_arr[$map_canvas_name] = array();
150 150
 
151 151
     /**
152
-	 * Filter the post types to display data on map.
153
-	 *
154
-	 * @since 1.0.0
155
-	 *
156
-	 * @param object $object Objects of post types.
157
-	 */
158
-	$post_types = apply_filters("geodir_map_post_type_list_{$map_canvas_name}", geodir_get_posttypes('object'));
152
+     * Filter the post types to display data on map.
153
+     *
154
+     * @since 1.0.0
155
+     *
156
+     * @param object $object Objects of post types.
157
+     */
158
+    $post_types = apply_filters("geodir_map_post_type_list_{$map_canvas_name}", geodir_get_posttypes('object'));
159 159
     
160
-	/**
161
-	 * Filter the post types to exclude to display data on map.
162
-	 *
163
-	 * @since 1.0.0
164
-	 *
165
-	 * @param array Array of post types to exclude to display data on map.
166
-	 */
167
-	$exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map'));
160
+    /**
161
+     * Filter the post types to exclude to display data on map.
162
+     *
163
+     * @since 1.0.0
164
+     *
165
+     * @param array Array of post types to exclude to display data on map.
166
+     */
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 169
     if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
170 170
         // Set default map options
@@ -180,13 +180,13 @@  discard block
 block discarded – undo
180 180
         }
181 181
 
182 182
         /**
183
-		 * Filter the width of map.
184
-		 *
185
-		 * @since 1.0.0
186
-		 *
187
-		 * @param int $map_width Width of map box, eg: gd_place.
188
-		 */
189
-		$map_width = apply_filters('geodir_change_map_width', $map_width);
183
+         * Filter the width of map.
184
+         *
185
+         * @since 1.0.0
186
+         *
187
+         * @param int $map_width Width of map box, eg: gd_place.
188
+         */
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">
@@ -285,29 +285,29 @@  discard block
 block discarded – undo
285 285
 
286 286
                     <div id="<?php echo $map_canvas_name; ?>_directionsPanel" style="width:auto;"></div>
287 287
                 <?php 
288
-				}
288
+                }
289 289
 				
290
-				$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';
293
-
294
-				/**
295
-				 * Filter the post type to retrive data for map
296
-				 *
297
-				 * @since 1.0.0
298
-				 *
299
-				 * @param string $geodir_default_map_search_pt Post type, eg: gd_place.
300
-				 */
301
-				$map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt);
302
-				?>
290
+                $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';
293
+
294
+                /**
295
+                 * Filter the post type to retrive data for map
296
+                 *
297
+                 * @since 1.0.0
298
+                 *
299
+                 * @param string $geodir_default_map_search_pt Post type, eg: gd_place.
300
+                 */
301
+                $map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt);
302
+                ?>
303 303
                 <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>">
304 304
                     <?php
305 305
                     $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
306 306
                     $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
307
-					$map_cat_class = '';
308
-					if ($geodir_map_options['enable_post_type_filters']) {
309
-						$map_cat_class = $geodir_available_pt_on_map > 1 ? ' map-cat-ptypes' : ' map-cat-floor';
310
-					}
307
+                    $map_cat_class = '';
308
+                    if ($geodir_map_options['enable_post_type_filters']) {
309
+                        $map_cat_class = $geodir_available_pt_on_map > 1 ? ' map-cat-ptypes' : ' map-cat-floor';
310
+                    }
311 311
                     ?>
312 312
                     <div
313 313
                         class="map-category-listing<?php echo $map_cat_class;?>">
@@ -350,14 +350,14 @@  discard block
 block discarded – undo
350 350
 
351 351
                 <?php
352 352
                 if ($geodir_map_options['enable_location_filters']) {
353
-					$country = get_query_var('gd_country');
354
-					$region = get_query_var('gd_region');
355
-					$city = get_query_var('gd_city');
353
+                    $country = get_query_var('gd_country');
354
+                    $region = get_query_var('gd_region');
355
+                    $city = get_query_var('gd_city');
356 356
                     
357 357
                     //fix for location/me page
358 358
                     $country = $country != 'me' ? $country : '';
359
-					$region = $region != 'me' ? $region : '';
360
-					$city = $country != 'me' ? $city : '';
359
+                    $region = $region != 'me' ? $region : '';
360
+                    $city = $country != 'me' ? $city : '';
361 361
                     ?>
362 362
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/>
363 363
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country"
@@ -368,8 +368,8 @@  discard block
 block discarded – undo
368 368
                            value="<?php echo $city;?>"/>
369 369
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood"
370 370
                            value="<?php if (isset($_REQUEST['gd_neighbourhood'])) {
371
-                               echo $_REQUEST['gd_neighbourhood'];
372
-                           }?>"/>
371
+                                echo $_REQUEST['gd_neighbourhood'];
372
+                            }?>"/>
373 373
                 <?php } else { //end of location filter
374 374
                     ?>
375 375
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/>
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
                                     foreach ($post_types as $post_type => $args) {
398 398
                                         if (!in_array($post_type, $exclude_post_types)) {
399 399
                                             $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
400
-											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>';
400
+                                            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>';
401 401
                                         }
402 402
                                     }
403 403
                                     ?>
Please login to merge, or discard this patch.
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -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,39 +188,39 @@  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 213
                             </div>
214 214
                             <!-- new map end -->
215 215
                         </div>
216
-                        <div class="<?php echo $map_canvas_name;?>_BottomLeft BottomLeft"></div>
216
+                        <div class="<?php echo $map_canvas_name; ?>_BottomLeft BottomLeft"></div>
217 217
                     </div>
218 218
                 </div>
219 219
                 <?php if ($geodir_map_options['enable_jason_on_load']) { ?>
220
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/>
220
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="1"/>
221 221
                 <?php } else {
222 222
                     ?>
223
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/>
223
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="0"/>
224 224
                 <?php }
225 225
 
226 226
                 if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
                            onclick="calcRoute('<?php echo $map_canvas_name; ?>')"/>
241 241
 
242 242
                     <script>
243
-                        <?php if(geodir_is_page('detail')){?>
243
+                        <?php if (geodir_is_page('detail')) {?>
244 244
                         jQuery(function () {
245 245
                             gd_initialize_ac();
246 246
                         });
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
                             // Create the autocomplete object, restricting the search
251 251
                             // to geographical location types.
252 252
                             autocomplete = new google.maps.places.Autocomplete(
253
-                                /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name;?>_fromAddress')),
253
+                                /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name; ?>_fromAddress')),
254 254
                                 {types: ['geocode']});
255 255
                             // When the user selects an address from the dropdown,
256 256
                             // populate the address fields in the form.
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 				 */
301 301
 				$map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt);
302 302
 				?>
303
-                <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>">
303
+                <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel; ?>">
304 304
                     <?php
305 305
                     $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
306 306
                     $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
@@ -310,12 +310,12 @@  discard block
 block discarded – undo
310 310
 					}
311 311
                     ?>
312 312
                     <div
313
-                        class="map-category-listing<?php echo $map_cat_class;?>">
313
+                        class="map-category-listing<?php echo $map_cat_class; ?>">
314 314
                         <div class="trigger triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div>
315
-                        <div id="<?php echo $map_canvas_name;?>_cat"
316
-                             class="<?php echo $map_canvas_name;?>_map_category  map_category"
317
-                             <?php if ($child_collapse){ ?>checked="checked" <?php }?>
318
-                             style="max-height:<?php echo $geodir_map_options['height'];?>;">
315
+                        <div id="<?php echo $map_canvas_name; ?>_cat"
316
+                             class="<?php echo $map_canvas_name; ?>_map_category  map_category"
317
+                             <?php if ($child_collapse) { ?>checked="checked" <?php }?>
318
+                             style="max-height:<?php echo $geodir_map_options['height']; ?>;">
319 319
                             <input
320 320
                                 onkeydown="if(event.keyCode == 13){build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false)}"
321 321
                                 type="text"
@@ -327,11 +327,11 @@  discard block
 block discarded – undo
327 327
                                     <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/>
328 328
                                 <?php } else {$child_collapse = "0";
329 329
                                     ?>
330
-                                    <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/>
330
+                                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="0"/>
331 331
                                 <?php } ?>
332 332
                                 <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/>
333 333
                                 <div class="toggle">
334
-                                    <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'),0,true,0,$map_canvas_name,$child_collapse,true); ?>
334
+                                    <?php echo home_map_taxonomy_walker(array($map_search_pt . 'category'), 0, true, 0, $map_canvas_name, $child_collapse, true); ?>
335 335
                                     <script>jQuery( document ).ready(function() {
336 336
                                             geodir_show_sub_cat_collapse_button();
337 337
                                         });</script>
@@ -359,23 +359,23 @@  discard block
 block discarded – undo
359 359
 					$region = $region != 'me' ? $region : '';
360 360
 					$city = $country != 'me' ? $city : '';
361 361
                     ?>
362
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/>
363
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country"
364
-                           value="<?php echo $country;?>"/>
365
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_region" name="gd_region"
366
-                           value="<?php echo $region;?>"/>
367
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_city" name="gd_city"
368
-                           value="<?php echo $city;?>"/>
369
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood"
362
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="1"/>
363
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_country" name="gd_country"
364
+                           value="<?php echo $country; ?>"/>
365
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_region" name="gd_region"
366
+                           value="<?php echo $region; ?>"/>
367
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_city" name="gd_city"
368
+                           value="<?php echo $city; ?>"/>
369
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_neighbourhood" name="gd_neighbourhood"
370 370
                            value="<?php if (isset($_REQUEST['gd_neighbourhood'])) {
371 371
                                echo $_REQUEST['gd_neighbourhood'];
372 372
                            }?>"/>
373 373
                 <?php } else { //end of location filter
374 374
                     ?>
375
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/>
375
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="0"/>
376 376
                 <?php }?>
377 377
 
378
-                <input type="hidden" id="<?php echo $map_canvas_name;?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt;?>"/>
378
+                <input type="hidden" id="<?php echo $map_canvas_name; ?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt; ?>"/>
379 379
 
380 380
                 <input type="hidden" name="limitstart" value=""/>
381 381
 
@@ -383,10 +383,10 @@  discard block
 block discarded – undo
383 383
 
384 384
                 <?php if ($geodir_map_options['enable_post_type_filters']) {
385 385
                     $post_types = geodir_get_posttypes('object');
386
-                    if (count((array)($post_types)) > 1) {
386
+                    if (count((array) ($post_types)) > 1) {
387 387
                         ?>
388
-                        <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu"
389
-                             style="max-width:<?php echo $map_width;?>!important;">
388
+                        <div class="map-places-listing" id="<?php echo $map_canvas_name; ?>_posttype_menu"
389
+                             style="max-width:<?php echo $map_width; ?>!important;">
390 390
 
391 391
                             <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
392 392
                             <div class="geodir-map-posttype-list"><?php } ?>
@@ -422,9 +422,9 @@  discard block
 block discarded – undo
422 422
         <script type="text/javascript">
423 423
 
424 424
             jQuery(document).ready(function () {
425
-                //initMap('<?php echo $map_canvas_name;?>'); // depreciated, no need to load this twice
426
-                build_map_ajax_search_param('<?php echo $map_canvas_name;?>', false);
427
-                map_sticky('<?php echo $map_canvas_name;?>');
425
+                //initMap('<?php echo $map_canvas_name; ?>'); // depreciated, no need to load this twice
426
+                build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false);
427
+                map_sticky('<?php echo $map_canvas_name; ?>');
428 428
             });
429 429
 
430 430
         </script>
@@ -435,18 +435,18 @@  discard block
 block discarded – undo
435 435
             <script>
436 436
                 (function () {
437 437
                     var screenH = jQuery(window).height();
438
-                    var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']);?>";
438
+                    var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']); ?>";
439 439
 
440 440
                     var ptypeH = '';
441
-                    if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
442
-                        ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
441
+                    if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
442
+                        ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
443 443
                     }
444 444
 
445
-                    jQuery("#sticky_map_<?php echo $map_canvas_name;?>").css("min-height", screenH * (heightVH / 100) + 'px');
446
-                    jQuery("#<?php echo $map_canvas_name;?>_wrapper").height(screenH * (heightVH / 100) + 'px');
447
-                    jQuery("#<?php echo $map_canvas_name;?>").height(screenH * (heightVH / 100) + 'px');
448
-                    jQuery("#<?php echo $map_canvas_name;?>_loading_div").height(screenH * (heightVH / 100) + 'px');
449
-                    jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
445
+                    jQuery("#sticky_map_<?php echo $map_canvas_name; ?>").css("min-height", screenH * (heightVH / 100) + 'px');
446
+                    jQuery("#<?php echo $map_canvas_name; ?>_wrapper").height(screenH * (heightVH / 100) + 'px');
447
+                    jQuery("#<?php echo $map_canvas_name; ?>").height(screenH * (heightVH / 100) + 'px');
448
+                    jQuery("#<?php echo $map_canvas_name; ?>_loading_div").height(screenH * (heightVH / 100) + 'px');
449
+                    jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
450 450
 
451 451
                 }());
452 452
             </script>
@@ -458,13 +458,13 @@  discard block
 block discarded – undo
458 458
             <script>
459 459
                 (function () {
460 460
                     var screenH = jQuery(window).height();
461
-                    var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']);?>";
461
+                    var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']); ?>";
462 462
                     var ptypeH = '';
463
-                    if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
464
-                        ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
463
+                    if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
464
+                        ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
465 465
                     }
466 466
 
467
-                    jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", heightVH - ptypeH + 'px');
467
+                    jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", heightVH - ptypeH + 'px');
468 468
 
469 469
                 }());
470 470
             </script>
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
          * @param array $geodir_map_options Array of map settings.
480 480
          * @param string $map_canvas_name The canvas name and ID for the map.
481 481
          */
482
-        do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
482
+        do_action('geodir_map_after_render', $geodir_map_options, $map_canvas_name);
483 483
 
484 484
 
485 485
     endif; // Exclude posttypes if end
Please login to merge, or discard this patch.
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.
geodirectory-functions/reviews.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * The template for displaying Comments.
4
- *
5
- * The area of the page that contains both current comments
6
- * and the comment form.
7
- *
8
- * @since 1.0.0
9
- * @since 1.5.4 Modified to fix review sorting.
10
- *
11
- * @package GeoDirectory
12
- */
3
+     * The template for displaying Comments.
4
+     *
5
+     * The area of the page that contains both current comments
6
+     * and the comment form.
7
+     *
8
+     * @since 1.0.0
9
+     * @since 1.5.4 Modified to fix review sorting.
10
+     *
11
+     * @package GeoDirectory
12
+     */
13 13
 
14 14
 /*
15 15
  * If the current post is protected by a password and
Please login to merge, or discard this patch.
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.
geodirectory-functions/taxonomy_functions.php 3 patches
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -447,16 +447,16 @@  discard block
 block discarded – undo
447 447
             case 'Array':
448 448
                 $post_types = (array)$post_types;
449 449
                 break;
450
-			case 'options':
450
+            case 'options':
451 451
                 $post_types = (array)$post_types;
452 452
 				
453
-				$options = array();
454
-				if (!empty($post_types)) {
455
-					foreach ($post_types as $key => $info) {
456
-						$options[$key] = __($info['labels']['singular_name'], 'geodirectory');
457
-					}
458
-				}
459
-				$post_types = $options;
453
+                $options = array();
454
+                if (!empty($post_types)) {
455
+                    foreach ($post_types as $key => $info) {
456
+                        $options[$key] = __($info['labels']['singular_name'], 'geodirectory');
457
+                    }
458
+                }
459
+                $post_types = $options;
460 460
                 break;
461 461
             default:
462 462
                 $post_types = array_keys($post_types);
@@ -1059,7 +1059,7 @@  discard block
 block discarded – undo
1059 1059
         if (is_array($post_cat_array)) {
1060 1060
             $post_cat_array = array_unique( $post_cat_array );
1061 1061
 
1062
-			foreach ($post_cat_array as $post_cat_html) {
1062
+            foreach ($post_cat_array as $post_cat_html) {
1063 1063
 
1064 1064
                 $post_cat_info = explode(":", $post_cat_html);
1065 1065
                 $post_maincat_str = $post_cat_info[0];
@@ -1139,9 +1139,9 @@  discard block
 block discarded – undo
1139 1139
             if ($selected == $cat_term->term_id)
1140 1140
                 $option_selected = ' selected="selected" ';
1141 1141
 				
1142
-			// Count child terms
1143
-			$child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1144
-			$has_child = !empty( $child_terms ) ? 't' : 'f';
1142
+            // Count child terms
1143
+            $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1144
+            $has_child = !empty( $child_terms ) ? 't' : 'f';
1145 1145
 
1146 1146
             echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>';
1147 1147
         }
@@ -1430,21 +1430,21 @@  discard block
 block discarded – undo
1430 1430
             }
1431 1431
         }
1432 1432
 
1433
-		// Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz.
1433
+        // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz.
1434 1434
         $site_url = trailingslashit(get_bloginfo('url'));
1435 1435
 
1436
-		$fix_url = strpos($post_link, $site_url) === 0 ? true : false;
1437
-		if ($fix_url) {
1438
-			$post_link = str_replace($site_url, '', $post_link);
1439
-		}
1436
+        $fix_url = strpos($post_link, $site_url) === 0 ? true : false;
1437
+        if ($fix_url) {
1438
+            $post_link = str_replace($site_url, '', $post_link);
1439
+        }
1440 1440
 		
1441 1441
         $post_link = trailingslashit(
1442 1442
             preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1443 1443
         );
1444 1444
 
1445
-		if ($fix_url) {
1446
-			$post_link = $site_url . $post_link;
1447
-		}
1445
+        if ($fix_url) {
1446
+            $post_link = $site_url . $post_link;
1447
+        }
1448 1448
 
1449 1449
         if (isset($comment_post_cache[$post->ID])) {
1450 1450
             $post = $comment_post_cache[$post->ID];
@@ -1532,23 +1532,23 @@  discard block
 block discarded – undo
1532 1532
 
1533 1533
                 if (!empty($post_location)) {
1534 1534
                     $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : '';
1535
-					$region_slug = isset($post_location->region_slug) ? $post_location->region_slug : '';
1536
-					$city_slug = isset($post_location->city_slug) ? $post_location->city_slug : '';
1535
+                    $region_slug = isset($post_location->region_slug) ? $post_location->region_slug : '';
1536
+                    $city_slug = isset($post_location->city_slug) ? $post_location->city_slug : '';
1537 1537
 					
1538
-					$geodir_show_location_url = get_option('geodir_show_location_url');
1538
+                    $geodir_show_location_url = get_option('geodir_show_location_url');
1539 1539
 					
1540
-					$location_slug = array();
1541
-					if ($geodir_show_location_url == 'all') {
1542
-						$location_slug[] = $country_slug;
1543
-						$location_slug[] = $region_slug;
1544
-					} else if ($geodir_show_location_url == 'country_city') {
1545
-						$location_slug[] = $country_slug;
1546
-					} else if ($geodir_show_location_url == 'region_city') {
1547
-						$location_slug[] = $region_slug;
1548
-					}
1549
-					$location_slug[] = $city_slug;
1540
+                    $location_slug = array();
1541
+                    if ($geodir_show_location_url == 'all') {
1542
+                        $location_slug[] = $country_slug;
1543
+                        $location_slug[] = $region_slug;
1544
+                    } else if ($geodir_show_location_url == 'country_city') {
1545
+                        $location_slug[] = $country_slug;
1546
+                    } else if ($geodir_show_location_url == 'region_city') {
1547
+                        $location_slug[] = $region_slug;
1548
+                    }
1549
+                    $location_slug[] = $city_slug;
1550 1550
 					
1551
-					$location_request .= implode('/', $location_slug) . '/';
1551
+                    $location_request .= implode('/', $location_slug) . '/';
1552 1552
                 }
1553 1553
             }
1554 1554
 
@@ -1656,19 +1656,19 @@  discard block
 block discarded – undo
1656 1656
         if ($include_location) {
1657 1657
             global $post;
1658 1658
 			
1659
-			$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1660
-			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1659
+            $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1660
+            $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1661 1661
             
1662
-			if(geodir_is_page('detail') && isset($post->country_slug)){
1662
+            if(geodir_is_page('detail') && isset($post->country_slug)){
1663 1663
                 $location_terms = array(
1664 1664
                     'gd_country' => $post->country_slug,
1665 1665
                     'gd_region' => $post->region_slug,
1666 1666
                     'gd_city' => $post->city_slug
1667 1667
                 );
1668 1668
 				
1669
-				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1670
-					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1671
-				}
1669
+                if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1670
+                    $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1671
+                }
1672 1672
             } else {
1673 1673
                 $location_terms = geodir_get_current_location_terms('query_vars');
1674 1674
             }
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
         if(function_exists('icl_object_id')){
1705 1705
             $post_types = get_option('geodir_post_types');
1706 1706
             $post_type = str_replace("category","",$taxonomy);
1707
-			$post_type = str_replace("_tags","",$post_type);
1707
+            $post_type = str_replace("_tags","",$post_type);
1708 1708
             $slug = $post_types[$post_type]['rewrite']['slug'];
1709 1709
             if ( gd_wpml_slug_translation_turned_on( $post_type )) {
1710 1710
 
@@ -1752,13 +1752,13 @@  discard block
 block discarded – undo
1752 1752
  * @return string The modified link.
1753 1753
  */
1754 1754
 function geodir_posttype_link($link, $post_type) {
1755
-	global $geodir_add_location_url, $post, $gd_session;
1755
+    global $geodir_add_location_url, $post, $gd_session;
1756 1756
 	
1757
-	$location_terms = array();
1757
+    $location_terms = array();
1758 1758
 	
1759
-	if (in_array($post_type, geodir_get_posttypes())) {
1760
-		if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1761
-			if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1759
+    if (in_array($post_type, geodir_get_posttypes())) {
1760
+        if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1761
+            if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1762 1762
                 $location_terms = array(
1763 1763
                     'gd_country' => $post->country_slug,
1764 1764
                     'gd_region' => $post->region_slug,
@@ -1768,22 +1768,22 @@  discard block
 block discarded – undo
1768 1768
                 $location_terms = geodir_get_current_location_terms('query_vars');
1769 1769
             }
1770 1770
 			
1771
-			$location_terms = geodir_remove_location_terms($location_terms);
1771
+            $location_terms = geodir_remove_location_terms($location_terms);
1772 1772
 			
1773
-			if (!empty($location_terms)) {
1774
-				if (get_option('permalink_structure') != '') {
1775
-					$location_terms = implode("/", $location_terms);
1776
-					$location_terms = rtrim($location_terms, '/');
1773
+            if (!empty($location_terms)) {
1774
+                if (get_option('permalink_structure') != '') {
1775
+                    $location_terms = implode("/", $location_terms);
1776
+                    $location_terms = rtrim($location_terms, '/');
1777 1777
 					
1778
-					$link .= urldecode($location_terms) . '/';
1779
-				} else {
1780
-					$link = geodir_getlink($link, $location_terms);
1781
-				}
1782
-			}
1783
-		}
1784
-	}
1778
+                    $link .= urldecode($location_terms) . '/';
1779
+                } else {
1780
+                    $link = geodir_getlink($link, $location_terms);
1781
+                }
1782
+            }
1783
+        }
1784
+    }
1785 1785
 	
1786
-	return $link;
1786
+    return $link;
1787 1787
 }
1788 1788
 
1789 1789
 /**
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                                     $cpt_name = __($args->labels->singular_name, 'geodirectory');
189 189
                                     $items .= '<li class="' . $li_class . '">
190 190
 											<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '">
191
-												' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
191
+												' . sprintf(__('Add %s', 'geodirectory'), $cpt_name) . '
192 192
 											</a>
193 193
 										</li>';
194 194
                                 }
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
                                         $cpt_name = __($args->labels->singular_name, 'geodirectory');
268 268
                                         $items .= '<li class="' . $li_class . '">
269 269
 														<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '">
270
-															' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
270
+															' . sprintf(__('Add %s', 'geodirectory'), $cpt_name) . '
271 271
 														</a>
272 272
 													</li>';
273 273
                                     }
@@ -441,14 +441,14 @@  discard block
 block discarded – undo
441 441
         switch ($output):
442 442
             case 'object':
443 443
             case 'Object':
444
-                $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
444
+                $post_types = json_decode(json_encode($post_types), FALSE); //(object)$post_types;
445 445
                 break;
446 446
             case 'array':
447 447
             case 'Array':
448
-                $post_types = (array)$post_types;
448
+                $post_types = (array) $post_types;
449 449
                 break;
450 450
 			case 'options':
451
-                $post_types = (array)$post_types;
451
+                $post_types = (array) $post_types;
452 452
 				
453 453
 				$options = array();
454 454
 				if (!empty($post_types)) {
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
     } elseif (isset($wp_query->tax_query->queries)) {
643 643
         $tax_arr = $wp_query->tax_query->queries;
644 644
         //if tax query has 'relation' set then it will break wp_list_pluck so we remove it
645
-        if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
645
+        if (isset($tax_arr['relation'])) {unset($tax_arr['relation']); }
646 646
         $taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
647 647
     }
648 648
 
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
             $cat_exclude = serialize($exclude_cats);
766 766
 
767 767
         if (isset($_REQUEST['backandedit'])) {
768
-            $post = (object)$gd_session->get('listing');
768
+            $post = (object) $gd_session->get('listing');
769 769
 
770 770
             if (!is_array($post->post_category[$cat_taxonomy]))
771 771
                 $post_category = $post->post_category[$cat_taxonomy];
@@ -843,14 +843,14 @@  discard block
 block discarded – undo
843 843
 
844 844
             function show_subcatlist(main_cat, catObj) {
845 845
                 if (main_cat != '') {
846
-					var url = '<?php echo geodir_get_ajax_url();?>';
847
-                    var cat_taxonomy = '<?php echo $cat_taxonomy;?>';
848
-                    var cat_exclude = '<?php echo base64_encode($cat_exclude);?>';
846
+					var url = '<?php echo geodir_get_ajax_url(); ?>';
847
+                    var cat_taxonomy = '<?php echo $cat_taxonomy; ?>';
848
+                    var cat_exclude = '<?php echo base64_encode($cat_exclude); ?>';
849 849
                     var cat_limit = jQuery('#' + cat_taxonomy).find('#cat_limit').val();
850
-					<?php if ((int)$cat_limit > 0) { ?>
850
+					<?php if ((int) $cat_limit > 0) { ?>
851 851
 					var selected = parseInt(jQuery('#' + cat_taxonomy).find('.cat_sublist > div.post_catlist_item').length);
852 852
 					if (cat_limit != '' && selected > 0 && selected >= cat_limit && cat_limit != 0) {
853
-						alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int)$cat_limit));?>");
853
+						alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int) $cat_limit)); ?>");
854 854
 						return false;
855 855
 					}
856 856
 					<?php } ?>
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
             }
890 890
 
891 891
             function update_listing_cat(el) {
892
-                var cat_taxonomy = '<?php echo $cat_taxonomy;?>';
892
+                var cat_taxonomy = '<?php echo $cat_taxonomy; ?>';
893 893
                 var cat_ids = '';
894 894
                 var main_cat = '';
895 895
                 var sub_cat = '';
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
         <div class="main_cat_list" style=" <?php if (isset($style)) {
971 971
             echo $style;
972 972
         }?> ">
973
-            <?php geodir_get_catlist($cat_taxonomy, 0);  // print main categories list
973
+            <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list
974 974
             ?>
975 975
         </div>
976 976
     <?php
@@ -997,9 +997,9 @@  discard block
 block discarded – undo
997 997
     if ($exclude != '') {
998 998
         $exclude_cats = maybe_unserialize(base64_decode($exclude));
999 999
         print_r($exclude_cats);
1000
-        if(is_array( $exclude_cats)){
1001
-            $exclude_cats = array_map( 'intval', $exclude_cats );
1002
-        }else{
1000
+        if (is_array($exclude_cats)) {
1001
+            $exclude_cats = array_map('intval', $exclude_cats);
1002
+        } else {
1003 1003
             $exclude_cats = intval($exclude_cats);
1004 1004
         }
1005 1005
 
@@ -1013,25 +1013,25 @@  discard block
 block discarded – undo
1013 1013
         <?php $main_cat = get_term($parrent, $request_taxonomy); ?>
1014 1014
 
1015 1015
         <div class="post_catlist_item" style="border:1px solid #CCCCCC; margin:5px auto; padding:5px;">
1016
-            <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png';?>"
1016
+            <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png'; ?>"
1017 1017
                  onclick="jQuery(this).closest('div').remove();update_listing_cat(this);" align="right"/>
1018 1018
             <?php /* ?>
1019 1019
 		<img src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png';?>" onclick="jQuery(this).closest('div').remove();show_subcatlist();" align="right" /> 
1020 1020
 		<?php */ ?>
1021 1021
 
1022
-            <input type="checkbox" value="<?php echo $main_cat->term_id;?>" class="listing_main_cat"
1022
+            <input type="checkbox" value="<?php echo $main_cat->term_id; ?>" class="listing_main_cat"
1023 1023
                    onchange="if(jQuery(this).is(':checked')){jQuery(this).closest('div').find('.post_default_category').prop('checked',false).show();}else{jQuery(this).closest('div').find('.post_default_category').prop('checked',false).hide();};update_listing_cat()"
1024 1024
                    checked="checked" disabled="disabled"/>
1025 1025
        <span> 
1026
-        <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1026
+        <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
1027 1027
         </span>
1028 1028
             <br/>
1029 1029
 
1030 1030
             <div class="post_default_category">
1031
-                <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>"
1032
-                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?>   />
1031
+                <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id; ?>"
1032
+                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" '; ?>   />
1033 1033
         <span> 
1034
-        <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1034
+        <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
1035 1035
         </span>
1036 1036
             </div>
1037 1037
 
@@ -1064,7 +1064,7 @@  discard block
 block discarded – undo
1064 1064
         $post_cat_str = $post_categories[$request_taxonomy];
1065 1065
         $post_cat_array = explode("#", $post_cat_str);
1066 1066
         if (is_array($post_cat_array)) {
1067
-            $post_cat_array = array_unique( $post_cat_array );
1067
+            $post_cat_array = array_unique($post_cat_array);
1068 1068
 
1069 1069
 			foreach ($post_cat_array as $post_cat_html) {
1070 1070
 
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
                 }
1080 1080
                 $post_sub_catid = '';
1081 1081
                 if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1082
-                    $post_sub_catid = (int)$post_cat_info[1];
1082
+                    $post_sub_catid = (int) $post_cat_info[1];
1083 1083
                 }
1084 1084
 
1085 1085
                 geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
             }
1101 1101
 
1102 1102
             if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1103
-                $post_sub_catid = (int)$post_cat_info[1];
1103
+                $post_sub_catid = (int) $post_cat_info[1];
1104 1104
             }
1105 1105
 
1106 1106
             geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
@@ -1147,8 +1147,8 @@  discard block
 block discarded – undo
1147 1147
                 $option_selected = ' selected="selected" ';
1148 1148
 				
1149 1149
 			// Count child terms
1150
-			$child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1151
-			$has_child = !empty( $child_terms ) ? 't' : 'f';
1150
+			$child_terms = get_terms($cat_taxonomy, array('parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1));
1151
+			$has_child = !empty($child_terms) ? 't' : 'f';
1152 1152
 
1153 1153
             echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>';
1154 1154
         }
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
             2 => __('Custom field updated.', 'geodirectory'),
1183 1183
             3 => __('Custom field deleted.', 'geodirectory'),
1184 1184
             4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1185
-            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1185
+            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], false)) : false,
1186 1186
             6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1187 1187
             7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1188 1188
             8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
             'menu_icon' => $menu_icon,
1320 1320
             'public' => true,
1321 1321
             'query_var' => true,
1322
-            'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true),
1322
+            'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1323 1323
             'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1324 1324
             'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1325 1325
 
@@ -1341,25 +1341,25 @@  discard block
 block discarded – undo
1341 1341
 }
1342 1342
 
1343 1343
 $gd_wpml_get_languages = "";
1344
-function gd_wpml_get_lang_from_url($url){
1344
+function gd_wpml_get_lang_from_url($url) {
1345 1345
 
1346 1346
     global $gd_wpml_get_languages;
1347
-    if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
1347
+    if (isset($_REQUEST['lang']) && $_REQUEST['lang']) {return $_REQUEST['lang']; }
1348 1348
 
1349 1349
 
1350 1350
     //
1351
-    $url = str_replace(array("http://","https://"),"",$url);
1352
-    $site_url = str_replace(array("http://","https://"),"",get_bloginfo('url'));
1351
+    $url = str_replace(array("http://", "https://"), "", $url);
1352
+    $site_url = str_replace(array("http://", "https://"), "", get_bloginfo('url'));
1353 1353
 
1354
-    $url = str_replace($site_url,"",$url);
1354
+    $url = str_replace($site_url, "", $url);
1355 1355
 
1356 1356
 
1357 1357
     $segments = explode('/', trim($url, '/'));
1358 1358
 
1359 1359
     //print_r( $segments);
1360
-    if($gd_wpml_get_languages){
1360
+    if ($gd_wpml_get_languages) {
1361 1361
         $langs = $gd_wpml_get_languages;
1362
-    }else{
1362
+    } else {
1363 1363
         global $sitepress;
1364 1364
         $gd_wpml_get_languages = $sitepress->get_active_languages();
1365 1365
     }
@@ -1422,17 +1422,17 @@  discard block
 block discarded – undo
1422 1422
         $slug = $post_types[$post->post_type]['rewrite']['slug'];
1423 1423
 
1424 1424
         // Alter the CPT slug if WPML is set to do so
1425
-        if(function_exists('icl_object_id')){
1426
-            if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1425
+        if (function_exists('icl_object_id')) {
1426
+            if (gd_wpml_slug_translation_turned_on($post->post_type) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1427 1427
 
1428 1428
                 $org_slug = $slug;
1429
-                $slug = apply_filters( 'wpml_translate_single_string',
1429
+                $slug = apply_filters('wpml_translate_single_string',
1430 1430
                     $slug,
1431 1431
                     'WordPress',
1432 1432
                     'URL slug: ' . $slug,
1433 1433
                     $language_code);
1434 1434
 
1435
-                if(!$slug){$slug = $org_slug;}
1435
+                if (!$slug) {$slug = $org_slug; }
1436 1436
 
1437 1437
             }
1438 1438
         }
@@ -1446,7 +1446,7 @@  discard block
 block discarded – undo
1446 1446
 		}
1447 1447
 		
1448 1448
         $post_link = trailingslashit(
1449
-            preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1449
+            preg_replace("/" . preg_quote($slug, "/") . "/", $slug . "/%gd_taxonomy%", $post_link, 1)
1450 1450
         );
1451 1451
 
1452 1452
 		if ($fix_url) {
@@ -1474,7 +1474,7 @@  discard block
 block discarded – undo
1474 1474
                 )
1475 1475
             );
1476 1476
 
1477
-            $post = (object)array_merge((array)$post, (array)$post2);
1477
+            $post = (object) array_merge((array) $post, (array) $post2);
1478 1478
 
1479 1479
             $comment_post_cache[$post->ID] = $post;
1480 1480
         }
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
 
1484 1484
         if (false !== strpos($post_link, '%gd_taxonomy%')) {
1485 1485
 
1486
-            if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1486
+            if (apply_filters("geodir_add_location_url_to_url", get_option('geodir_add_location_url'), $post->post_type, $post)) {
1487 1487
                 $location_request = '';
1488 1488
 
1489 1489
 
@@ -1497,7 +1497,7 @@  discard block
 block discarded – undo
1497 1497
                         $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1498 1498
                         $post->country_slug = str_replace(']', '', $post->country_slug);
1499 1499
 
1500
-                        $post_location = (object)array('country_slug' => $post->country_slug,
1500
+                        $post_location = (object) array('country_slug' => $post->country_slug,
1501 1501
                             'region_slug' => $post->region_slug,
1502 1502
                             'city_slug' => $post->city_slug
1503 1503
                         );
@@ -1526,7 +1526,7 @@  discard block
 block discarded – undo
1526 1526
                             $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1527 1527
                             $post->country_slug = str_replace(']', '', $post->country_slug);
1528 1528
 
1529
-                            $post_location = (object)array('country_slug' => $post->country_slug,
1529
+                            $post_location = (object) array('country_slug' => $post->country_slug,
1530 1530
                                 'region_slug' => $post->region_slug,
1531 1531
                                 'city_slug' => $post->city_slug
1532 1532
                             );
@@ -1666,7 +1666,7 @@  discard block
 block discarded – undo
1666 1666
 			$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1667 1667
 			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1668 1668
             
1669
-			if(geodir_is_page('detail') && isset($post->country_slug)){
1669
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
1670 1670
                 $location_terms = array(
1671 1671
                     'gd_country' => $post->country_slug,
1672 1672
                     'gd_region' => $post->region_slug,
@@ -1685,7 +1685,7 @@  discard block
 block discarded – undo
1685 1685
 
1686 1686
             if (!empty($location_terms)) {
1687 1687
 
1688
-                $url_separator = '';//get_option('geodir_listingurl_separator');
1688
+                $url_separator = ''; //get_option('geodir_listingurl_separator');
1689 1689
 
1690 1690
                 if (get_option('permalink_structure') != '') {
1691 1691
                     $old_listing_slug = '/' . $listing_slug . '/';
@@ -1708,31 +1708,31 @@  discard block
 block discarded – undo
1708 1708
         }*/
1709 1709
 
1710 1710
         // Alter the CPT slug if WPML is set to do so
1711
-        if(function_exists('icl_object_id')){
1711
+        if (function_exists('icl_object_id')) {
1712 1712
             $post_types = get_option('geodir_post_types');
1713
-            $post_type = str_replace("category","",$taxonomy);
1714
-			$post_type = str_replace("_tags","",$post_type);
1713
+            $post_type = str_replace("category", "", $taxonomy);
1714
+			$post_type = str_replace("_tags", "", $post_type);
1715 1715
             $slug = $post_types[$post_type]['rewrite']['slug'];
1716
-            if ( gd_wpml_slug_translation_turned_on( $post_type )) {
1716
+            if (gd_wpml_slug_translation_turned_on($post_type)) {
1717 1717
 
1718 1718
                 global $sitepress;
1719 1719
                 $default_lang = $sitepress->get_default_language();
1720 1720
                 $language_code = gd_wpml_get_lang_from_url($termlink);
1721
-                if(!$language_code ){$language_code  = $default_lang;}
1721
+                if (!$language_code) {$language_code = $default_lang; }
1722 1722
 
1723 1723
                 $org_slug = $slug;
1724
-                $slug = apply_filters( 'wpml_translate_single_string',
1724
+                $slug = apply_filters('wpml_translate_single_string',
1725 1725
                     $slug,
1726 1726
                     'WordPress',
1727 1727
                     'URL slug: ' . $slug,
1728 1728
                     $language_code);
1729 1729
 
1730 1730
 
1731
-                if(!$slug){$slug = $org_slug;}
1731
+                if (!$slug) {$slug = $org_slug; }
1732 1732
 
1733 1733
                 $termlink = trailingslashit(
1734 1734
 
1735
-                    preg_replace(  "/" . preg_quote( $org_slug, "/" ) . "/", $slug  ,$termlink, 1 )
1735
+                    preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug, $termlink, 1)
1736 1736
                 );
1737 1737
 
1738 1738
             }
@@ -1765,7 +1765,7 @@  discard block
 block discarded – undo
1765 1765
 	
1766 1766
 	if (in_array($post_type, geodir_get_posttypes())) {
1767 1767
 		if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1768
-			if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1768
+			if (geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1769 1769
                 $location_terms = array(
1770 1770
                     'gd_country' => $post->country_slug,
1771 1771
                     'gd_region' => $post->region_slug,
@@ -1878,7 +1878,7 @@  discard block
 block discarded – undo
1878 1878
 
1879 1879
     $where_fields = array($slug);
1880 1880
     if (!empty($taxonomy)) {
1881
-        $parent = (int)$parent;
1881
+        $parent = (int) $parent;
1882 1882
         if ($parent > 0) {
1883 1883
             $where_fields[] = $parent;
1884 1884
             $else_where_fields[] = $parent;
@@ -1947,7 +1947,7 @@  discard block
 block discarded – undo
1947 1947
         $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
1948 1948
         //$terms = get_terms( $taxonomy );
1949 1949
 
1950
-        if($terms) {
1950
+        if ($terms) {
1951 1951
             foreach ($terms as $term) {
1952 1952
                 $post_type = str_replace("category", "", $term->taxonomy);
1953 1953
                 $a_terms[$post_type][] = $term;
@@ -1955,7 +1955,7 @@  discard block
 block discarded – undo
1955 1955
             }
1956 1956
         }
1957 1957
 
1958
-        if($a_terms) {
1958
+        if ($a_terms) {
1959 1959
             foreach ($a_terms as $pt => $t2) {
1960 1960
 
1961 1961
                 foreach ($t2 as $term) {
@@ -1980,7 +1980,7 @@  discard block
 block discarded – undo
1980 1980
     }
1981 1981
 
1982 1982
     if (is_ssl()) {
1983
-        $terms_icons = str_replace("http:","https:",$terms_icons );
1983
+        $terms_icons = str_replace("http:", "https:", $terms_icons);
1984 1984
     }
1985 1985
 
1986 1986
     return $terms_icons;
Please login to merge, or discard this patch.
Braces   +170 added lines, -121 removed lines patch added patch discarded remove patch
@@ -39,8 +39,9 @@  discard block
 block discarded – undo
39 39
     if (get_option('geodir_show_listing_nav')) {
40 40
 
41 41
         $menu_class = '';
42
-        if (geodir_is_page('listing'))
43
-            $menu_class = 'current-menu-item';
42
+        if (geodir_is_page('listing')) {
43
+                    $menu_class = 'current-menu-item';
44
+        }
44 45
 
45 46
 
46 47
         //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
@@ -52,8 +53,9 @@  discard block
 block discarded – undo
52 53
                     if (in_array($post_type, $show_post_type_main_nav)) {
53 54
                         if (get_post_type_archive_link($post_type)) {
54 55
                             $menu_class = '';
55
-                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
-                                $menu_class = 'current-menu-item';
56
+                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) {
57
+                                                            $menu_class = 'current-menu-item';
58
+                            }
57 59
                             /**
58 60
                              * Filter the menu li class.
59 61
                              *
@@ -130,8 +132,9 @@  discard block
 block discarded – undo
130 132
                             if (get_post_type_archive_link($post_type)) {
131 133
 
132 134
                                 $menu_class = '';
133
-                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
-                                    $menu_class = 'current-menu-item';
135
+                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) {
136
+                                                                    $menu_class = 'current-menu-item';
137
+                                }
135 138
 
136 139
                                 $items .= '<li class="' . $sub_li_class . '">
137 140
 														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
@@ -153,8 +156,9 @@  discard block
 block discarded – undo
153 156
     if (get_option('geodir_show_addlisting_nav')) {
154 157
 
155 158
         $menu_class = '';
156
-        if (geodir_is_page('add-listing'))
157
-            $menu_class = 'current-menu-item';
159
+        if (geodir_is_page('add-listing')) {
160
+                    $menu_class = 'current-menu-item';
161
+        }
158 162
 
159 163
         //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
160 164
         $post_types = geodir_get_posttypes('object');
@@ -170,8 +174,9 @@  discard block
 block discarded – undo
170 174
                                 if (geodir_get_addlisting_link($post_type)) {
171 175
 
172 176
                                     $menu_class = '';
173
-                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
174
-                                        $menu_class = 'current-menu-item';
177
+                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) {
178
+                                                                            $menu_class = 'current-menu-item';
179
+                                    }
175 180
                                     /**
176 181
                                      * Filter the menu li class.
177 182
                                      *
@@ -255,8 +260,9 @@  discard block
 block discarded – undo
255 260
                                     if (geodir_get_addlisting_link($post_type)) {
256 261
 
257 262
                                         $menu_class = '';
258
-                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
259
-                                            $menu_class = 'current-menu-item';
263
+                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) {
264
+                                                                                    $menu_class = 'current-menu-item';
265
+                                        }
260 266
                                         /**
261 267
                                          * Filter the menu li class.
262 268
                                          *
@@ -311,8 +317,9 @@  discard block
 block discarded – undo
311 317
     }
312 318
     //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
313 319
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
314
-    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
315
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
320
+    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) {
321
+            $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
322
+    }
316 323
 
317 324
     return $menu;
318 325
 
@@ -399,25 +406,29 @@  discard block
 block discarded – undo
399 406
     $geodir_post_type = get_query_var('post_type');
400 407
 
401 408
     if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
402
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
403
-            $geodir_post_type = get_post_type($_REQUEST['pid']);
404
-        elseif (isset($_REQUEST['listing_type']))
405
-            $geodir_post_type = $_REQUEST['listing_type'];
409
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
410
+                    $geodir_post_type = get_post_type($_REQUEST['pid']);
411
+        } elseif (isset($_REQUEST['listing_type'])) {
412
+                    $geodir_post_type = $_REQUEST['listing_type'];
413
+        }
406 414
 
407 415
     }
408 416
 
409
-    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
410
-        $geodir_post_type = $_REQUEST['stype'];
417
+    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) {
418
+            $geodir_post_type = $_REQUEST['stype'];
419
+    }
411 420
 
412
-    if (is_tax())
413
-        $geodir_post_type = geodir_get_taxonomy_posttype();
421
+    if (is_tax()) {
422
+            $geodir_post_type = geodir_get_taxonomy_posttype();
423
+    }
414 424
 
415 425
 
416 426
     $all_postypes = geodir_get_posttypes();
417 427
     $all_postypes = stripslashes_deep($all_postypes);
418 428
 
419
-    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
420
-        $geodir_post_type = '';
429
+    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) {
430
+            $geodir_post_type = '';
431
+    }
421 432
 
422 433
 
423 434
     return $geodir_post_type;
@@ -464,11 +475,12 @@  discard block
 block discarded – undo
464 475
         endswitch;
465 476
     }
466 477
 
467
-    if (!empty($post_types))
468
-        return $post_types;
469
-    else
470
-        return array();
471
-}
478
+    if (!empty($post_types)) {
479
+            return $post_types;
480
+    } else {
481
+            return array();
482
+    }
483
+    }
472 484
 
473 485
 /**
474 486
  * Get Custom Post Type info.
@@ -485,9 +497,10 @@  discard block
 block discarded – undo
485 497
     $post_types = stripslashes_deep($post_types);
486 498
     if (!empty($post_types) && $post_type != '') {
487 499
         return $post_types[$post_type];
488
-    } else
489
-        return false;
490
-}
500
+    } else {
501
+            return false;
502
+    }
503
+    }
491 504
 
492 505
 if (!function_exists('geodir_get_taxonomies')) {
493 506
     /**
@@ -511,18 +524,21 @@  discard block
 block discarded – undo
511 524
             $gd_taxonomies = array_keys($taxonomies);
512 525
 
513 526
 
514
-            if ($post_type != '')
515
-                $gd_taxonomies = array();
527
+            if ($post_type != '') {
528
+                            $gd_taxonomies = array();
529
+            }
516 530
 
517 531
             $i = 0;
518 532
             foreach ($taxonomies as $taxonomy => $args) {
519 533
 
520
-                if ($post_type != '' && $args['object_type'] == $post_type)
521
-                    $gd_taxonomies[] = $taxonomy;
534
+                if ($post_type != '' && $args['object_type'] == $post_type) {
535
+                                    $gd_taxonomies[] = $taxonomy;
536
+                }
522 537
 
523 538
                 if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
524
-                    if (array_search($taxonomy, $gd_taxonomies) !== false)
525
-                        unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
539
+                    if (array_search($taxonomy, $gd_taxonomies) !== false) {
540
+                                            unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
541
+                    }
526 542
                 }
527 543
 
528 544
             }
@@ -577,10 +593,11 @@  discard block
 block discarded – undo
577 593
                 . ucfirst($category_obj->name) . '</option>';
578 594
         }
579 595
 
580
-        if ($echo)
581
-            echo $html;
582
-        else
583
-            return $html;
596
+        if ($echo) {
597
+                    echo $html;
598
+        } else {
599
+                    return $html;
600
+        }
584 601
     }
585 602
 }
586 603
 
@@ -614,11 +631,12 @@  discard block
 block discarded – undo
614 631
 
615 632
     }
616 633
 
617
-    if (!empty($listing_slug))
618
-        return $listing_slug;
619
-    else
620
-        return false;
621
-}
634
+    if (!empty($listing_slug)) {
635
+            return $listing_slug;
636
+    } else {
637
+            return false;
638
+    }
639
+    }
622 640
 
623 641
 
624 642
 /**
@@ -649,16 +667,18 @@  discard block
 block discarded – undo
649 667
     if (!empty($taxonomies)) {
650 668
         foreach (geodir_get_posttypes() as $pt) {
651 669
             $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
652
-            if (array_intersect($taxonomies, $object_taxonomies))
653
-                $post_type[] = $pt;
670
+            if (array_intersect($taxonomies, $object_taxonomies)) {
671
+                            $post_type[] = $pt;
672
+            }
654 673
         }
655 674
     }
656 675
 
657
-    if (!empty($post_type))
658
-        return $post_type[0];
659
-    else
660
-        return false;
661
-}
676
+    if (!empty($post_type)) {
677
+            return $post_type[0];
678
+    } else {
679
+            return false;
680
+    }
681
+    }
662 682
 
663 683
 if (!function_exists('geodir_custom_taxonomy_walker')) {
664 684
     /**
@@ -714,18 +734,18 @@  discard block
 block discarded – undo
714 734
                 $checked = '';
715 735
 
716 736
                 if (in_array($cat_term->term_id, $search_terms)) {
717
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
718
-                        $checked = 'selected="selected"';
719
-                    else
720
-                        $checked = 'checked="checked"';
737
+                    if ($cat_display == 'select' || $cat_display == 'multiselect') {
738
+                                            $checked = 'selected="selected"';
739
+                    } else {
740
+                                            $checked = 'checked="checked"';
741
+                    }
721 742
                 }
722 743
 
723
-                if ($cat_display == 'radio')
724
-                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
725
-                elseif ($cat_display == 'select' || $cat_display == 'multiselect')
726
-                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
727
-
728
-                else {
744
+                if ($cat_display == 'radio') {
745
+                                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
746
+                } elseif ($cat_display == 'select' || $cat_display == 'multiselect') {
747
+                                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>';
748
+                } else {
729 749
                     $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>';
730 750
                 }
731 751
 
@@ -734,8 +754,9 @@  discard block
 block discarded – undo
734 754
 
735 755
             }
736 756
 
737
-            if ($cat_display == 'checkbox' || $cat_display == 'radio')
738
-                $out .= '</div>';
757
+            if ($cat_display == 'checkbox' || $cat_display == 'radio') {
758
+                            $out .= '</div>';
759
+            }
739 760
 
740 761
             return $out;
741 762
         }
@@ -761,18 +782,21 @@  discard block
 block discarded – undo
761 782
         global $exclude_cats, $gd_session;
762 783
 
763 784
         $cat_exclude = '';
764
-        if (is_array($exclude_cats) && !empty($exclude_cats))
765
-            $cat_exclude = serialize($exclude_cats);
785
+        if (is_array($exclude_cats) && !empty($exclude_cats)) {
786
+                    $cat_exclude = serialize($exclude_cats);
787
+        }
766 788
 
767 789
         if (isset($_REQUEST['backandedit'])) {
768 790
             $post = (object)$gd_session->get('listing');
769 791
 
770
-            if (!is_array($post->post_category[$cat_taxonomy]))
771
-                $post_category = $post->post_category[$cat_taxonomy];
792
+            if (!is_array($post->post_category[$cat_taxonomy])) {
793
+                            $post_category = $post->post_category[$cat_taxonomy];
794
+            }
772 795
 
773 796
             $post_categories = $post->post_category_str;
774
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
775
-                $post_category_str = $post_categories[$cat_taxonomy];
797
+            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
798
+                            $post_category_str = $post_categories[$cat_taxonomy];
799
+            }
776 800
 
777 801
         } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
778 802
             global $post;
@@ -963,8 +987,9 @@  discard block
 block discarded – undo
963 987
         if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
964 988
             $post_cat_str = $post_categories[$cat_taxonomy];
965 989
             $post_cat_array = explode("#", $post_cat_str);
966
-            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
967
-                $style = "display:none;";
990
+            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) {
991
+                            $style = "display:none;";
992
+            }
968 993
         }
969 994
         ?>
970 995
         <div class="main_cat_list" style=" <?php if (isset($style)) {
@@ -999,7 +1024,7 @@  discard block
 block discarded – undo
999 1024
         print_r($exclude_cats);
1000 1025
         if(is_array( $exclude_cats)){
1001 1026
             $exclude_cats = array_map( 'intval', $exclude_cats );
1002
-        }else{
1027
+        } else{
1003 1028
             $exclude_cats = intval($exclude_cats);
1004 1029
         }
1005 1030
 
@@ -1029,7 +1054,10 @@  discard block
 block discarded – undo
1029 1054
 
1030 1055
             <div class="post_default_category">
1031 1056
                 <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>"
1032
-                       onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?>   />
1057
+                       onchange="update_listing_cat()" <?php if ($default) {
1058
+    echo ' checked="checked" ';
1059
+}
1060
+?>   />
1033 1061
         <span> 
1034 1062
         <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
1035 1063
         </span>
@@ -1134,8 +1162,9 @@  discard block
 block discarded – undo
1134 1162
         //$onchange = ' onchange="update_listing_cat()"  ';
1135 1163
 
1136 1164
         $option_selected = '';
1137
-        if (!$selected)
1138
-            $option_slected = ' selected="selected" ';
1165
+        if (!$selected) {
1166
+                    $option_slected = ' selected="selected" ';
1167
+        }
1139 1168
 
1140 1169
         echo '<select field_type="select" id="' . $cat_taxonomy . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1141 1170
 
@@ -1143,8 +1172,9 @@  discard block
 block discarded – undo
1143 1172
 
1144 1173
         foreach ($cat_terms as $cat_term) {
1145 1174
             $option_selected = '';
1146
-            if ($selected == $cat_term->term_id)
1147
-                $option_selected = ' selected="selected" ';
1175
+            if ($selected == $cat_term->term_id) {
1176
+                            $option_selected = ' selected="selected" ';
1177
+            }
1148 1178
 				
1149 1179
 			// Count child terms
1150 1180
 			$child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
@@ -1210,8 +1240,9 @@  discard block
 block discarded – undo
1210 1240
 
1211 1241
     $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1212 1242
 
1213
-    if (!$listing_slug = get_option('geodir_listing_prefix'))
1214
-        $listing_slug = 'places';
1243
+    if (!$listing_slug = get_option('geodir_listing_prefix')) {
1244
+            $listing_slug = 'places';
1245
+    }
1215 1246
 
1216 1247
     /**
1217 1248
      * Taxonomies
@@ -1359,7 +1390,7 @@  discard block
 block discarded – undo
1359 1390
     //print_r( $segments);
1360 1391
     if($gd_wpml_get_languages){
1361 1392
         $langs = $gd_wpml_get_languages;
1362
-    }else{
1393
+    } else{
1363 1394
         global $sitepress;
1364 1395
         $gd_wpml_get_languages = $sitepress->get_active_languages();
1365 1396
     }
@@ -1502,8 +1533,9 @@  discard block
 block discarded – undo
1502 1533
                             'city_slug' => $post->city_slug
1503 1534
                         );
1504 1535
 
1505
-                    } else
1506
-                        $post_location = geodir_get_location();
1536
+                    } else {
1537
+                                            $post_location = geodir_get_location();
1538
+                    }
1507 1539
 
1508 1540
 
1509 1541
                 } else {
@@ -1532,8 +1564,9 @@  discard block
 block discarded – undo
1532 1564
                             );
1533 1565
 
1534 1566
                         }
1535
-                    } else
1536
-                        $post_location = geodir_get_location();
1567
+                    } else {
1568
+                                            $post_location = geodir_get_location();
1569
+                    }
1537 1570
                 }
1538 1571
 
1539 1572
 
@@ -1576,8 +1609,9 @@  discard block
 block discarded – undo
1576 1609
                         $post_terms = $post_terms[0];
1577 1610
                     }
1578 1611
 
1579
-                    if (!$post_terms)
1580
-                        $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1612
+                    if (!$post_terms) {
1613
+                                            $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1614
+                    }
1581 1615
 
1582 1616
                     if (!$post_terms) {
1583 1617
                         $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
@@ -1591,8 +1625,9 @@  discard block
 block discarded – undo
1591 1625
 
1592 1626
                 $term = get_term_by('id', $post_terms, $taxonomies);
1593 1627
 
1594
-                if (!empty($term))
1595
-                    $term_request = $term->slug;
1628
+                if (!empty($term)) {
1629
+                                    $term_request = $term->slug;
1630
+                }
1596 1631
                 //$term_request = $term->slug.'/';
1597 1632
             }
1598 1633
 
@@ -1607,15 +1642,20 @@  discard block
 block discarded – undo
1607 1642
                 $request_term .= $term_request;
1608 1643
 
1609 1644
             } else {
1610
-                if (isset($location_request) && $location_request != '') $request_term = $location_request;
1645
+                if (isset($location_request) && $location_request != '') {
1646
+                    $request_term = $location_request;
1647
+                }
1611 1648
 
1612
-                if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1649
+                if (isset($term_request) && $term_request != '') {
1650
+                    $request_term .= $term_request;
1651
+                }
1613 1652
             }
1614 1653
             $request_term = trim($request_term, '/');
1615
-            if (!empty($request_term))
1616
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1617
-            else
1618
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1654
+            if (!empty($request_term)) {
1655
+                            $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1656
+            } else {
1657
+                            $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1658
+            }
1619 1659
             //echo $post_link ;
1620 1660
         }
1621 1661
         // temp cache the permalink
@@ -1657,8 +1697,9 @@  discard block
 block discarded – undo
1657 1697
             if ($geodir_add_location_url && get_option('geodir_add_location_url')) {
1658 1698
                 $include_location = true;
1659 1699
             }
1660
-        } elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1)
1661
-            $include_location = true;
1700
+        } elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1701
+                    $include_location = true;
1702
+        }
1662 1703
 
1663 1704
         if ($include_location) {
1664 1705
             global $post;
@@ -1808,10 +1849,11 @@  discard block
 block discarded – undo
1808 1849
     if (!is_object($obj_post_type)) {
1809 1850
         return;
1810 1851
     }
1811
-    if ($echo)
1812
-        echo $obj_post_type->labels->singular_name;
1813
-    else
1814
-        return $obj_post_type->labels->singular_name;
1852
+    if ($echo) {
1853
+            echo $obj_post_type->labels->singular_name;
1854
+    } else {
1855
+            return $obj_post_type->labels->singular_name;
1856
+    }
1815 1857
 
1816 1858
 }
1817 1859
 
@@ -1828,14 +1870,16 @@  discard block
 block discarded – undo
1828 1870
 {
1829 1871
     $all_postypes = geodir_get_posttypes();
1830 1872
 
1831
-    if (!in_array($post_type, $all_postypes))
1832
-        return false;
1873
+    if (!in_array($post_type, $all_postypes)) {
1874
+            return false;
1875
+    }
1833 1876
 
1834 1877
     $obj_post_type = get_post_type_object($post_type);
1835
-    if ($echo)
1836
-        echo $obj_post_type->labels->name;
1837
-    else
1838
-        return $obj_post_type->labels->name;
1878
+    if ($echo) {
1879
+            echo $obj_post_type->labels->name;
1880
+    } else {
1881
+            return $obj_post_type->labels->name;
1882
+    }
1839 1883
 
1840 1884
 }
1841 1885
 
@@ -1860,19 +1904,22 @@  discard block
 block discarded – undo
1860 1904
     $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1861 1905
 
1862 1906
     if (is_int($term)) {
1863
-        if (0 == $term)
1864
-            return 0;
1907
+        if (0 == $term) {
1908
+                    return 0;
1909
+        }
1865 1910
         $where = 't.term_id = %d';
1866
-        if (!empty($taxonomy))
1867
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1868
-        else
1869
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1911
+        if (!empty($taxonomy)) {
1912
+                    return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1913
+        } else {
1914
+                    return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1915
+        }
1870 1916
     }
1871 1917
 
1872 1918
     $term = trim(wp_unslash($term));
1873 1919
 
1874
-    if ('' === $slug = sanitize_title($term))
1875
-        return 0;
1920
+    if ('' === $slug = sanitize_title($term)) {
1921
+            return 0;
1922
+    }
1876 1923
 
1877 1924
     $where = 't.slug = %s';
1878 1925
 
@@ -1889,14 +1936,16 @@  discard block
 block discarded – undo
1889 1936
         $where_fields[] = $taxonomy;
1890 1937
 
1891 1938
 
1892
-        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1893
-            return $result;
1939
+        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) {
1940
+                    return $result;
1941
+        }
1894 1942
 
1895 1943
         return false;
1896 1944
     }
1897 1945
 
1898
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1899
-        return $result;
1946
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) {
1947
+            return $result;
1948
+    }
1900 1949
 
1901 1950
     return false;
1902 1951
 }
Please login to merge, or discard this patch.
geodirectory-functions/wp-session/wp-session.php 3 patches
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WordPress session managment.
4
- *
5
- * Standardizes WordPress session data and uses either database transients or in-memory caching
6
- * for storing user session information.
7
- *
8
- * @package WordPress
9
- * @subpackage Session
10
- * @since   3.7.0
11
- */
3
+     * WordPress session managment.
4
+     *
5
+     * Standardizes WordPress session data and uses either database transients or in-memory caching
6
+     * for storing user session information.
7
+     *
8
+     * @package WordPress
9
+     * @subpackage Session
10
+     * @since   3.7.0
11
+     */
12 12
 
13 13
 // Exit if accessed directly
14 14
 if ( ! defined( 'ABSPATH' ) ) exit;
@@ -19,16 +19,16 @@  discard block
 block discarded – undo
19 19
  * @return int
20 20
  */
21 21
 function wp_session_cache_expire() {
22
-	$wp_session = WP_Session::get_instance();
22
+    $wp_session = WP_Session::get_instance();
23 23
 
24
-	return $wp_session->cache_expiration();
24
+    return $wp_session->cache_expiration();
25 25
 }
26 26
 
27 27
 /**
28 28
  * Alias of wp_session_write_close()
29 29
  */
30 30
 function wp_session_commit() {
31
-	wp_session_write_close();
31
+    wp_session_write_close();
32 32
 }
33 33
 
34 34
 /**
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
  * @param string $data
38 38
  */
39 39
 function wp_session_decode( $data ) {
40
-	$wp_session = WP_Session::get_instance();
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
 /**
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
  * @return string
49 49
  */
50 50
 function wp_session_encode() {
51
-	$wp_session = WP_Session::get_instance();
51
+    $wp_session = WP_Session::get_instance();
52 52
 
53
-	return $wp_session->json_out();
53
+    return $wp_session->json_out();
54 54
 }
55 55
 
56 56
 /**
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
  * @return bool
62 62
  */
63 63
 function wp_session_regenerate_id( $delete_old_session = false ) {
64
-	$wp_session = WP_Session::get_instance();
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
-	return true;
68
+    return true;
69 69
 }
70 70
 
71 71
 /**
@@ -76,10 +76,10 @@  discard block
 block discarded – undo
76 76
  * @return bool
77 77
  */
78 78
 function wp_session_start() {
79
-	$wp_session = WP_Session::get_instance();
80
-	do_action( 'wp_session_start' );
79
+    $wp_session = WP_Session::get_instance();
80
+    do_action( 'wp_session_start' );
81 81
 
82
-	return $wp_session->session_started();
82
+    return $wp_session->session_started();
83 83
 }
84 84
 add_action( 'plugins_loaded', 'wp_session_start' );
85 85
 
@@ -89,32 +89,32 @@  discard block
 block discarded – undo
89 89
  * @return int
90 90
  */
91 91
 function wp_session_status() {
92
-	$wp_session = WP_Session::get_instance();
92
+    $wp_session = WP_Session::get_instance();
93 93
 
94
-	if ( $wp_session->session_started() ) {
95
-		return PHP_SESSION_ACTIVE;
96
-	}
94
+    if ( $wp_session->session_started() ) {
95
+        return PHP_SESSION_ACTIVE;
96
+    }
97 97
 
98
-	return PHP_SESSION_NONE;
98
+    return PHP_SESSION_NONE;
99 99
 }
100 100
 
101 101
 /**
102 102
  * Unset all session variables.
103 103
  */
104 104
 function wp_session_unset() {
105
-	$wp_session = WP_Session::get_instance();
105
+    $wp_session = WP_Session::get_instance();
106 106
 
107
-	$wp_session->reset();
107
+    $wp_session->reset();
108 108
 }
109 109
 
110 110
 /**
111 111
  * Write session data and end session
112 112
  */
113 113
 function wp_session_write_close() {
114
-	$wp_session = WP_Session::get_instance();
114
+    $wp_session = WP_Session::get_instance();
115 115
 
116
-	$wp_session->write_data();
117
-	do_action( 'wp_session_commit' );
116
+    $wp_session->write_data();
117
+    do_action( 'wp_session_commit' );
118 118
 }
119 119
 add_action( 'shutdown', 'wp_session_write_close' );
120 120
 
@@ -126,44 +126,44 @@  discard block
 block discarded – undo
126 126
  * of a scheduled task or cron job.
127 127
  */
128 128
 function wp_session_cleanup() {
129
-	global $wpdb;
129
+    global $wpdb;
130 130
 
131
-	if ( defined( 'WP_SETUP_CONFIG' ) ) {
132
-		return;
133
-	}
131
+    if ( defined( 'WP_SETUP_CONFIG' ) ) {
132
+        return;
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' );
139
-		$expired_sessions = array();
138
+        $now = current_time( 'timestamp' );
139
+        $expired_sessions = array();
140 140
 
141
-		foreach( $expiration_keys as $expiration ) {
141
+        foreach( $expiration_keys as $expiration ) {
142 142
 
143
-			// If the session has expired
144
-			if ( $now > intval( $expiration->option_value ) ) {
143
+            // If the session has expired
144
+            if ( $now > intval( $expiration->option_value ) ) {
145 145
 
146
-				// Get the session ID by parsing the option_name
147
-				$session_id = substr( $expiration->option_name, 20 );
146
+                // Get the session ID by parsing the option_name
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 ) ) {
150
-					continue;
151
-				}
149
+                if( (int) -1 === (int) $session_id || ! preg_match( '/^[a-f0-9]{32}$/', $session_id ) ) {
150
+                    continue;
151
+                }
152 152
 
153
-				$expired_sessions[] = $expiration->option_name;
154
-				$expired_sessions[] = esc_sql( "_wp_session_$session_id" );
155
-			}
156
-		}
153
+                $expired_sessions[] = $expiration->option_name;
154
+                $expired_sessions[] = esc_sql( "_wp_session_$session_id" );
155
+            }
156
+        }
157 157
 
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')"  );
162
-		}
163
-	}
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')"  );
162
+        }
163
+    }
164 164
 
165
-	// Allow other plugins to hook in to the garbage collection process.
166
-	do_action( 'wp_session_cleanup' );
165
+    // Allow other plugins to hook in to the garbage collection process.
166
+    do_action( 'wp_session_cleanup' );
167 167
 }
168 168
 add_action( 'wp_session_garbage_collection', 'wp_session_cleanup' );
169 169
 
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
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' );
176
-	}
174
+    if ( ! wp_next_scheduled( 'wp_session_garbage_collection' ) ) {
175
+        wp_schedule_event( current_time( 'timestamp' ), 'twicedaily', 'wp_session_garbage_collection' );
176
+    }
177 177
 }
178 178
 add_action( 'wp', 'wp_session_register_garbage_collection' );
Please login to merge, or discard this patch.
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/add-listing.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Template for add listings page
4
- *
5
- * You can make most changes via hooks or see the link below for info on how to replace the template in your theme.
6
- *
7
- * @link http://docs.wpgeodirectory.com/customizing-geodirectory-templates/
8
- * @since 1.0.0
9
- * @package GeoDirectory
10
- */
3
+     * Template for add listings page
4
+     *
5
+     * You can make most changes via hooks or see the link below for info on how to replace the template in your theme.
6
+     *
7
+     * @link http://docs.wpgeodirectory.com/customizing-geodirectory-templates/
8
+     * @since 1.0.0
9
+     * @package GeoDirectory
10
+     */
11 11
  
12 12
 global $gd_session;
13 13
 
Please login to merge, or discard this patch.
geodirectory-templates/geodir-listing.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Template for the listings (category) page
4
- *
5
- * You can make most changes via hooks or see the link below for info on how to replace the template in your theme.
6
- *
7
- * @link http://docs.wpgeodirectory.com/customizing-geodirectory-templates/
8
- * @since 1.0.0
9
- * @package GeoDirectory
10
- */
3
+                         * Template for the listings (category) page
4
+                         *
5
+                         * You can make most changes via hooks or see the link below for info on how to replace the template in your theme.
6
+                         *
7
+                         * @link http://docs.wpgeodirectory.com/customizing-geodirectory-templates/
8
+                         * @since 1.0.0
9
+                         * @package GeoDirectory
10
+                         */
11 11
 
12 12
 // call header
13 13
 get_header();
Please login to merge, or discard this patch.
geodirectory-templates/listing-filter-form.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
 
26 26
 <form class="<?php
27 27
 /**
28
- * Filters the GD search form class.
29
- *
30
- * @since 1.0.0
31
- * @param string $class The class for the search form, default: 'geodir-listing-search'.
32
- */
28
+     * Filters the GD search form class.
29
+     *
30
+     * @since 1.0.0
31
+     * @param string $class The class for the search form, default: 'geodir-listing-search'.
32
+     */
33 33
 echo apply_filters('geodir_search_form_class', 'geodir-listing-search'); ?>"
34 34
       name="geodir-listing-search" action="<?php echo $search_url ?>" method="get">
35 35
     <input type="hidden" name="geodir_search" value="1"/>
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
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($_REQUEST['s']);
96
-                       } else {
97
-                           echo $default_search_for_text;
98
-                       } ?>" type="text"
95
+                            echo esc_attr($_REQUEST['s']);
96
+                        } else {
97
+                            echo $default_search_for_text;
98
+                        } ?>" type="text"
99 99
                        onblur="if (this.value == '') {this.value = '<?php echo $default_search_for_text; ?>';}"
100 100
                        onfocus="if (this.value == '<?php echo $default_search_for_text; ?>') {this.value = '';}"
101 101
                        onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);">
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 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,14 +75,14 @@  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>
@@ -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.
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.