This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
forecast3ds.php
145 lines (127 loc) · 11.3 KB
/
forecast3ds.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?php
// 31-Jan-2019 DarkSky multilanguage support added - ktrue
include_once('settings.php');
include_once('common.php');
include_once('livedata.php');
error_reporting(0); date_default_timezone_set($TZ);
header('Content-type: text/html; charset=UTF-8');
####################################################################################################
# HOME WEATHER STATION TEMPLATE by BRIAN UNDERDOWN 2016-17 #
# CREATED FOR HOMEWEATHERSTATION TEMPLATE at https://weather34.com/homeweatherstation/ #
# #
# #
# 3 DAY WEATHER FORECAST: December 2017 #
# #
# https://www.weather34.com #
####################################################################################################
?>
<div class="updatedtimecurrent">
<?php
$forecastime=filemtime('jsondata/darksky-'.$language.'.txt');
$weather34wuurl = file_get_contents('jsondata/darksky-'.$language.'.txt');
if(filesize('jsondata/darksky-'.$language.'.txt')<1){echo "".$offline. " Offline<br>";}else echo $online,"";echo " ", date($timeFormat,$forecastime); ?></div>
<?php
$rainsvg= '<svg id="weather34 raindrop" x="0px" y="0px" viewBox="0 0 512 512" width="8px" fill="#01a4b5" stroke="#01a4b5" stroke-width="3%"><g><g><path d="M348.242,124.971C306.633,58.176,264.434,4.423,264.013,3.889C262.08,1.433,259.125,0,256,0 c-3.126,0-6.079,1.433-8.013,3.889c-0.422,0.535-42.621,54.287-84.229,121.083c-56.485,90.679-85.127,161.219-85.127,209.66
C78.632,432.433,158.199,512,256,512c97.802,0,177.368-79.567,177.368-177.369C433.368,286.19,404.728,215.65,348.242,124.971z
M256,491.602c-86.554,0-156.97-70.416-156.97-156.97c0-93.472,123.907-263.861,156.971-307.658
C289.065,70.762,412.97,241.122,412.97,334.632C412.97,421.185,342.554,491.602,256,491.602z"/></g></g><g>
<g><path d="M275.451,86.98c-1.961-2.815-3.884-5.555-5.758-8.21c-3.249-4.601-9.612-5.698-14.215-2.45
c-4.601,3.249-5.698,9.613-2.45,14.215c1.852,2.623,3.75,5.328,5.688,8.108c1.982,2.846,5.154,4.369,8.377,4.369
c2.012,0,4.046-0.595,5.822-1.833C277.536,97.959,278.672,91.602,275.451,86.98z"/></g></g><g> <g>
<path d="M362.724,231.075c-16.546-33.415-38.187-70.496-64.319-110.213c-3.095-4.704-9.42-6.01-14.126-2.914
c-4.706,3.096-6.01,9.421-2.914,14.127c25.677,39.025,46.9,75.379,63.081,108.052c1.779,3.592,5.391,5.675,9.148,5.675
c1.521,0,3.064-0.342,4.517-1.062C363.159,242.241,365.224,236.123,362.724,231.075z"/>
</g></svg>';
$snowflakesvg= '<svg id="weather34 snowflake" x="0px" y="0px" viewBox="0 0 34.875 34.876" width="8px" fill="#01a4b5" stroke="#01a4b5" stroke-width="3%"><g><path d="M32.916,24.087c-0.181-0.635-0.598-1.161-1.173-1.481c-1.062-0.592-2.462-0.25-3.179,0.697l-5.193-2.998l4.025-1.078
c0.268-0.072,0.425-0.348,0.354-0.613s-0.346-0.426-0.611-0.354l-4.992,1.336l-3.707-2.14l3.71-2.142l4.989,1.336
c0.043,0.012,0.087,0.017,0.13,0.017c0.221,0,0.423-0.147,0.481-0.371c0.07-0.267-0.087-0.541-0.354-0.612l-4.022-1.078
l5.197-3.001c0.463,0.624,1.183,1.015,1.972,1.015l0,0c0.417,0,0.833-0.108,1.2-0.312c1.119-0.625,1.553-1.996,1.046-3.148
c-0.031-0.071-0.054-0.143-0.092-0.212c-0.128-0.229-0.301-0.423-0.492-0.594c-0.766-0.68-1.942-0.874-2.867-0.36
c-0.979,0.546-1.43,1.663-1.193,2.704l-5.271,3.044l1.079-4.026c0.07-0.267-0.088-0.541-0.354-0.612
c-0.267-0.07-0.54,0.087-0.612,0.354l-1.338,4.992l-3.709,2.14v-4.282l3.652-3.652c0.195-0.195,0.195-0.512,0-0.707
c-0.194-0.195-0.512-0.195-0.707,0l-2.945,2.946V4.876c1.124-0.231,1.972-1.228,1.972-2.419c0-1.192-0.851-2.19-1.977-2.42
c0,0.008,0.005,0.015,0.005,0.023v0.012C17.778,0.03,17.612,0,17.439,0c-0.174,0-0.34,0.03-0.501,0.072V0.059
c0-0.008,0.004-0.015,0.005-0.023c-1.125,0.23-1.974,1.228-1.974,2.419c0,1.19,0.846,2.186,1.969,2.418v6.02l-2.946-2.945
c-0.195-0.195-0.512-0.195-0.707,0c-0.195,0.195-0.195,0.512,0,0.707l3.653,3.652v4.282l-3.708-2.141l-1.338-4.992
c-0.072-0.267-0.345-0.424-0.612-0.354c-0.267,0.071-0.425,0.346-0.354,0.612l1.079,4.026l-5.271-3.044
C6.97,9.654,6.519,8.538,5.54,7.991c-0.92-0.512-2.1-0.319-2.865,0.361C2.483,8.523,2.31,8.717,2.181,8.947
C2.143,9.015,2.12,9.088,2.089,9.158c-0.506,1.151-0.073,2.522,1.047,3.148c0.367,0.204,0.782,0.312,1.2,0.312
c0.789,0,1.51-0.392,1.972-1.015l5.197,3.001l-4.022,1.078c-0.268,0.071-0.425,0.346-0.354,0.612
c0.061,0.224,0.263,0.371,0.482,0.371c0.043,0,0.086-0.005,0.13-0.017l4.989-1.336l3.708,2.142l-3.707,2.14l-4.992-1.336
c-0.265-0.072-0.541,0.088-0.612,0.354c-0.07,0.269,0.087,0.541,0.354,0.613l4.025,1.078l-5.193,2.998
c-0.717-0.947-2.119-1.287-3.179-0.697c-0.575,0.32-0.992,0.849-1.173,1.481c-0.158,0.56-0.105,1.14,0.126,1.666
c0.031,0.069,0.055,0.144,0.093,0.211c0.128,0.229,0.298,0.425,0.485,0.599c0.451,0.418,1.041,0.67,1.673,0.67
c0.418,0,0.833-0.107,1.2-0.312c0.576-0.319,0.993-0.849,1.173-1.481c0.115-0.406,0.113-0.824,0.021-1.224l5.271-3.043
l-1.077,4.021c-0.07,0.269,0.088,0.541,0.354,0.613c0.043,0.012,0.087,0.018,0.13,0.018c0.221,0,0.423-0.147,0.482-0.371
l1.335-4.988l3.709-2.143v4.281l-3.653,3.652c-0.195,0.195-0.195,0.512,0,0.707c0.195,0.195,0.512,0.195,0.707,0l2.946-2.945v6.021
c-1.124,0.23-1.972,1.229-1.972,2.419s0.851,2.188,1.977,2.42c0-0.008,0.995-0.022,0.995-0.022c0,0.008,1.969-0.662,1.969-2.396
c0-1.189-0.846-2.188-1.969-2.418v-6.021l2.945,2.945c0.099,0.1,0.227,0.146,0.354,0.146s0.257-0.049,0.354-0.146
c0.195-0.193,0.195-0.512,0-0.707l-3.651-3.652v-4.281l3.709,2.142l1.335,4.988c0.061,0.223,0.263,0.37,0.481,0.37
c0.043,0,0.086-0.004,0.131-0.016c0.267-0.072,0.425-0.348,0.354-0.613l-1.076-4.021l5.271,3.043
c-0.093,0.4-0.095,0.816,0.021,1.223c0.18,0.635,0.598,1.162,1.173,1.482c0.367,0.204,0.782,0.312,1.2,0.312
c0.632,0,1.223-0.252,1.673-0.67c0.188-0.174,0.356-0.369,0.484-0.6c0.038-0.066,0.062-0.141,0.093-0.211
C33.021,25.229,33.073,24.646,32.916,24.087z M29.823,8.87c0.22-0.122,0.466-0.186,0.714-0.186c0.269,0,0.523,0.073,0.747,0.203
c0.222,0.131,0.409,0.319,0.538,0.551c0.042,0.076,0.074,0.155,0.102,0.234c0.229,0.661-0.038,1.413-0.669,1.765
c-0.219,0.122-0.465,0.186-0.713,0.186l0,0c-0.433,0-0.83-0.196-1.105-0.514c-0.064-0.075-0.13-0.151-0.181-0.24
c-0.125-0.224-0.178-0.467-0.179-0.708C29.076,9.644,29.339,9.139,29.823,8.87z M5.621,10.869
c-0.049,0.088-0.107,0.169-0.175,0.243c-0.443,0.497-1.225,0.659-1.824,0.326c-0.632-0.353-0.898-1.104-0.67-1.766
c0.027-0.079,0.06-0.158,0.102-0.234c0.13-0.232,0.316-0.42,0.539-0.551c0.224-0.13,0.479-0.203,0.747-0.203
c0.248,0,0.495,0.064,0.714,0.186C5.536,9.14,5.802,9.644,5.8,10.162C5.798,10.4,5.746,10.645,5.621,10.869z M5.75,25.165
c-0.106,0.378-0.354,0.69-0.697,0.882c-0.22,0.122-0.467,0.188-0.715,0.188c-0.267,0-0.523-0.072-0.747-0.203
c-0.222-0.131-0.408-0.319-0.538-0.553c-0.043-0.074-0.074-0.152-0.103-0.232c-0.099-0.283-0.111-0.588-0.028-0.883
c0.107-0.379,0.355-0.69,0.698-0.883c0.219-0.123,0.465-0.188,0.714-0.188c0.432,0,0.829,0.195,1.105,0.514
c0.064,0.075,0.13,0.151,0.18,0.24c0.123,0.221,0.178,0.463,0.18,0.707C5.8,24.893,5.789,25.029,5.75,25.165z M18.908,32.458
c0,0.634-0.406,1.17-0.97,1.376h-1c-0.564-0.205-0.972-0.742-0.972-1.376s0.406-1.171,0.972-1.376
c0.156-0.057,0.323-0.094,0.499-0.094c0.177,0,0.344,0.037,0.501,0.095C18.5,31.288,18.908,31.824,18.908,32.458z M17.439,3.927
c-0.177,0-0.344-0.036-0.501-0.094c-0.563-0.206-0.969-0.742-0.969-1.376c0-0.634,0.404-1.17,0.969-1.376
c0.157-0.058,0.324-0.094,0.501-0.094c0.176,0,0.343,0.036,0.499,0.093c0.563,0.205,0.972,0.742,0.972,1.376
c0,0.634-0.407,1.171-0.972,1.376C17.782,3.892,17.615,3.927,17.439,3.927z M31.923,25.244c-0.027,0.08-0.061,0.158-0.103,0.234
c-0.13,0.231-0.326,0.414-0.554,0.541c-0.438,0.244-0.992,0.278-1.445,0.025c-0.342-0.189-0.59-0.504-0.697-0.882
c-0.038-0.136-0.05-0.272-0.049-0.41c0.001-0.245,0.057-0.487,0.18-0.708c0.05-0.089,0.114-0.165,0.18-0.238
c0.275-0.318,0.674-0.516,1.104-0.516c0.249,0,0.495,0.062,0.714,0.188c0.344,0.19,0.59,0.504,0.698,0.881
C32.037,24.656,32.023,24.96,31.923,25.244z"/></g></svg>';
?>
<div class="darkskyforecasthome">
<div class="darkskydiv">
<?php
foreach ($darkskydayCond as $cond) {
$darkskydayTime = $cond['time'];
$darkskydaySummary = $cond['summary'];
$darkskydayIcon = $cond['icon'];
$darkskydayTempHigh = round($cond['temperatureMax']);
$darkskydayTempLow = round($cond['temperatureMin']);
$darkskydayWinddir = $cond['windBearing'];
$darkskydayClouds = $cond['cloudCover']*100;
$darkskydayHumidity = $cond['humidity']*100;
$darkskydayPrecipProb = $cond['precipProbability']*100;
$darkskydayprecipIntensity = number_format($cond['precipIntensityMax'],1);
if (isset($cond['precipType'])){$darkskydayPrecipType = $cond['precipType'];}
$darkskydayacumm=round($cond['precipAccumulation'],1);
$darkskydayWindSpeed = round($cond['windSpeed'],0);
echo '<div class="darkskyforecastinghome">';
echo '<div class="darkskyweekdayhome">'.strftime("%a %b %e", $darkskydayTime).'<br>';
if ($darkskydayacumm>0 ){echo '<img src="css/darkskyicons/snow.svg" width="45"></img><br>';}
else if ($darkskydayIcon == 'partly-cloudy-night'){echo '<img src="css/darkskyicons/partly-cloudy-day.svg" width="45"></img><br>';}
else echo '<img src="css/darkskyicons/'.$darkskydayIcon.'.svg" width="45"></img><br>';
echo '</div><darkskytemphihome><span> '.$darkskydayTempHigh.'° </span></darkskytemphihome>| ';
echo '<darkskytemplohome><span>'.$darkskydayTempLow.'° </span></darkskytemplohome><br>';
echo "<img src = 'css/windicons/avgw.svg' width='20' style='-webkit-transform:rotate(".$darkskydayWinddir."deg);-moz-transform:rotate(".$darkskydayWinddir."deg);-o-transform:rotate(".$darkskydayWinddir."deg);transform:rotate(".$darkskydayWinddir."deg)'></span>";
echo '<darkskytempwindhome><span2>';
if ($darkskydayWinddir <15 ) echo $lang['North'];
elseif ($darkskydayWinddir <45 ) echo $lang['NNE'];
elseif ($darkskydayWinddir <90 ) echo $lang['ENE'];
elseif ($darkskydayWinddir <110 ) echo $lang['East'];
elseif ($darkskydayWinddir <150 ) echo $lang['SE'];
elseif ($darkskydayWinddir <170 ) echo $lang['SSE'];
elseif ($darkskydayWinddir <190 ) echo $lang['South'];
elseif ($darkskydayWinddir <220 ) echo $lang['SSW'];
elseif ($darkskydayWinddir <250 ) echo $lang['SW'];
elseif ($darkskydayWinddir <270 ) echo $lang['West'];
elseif ($darkskydayWinddir <300 ) echo $lang['NW'];
elseif ($darkskydayWinddir <340 ) echo $lang['NWN'];
elseif ($darkskydayWinddir <360 ) echo $lang['North'];
echo '</span2><br><span4> '.$darkskydayWindSpeed.' </span4><span2><oorange> '.$windunit.'</oorange><br>';
if ( $darkskydayacumm>0){echo $snowflakesvg.'<darkskytempwindhome><span><blue1>'.$darkskydayacumm.'</blue1></span>cm</darkskywindhome></span>';}
if ( $darkskydayacumm==0){echo ' '.$rainsvg.' <darkskytempwindhome><span>'. $darkskydayprecipIntensity. "</span> ".$rainunit.'</darkskywindhome></span>';}
echo '</div>';}?>
</div></div></div>