Support » Plugin: Event Organiser » Event Organiser – leaflet.css from cloudflare

  • Resolved stefandog

    (@stefandog)


    Hi all,

    I really hope that anybody can help me.

    I’m using Event Organiser with WordPress twentyfourteen and it works great.

    But it uses a css file from cdnjs.cloudflare.com (ajax/libs/leaflet/1.3.1/leaflet.css)

    It’s called in every site head with:

    <link rel='stylesheet' id='eo-leaflet.js-css' href='http://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.css?ver=4.9.8' type='text/css' media='all' />
    <style id='eo-leaflet.js-inline-css' type='text/css'>

    Even when i disable CSS and disable all theme support, event organiser calls this file from cloudflare.

    Is there any possibility to get rid of this or download and host this css-file locally? I don’t want to have any external ressources because of GDPR.

Viewing 5 replies - 1 through 5 (of 5 total)
  • I’ve found that this seems to be done in

    event-organiser-register.php

    wp_register_style( 'eo-leaflet.js', "{$protocal}cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.css" );

    What happens, when I delete this registration? Is it necessary to reinstall event organiser?

    I might have a solution! : )

    leaflet is used for OpenStreetMaps. It can also be downloaded here:
    https://leafletjs.com/

    When I extract and copy the latest version to a new folder in “event-organiser” on my webserver and change event-organiser-register.php to

    wp_register_script( 'eo-leaflet.js', EVENT_ORGANISER_URL."NEW-FOLDER/leaflet.js" );
    		wp_register_style( 'eo-leaflet.js', EVENT_ORGANISER_URL."NEW-FOLDER/leaflet.css" );

    (you have to replace NEW-FOLDER) then everything works perfectly fine without any external sources. You also don’t have to reinstall anything.

    I guess EO updates may override this, but for now I’m happy with this solution.

    Thanks for the great Plugin.

    Guillermo

    (@guillermovargasquisoboni)

    Hi Stefan,

    I’m interested in your experience with leaflet. Have you ever thought about styling your maps? I’m trying to change some aspects on my maps, in particular the scrolling zoom and the colors, but I don’t know how to proceed. If you have any experience on this, it will be really nice if you can point me in the right direction.

    Guillermo

    (@guillermovargasquisoboni)

    Dear stefandog,

    I have been playing around a little bit. By the moment, I can tell you something that can be avoid overriding your development with futur eo updates.
    I done this by following this thread: https://wordpress.stackexchange.com/questions/160249/change-src-from-wp-register-script-in-plugins-themes

    You can add a piece of code in your child functions.php or like me, in a mini-plugin that I created in order to adapt EO to my use.

    function mylocal_leaflet() {
        wp_deregister_script( 'eo-leaflet.js');
        wp_register_script( 'eo-leaflet.js', 'http://localhost:8888/test/wp-content/plugins/event-organiser-myway/leaflet/leaflet.js' );
        
    add_action('wp_enqueue_scripts', 'mylocal_leaflet');
    
    }
    • This reply was modified 8 months, 2 weeks ago by  Guillermo.

    Thank you both! This is very useful as it is unfortunately an issue for compatibility with the GDPR (unless one mentions it in the data protection guidelines of the website).

    There are in fact multiple occurences to deregister:

    
    event-organiser/includes/event-organiser-register.php:		wp_register_style( 'eo-leaflet.js', "{$protocal}cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.css" );
    event-organiser/includes/event-organiser-register.php:		wp_register_script( 'eo-leaflet.js', "{$protocal}cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.js" );
    event-organiser/includes/event-organiser-register.php:		wp_register_style( 'eo-leaflet.js', "{$protocal}cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.css" );

    In my case, I want to entirely disable the map. So besides editing the two templates (event-meta-event-single.php and taxonomy-event-venue.php), I added to functions.php of my theme the following lines:

    
    // disable loading the leaflet library from cloudflare for OSM in Event Organizer
    function disable_loading_leaflet() {
        wp_deregister_script('eo-leaflet.js');
        wp_deregister_style('eo-leaflet.css');
        wp_deregister_style('eo-leaflet.js');
    }
    add_action('wp_enqueue_scripts', 'disable_loading_leaflet');
    • This reply was modified 2 months, 3 weeks ago by  curlybracket.
Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.