• Resolved Oliver Campion

    (@domainsupport)


    Hi,

    We’ve noticed that your plugin, when activated, strips the HTML from markers? For example, this marker which should be rendered with an image and link …

                            marker.bindPopup(window.WPLeafletMapPlugin.unescape('<a href=\"https://scallop.org.uk/the-denbigh/\" title=\"The Denbigh\"> <img loading=\"lazy\" src=\"https://scallop.org.uk/wp-content/uploads/2025/02/p89-150x150.png\" alt=\"The Denbigh\" title=\"The Denbigh\"><br />The Denbigh</a>'));

    Is instead rendered like this with all HTML tags stripped?

    <div class="leaflet-popup-content" style="width: 71px;"> The Denbigh</div>

    Please advise.

    Thank you.

    Oliver

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author hupe13

    (@hupe13)

    I cannot confirm that. There must be another cause. Maybe the reason is, that the marker “Georgie Porgie” has an incorrect latitude and longitude.

    Thread Starter Oliver Campion

    (@domainsupport)

    Ah, good catch, however removing that marker doesn’t resolve the issue. I have disabled your plugin so you can see how the marker content is meant to look … ?

    Plugin Author hupe13

    (@hupe13)

    The scripts for clustering markers I changed 2 years ago. New in last version is the script for fullscreen. Can you enable the Extension plugin again and test the page with and without cluster and fullscreen?

    Thread Starter Oliver Campion

    (@domainsupport)

    I’ve re-enabled the plugin and disabled both cluster and fullscreen shortcodes and the issue persists. So this is odd!

    Plugin Author hupe13

    (@hupe13)

    Searched and found. What is your editor in backend?

    Changelog

    • This reply was modified 1 month, 2 weeks ago by hupe13.
    Thread Starter Oliver Campion

    (@domainsupport)

    Yeah, we use the Shortcode block to inject our markers dynamically. But surely this would only decode HTML entities not stripe HTML tags?

    Plugin Author hupe13

    (@hupe13)

    The render_block filter is the only place where something is done without using any shortcode from the Extension plugin (and the gesture handling, of course).

    How do you “inject our markers dynamically”? If I create marker dynamically I use a php script with do_shortcode('[leaflet-marker ... ]... [/leaflet-marker]');.

    Or can you comment out the render_block for testing and try again?

    Thread Starter Oliver Campion

    (@domainsupport)

    I can confirm that commenting out the render_block filter resolves the issue!

    I can also confirm that we also use do_shortcode() (within our own shortcode) to render the markers dynamically …

    $lat = filter_var(get_post_meta($post->ID, 'geo_latitude', true), FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
    $lng = filter_var(get_post_meta($post->ID, 'geo_longitude', true), FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
    if ($lat && $lng) {
    $content .= do_shortcode('[leaflet-marker svg lat=' . esc_attr($lat) . ' lng=' . esc_attr($lng) . ' iconClass="dashicons-svg dashicons-svg-' . esc_attr(sanitize_key($marker_icon['iconClass'])) . '"]' . $marker_content . '[/leaflet-marker]');
    }
    Plugin Author hupe13

    (@hupe13)

    <del>I think, the easiest way will be to create a switch in next version.</del>

    I’ll delete it, I’ve tested it, it’s no longer needed. See in /wp-includes/js/dist/block-library.js, search “core/shortcode”. There is written "source":"raw".

    • This reply was modified 1 month, 1 week ago by hupe13.
    • This reply was modified 1 month, 1 week ago by hupe13.
    • This reply was modified 1 month, 1 week ago by hupe13.
    Thread Starter Oliver Campion

    (@domainsupport)

    I was going to suggest setting the filter callback as a named function rather than an anonymous one so that it could be removed with remove_filter() but if it’s not needed at all and you’re going to remove it, that works too πŸ™‚

    Plugin Author hupe13

    (@hupe13)

    It is solved in version 4.12.

Viewing 11 replies - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.