From ec22a311aef69abc8adcb12de7c71912fd8c0e47 Mon Sep 17 00:00:00 2001 From: bozdoz Date: Thu, 15 Jan 2026 23:43:46 -0400 Subject: [PATCH] groundwork for leaflet v2 --- class.plugin-settings.php | 1 + scripts/construct-leaflet-map.js | 2 ++ shortcodes/class.geojson-shortcode.php | 2 +- shortcodes/class.image-shortcode.php | 2 +- shortcodes/class.map-shortcode.php | 5 +++-- shortcodes/class.wms-shortcode.php | 2 +- templates/settings.php | 2 ++ 7 files changed, 11 insertions(+), 5 deletions(-) diff --git a/class.plugin-settings.php b/class.plugin-settings.php index be6a360..058a1f0 100644 --- a/class.plugin-settings.php +++ b/class.plugin-settings.php @@ -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), diff --git a/scripts/construct-leaflet-map.js b/scripts/construct-leaflet-map.js index 907470f..d6485f6 100644 --- a/scripts/construct-leaflet-map.js +++ b/scripts/construct-leaflet-map.js @@ -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() { diff --git a/shortcodes/class.geojson-shortcode.php b/shortcodes/class.geojson-shortcode.php index 838685a..01d51da 100644 --- a/shortcodes/class.geojson-shortcode.php +++ b/shortcodes/class.geojson-shortcode.php @@ -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); } function pointToLayer (feature, latlng) { diff --git a/shortcodes/class.image-shortcode.php b/shortcodes/class.image-shortcode.php index 80ffdd5..cadef39 100644 --- a/shortcodes/class.image-shortcode.php +++ b/shortcodes/class.image-shortcode.php @@ -43,7 +43,7 @@ protected function getHTML($atts='', $content=null) $source = empty($src) ? $source : $src; ob_start(); ?>/*