\n"; /* -------------------------------------------------------- Note: this trends-inc.php REPLACES the need for WD to upload trends-inc.txt -> trends-inc.html Make sure you have testtags.txt -> testtags.php at version 1.02 or higher. Make sure you have these in Settings.php: $SITE['uomDistance'] = ' miles'; // or ' km' -- used for Wind Run display $SITE['WDdateMDY'] = true; // for WD date format of month/day/year. =false for day/month/year $SITE['dateOnlyFormat'] = 'd-M-Y'; // for 31-Mar-2008 or 'j/n/Y' for Euro format otherwise the defaults below will be used. ------------------------------------------------------------ */ // --- default settings -----------(will be overriden by Settings.php)--------------- $uomTemp = '°F'; $uomBaro = ' inHg'; $uomWind = ' mph'; $uomRain = ' in'; $uomPerHour = '/hr'; $uomDistance = ' miles'; $timeFormat = 'd-M-Y g:ia'; // 31-Mar-2006 6:35pm //$timeFormat = 'd-M-Y H:i'; // 31-Mar-2006 18:35 $timeOnlyFormat = 'g:ia'; // h:mm[am|pm]; //$timeOnlyFormat = 'H:i'; // hh:mm $dateOnlyFormat = 'd-M-Y'; // d-Mon-YYYY $WDdateMDY = true; // true=dates by WD are 'month/day/year' // // false=dates by WD are 'day/month/year' $ourTZ = "PST8PDT"; //NOTE: this *MUST* be set correctly to // translate UTC times to your LOCAL time for the displays. // $haveUV = true; // set to false if no UV sensor $haveSolar = true; // set to false if no Solar sensor // --- end of settings for standalone use // allow viewing of generated source if ( isset($_REQUEST['sce']) && strtolower($_REQUEST['sce']) == 'view' ) { //--self downloader -- $filenameReal = __FILE__; $download_size = filesize($filenameReal); header('Pragma: public'); header('Cache-Control: private'); header('Cache-Control: no-cache, must-revalidate'); header("Content-type: text/plain"); header("Accept-Ranges: bytes"); header("Content-Length: $download_size"); header('Connection: close'); readfile($filenameReal); exit; } // overrides from Settings.php if available @include_once("Settings.php"); @include_once("common.php"); if (isset($SITE['WXtags'])) { @include_once($SITE['WXtags']); } global $SITE; if (isset($SITE['uomTemp'])) {$uomTemp = $SITE['uomTemp'];} if (isset($SITE['uomBaro'])) {$uomBaro = $SITE['uomBaro'];} if (isset($SITE['uomWind'])) {$uomWind = $SITE['uomWind'];} if (isset($SITE['uomRain'])) {$uomRain = $SITE['uomRain'];} if (isset($SITE['uomPerHour'])) {$uomPerHour = $SITE['uomPerHour'];} if (isset($SITE['uomDistance'])) {$uomDistance = $SITE['uomDistance'];} if (isset($SITE['timeFormat'])) {$timeFormat = $SITE['timeFormat'];} if (isset($SITE['timeOnlyFormat'])) {$timeOnlyFormat = $SITE['timeOnlyFormat'];} if (isset($SITE['dateOnlyFormat'])) {$dateOnlyFormat = $SITE['dateOnlyFormat'];} if (isset($SITE['WDdateMDY'])) {$WDdateMDY = $SITE['WDdateMDY'];} if (isset($SITE['tz'])) {$ourTZ = $SITE['tz'];} if (isset($SITE['UV'])) {$haveUV = $SITE['UV'];} if (isset($SITE['SOLAR'])) {$haveSolar = $SITE['SOLAR'];} // end of overrides from Settings.php // testing parameters $DebugMode = false; if (isset($_REQUEST['debug'])) {$DebugMode = strtolower($_REQUEST['debug']) == 'y'; } if (isset($_REQUEST['UV'])) {$haveUV = $_REQUEST['UV'] <> '0';} if (isset($_REQUEST['solar'])) {$haveSolar = $_REQUEST['solar'] <> '0';} ?> Grafici Valle Muricana
Condizione meteo alle : del della stazione di Valle Muricana

Temperatura attuale

°C

Indice di calore 8.2°C
Indice di calore massimo odierno 9.4°C alle 14.22
Max.velocità del vento 32.2 km/hr alle 17.00
Wind chill minimo odierno -2.2°C alle 5.09

23) {$t[0] = 12; } if (preg_match('/^12.*am/i',$WDtime)) { $t[0] = 0; } $t2 = join(':',$t); // put time back to gether; $t2 = preg_replace('/[^\d\:]/is','',$t2); // strip out the am/pm if any $r = date($timeOnlyFormat , strtotime($t2)); if ($DebugMode) { $r = "" . $r; $r = '' . $r . ''; } return ($r); } //========================================================================= // strip trailing units from a measurement // i.e. '30.01 in. Hg' becomes '30.01' function unUnit ($data) { global $DebugMode; preg_match('/([\d\.\,\+\-]+)/',$data,$t); $r = $t[1]; if ($DebugMode) { $r = "" . $r; $r = '' . $r . ''; } return ($r); } //========================================================================= // adjust WD date to desired format // function adjustWDdate ($WDdate) { global $timeFormat,$timeOnlyFormat,$dateOnlyFormat,$WDdateMDY,$DebugMode; $d = split('/',$WDdate); if ($d[2] > 70 and $d[2] <= 99) {$d[2] += 1900;} // 2 digit dates 70-99 are 1970-1999 if ($d[2] < 99) {$d[2] += 2000; } // 2 digit dates (left) are assumed 20xx dates. if ($WDdateMDY) { $new = sprintf('%04d-%02d-%02d',$d[2],$d[0],$d[1]); // M/D/YYYY -> YYYY-MM-DD } else { $new = sprintf('%04d-%02d-%02d',$d[2],$d[1],$d[0]); // D/M/YYYY -> YYYY-MM-DD } $r = date($dateOnlyFormat,strtotime($new)); if ($DebugMode) { $r = "" . $r; $r = '' . $r . ''; } return ($r); } //========================================================================= // formatDate from Y, M, D // function formatDateYMD ( $Y, $M, $D) { global $timeFormat,$timeOnlyFormat,$dateOnlyFormat,$WDdateMDY,$DebugMode; $t = mktime(0,0,0,$M,$D,$Y); $r = date($dateOnlyFormat,$t); if ($DebugMode) { $r = "" . $r; $r = '' . $r . ''; } return ($r); } //========================================================================= // format weather record like: // '56.1°F on: Mar 01 2008' // '22.5°C on: 01 Mar 2008' // to using the uom values and date format // function reformatRecord ( $record ) { global $uomTemp,$timeFormat,$timeOnlyFormat,$dateOnlyFormat,$WDdateMDY,$DebugMode; // old: preg_match('|(.*?)\°(.*)\s+on\:\s+(\S+) (\S+) (\S+)|is',$record,$vals); preg_match('|([\d\,\.\-]+)[\°]*(.*)\s+on\:\s+(\S+) (\S+) (\S+)|is',$record,$vals); /* [0] => 62.3°F on: Mar 03 2008 [1] => 62.3 [2] => F [3] => Mar [4] => 03 [5] => 2008 */ $t = ''; if ($DebugMode) { $t = "\n"; } $d = $vals[3] . ' ' . $vals[4] . ' ' . $vals[5]; $d = date($dateOnlyFormat,strtotime($d)); $r = $t . $vals[1] . ' ' . $uomTemp . ' ' . langtransstr('on') . ' ' . $d; if ($DebugMode) { $r = '' . $r . ''; } return ($r); } ?>