-
Notifications
You must be signed in to change notification settings - Fork 1
/
PW-forecast-demo.php
231 lines (212 loc) · 6.24 KB
/
PW-forecast-demo.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<?php header('Content-type: text/html; charset=UTF-8'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="Robots" content="index,nofollow" />
<title>Pirateweather Forecast script - Demo Page</title>
<style type="text/css">
/*--------------------------------------------------
tabbertab
--------------------------------------------------*/
/* $Id: example.css,v 1.5 2006/03/27 02:44:36 pat Exp $ */
/*--------------------------------------------------
REQUIRED to hide the non-active tab content.
But do not hide them in the print stylesheet!
--------------------------------------------------*/
.tabberlive .tabbertabhide {
display:none;
}
/*--------------------------------------------------
.tabber = before the tabber interface is set up
.tabberlive = after the tabber interface is set up
--------------------------------------------------*/
.tabber {
}
.tabberlive {
margin-top:1em;
}
/*--------------------------------------------------
ul.tabbernav = the tab navigation list
li.tabberactive = the active tab
--------------------------------------------------*/
ul.tabbernav
{
margin:0 0 3px 0;
padding: 0 3px ;
border-bottom: 0px solid #778;
font: bold 12px Verdana, sans-serif;
}
ul.tabbernav li
{
list-style: none;
margin: 0;
min-height:40px;
display: inline;
}
ul.tabbernav li a
{
padding: 3px 0.5em;
min-height: 40px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
margin-left: 3px;
border: 1px solid #778;
border-bottom: none;
background: #DDE !important;
text-decoration: none !important;
}
ul.tabbernav li a:link { color: #448 !important;}
ul.tabbernav li a:visited { color: #667 !important; }
ul.tabbernav li a:hover
{
color: #000;
background: #AAE !important;
border-color: #227;
}
ul.tabbernav li.tabberactive a
{
background-color: #fff !important;
border-bottom: none;
}
ul.tabbernav li.tabberactive a:hover
{
color: #000;
background: white !important;
border-bottom: 1px solid white;
}
/*--------------------------------------------------
.tabbertab = the tab content
Add style only after the tabber interface is set up (.tabberlive)
--------------------------------------------------*/
.tabberlive .tabbertab {
padding:5px;
border:0px solid #aaa;
border-top:0;
overflow:auto;
}
/* If desired, hide the heading since a heading is provided by the tab */
.tabberlive .tabbertab h2 {
display:none;
}
.tabberlive .tabbertab h3 {
display:none;
}
</style>
</head>
<body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; background-color:#FFFFFF; width: 680px; margin: 0 auto;">
<?php
if(isset($_REQUEST['sce'])) {
print "<h2>Sorry.. the viewing of source on this demo page is not available.</h2>\n";
print "</body></html>\n";
exit;
}
$SITE = array();
global $SITE;
$SITE['PWAPIkey'] = 'specify-for-standalone-use-here'; // use this only for standalone
$SITE['charset'] = 'UTF-8';
$SITE['lang'] = 'en';
$SITE['PWshowUnitsAs'] = 'ca';
$SITE['PWforecasts'] = array(
// Location|lat,long (separated by | characters)
'Saratoga, CA, USA|37.27465,-122.02295',
'Auckland, NZ|-36.910,174.771', // Awhitu, Waiuku New Zealand
'Assen, NL|53.02277,6.59037',
'Blankenburg, DE|51.8089941,10.9080649',
'Cheyenne, WY, USA|41.144259,-104.83497',
'Carcassonne, FR|43.2077801,2.2790407',
'Braniewo, PL|54.3793635,19.7853585',
'Omaha, NE, USA|41.19043,-96.13114',
'Johanngeorgenstadt, DE|50.439339,12.706085',
'Athens, GR|37.97830,23.715363',
'Haifa, IL|32.7996029,34.9467358',
);
include_once("PW-forecast-lang.php");
$t = unserialize(base64_decode(TRANTABLE));
$SITE['installedLanguages'] = array (
'af' => 'Afrikaans',
'bg' => 'български език',
'cs' => 'český jazyk',
'ct' => 'Català',
'dk' => 'Dansk',
'nl' => 'Nederlands',
'en' => 'English',
'fi' => 'Suomi',
'fr' => 'Français',
'de' => 'Deutsch',
'el' => 'Ελληνικά',
'hu' => 'Magyar',
'it' => 'Italiano',
'he' => 'עִבְרִית',
'no' => 'Norsk',
'pl' => 'Polski',
'pt' => 'Português',
'ro' => 'limba română',
'es' => 'Español',
'se' => 'Svenska',
'si' => 'Slovenščina',
'sk' => 'Slovenčina',
'sr' => 'Srpski',
);
$SITE['WULanguages'] = array ( // for WeatherUnderground forecast supported languages
'af' => 'afrikaans',
'bg' => 'bulgarian',
'cs' => 'czech',
'ct' => 'catalan',
'dk' => 'danish',
'nl' => 'dutch',
'en' => 'english',
'fi' => 'finnish',
'fr' => 'french',
'de' => 'german',
'el' => 'greek',
'ga' => 'gaelic',
'he' => 'hebrew',
'hu' => 'hungarian',
'it' => 'italian',
'no' => 'norwegian',
'pl' => 'polish',
'pt' => 'portuguese',
'ro' => 'romanian',
'es' => 'espanol',
'se' => 'swedish',
'si' => 'slovenian',
'sk' => 'slovak',
'sr' => 'serbian',
);
if(isset($_REQUEST['z']) and is_numeric($_REQUEST['z'])) {
$doZ = $_REQUEST['z'];
$doZ = preg_replace('|[^\d]+|Uis','',$doZ);
$doZ = '&z='.$doZ;
} else {
$doZ = '';
}
print "<h1>Demo page for PW-forecast.php</h1>\n";
print "<p>Click on a language link to see forecast in that language</p>\n";
print "<p>";
$tList = '';
foreach ($SITE['installedLanguages'] as $lang => $langName) {
$tList .= "<a href=\"?lang=$lang$doZ\">$langName</a> | ";
}
$tList = substr($tList,0,strlen($tList)-3);
print $tList;
print "</p>\n";
if(isset($_GET['lang']) and isset($SITE['installedLanguages'][$_GET['lang']])) {
print "<h3>Forecast language '" . $SITE['installedLanguages'][$_GET['lang']] .
"' (" .
ucfirst($SITE['WULanguages'][$_GET['lang']]) .
") shown.</h3>\n";
} else {
print "<h3>Forecast language 'English' shown.</h3>\n";
}
$doIncludePW = true;
$doPrintPW = true;
$useUTF8 = true;
print "<div style=\"border: 1px solid black; margin: 5px;\">\n";
include_once("PW-forecast.php");
print "</div>\n";
?>
<hr />
<p>See the <a href="https://github.com/ktrue/Weather-PHP/tree/master/forecast/pirateweather">script page</a> for documentation and downloads.</p>
</body>
</html>