Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions class.plugin-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ private function __construct()
$foreachmap
)
),
// TODO default needs to be "global"
'js_url' => array(
'display_name'=>__('JavaScript URL', 'leaflet-map'),
'default' => sprintf('https://unpkg.com/leaflet@%s/dist/leaflet.js', $leaflet_version),
Expand Down
2 changes: 2 additions & 0 deletions scripts/construct-leaflet-map.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// TODO: needs leaflet v2 proxy:
// https://codepen.io/bozdoz/pen/EaVOegY?editors=0010
(function () {
// holds a function queue to call once page is loaded
function Main() {
Expand Down
2 changes: 1 addition & 1 deletion shortcodes/class.geojson-shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ function camelFun (_, first_letter) {
style[ rewrite_keys[ key ] ] = props[ key ];
}
}
return L.Util.extend(style, default_style);
return Object.assign(style, default_style);
}
<?php echo $onEachFeature; ?>
function pointToLayer (feature, latlng) {
Expand Down
2 changes: 1 addition & 1 deletion shortcodes/class.image-shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected function getHTML($atts='', $content=null)
$source = empty($src) ? $source : $src;

ob_start(); ?>/*<script>*/
var options = L.Util.extend({}, {
var options = Object.assign({}, {
attributionControl: false
}, <?php echo $map_options; ?>, {
crs: L.CRS.Simple
Expand Down
5 changes: 3 additions & 2 deletions shortcodes/class.map-shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function __construct()
protected function enqueue()
{
wp_enqueue_style('leaflet_stylesheet');
// TODO needs to load leaflet_js first as module
wp_enqueue_script('wp_leaflet_map');

if (wp_script_is('leaflet_mapquest_plugin', 'registered')) {
Expand Down Expand Up @@ -297,13 +298,13 @@ protected function getHTML($atts='', $content=null)
var baseUrl = atob('<?php echo base64_encode(filter_var($tileurl, FILTER_SANITIZE_URL)); ?>');
var base = (!baseUrl && window.MQ) ?
window.MQ.mapLayer() : L.tileLayer(baseUrl,
L.Util.extend({}, {
Object.assign({}, {
detectRetina: <?php echo $detect_retina ? '1' : '0'; ?>,
},
<?php echo $tile_layer_options; ?>
)
);
var options = L.Util.extend({}, {
var options = Object.assign({}, {
layers: [base],
attributionControl: false
},
Expand Down
2 changes: 1 addition & 1 deletion shortcodes/class.wms-shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected function getHTML($atts = '', $content = null)
ob_start();
?>/*<script>*/
var srcUrl = atob('<?php echo base64_encode( $source ); ?>');
var options = L.Util.extend({}, {
var options = Object.assign({}, {
attributionControl: false
}, <?php echo $map_options; ?>);
var zoom = <?php echo $zoom; ?>;
Expand Down
2 changes: 2 additions & 0 deletions templates/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ function verify_nonce () {
}
/** END FORM SUBMISSION */

// TODO: maybe we should fetch unpkg for latest and load current and get L.version, and just inform

/** CHECK LEAFLET VERSION */
$db_js_url = $settings->get('js_url');
$unpkg_url = "https://unpkg.com/leaflet";
Expand Down