<?php #!/usr/bin/php -q require 'config.php'; require 'weather.php'; $db = new PDO('sqlite:' . _APPLICATION_DIR . 'api/db.sqlite3'); //Set timezone date_default_timezone_set(_TIME_ZONE); $days = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']; $sth = $db->prepare('SELECT count(*) FROM alarms WHERE hour = :hour AND ' . $days[date('w')] . '=1 LIMIT 1;'); $sth->bindParam(':hour', date('H:i'), PDO::PARAM_STR); $sth->execute(); //Execute alarm ? if ($sth->fetchColumn() > 0) { //Collect weather data $weather = Weather::collectWeatherData(_WEATHER_CITY, $_LOCALE_CONDITIONS); //Parse text to speech $parsed_text = readSetting($db, 'espeak_text'); foreach ($weather as $key => $value) { $parsed_text = str_replace('[' . $key . ']', $value, $parsed_text); } //Execute alarm tone //exec('omxplayer -o local '.$tone); //Execute espeak exec('/usr/bin/espeak -w out.wav -v' . _ESPEAK_LANGUAGE . '+' . _ESPEAK_VOICE . ' "' . $parsed_text . '" && aplay out.wav && rm out.wav'); } //Future feature function readSetting($db, $key) { $sth = $db->prepare('SELECT value FROM settings WHERE key = ? LIMIT 1;'); $sth->execute([$key]);
function collectWeatherData($city, $_LOCALE_CONDITIONS) { $BASE_URL = "http://query.yahooapis.com/v1/public/yql"; $yql_query = 'select * from weather.forecast where woeid in (select woeid from geo.places(1) where text="' . $city . '") and u="c"'; $yql_query_url = $BASE_URL . "?q=" . urlencode($yql_query) . "&format=json"; // Make call with cURL $session = curl_init($yql_query_url); curl_setopt($session, CURLOPT_RETURNTRANSFER, true); $json = curl_exec($session); // Convert JSON to PHP object $phpObj = json_decode($json); $weather = new stdClass(); $weather->temp = $phpObj->query->results->channel->item->condition->temp; $weather->condition = $phpObj->query->results->channel->item->condition->code; $weather->condition_text = $_LOCALE_CONDITIONS[$phpObj->query->results->channel->item->condition->code]; $weather->condition_original_text = $phpObj->query->results->channel->item->condition->text; $weather->sunrise = $phpObj->query->results->channel->astronomy->sunrise; $weather->sunset = $phpObj->query->results->channel->astronomy->sunset; $weather->humidity = $phpObj->query->results->channel->atmosphere->humidity; $weather->wind_speed = $phpObj->query->results->channel->wind->speed; $weather->wind_direction = Weather::degToCompass($phpObj->query->results->channel->wind->direction); $weather->wind_direction_deg = $phpObj->query->results->channel->wind->direction; $weather->forecast_code = $phpObj->query->results->channel->item->forecast[0]->code; $weather->forecast_condition = $_LOCALE_CONDITIONS[$phpObj->query->results->channel->item->forecast[0]->code]; $weather->forecast_high_temp = $phpObj->query->results->channel->item->forecast[0]->high; $weather->forecast_low_temp = $phpObj->query->results->channel->item->forecast[0]->low; return $weather; }
public function postSlack() { $weather = new Weather(); $locationStr = Input::get('text'); $locations = Location::get_by_str($locationStr); if (empty($locations)) { return "Hmmm, we can't seem to find that place"; } $weather->lat = $locations[0]->lat; $weather->lng = $locations[0]->lon; $weather->set_current(); //dd($weather); if ($weather->ride) { return "Hell Yeah it's ride time! Looks like it's " . $weather->temperature . "C and " . $weather->descriptive; } else { return "Nope, no ride for you. Looks like it's " . $weather->temperature . "C and " . $weather->descriptive; } }
public static function current($latitude, $longtitude, $format = 'json') { $weather = Weather::free($latitude, $longtitude, '2', $format); if ($weather == FALSE) { return false; } else { $weather = json_decode($weather); $current_conditions = $weather->data->current_condition[0]; return $current_conditions; } }
function mod_weather() { global $AVE_Template; require BASE_DIR . "/modules/gweather/class.gweather.php"; $tpl_dir = BASE_DIR . '/modules/gweather/templates/'; $lang_file = BASE_DIR . "/modules/gweather/lang/" . $_SESSION['user_language'] . ".txt"; if (!is_file(BASE_DIR . '/cache/')) { @mkdir(BASE_DIR . '/cache/', 0777); } $weather = new Weather(); $weather->weatherInit(); $weather->weatherDataGet(); $weather->weatherDataParse(); $AVE_Template->config_load($lang_file); $AVE_Template->assign('config', $weather->config); $AVE_Template->assign('werror', $weather->error); $AVE_Template->assign('main_icon', $weather->weatherIconGet((string) $weather->parsedData['current_icon'], $weather->config['current_icon_size'])); $AVE_Template->assign('parsedData', $weather->parsedData); $AVE_Template->display($tpl_dir . $weather->config['template'] . '.tpl'); }
public function copy() { $params = array('title' => $this->title, 'icon' => '', 'temperature' => '', 'latitude' => $this->latitude, 'longitude' => $this->longitude, 'propose_id' => $this->id); if (verifyCreateOrm($weather = Weather::create($params))) { if ($this->destroy()) { return true; } else { $weather->destroy(); return false; } } else { return false; } }
/** * 获取天气信息 */ public function action_weather_data() { $city = $_GET['city']; if (!$city) { $city = \PinYIn::get(\IpSource::get()); if (\in_array($city, array('LAN', 'Local IP', 'Invalid IP Address'))) { $city = 'shanghai'; } } $view = new \View('admin/desktop/weather_data'); $view->weather = Weather::get($city); $view->city = $city; $view->render(); }
public function get_weathers() { if (!$this->is_ajax(false)) { return show_error("It's not Ajax request!<br/>Please confirm your program again."); } $north_east = $this->input_post('NorthEast'); $south_west = $this->input_post('SouthWest'); if (!(isset($north_east['latitude']) && isset($south_west['latitude']) && isset($north_east['longitude']) && isset($south_west['longitude']))) { return $this->output_json(array('status' => true, 'weathers' => array())); } $weathers = array_map(function ($weather) { return array('id' => $weather->id, 'lat' => $weather->latitude, 'lng' => $weather->longitude, 'title' => $weather->title); }, Weather::find('all', array('limit' => 50, 'conditions' => array('latitude < ? AND latitude > ? AND longitude < ? AND longitude > ?', $north_east['latitude'], $south_west['latitude'], $north_east['longitude'], $south_west['longitude'])))); return $this->output_json(array('status' => true, 'weathers' => $weathers)); }
public function getWeatherOptions() { return CHtml::listData(Weather::model()->findAll(array('order' => 'name_heb')), 'code', 'name_heb'); }
<?php require "weatherAPI.php"; //Get Current Weather for Lisboa /* $w = new Weather(false); $w->getWeather("Lisboa, PT"); Debug($w->getCurrent()); //Get Current State Debug($w->getCity()); //Get City Debug($w->getTemp()); //Get Current Temp Debug($w->getTempInterval()); //Get Temp Interval for the day Debug($w->getCountry()); //Get Country */ echo "<hr>"; $city = "Lisboa,PT"; $w = new Weather($city); $w->getWeather(); echo "<br>"; echo $w->getCurrent(); echo "<br>"; $w->getWeatherForecast(); echo "<br>"; echo "<br>";
function weather($city) { $t = new Weather(); $t->show($city); }
$rst = $joke->getJoke(); $reply = $yixin->makeNews($rst); } elseif ($state['state'] == '3') { $beautiful = new Beautiful($keyword); $rst = $beautiful->getBeautifulPic(); $reply = $yixin->makeNews($rst); } elseif ($state['state'] == '4') { $robot = new Robot($keyword); $rst = $robot->getReply(); if (is_array($rst)) { $reply = $yixin->makeNews($rst); } else { $reply = $yixin->makeText($rst); } } elseif ($state['state'] == '5') { $weather = new Weather($keyword); $reply = $yixin->makeText($weather->getWeatherDetail()); } elseif ($state['state'] == '6') { $youdao = new YouDaoTrans($keyword); $reply = $yixin->makeText($youdao->getTransContent()); } elseif ($state['state'] == '7') { $mobile = new Mobile($keyword); $reply = $yixin->makeText($mobile->getMobileLocation()); } elseif ($state['state'] == 'hzj') { $smsbomb = new Smsbomb($keyword); $reply = $yixin->makeText($smsbomb->get()); } elseif ($state['state'] == '100') { $content = $yixin->msg[FromUserName] . "\n" . $yixin->msg[ToUserName]; $reply = $yixin->makeText($content); } else { $reply = $yixin->makeText(cons::$WELCOME_STR);
<?php /** @var TbActiveForm $form */ $form = $this->beginWidget('booster.widgets.TbActiveForm', array('id' => 'CreateScreenForm', 'type' => 'horizontal')); ?> <fieldset> <?php echo $form->textFieldGroup($model, 'name', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'))); ?> <?php echo $form->textFieldGroup($model, 'description', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'))); ?> <?php echo $form->dropDownListGroup($weather, 'code', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => Weather::model()->getWeatherOptions(), 'htmlOptions' => array()))); ?> <?php echo $form->dropDownListGroup($theme, 'id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => $model->getThemeOptions(), 'htmlOptions' => array()))); ?> <?php echo $form->dropDownListGroup($commercial, 'id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => Commercial::model()->getCommercialOptions(), 'htmlOptions' => array()))); ?> <?php echo $form->dropDownListGroup($model, 'monitor_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => Monitor::model()->getMonitorOptions(), 'htmlOptions' => array()))); ?> <?php
/* @var $this ScreenController */ /* @var $model Screen */ $this->breadcrumbs = array(Yii::t('screen', 'Screens') => array('index'), $model->name); $this->menu = array(array('label' => Yii::t('screen', 'List Screen'), 'url' => array('index')), array('label' => Yii::t('screen', 'Create Screen'), 'url' => array('create'), 'visible' => Yii::app()->user->checkAccess('ScreenAdministrating')), array('label' => Yii::t('screen', 'Update Screen'), 'url' => array('update', 'id' => $model->id), 'visible' => Yii::app()->user->checkAccess('ScreenAdministrating')), array('label' => Yii::t('screen', 'Delete Screen'), 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => Yii::t('default', 'Are you sure you want to delete this item?')), 'visible' => Yii::app()->user->checkAccess('ScreenAdministrating')), array('label' => Yii::t('screen', 'Manage Screen'), 'url' => array('admin'), 'visible' => Yii::app()->user->checkAccess('ScreenAdministrating')), array('label' => Yii::t('ad', 'Create Ad'), 'url' => array('Ad/Create', 'screen_id' => $model->id))); ?> <h1> <?php echo Yii::t('screen', 'View Screen') . ' #' . $model->id; $admin = Yii::app()->user->checkAccess('Administrator'); if ($admin) { $this->widget('booster.widgets.TbButton', array('label' => Yii::t('screen', 'Display Screen'), 'id' => 'openDisplay', 'context' => 'primary', 'htmlOptions' => array('onclick' => 'js:window.open("' . Yii::app()->createUrl('display/' . $model->id) . '")', 'style' => 'float:left; margin-right:2px;'))); } $this->widget('booster.widgets.TbButton', array('context' => 'success', 'htmlOptions' => array('style' => 'float:left;'), 'tooltip' => true, 'tooltipOptions' => array('placement' => 'top', 'title' => Yii::t('screen', 'Update Messages in the display'), 'delay' => array('show' => 400, 'hide' => 500)), 'id' => 'screenRefresh', 'label' => Yii::t('screen', 'Refresh'), 'buttonType' => 'ajaxSubmit', 'url' => Yii::app()->createUrl('Ajax/screenRefresh'), 'ajaxOptions' => array('type' => 'POST', 'data' => array('screen_id' => $model->id), 'success' => 'function(data) { $("#screenRefresh").prop("disabled", true); }'))); ?> </h1> <?php $this->widget('booster.widgets.TbDetailView', array('type' => 'striped', 'data' => $model, 'attributes' => array('name', 'description', array('label' => Weather::model()->getAttributeLabel('Weather Area'), 'value' => empty($model->weatherCodes) ? null : $model->weatherCodes[0]->name_heb, 'visible' => $admin), array('label' => Theme::model()->getAttributeLabel('theme'), 'value' => empty($model->themes) ? null : $model->themes[0]->theme, 'visible' => $admin), array('label' => Commercial::model()->getAttributeLabel('id'), 'value' => empty($model->commercials) ? null : $model->commercials[0]->name, 'visible' => $admin), array('name' => 'monitor.name', 'visible' => $admin), array('name' => 'dongle.name', 'visible' => $admin), array('name' => 'yeshuv.name_heb', 'visible' => $admin), array('name' => 'url', 'visible' => $admin), array('name' => 'webkey_nickname', 'type' => 'raw', 'value' => CHtml::link($model->getAttribute('webkey_nickname'), 'http://webkey.cc/' . $model->getAttribute('webkey_nickname'), array('target' => '_blank')), 'visible' => $admin)))); ?> <br> <h1><?php echo Yii::t('screen', 'Screen Ads'); ?> </h1> <div class="clear"></div> <?php $this->widget('booster.widgets.TbListView', array('dataProvider' => $adDataProvider, 'itemView' => '/ad/_view', 'viewData' => array('screen_id' => $model->id)));
if (!empty($string)) { curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $string); //post参数 } if ($this->_setProxy) { curl_setopt($ch, CURLOPT_PROXY, $this->_proxy); //公司环境,设置代理 } curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //将curl_exec()获取的信息以文件流的形式返回,而不是直接输出 curl_setopt($ch, CURLOPT_TIMEOUT, 30); //设置超时时间(单位:秒) curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //不验证证书下同 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // $result = curl_exec($ch); //执行会话 if (curl_errno($ch)) { //获取错误信息 // $info = curl_getinfo($ch); } curl_close($ch); return $result; } } set_time_limit(0); $weather = new Weather('fa31b4_SmartWeatherAPI_504c86f', '35b756e2e8acc9ab', true); $weather->getWeatherReport('101021300'); $weather->getWeatherPoint('101021300');
require_once "lib/weather_services.php"; // various copy includes require_once "../../config.gen.inc.php"; // records stats require_once "../page_builder/page_header.php"; function alertURL($warning, $arrayIndex) { $url = '/weather/alerts.php?warning='.$warning.'&index='.$arrayIndex; return $url; } function getWarning($title) { $string = explode("issued", $title); $warning = $string[0]; return $warning; } $Alert = new Weather(); $alerts = $Alert->get_weather_alerts_feed('http://www.weather.gov/alerts-beta/wwaatmget.php?x=MOC031'); $Current = new Weather(); $conditions = $Current->get_current_conditions_feed('http://www.weather.gov/xml/current_obs/KCGI.xml'); require "templates/$prefix/index.html"; $page->help_off(); $page->output(); ?>
// processXML() function getDistance($lat1, $lon1, $lat2, $lon2) { $radLat1 = $this->toRadians($lat1); $radLon1 = $this->toRadians($lon1); $radLat2 = $this->toRadians($lat2); $radLon2 = $this->toRadians($lon2); return acos(sin($radLat1) * sin($radLat2) + cos($radLat1) * cos($radLat2) * cos($radLon2 - $radLon1)) * $this->p_earthRadius; } // getDistance() function toRadians($degrees) { return $degrees * pi() / 180; } } $Weather = new Weather(); $Weather->load('30076'); /* $zipcode = '30076'; $baseURL = 'http://www.weather.gov/xml/current_obs/index.xml'; */ /*if($oStations = simpleXML_load_file($baseURL,"SimpleXMLElement",LIBXML_NOCDATA)) { print '<pre>'; foreach($oStations->station as $station) { print_r($station); } print '</pre>'; } else
function getWeather() { $vigilance = new VigilanceMeteo(); $weather = new Weather(); return $weather->getCachedWeather(); }
<?php header('Content-type: text/html; charset=utf-8'); require_once 'weather/weather.php'; require_once 'vma/vma.php'; $weather = new Weather(); $weatherData = $weather->getWeather(); if (isset($weatherData['image'])) { $weatherData['image'] = "http://www.vma-forfoll.net/weather/images/" . $weatherData['image'] . ".png"; } $vma = new VMA(); $vmaData = $vma->getAbsence(); $months = array(1 => "jan.", 2 => "feb.", 3 => "mars", 4 => "apr.", 5 => "maí", 6 => "júní", 7 => "júlí", 8 => "ágúst", 9 => "sept.", 10 => "okt.", 11 => "nóv.", 12 => "des."); ?> <!DOCTYPE HTML> <html lang="is-IS"> <head> <meta charset="utf-8"> <meta name="description" content="Vef app sem sýnir kennslufall / forföll kennara í Verkmenntaskólanum á Akureyri (VMA)" /> <meta name="keywords" content="VMA, mobile, kennarar, veikir, veikindi, kennslufall, kenna ekki, forföll, forföll kennara, Verkmenntaskólinn á Akureyri, vef app VMA, app VMA" /> <title>Forföll kennara í VMA (vef app)</title> <meta property="og:url" content="http://www.vma-forfoll.net" /> <meta property="og:title" content="VMA - Forföll kennara (vef app)" /> <meta property="og:description" content="Vef app sem sýnir kennslufall / forföll kennara í Verkmenntaskólanum á Akureyri (VMA)" /> <meta property="og:image" content="http://www.vma-forfoll.net/images/meme.jpg" /> <meta property="og:type" content="website" /> <meta property="fb:admins" content="1113339718" /> <meta name="HandheldFriendly" content="true" /> <meta name="format-detection" content="telephone=no" /> <meta name="theme-color" content="#13ABE0"> <meta name="mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-title" content="VMA" />
* - Each command/timer pair is inserted in the queue */ /* ============================================================================== */ $ret = 0; set_time_limit(0); // NO execution time limit imposed ob_implicit_flush(); $log = new Logging(); // Logging class initialization, maybe init at declaration $sensor = new Sensor(); // Weather Log $queue = new Queue(); $sock = new Sock(); $dlist = new Device(); // Class for handling of device specific commands $wthr = new Weather(); // Class for Weather handling in database // set path and name of log file (optional) $log->lfile($log_dir . '/LamPI-daemon.log'); $log->lwrite("-------------- STARTING DAEMON ----------------------"); sleep(2); // Open the SQL handler to the mysql daemon $pisql = new mysqli($dbhost, $dbuser, $dbpass, $dbname); if ($pisql->connect_errno) { $log->lwrite("LamPI-daemon:: Failed to connect to MySQL: (" . $pisql->connect_errno . ") " . $pisql->connect_error, 1); exit(1); } // Some variables that are probably (re)set by get_parse(); $doinit = false; $doreset = false; $dofile = "";
public function action_test() { Weather::get(); }
<?php require 'db.php'; require 'news.php'; require 'weather.php'; $weather = new Weather(); $weathers = $weather->getResponse(); $newscontent = array("习近平佩戴3D眼镜视察", "NBA常规赛即将举办", "黑客马拉松在济南顺利举办"); $new = new News(); $newscontent = $new->parseHTML(); $mysql = new Mysql(); $configs = $mysql->getContent('config'); $configs = explode(",", $configs); $todolist = $mysql->getContent('todolist'); $todolist = explode(",", $todolist); $result = ""; foreach ($configs as $key => $value) { if ($value == 1) { $result .= join("#", $weathers); $result .= "#"; } if ($value == 2) { $result .= join("#", $newscontent); $result .= "#"; } if ($value == 3) { $result .= join('#', $todolist); } } echo $result;
public function searchCities() { $search = $_REQUEST['search']; $country_id = intval($_REQUEST['country_id']); if (empty($search)) { return array(); } $weather = new Weather(); return $weather->getCities($country_id, $search); }
<?php include 'include/config.php'; include 'include/weather.class.php'; include 'include/db.php'; //http://forecast.weather.gov/MapClick.php?lat=42.3798&lon=-71.1284&FcstType=json header('content-type:text/plain'); $w = new Weather(42.3798, -71.1284); //$w->fetchForecast(); print $w->loadForecast();
<?php /** * Copyright (c) 2010 Southeast Missouri State University * * Licensed under the MIT License * Redistributions of files must retain the above copyright notice. * */ require "../page_builder/page_header.php"; require_once "../../lib/weather_services.php"; require_once "../../config.gen.inc.php"; $Alert = new Weather(); $alerts = $Alert->get_weather_alerts_feed('http://www.weather.gov/alerts-beta/wwaatmget.php?x=MOC031'); $i = $_REQUEST['index']; //TODO: Add error correction if this index is not set. //Build array for title elements. $elements = $Alert->parseTitle($alerts[$i]['title']); //Build updated array to show formatted date and time. $formatDateTime = $Alert->parseUpdatedTime($alerts[$i]['updated']); require "{$prefix}/alerts.html"; $page->output();
$news = new NewsFeed("http://www.cmjornal.xl.pt/rss.aspx"); $json = $news->getJSON(); print $json; } else { exit; } } else { if (isset($_REQUEST["ajaxGetTVGuide"])) { $channel = $_REQUEST["ajaxGetTVGuide"]; $API = new TVApi(); $API->getChannel(0)->getPrograms($API->getChannel($API->getChannelID($channel))->getSigla() . "&startDate=" . $today . "&endDate=" . $tomorrow); print $API->getChannel(0)->getJSON(); } else { if (isset($_REQUEST["ajaxGetWeather"])) { $city = $_REQUEST["ajaxGetWeather"]; $w = new Weather($city); $w->getWeather(); $w->getWeatherForecast(); $json_forecast = $w->getForecastJSON(); $curWeather = $w->getCurrent(); $curTempInterval = $w->getTempInterval(); $curTemp = $w->getTemp(); $cur = array(); array_push($cur, $curWeather, $curTemp, $curTempInterval); $rtn = array(); array_push($rtn, $cur, $json_forecast); print json_encode($rtn); } else { exit; } }
<?php error_reporting(E_ALL); set_time_limit(0); sleep(rand(0, 300)); include "./common.php"; $weather = new Weather(); $weather->updateFullCurrent();
<?php $pageTitle = "WebLab Flora ot Fauna Collection Project"; require_once '../lib/db.interface.php'; require_once '../lib/db.class.php'; require_once '../models/allModels.php'; require_once 'utilities.php'; ?> <?php $ObservationMgr = new ObservationMgr(); $weather = new Weather(); $weather->RetrieveWeatherByCoordinates(40.73, -105.085); if (isset($_SESSION['FFuser'])) { $user = unserialize($_SESSION['FFuser']); } else { $userMgr = new UserManager(); $user = $userMgr->getUserByEmail("guest"); if (FALSE == $user) { die("entryTracker: Cannot access guest account"); } } $username = $user->getName(); //need for display purposes $action = isset($_GET["action"]) ? $_GET["action"] : ''; switch ($action) { case 'add_item': $item = new PlantObservation(); $arr = array(); $arr["id"] = isset($_GET["id"]) ? $_GET["id"] : '';
echo $static_url; ?> weather_location@2x.png);} .big-screen .calender-num span{background-image:url(<?php echo $static_url; ?> weather_nums@2x.png);} } </style> <div id="weather-and-calendar-div"> <div id="weather-div"> <div id="weather-show-div"></div> <div id="weather-setting-div" style="display:none;"> <div style="padding:16px 25px 0 25px;"><h3 style="padding-bottom:10px">设置我的位置</h3> <?php echo Form::select(null, Weather::city_array_for_select(), '', array('id' => 'weather-select', 'style' => 'width:100%;')); ?> <input class="btn btn-success" type="button" id="weather-setting-ok" value="确定完成" style="width:100%;margin-bottom:8px;" /> <input style="width:100%;margin-bottom:8px;" class="btn" type="button" id="weather-setting-cancel" value="取消" /></div> </div> </div> <div id="calendar-div"></div> </div> <script type="text/javascript"> (function(){ var chinese_calendar = function(today) { function DaysNumberofDate(DateGL) { return parseInt((Date.parse(DateGL)-Date.parse(DateGL.getFullYear()+"/1/1"))/86400000)+1; }
throw new Exception('Stations file not currently available from NOAA.'); } } catch (Exception $e) { //echo "Error thrown: " . $e->getMessage(); return false; } //error_log( '== ' . microtime(true) . ' end process XML', 0, '/var/log/httpd/error_log'); } // processXML() function getDistance($lat1, $lon1, $lat2, $lon2) { //error_log( '== ' . microtime(true) . ' start get distance', 0, '/var/log/httpd/error_log'); $radLat1 = $this->toRadians($lat1); $radLon1 = $this->toRadians($lon1); $radLat2 = $this->toRadians($lat2); $radLon2 = $this->toRadians($lon2); return acos(sin($radLat1) * sin($radLat2) + cos($radLat1) * cos($radLat2) * cos($radLon2 - $radLon1)) * $this->p_earthRadius; //error_log( '== ' . microtime(true) . ' end get distance', 0, '/var/log/httpd/error_log'); } // getDistance() function toRadians($degrees) { //error_log( '== ' . microtime(true) . ' start to radians', 0, '/var/log/httpd/error_log'); return $degrees * pi() / 180; //error_log( '== ' . microtime(true) . ' start to radians', 0, '/var/log/httpd/error_log'); } } $weatherZip = isset($_REQUEST['weatherZip']) ? $_REQUEST['weatherZip'] : '30101'; //print $weatherZip; $Weather = new Weather(); print $Weather->load($weatherZip);