Support » Plugin: Stormia - Live Weather Radar » FIX for PHP errors and wrong location

  • Developer seems absent from this forum, but this is for them or anyone using this plugin – the fix for errors is super easy, and is just correcting a syntax error/typo.

    If you want to avoid that and use the stormia shortcode, you’ll need to update a few lines of code in the stormia.php file. The dev incorrectly used the variable $attrs instead of the correct $atts six times, starting around line 30. Here is the incorrect code:

    
      if(array_key_exists('lat', $attrs) && array_key_exists('lon', $attrs)) {
        $latlong = '&lat='.$attrs['lat'].'&lon='.$attrs['lon'];
      } else {
        $latlong = '';
      }
    
    	$html .= '<iframe src="https://stormia.io/embed?l='.$attrs["layer"].'&z='.$attrs["zoom"].$latlong.'" style="width:100%;border:0;margin-bottom:0;" height="'.$atts["height"].'" frameborder="'.$atts["frameborder"].'"></iframe><div style="width:100%;text-align:right;">'; 

    If you replace those $attrs with $atts everything will work fine.

    As an aside, this plugin is essentially just a shortcode for an iframe embed; you can easily do this without a plugin with just a little effort.

    Hope that helps someone!

Viewing 1 replies (of 1 total)
  • ANOTHER problem/fix – you may have noticed that the rain layer doesn’t display on load unless you specify it in the shortcode. This is more typos from the dev. Line 19 defines the default layer variable, and includes a comma at the end which needs to be removed.

    Here is the incorrect code:

    function stormia_embed_shortcode( $atts, $content = null ) {
    	$defaults = array(
        'url' => 'map', // using geolocation (default behavior of no url is provided)
    		'width' => '800',
    		'height' => '500',
        'layer' => 'rain,',
        'zoom' => '8',
        'frameborder' => '0'
    	);

    Simply remove that comma from rain and you’ll be good to go.

Viewing 1 replies (of 1 total)
  • The topic ‘FIX for PHP errors and wrong location’ is closed to new replies.