Example #1
0
# First get the data from a weather class
#
if (!isset($yahooArray)) {
    ws_message('<!-- module yahooForecast2.php (' . __LINE__ . '): loading  yahoo.weather2.php -->');
    include_once 'yahoo.weather2.php';
    $weather = new yahooWeather();
    #	$yahooArray      = $weather->getWeatherData($SITE['yaPlaceID']);
} else {
    ws_message('<!-- ' . $pageName . ' - yahoo data already loaded --> ');
}
if (isset($_REQUEST['city'])) {
    $yaPlaceID = $_REQUEST['city'];
} else {
    $yaPlaceID = $SITE['yaPlaceID'];
}
$yahooArray = $weather->getWeatherData($yaPlaceID);
#---------------------------------------------------------------------------
# define array and fill first row with headings
#---------------------------------------------------------------------------
$forecast = array();
$forecast[0]['period'] = langtransstr('date');
$forecast[0]['condition'] = langtransstr('forecast');
$forecast[0]['iconUrl'] = langtransstr('icon');
$forecast[0]['tempLow'] = langtransstr('low');
$forecast[0]['tempHigh'] = langtransstr('high');
#---------------------------------------------------------------------------
# load icon translate if necessary
include_once 'wsIconUrl.php';
#---------------------------------------------------------------------------
#process each forecast		echo '<pre>'.PHP_EOL; print_r($yahooArray);
if ($SITE['fctOrg'] != 'yahoo') {
Example #2
0
if (!isset($yahooArray)) {
    ws_message('<!-- moduledash_yahoo.php (' . __LINE__ . '): loading yahoo.weather2.php -->');
    include_once $yahoo_folder . 'yahoo.weather2.php';
} else {
    ws_message('<!-- dash_yahoo.php (' . __LINE__ . '): yahoo data already loaded --> ');
}
$weather = new yahooWeather();
$testDash = false;
$result_arr = array();
#
#echo '<pre>'; print_r ($my_yahoos);  exit;
$count_yahoo = 0;
$start_yahoo = microtime(true);
foreach ($my_yahoos as $key => $arr) {
    $hahooID = $arr['hahooID'];
    $result = $weather->getWeatherData($hahooID);
    #echo '<pre>'; var_dump($result['ccn'][1]); exit;
    if (!$result) {
        unset($my_yahoos[$key]);
        continue;
    }
    # {echo '<br />false for : '.$key; continue;} else {echo '<br />true for : '.$key;}
    $count_yahoo++;
    $my_yahoos[$key]['found'] = true;
    $my_yahoos[$key]['temp'] = round($result['ccn'][1]['tempNU'], 0);
    $notUsed = '';
    $iconOut = '';
    $iconUrlOut = '';
    wsChangeIcon('yahoo', $result['ccn'][1]['icon'], $iconOut, $result['ccn'][1]['iconUrl'], $iconUrlOut, $notUsed);
    $my_yahoos[$key]['iconurl'] = $iconUrlOut;
    $my_yahoos[$key]['desc'] = langtransstr($result['ccn'][1]['text']);
Example #3
0
} else {
    $dayNight = 'nighttime';
}
#
ws_message("<!-- module wsDataGet.php (" . __LINE__ . "): time  is {$nowInt} => {$now}  | it is  {$dayNight} | sunrise at {$sunriseInt} => {$sunrise}  | sunset at  {$sunsetInt} => {$sunset} -->");
ws_message('<!-- module wsDataGet.php (' . __LINE__ . '): loading  wsIconUrl.php -->');
include_once 'wsIconUrl.php';
#---------------------- and now get the current conditions from some source --------------
ws_message('<!-- module wsDataGet.php (' . __LINE__ . '): $SITE["curCondFrom"] = ' . $SITE['curCondFrom'] . '  -->');
#
switch ($SITE['curCondFrom']) {
    case 'yahoo':
        ws_message('<!-- module wsDataGet.php (' . __LINE__ . '): loading  yahoo.weather2.php -->');
        include_once 'forecasts/yahoo.weather2.php';
        $weather = new yahooWeather();
        $yahooArray = $weather->getWeatherData($SITE['yaPlaceID']);
        $condDesc = cleanCurCond($yahooArray['ccn']['1']['text']);
        $ccnIconNr = $iconIn = $yahooArray['ccn']['1']['icon'];
        $ccnIconUrl = $urlIn = $yahooArray['ccn']['1']['iconUrl'];
        wsChangeIcon('yahoo', $iconIn, $ccnIconNr, $urlIn, $ccnIconUrl);
        $headerClass = wsHeaderLookup('yahoo', $iconIn);
        break;
    case 'wd':
        if (isset($ws['wdCurCond']) && isset($ws['wdCurIcon'])) {
            $condDesc = cleanCurCond($ws['wdCurCond']);
            $ccnIconNr = $ccnIconUrl = $urlIn = $notUsed = '';
            wsChangeIcon('wd', $ws['wdCurIcon'], $ccnIconNr, $urlIn, $ccnIconUrl);
            $headerClass = wsHeaderLookup('wd', $ws['wdCurIcon']);
            break;
        }
    default: