TRUE, "ee_enable_streetview" => TRUE, "ee_enable_widget" => FALSE, "fe_interval" => 60, // "gm_api_url" => "http://maps.google.com/maps?file=api&v=2.x", "gm_api_key" => "", "gm_enable_map" => TRUE, "gm_use_static_map" => TRUE, "gm_use_dynamic_map" => TRUE, "gm_map_width" => 200, "gm_map_height" => 200, "gm_map_zoom" => 10, "gm_enable_streetview" => TRUE, // "ig_api_url" => "http://www.google.com/ig/api", "ig_enable_weather" => TRUE, "ig_enable_weather_icon" => TRUE, "ig_weather_icon_url" => "http://www.google.com/ig", "ig_weather_icon_height" => 40, "ig_weather_icon_width" => 40, "widget_title" => "Eagle Eye" ); add_option("ee_options", $ee_options, '', 'yes'); } /* * Function to execute when plugin is removed */ register_deactivation_hook( __FILE__, 'eagle_eye_deactivate' ); function eagle_eye_deactivate() { delete_option("ee_options"); } /* * Add Eagle Eye to Plugin menu */ function eagle_eye_add_menu() { if (function_exists('add_options_page')) { add_submenu_page('plugins.php', 'Eagle Eye Options', 'Eagle Eye', 8, basename(__FILE__), 'eagle_eye_options_page'); } } add_action('admin_menu', 'eagle_eye_add_menu'); function eagle_eye_options_page() { include dirname(__FILE__) . "/fe_config.php"; $ee_options = get_option("ee_options"); if(@$_GET['f'] == 'callback') { /* * Return from request for Fire Eagle authorization */ if (@$_SESSION['auth_state'] != "start") { echo "Out of sequence."; } if ($_GET['oauth_token'] != $_SESSION['request_token']) { echo "Token mismatch."; } $fe = new FireEagle( $fe_key, $fe_secret, $_SESSION['request_token'], $_SESSION['request_secret']); try { $tok = $fe->getAccessToken(); } catch (FireEagleException $e) { echo $e->getMessage(); } if (isset($tok['oauth_token']) && is_string($tok['oauth_token']) && isset($tok['oauth_token_secret']) && is_string($tok['oauth_token_secret'])) { $ee_options['fe_access_token'] = $tok['oauth_token']; $ee_options['fe_access_secret'] = $tok['oauth_token_secret']; $ee_options['fe_auth_state'] = 'done'; $_SESSION['fe_access_token'] = $tok['oauth_token']; $_SESSION['fe_access_secret'] = $tok['oauth_token_secret']; $_SESSION['fe_auth_state'] = 'done'; $ee_options['ee_enable_widget'] = 1; $ee_options['fe_last_updated'] = time(); update_option('ee_options', $ee_options); } } if ($_POST['ee_send']) { /* * Save form variables */ $ee_options['fe_interval'] = $_POST['ee_fe_interval']; // $ee_options['gm_api_url'] = $_POST['ee_gm_api_url']; $ee_options['gm_api_key'] = $_POST['ee_gm_api_key']; $ee_options['gm_enable_map'] = $_POST['ee_gm_enable_map']; $ee_options['gm_enable_streetview'] = $_POST['ee_gm_enable_streetview']; $ee_options['gm_use_static_map'] = $_POST['ee_gm_use_static_map']; $ee_options['gm_use_dynamic_map'] = $_POST['ee_gm_use_dynamic_map']; $ee_options['gm_map_width'] = $_POST['ee_gm_map_width']; $ee_options['gm_map_height'] = $_POST['ee_gm_map_height']; $ee_options['gm_map_zoom'] = $_POST['ee_gm_map_zoom']; // $ee_options['ig_api_url'] = $_POST['ee_ig_api_url']; $ee_options['ig_enable_weather'] = $_POST['ee_ig_enable_weather']; $ee_options['ig_enable_weather_icon'] = $_POST['ee_ig_enable_weather_icon']; $ee_options['ig_weather_icon_url'] = $_POST['ee_ig_weather_icon_url']; $ee_options['ig_weather_icon_height'] = $_POST['ee_ig_weather_icon_height']; $ee_options['ig_weather_icon_width'] = $_POST['ee_ig_weather_icon_width']; $ee_options['widget_title'] = $_POST['ee_widget_title']; update_option('ee_options', $ee_options); print '

Settings saved.

'; } ?>

