plugin conflict with Leaflet Maps Marker (CDN/js issue)
-
Hi,
I am the developer of the mapping plugin “Leaflet Maps Marker” (https://www.ads-software.com/extend/plugins/leaflet-maps-marker/) and found a conflict with w3tc plugin:
If w3tc is active and a CDN (like Amazon Cloudfront) is set up, my layer maps break, as w3tc removes the trailing slash from my icon-dir constants:
javascript output without w3tc and inactive CDN (taken from https://www.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/leaflet-fullscreen.php?layer=1)
iconUrl: (feature.properties.icon != '') ? 'https://www.mapsmarker.com/wp-content/uploads/leaflet-maps-marker-icons/' + feature.properties.icon : 'https://www.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/leaflet-dist/images/marker.png',
javascript output with w3tc and active CDN:
iconUrl: (feature.properties.icon != '') ? 'https://cdn.mapsmarker.com/wp-content/uploads/leaflet-maps-marker-icons' + feature.properties.icon : 'https://www.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/leaflet-dist/images/marker.png',
I tried to fix it on my side, but didnt succeed – I guess this is a bug with w3tc (especially the newer version, as with older versions – dont ask me which one – image url werent replaced within javascript-tags).
Here is the code I use within my plugin to create the output above in case this helps you with analyzing:
$lmm_out .= " iconUrl: (feature.properties.icon != '') ? '" . LEAFLET_PLUGIN_ICONS_URL . "/' + feature.properties.icon : '" . LEAFLET_PLUGIN_URL . "leaflet-dist/images/marker.png" . "',".PHP_EOL;
The current workaround I give is to add
wp-content/uploads/leaflet-maps-marker-icons/*
to the list of rejected files within the w3tc CDN configuration. This is not optimal, as I would like my plugin to work out of the box without any additional configuration needed.I would really appreciate your help with this issue. If I can assist you in any way, let me know!
best,Robert
- The topic ‘plugin conflict with Leaflet Maps Marker (CDN/js issue)’ is closed to new replies.