function widget($args, $instance) { global $posty_plugin_url; if (!empty($instance['distancefrom']) && $instance['miles'] > 1) { if ($instance['reverse'] && geoDistanceFrom($instance['distancefrom']) < $instance['miles']) { return false; } elseif (!$instance['reverse'] && geoDistanceFrom($instance['distancefrom']) > $instance['miles']) { return false; } } $locationTest = geoLocationContent($instance['locationtype'], $instance['location'], $instance['reverse']); if (!$locationTest) { return false; } recordGeoStats('w_weather'); // $data = get_option('postyMap'); extract($args, EXTR_SKIP); echo $args['before_widget']; echo $args['before_title'] . do_shortcode(stripslashes($instance['title'])) . $args['after_title']; echo geoWeather($instance['image'], $instance['measurement'], $instance['humidity'], $instance['wind']); echo $args['after_widget']; }
function geoWeatherShortcode($attributes) { recordGeoStats('weather'); extract(shortcode_atts(array('image' => 'on', 'measurement' => 'Farenheit', 'humidity' => 'on', 'wind' => 'on', 'miles' => '', 'distancefrom' => '', 'locationtype' => '', 'location' => '', 'reverse' => false), $attributes)); if (!empty($distancefrom) && $miles > 1) { if ($reverse && geoDistanceFrom($distancefrom) < $miles) { return false; } elseif (!$reverse && geoDistanceFrom($distancefrom) > $miles) { return false; } } $locationTest = geoLocationContent($locationtype, $location, $reverse); if (!$locationTest) { return false; } return geoWeather($image, $measurement, $humidity, $wind); }