Forum Replies Created

Viewing 15 replies - 16 through 30 (of 155 total)
  • Thread Starter skirridsystems

    (@skirridsystems)

    Actually yes, that’s a much easier solution. Case closed!

    Plugin Author skirridsystems

    (@skirridsystems)

    Actually you can add links to markers. You need to use a markerfile to do it, and code the HTML by hand but it’s fairly straightforward:

    SH6564658285!red;Glyder Fach. See <a href="/wp-content/2022/wales-walks/">Wales Walks</a>

    The <a> tag includes the page to link to, and the bit between <a> and </a> is the text to turn into a link.

    https://skirridsystems.co.uk/os-datahub-maps/adding-markers/

    Plugin Author skirridsystems

    (@skirridsystems)

    At the moment the plugin will only interpret the height as a fixed pixel height, and because of the way the elevation plugin works there’s no obvious way to change it. I’ll see if it’s possible to make it a fixed aspect ratio or something like that.

    Plugin Author skirridsystems

    (@skirridsystems)

    I’m not aware of anything. Your browser should ask permission to access device location. The location information is used within the JS on the browser to set the map centre. No location info is sent to OS Data Hub (the API we use doesn’t have anything that would support that). Obviously OS can see what map tiles you’re requesting, but that’s always true regardless of whether you have location turned on.

    Simon

    In the single address case for attribute you should have:
    $to = $email_clean;
    otherwise you’re checking the sanitized version but using the the non-sanitized version.

    Apart from that everything looks good to me. I like the new variable names too ??

    if (strpos($email_to_attribute, ',') == true)
    is perfectly correct, but strpos will never actually return true, only false or an integer. I prefer !== false, but that’s just a personal style thing.

    Simon

    Good point. I guess the cleanup function could stop once it’s got 3 addresses, or whatever you set as the limit.

    if ( is_email( $clean ) ) {
        $clean_list[] = $clean;
        if ( count( $clean_list ) >= 3 ) break;
    }

    I use this plugin quite a bit for club websites where the email goes to several members of the management committee. They’re all volunteers so the hope is that at least one person will respond! So even if you use CC or BCC, you still might want it to go to several recipients.

    Actually the email_to value in the shortcode attributes does not appear to be sanitized but it is validated using is_email, which will reject a list.

    I think you need to add a custom cleanup function to apply to the email_to attribute, something like the (untested) code below. The idea is that it breaks the string at commas into an array, validates each address separately and generates an array containing only the valid addresses. The result could be an empty array. wp_mail will take a string or an array as the $to value.

    You could use this for CC and BCC fields, adding them to the $header array.

    Note that the email_settings value should never be a list because you want the FROM: field to be a single address, so the sanitization you have there is correct.

    This is code that could go in vscf-submission.php

    <?php
    function email_list_array( $list ) {
        $clean_list = array();
        if ( $list !== '' ) {
            $emails = explode( ',', $list );
            // Build the TO array from valid addresses in the list.
            foreach ( $emails as $email ) {
                $clean = sanitize_email( $email );
                if ( is_email( $clean ) ) {
                    $clean_list[] = $clean;
                }
            }
        }
        return $clean_list;
    }
    
    // In vscf-submission.php
        $email_admin = get_option('admin_email');
        $email_settings = get_option('vscf-setting-22');
        $email_to = email_list_array( $vscf_atts['email_to'] );
        $from_header = $vscf_atts['from_header'];
        // email address admin
        if ( count( $email_to) ) {
            $to = $email_to;
        } else {
            if ( is_email( $email_settings ) ) {
                $to = $email_settings;
            } else {
                $to = $email_admin;
            }
        }
    Thread Starter skirridsystems

    (@skirridsystems)

    One other query. If I have multiple popups on the same page, how can I tell which one is firing the paoc_popup_open event? What are the arguments in the callback function?

    Thread Starter skirridsystems

    (@skirridsystems)

    Thanks, that did the trick.
    I had to use jQuery(document).on instead of $(document).on

    Plugin Author skirridsystems

    (@skirridsystems)

    It appears that the scripts which os-datahub-maps requires are not being output when used within a Toolset view.

    The plugin registers all the scripts it needs on init using wp_register_script, but does not enqueue them. When the shortcode is parsed it creates a list of the scripts actually used, and the scripts in this list are then output using wp_print_scripts by the wp_footer hook. If the shortcode parsing is being delayed until after wp_footer has fired then the list will be empty and no scripts will be output.

    The reason the scripts are enqueued only when the shortcode is used is to prevent conflicts with other plugins which also use Leaflet maps. If two plugins enqueue the scripts for Leaflet, especially different versions of Leaflet, then neither of them works properly.

    Plugin Author skirridsystems

    (@skirridsystems)

    The warning messages you posted are nothing to do with the OS maps plugin. They appear when the 3D viewer starts so I suspect they may be related to that.

    The reason the map doesn’t appear on that page is that the Javascript files which the plugin adds to the WordPress output queue are not actually being sent. My best guess is that some other plugin is interfering with the way WordPress works. WP Views maybe?

    The plugin appears to be working fine on your demo page without those other items.

    Plugin Author skirridsystems

    (@skirridsystems)

    In the settings / global settings there’s an option ‘Unrestricted Pan’ which controls who is allowed to pan away from centre. If you set that to ‘No one’ then your users will not be able to pan away to a different area. It allows you to pan by 40% of the width/height of the map in any direction to give a little leeway, but that’s not a great number of additional tiles.

    In reality the tile limit from OS is quite high (about 2,000,000 per month) so unless you have a high number of site visitors abusing your maps then you’re unlikely to hit the limit.

    Plugin Author skirridsystems

    (@skirridsystems)

    This looks like a PHP/WordPress problem rather than a plugin problem. You’ll need to give a bit more information too; ‘using a variable’ doesn’t tell me much. What is the exact code you’ve tried?

    First things first: try
    echo do_shortcode('[osmap]');

    That should show the default map centred on OS HQ.

    Try dropping the do_shortcode() and just echo the bare shortcode. That way you’ll get to see what do_shortcode is seeing in each of your methods. e.g.
    echo '[osmap gpxfile="https://site/file.gpx"]';

    Don’t forget that variables are expanded in double-quoted strings but not in single-quoted strings.
    echo do_shortcode("[osmap gpxfile='$filepath']");
    will give a very different result from
    echo do_shortcode('[osmap gpxfile="$filepath"]');

    Simon

    I have tried this on one of my sites and sadly it doesn’t work.

    Like @dougvos, I have large quantities of media on my site and need to offload. What I see happening is that the files get offloaded to Amazon S£ but they don’t get compressed. If I turn off the offload then they get compressed but not offloaded.

    I was previously using the ShortPixel compression plugin which had the opposite problem – it compressed the images but prevented them from being offloaded.

    I really need both compression and offload. It would be great if you could get this working

    Plugin Author skirridsystems

    (@skirridsystems)

    Thanks for the report, I’ll add that to the next release.

Viewing 15 replies - 16 through 30 (of 155 total)