Eagle Eye Configuration


Done (Edit) Register Eagle Eye with Fire Eagle

How often (in minutes) to poll Fire Eagle for your current location.

To obtain a Google Maps API key, click here.
/> Display a map of your current location.
/> Use static map images from Google Maps
/> Use dynamic maps from Google Maps
/> Display a street-level view of your current location, when available.
/> Display information about the weather at your current location.
/> Display icon along with weather information when weather display is enabled.

error) { $ee->display(); } } class EagleEye { private $enableMap; private $enableSv; private $enableWeather; private $enableWeatherIcon; private $feAccessToken; private $feAccessSecret; private $feInterval; private $feKey; private $feLastUpdated; private $feLoc; private $feSecret; private $gmApiKey; private $mapHeight; private $mapWidth; private $wiHeight; private $wiWidth; private $wiUrl; public $error; function __construct( $feAccessToken, $feAccessSecret, $gmApiKey, $feInterval = 60, $enableMap = TRUE, $enableSv = TRUE, $enableWeather = TRUE, $enableWeatherIcon = TRUE, $mapHeight = 200, $mapWidth = 200, $useStaticMap = TRUE, $useDynamicMap = TRUE, $mapZoom = 10, $wiUrl = "http://www.google.com/ig", $wiHeight = 40, $wiWidth = 40) { include dirname(__FILE__) . "/fe_config.php"; $this->feKey = $fe_key; $this->feSecret = $fe_secret; if (empty($gmApiKey) || empty($feAccessToken) || empty($feAccessSecret)) { $this->error = true; } else { $this->feAccessToken = $feAccessToken; $this->feAccessSecret = $feAccessSecret; $this->gmApiKey = $gmApiKey; $this->feInterval = $feInterval; $this->enableMap = $enableMap; $this->enableSv = $enableSv; $this->enableWeather = $enableWeather; $this->enableWeatherIcon = $enableWeatherIcon; $this->mapHeight = $mapHeight; $this->mapWidth = $mapWidth; $this->useStaticMap = $useStaticMap; $this->useDynamicMap = $useDynamicMap; $this->mapZoom = $mapZoom; $this->wiUrl = $wiUrl; $this->wiHeight = $wiHeight; $this->wiWidth = $wiWidth; $this->feLastUpdated = $ee_options['fe_last_updated']; } } function display() { $current_timestamp = time(); $ref_time = $this->feLastUpdated + ($this->feInterval * 60); if ($current_timestamp > $ref_time) { $this->updateLocation(); } $ee_options = get_option('ee_options'); $this->printLocation(); if ($this->enableMap) { $this->printMapDiv(); } if ($this->enableSv) { $this->printSvDiv(); } if ($this->enableSv) { $this->printWeather(); } $this->printJavascript(); } function printJavascript() { $ee_options = get_option('ee_options'); ?>
useStaticMap) { $surl = 'http://maps.google.com/staticmap?markers='; $surl .= $ee_options['loc_latitude']; $surl .= ','; $surl .= $ee_options['loc_longitude']; $surl .= '&zoom=' . $this->mapZoom; $surl .= '&size=' . $this->mapWidth; $surl .= 'x' . $this->mapHeight; $surl .= '&key=' . $this->gmApiKey; print ''; } ?>
weather->current_conditions->temp_c['data']; $tempf = $xml->weather->current_conditions->temp_f['data']; $cond = $xml->weather->current_conditions->condition['data']; $icon = $xml->weather->current_conditions->icon['data']; ?>
Temperature: °F, °C
feKey, $this->feSecret, $this->feAccessToken, $this->feAccessSecret); $this->feLoc = $fe->user(); $ee_options['loc_longitude'] = $this->feLoc->user->best_guess->longitude; $ee_options['loc_latitude'] = $this->feLoc->user->best_guess->latitude; $ee_options['loc_name'] = htmlspecialchars($this->feLoc->user->best_guess->name); $ee_options['loc_location'] = htmlspecialchars($this->feLoc->user->location_hierarchy[2]->name); $ee_options['fe_last_updated'] = $this->feLastUpdated = time(); update_option('ee_options', $ee_options); } } /* * Eagle Eye Widget */ function widget_eagle_eye_init() { if (!function_exists('register_sidebar_widget')) { return; } function widget_eagle_eye($args) { extract($args); $ee_options = get_option('ee_options'); $title = $ee_options['widget_title']; ?>