PluginProbe
WP Directory Kit / 1.5.9
WP Directory Kit v1.5.9
1.5.9 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 All 37 releases
← All changes | elementor-elements/views/wdk-map.php +58 -21 1.3.2 → 1.5.9 View file →
@@ -7,15 +7,13 @@
7 7
8 8 if ( ! defined( 'ABSPATH' ) ) {
9 9 exit; // Exit if accessed directly.
10 10 }
11 -
12 11 ?>
13 12
14 13 <div class="wdk-element" id="wdk_el_<?php echo esc_html($id_element);?>">
15 14 <div class="wdk-map" class="wdk_map_results">
16 - <?php if($settings['conf_custom_dragging_mobile'] == 'yes'):?> <div class="map-hint"><?php echo esc_html__( 'Require 2 finger for map movement', 'wpdirectorykit' );?></div><?php endif;?>
17 - <div id="wdk_map_results_<?php echo esc_html($id_element);?>" style="height:<?php echo esc_attr($settings['conf_custom_map_height']['size']);?>px"
15 + <div id="wdk_map_results_<?php echo esc_html($id_element);?>" data-auto-search="enable" style="height:<?php echo esc_attr($settings['conf_custom_map_height']['size']);?>px"
18 16 data-el_id="<?php echo esc_attr($this->get_id());?>"
19 17 data-el_type="<?php echo esc_attr($this->get_name());?>"
20 18 <?php
21 19 $post_id = get_the_ID();
@@ -28,9 +26,9 @@
28 26 $post_id = $wdk_listing_page_id;
29 27 ?>
30 28 data-el_page_id="<?php echo esc_attr($post_id);?>"
31 29
32 - class="wdk_map_results <?php echo wmvc_show_data('styles_thmbn_des_type',$settings, '');?>
30 + class="wdk_map_results <?php echo esc_attr(wmvc_show_data('styles_thmbn_des_type',$settings, ''));?>
33 31 <?php if
34 32 (
35 33 wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_ajax_results') &&
36 34 isset($settings['is_ajax_enable']) && $settings['is_ajax_enable'] == 'yes'
@@ -36,10 +34,14 @@
36 34 isset($settings['is_ajax_enable']) && $settings['is_ajax_enable'] == 'yes'
37 35 ):?>
38 36 ajax_results_enabled
39 37 <?php endif;?>
40 - " >
38 + " >
41 39 </div>
40 + <form action="" class="wdk-search-form map" style="wdk-hidden">
41 + <input name="rectangle_ne" type="hidden" class="wdk-hidden" value="<?php echo isset($_GET['rectangle_ne']) ? esc_attr(sanitize_text_field(wp_unslash($_GET['rectangle_ne']))) : '';?>"/>
42 + <input name="rectangle_sw" type="hidden" class="wdk-hidden" value="<?php echo isset($_GET['rectangle_sw']) ? esc_attr(sanitize_text_field(wp_unslash($_GET['rectangle_sw']))) : '';?>"/>
43 + </form>
42 44 </div>
43 45 </div>
44 46 <?php
45 47 $zoom_index = $settings['conf_custom_map_zoom_index']['size'];
@@ -53,8 +55,9 @@
53 55 ?>
54 56 <?php
55 57 $WMVC = &wdk_get_instance();
56 58 $WMVC->model('category_m');
59 +
57 60 if (!$is_edit_mode)
58 61 ob_start();
59 62 ?>
60 63 <script>
@@ -72,10 +75,10 @@
72 75 wdk_clusters = L.markerClusterGroup({spiderfyOnMaxZoom: true, showCoverageOnHover: false, zoomToBoundsOnClick: true});
73 76 wdk_map = L.map('wdk_map_results_<?php echo esc_html($id_element);?>', {
74 77 center: ["<?php echo esc_js($lat);?>","<?php echo esc_js($lng);?>"],
75 78 zoom: "<?php echo esc_js($zoom_index);?>",
76 - scrollWheelZoom: false,
77 - dragging: ((!L.Browser.mobile) ? <?php if($settings['conf_custom_dragging'] == 'yes'):?> true <?php else:?> else <?php endif;?> : <?php if($settings['conf_custom_dragging_mobile'] == 'yes'):?> true <?php else:?> false <?php endif;?>),
79 + scrollWheelZoom: <?php echo (wmvc_show_data('enable_scrollWheelZoom', $settings, '') == 'yes') ? 'true' : 'false'; ?>,
80 + dragging: ((!L.Browser.mobile) ? (<?php if($settings['conf_custom_dragging'] == 'yes'):?> true <?php else:?> false <?php endif;?>) : (<?php if($settings['conf_custom_dragging_mobile'] == 'yes'):?> true <?php else:?> false <?php endif;?>)),
78 81 tap: !L.Browser.mobile,
79 82 fullscreenControl: true,
80 83 fullscreenControlOptions: {
81 84 position: 'topleft'
@@ -81,20 +84,39 @@
81 84 position: 'topleft'
82 85 },
83 86 });
84 87
85 -
88 + // Custom info label control on the top left of the map
89 +
90 + <?php if($settings['conf_custom_dragging_mobile'] != 'yes'):?>
91 + var InfoLabelControl = L.Control.extend({
92 + options: {
93 + position: 'topright'
94 + },
95 +
96 + onAdd: function (map) {
97 + var container = L.DomUtil.create('div', 'wdk-map-info-label only_mobile');
98 + container.innerHTML = '<?php echo esc_html__( 'Require 2 finger for map movement', 'wpdirectorykit' );?>';
99 + return container;
100 + }
101 + });
102 +
103 + wdk_map.addControl(new InfoLabelControl());
104 + <?php endif;?>
105 +
86 106 L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
87 107 attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
88 108 }).addTo(wdk_map);
89 109
90 - let drawMap = wdk_map_draw(wdk_map);
110 + <?php if(!isset($settings['disable_rectangle']) || $settings['disable_rectangle'] != 'yes'):?>
111 + let drawMap = wdk_map_draw(wdk_map, null, <?php if(isset($settings['enable_rectangle_auto_search']) && $settings['enable_rectangle_auto_search'] != 'yes'):?>false<?php else:?>true<?php endif;?>);
91 112
92 - // define rectangle geographical bounds
93 - <?php if(isset($_GET['rectangle_ne']) && isset($_GET['rectangle_sw'])) :?>
94 - <?php if(wdk_is_gps($_GET['rectangle_ne']) && wdk_is_gps($_GET['rectangle_sw'])) :?>
95 - var bounds = [[<?php echo isset($_GET['rectangle_ne']) ? esc_attr(sanitize_text_field($_GET['rectangle_ne'])) : '';?>], [<?php echo isset($_GET['rectangle_sw']) ? esc_attr(sanitize_text_field($_GET['rectangle_sw'])) : '';?>]];
96 - drawMap.setRectangle(L.rectangle(bounds, {color: "#ff7800", weight: 1}));
113 + // define rectangle geographical bounds
114 + <?php if(isset($_GET['rectangle_ne']) && isset($_GET['rectangle_sw'])) :?>
115 + <?php if(wdk_is_gps($_GET['rectangle_ne']) && wdk_is_gps($_GET['rectangle_sw'])) :?>
116 + var bounds = [[<?php echo isset($_GET['rectangle_ne']) ? esc_attr(sanitize_text_field(wp_unslash($_GET['rectangle_ne']))) : '';?>], [<?php echo isset($_GET['rectangle_sw']) ? esc_attr(sanitize_text_field(wp_unslash($_GET['rectangle_sw']))) : '';?>]];
117 + drawMap.drawOuther(bounds);
118 + <?php endif;?>
97 119 <?php endif;?>
98 120 <?php endif;?>
99 121
100 122 <?php if(!empty($settings['conf_custom_map_style']) && $settings['conf_custom_map_style'] =='custom' && !empty($settings['conf_custom_map_style_self'])):?>
@@ -195,8 +217,25 @@
195 217 }
196 218 ).addTo(wdk_map);
197 219
198 220 <?php elseif(in_array($settings['conf_custom_map_style'], array(
221 + 'https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}{r}.png',
222 + 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png',
223 + 'https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png',
224 + 'https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}{r}.png',
225 + ))):?>
226 +
227 + <?php
228 + // If no Carto key is provided, show default tile styling (fallback to OSM)
229 + if (!$is_edit_mode && empty($settings['carto_map_key'])): ?>
230 + var positron = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
231 + attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
232 + }).addTo(wdk_map);
233 + <?php else: ?>
234 + var positron = L.tileLayer('<?php echo esc_js($settings['conf_custom_map_style']);?>?key=<?php echo esc_js($settings['carto_map_key']);?>').addTo(wdk_map);
235 + <?php endif; ?>
236 +
237 + <?php elseif(in_array($settings['conf_custom_map_style'], array(
199 238 'https://{s}.tile.thunderforest.com/mobile-atlas/{z}/{x}/{y}.png',
200 239 'https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png',
201 240 'https://{s}.tile.thunderforest.com/transport-dark/{z}/{x}/{y}.png',
202 241 'https://{s}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png',
@@ -242,10 +281,8 @@
242 281 $listing_lng = wmvc_show_data('lng', $listing);
243 282
244 283 if(wmvc_show_data('conf_hide_real_location', $settings) == 'yes') {
245 284 $gps = wdk_get_near_location($listing_lat, $listing_lng);
246 - //$listing_lat = (wmvc_show_data('lat', $gps));
247 - //$listing_lng = (wmvc_show_data('lng', $gps));
248 285
249 286 $listing_lat = wdk_move_gps($listing_lat);
250 287 $listing_lng = wdk_move_gps($listing_lng);
251 288 }
@@ -271,9 +308,9 @@
271 308 } else {
272 309 $value = apply_filters( 'wpdirectorykit/listing/field/value', wdk_field_value_on_type($field_id, $listing), $field_id);
273 310 }
274 311
275 - $field_value = $value;
312 + $field_value = wdk_filter_decimal($value);
276 313
277 314 } else {
278 315 $field_value .= apply_filters( 'wpdirectorykit/listing/field/value', wdk_field_value_on_type($field_id, $listing), $field_id);
279 316 }
@@ -280,19 +317,19 @@
280 317
281 318 $field_value .= apply_filters( 'wpdirectorykit/listing/field/suffix',wdk_field_option ($field_id, 'suffix'), $field_id);
282 319 ?>
283 320 auto_marker_size = true;
284 - var innerMarker = '<div class="wdk_marker-container wdk_marker_label category_id_<?php echo esc_js(wmvc_show_data('category_id', $listing));?>"><?php echo esc_js(strip_tags($field_value));?></div>';
321 + var innerMarker = '<div class="wdk_marker-container wdk_marker_label category_id_<?php echo esc_js(wmvc_show_data('category_id', $listing));?>"><?php echo esc_js(wp_strip_all_tags($field_value));?></div>';
285 322 <?php elseif($pin_icon):?>
286 323 var image = '<?php echo esc_html($pin_icon);?>'; var innerMarker = '<div class="wdk_marker-container wdk_marker-container-image"><img src='+image+'></img></div>';
287 324 <?php elseif($font_icon && empty($font_class)):?>
288 - var innerMarker = '<div class="wdk_marker-container category_id_<?php echo esc_js(wmvc_show_data('category_id', $listing));?>"><div class="front wdk_face"><?php echo wdk_viewe($font_icon);?></div><div class="wdk_marker-card"><div class="wdk_marker-arrow"></div></div></div>';
325 + var innerMarker = '<div class="wdk_marker-container category_id_<?php echo esc_js(wmvc_show_data('category_id', $listing));?>"><div class="front wdk_face"><?php echo wdk_viewe($font_icon);// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped, WordPress.WP.I18n.NonSingularStringLiteralText?></div><div class="wdk_marker-card"><div class="wdk_marker-arrow"></div></div></div>';
289 326 <?php else:?>
290 - var innerMarker = '<div class="wdk_marker-container category_id_<?php echo esc_js(wmvc_show_data('category_id', $listing));?>"><div class="front wdk_face"><i class="<?php echo esc_html($font_class);?>"></i></div><div class="wdk_marker-card"><div class="wdk_marker-arrow"></div></div></div>';
327 + var innerMarker = '<div class="wdk_marker-container category_id_<?php echo esc_js(wmvc_show_data('category_id', $listing));?>"><div class="front wdk_face"><i class="<?php echo esc_attr($font_class);?>"></i></div><div class="wdk_marker-card"><div class="wdk_marker-arrow"></div></div></div>';
291 328 <?php endif;?>
292 329
293 330 wdk_markers.push(wdk_generate_marker_ajax_popup('<?php echo esc_url(admin_url('admin-ajax.php'));?>','<?php echo esc_html(wmvc_show_data('post_id', $listing));?>','<?php echo esc_html($listing_lat);?>','<?php echo esc_html($listing_lng);?>',innerMarker, wdk_jpopup_customOptions, auto_marker_size
294 - , <?php if(wmvc_show_data('disable_cluster', $settings) == 'yes'):?> false <?php endif;?>));
331 + , <?php if(wmvc_show_data('disable_cluster', $settings) == 'yes'):?> false<?php else:?> true <?php endif;?> <?php if(wmvc_show_data('custom_layout_id', $settings)):?>, <?php echo esc_js(wmvc_show_data('custom_layout_id', $settings));?> <?php endif;?>));
295 332 <?php endforeach; ?>
296 333 wdk_map.addLayer(wdk_clusters);
297 334 /* set center */
298 335 if(wdk_markers.length){