/** * Returns latest jaws version * * @access public * @return string Json encoded string */ function JawsVersion() { $jaws_version = ''; $httpRequest = new Jaws_HTTPRequest(); $httpRequest->default_error_level = JAWS_ERROR_NOTICE; $result = $httpRequest->get('http://jaws-project.com/version/0', $data); if (!Jaws_Error::IsError($result) && $result == 200) { if (preg_match('/^\\d+(\\.\\d+)+.*/i', $data)) { $jaws_version = $data; $this->gadget->registry->update('update_last_checking', serialize(array('version' => $jaws_version, 'time' => time()))); } } return $jaws_version; }
/** * Ping search engines to announce sitemap.xml updated * * @access public * @return bool True */ function PingSearchEngines() { $url = urlencode($this->gadget->urlMap('SitemapXML', array(), true)); $searchEngines = array('google' => 'http://www.google.com/webmasters/tools/ping?sitemap={url}', 'bing' => 'http://www.bing.com/ping?sitemap={url}'); $httpRequest = new Jaws_HTTPRequest(); $httpRequest->default_error_level = JAWS_ERROR_NOTICE; foreach ($searchEngines as $engine => $pingURL) { $pingURL = str_replace('{url}', $url, $pingURL); $result = $httpRequest->get($pingURL, $retData); if (!Jaws_Error::IsError($result) && $result != 200) { $GLOBALS['log']->Log(JAWS_ERROR_NOTICE, "Could not ping search engine '{$engine}': {$retData}"); } } return true; }
/** * Returns google map image * * @access public * @return void */ function GetGoogleMapImage() { $gMapParams = jaws()->request->fetch(array('latitude', 'longitude', 'zoom', 'size'), 'get'); $gMapURL = 'http://maps.google.com/maps/api/staticmap?center=' . $gMapParams['latitude'] . ',' . $gMapParams['longitude'] . '&zoom=' . $gMapParams['zoom'] . '&size=' . $gMapParams['size'] . '&maptype=roadmap&markers=color:blue|label:x|' . $gMapParams['latitude'] . ',' . $gMapParams['longitude'] . '&sensor=false'; header("Content-Type: image/png"); header("Pragma: public"); $httpRequest = new Jaws_HTTPRequest(); $result = $httpRequest->get($gMapURL, $data); if (Jaws_Error::IsError($result) || $result != 200) { $data = @file_get_contents('gadgets/Weather/Resources/images/gmap.png'); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); } else { $expires = 60 * 60 * 48; header("Cache-Control: max-age=" . $expires); header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT'); } echo $data; }