PluginProbe
wp-forecast / 9.6
wp-forecast v9.6
10.0 trunk 1.4 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3..5 3..8 3.0 3.1 3.2 3.3 3.4 3.6 All 86 releases
← All changes | wp-forecast-show.php +541 -455 3.0 → 9.6 View file →
@@ -1,491 +1,577 @@
1 1 <?php
2 +/**
3 + * Copyright 2006-2024 Hans Matzen (email : webmaster at tuxlog dot de)
4 + *
5 + * This program is free software; you can redistribute it and/or modify
6 + * it under the terms of the GNU General Public License as published by
7 + * the Free Software Foundation; either version 2 of the License, or
8 + * (at your option) any later version.
9 + *
10 + * This program is distributed in the hope that it will be useful,
11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 + * GNU General Public License for more details.
14 + *
15 + * You should have received a copy of the GNU General Public License
16 + * along with this program; if not, write to the Free Software
17 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 + *
19 + * @package wp-forecast
20 + */
2 21
3 -/* Copyright 2006-2010 Hans Matzen (email : webmaster at tuxlog dot de)
22 +/**
23 + * Display the weather-data.
24 + *
25 + * @param string $wpfcid The widget ID.
26 + * @param array $args The widget aprameters.
27 + * @param array $wpf_vars The Parameters of wth widget.
28 + */
29 +function show( $wpfcid, $args, $wpf_vars ) {
30 + // check how we are called as a widget or from sidebar.
4 31
5 - This program is free software; you can redistribute it and/or modify
6 - it under the terms of the GNU General Public License as published by
7 - the Free Software Foundation; either version 2 of the License, or
8 - (at your option) any later version.
32 + if ( count( $args ) == 0 ) {
33 + $show_from_widget = 0;
34 + } else {
35 + $show_from_widget = 1;
36 + }
9 37
10 - This program is distributed in the hope that it will be useful,
11 - but WITHOUT ANY WARRANTY; without even the implied warranty of
12 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 - GNU General Public License for more details.
38 + // take title from widget args.
39 + if ( isset( $args['title'] ) ) {
40 + // remember title from widget.
41 + $wpf_vars['title'] = $args['title'];
42 + // apply wp default filters to title for output.
43 + $title = apply_filters( 'widget_title', $args['title'] );
44 + }
14 45
15 - You should have received a copy of the GNU General Public License
16 - along with this program; if not, write to the Free Software
17 - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -*/
46 + // get translations.
47 + global $wpf_lang_dict;
48 + $wpf_lang = array();
49 + $langfile = WP_PLUGIN_DIR . '/wp-forecast/widgetlang/wp-forecast-' . strtolower( str_replace( '_', '-', $wpf_vars['wpf_language'] ) ) . '.php';
50 + if ( file_exists( $langfile ) ) {
51 + include $langfile;
52 + }
53 + $wpf_lang_dict[ $wpf_vars['wpf_language'] ] = $wpf_lang;
54 + $wpf_language = $wpf_vars['wpf_language'];
19 55
20 -//
21 -// display the weather-data
22 -//
23 -// the following structure will be used:
24 -/*
25 -<div class="wp-forecast">
26 - <div class="wp-forecast-curr">
27 - <div class="wp-forecast-curr-head">
28 - </div>
29 - <div class="wp-forecast-curr-block">
30 - <div class='wp-forecast-curr-left'>
31 - </div>
32 - <div class='wp-forecast-curr-right'>
33 - </div>
34 - </div>
35 - <div class="wp-forecast-curr-details">
36 - <div class="wp-forecast-copyright">
37 - </div>
38 - </div>
39 - </div>
40 - <div class="wp-forecast-fc">
56 + $plugin_path = plugins_url( '', __FILE__ );
57 + // show location selection dialog and handle it ajax like.
58 + $fout = '';
59 + $selector = substr( $wpfcid, 0, 1 );
41 60
42 - <div class="wp-forecast-fc-oneday">
43 - <div class="wp-forecast-fc-head">
44 - </div>
45 - <div class="wp-forecast-fc-block">
46 - <div class="wp-forecast-fc-left">
47 - </div>
48 - <div class='wp-forecast-fc-right'>
49 - </div>
50 - </div>
51 - <div class="wp-forecast-fc-block">
52 - <div class="wp-forecast-fc-left">
53 - </div>
54 - <div class='wp-forecast-fc-right'>
55 - </div>
56 - </div>
57 - </div>
58 - ... repetead for everey forecast day ...
59 - </div>
60 -</div>
61 -*/
61 + if ( '?' == $selector ) {
62 + $wpfcid = substr( $wpfcid, 1 );
62 63
63 -// if called directly, get parameters from GET and output the forecast html
64 -if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) {
65 - require_once("funclib.php");
66 - require_once( dirname(__FILE__) . '/../../../wp-config.php');
67 -
68 - $wpfcid = esc_attr($_GET['wpfcid']);
69 - $language_override = esc_attr($_GET['language_override']);
70 - $header = esc_attr($_GET['header']);
71 - $selector = esc_attr($_GET['selector']);
72 - if ($selector == "1")
73 - $selector = "?";
74 - $args=array();
75 -
76 - $wpf_vars=get_wpf_opts($wpfcid);
77 - if (!empty($language_override)) {
78 - $wpf_vars['wpf_language']=$language_override;
79 - }
80 - $weather=maybe_unserialize(wpf_get_option("wp-forecast-cache".$wpfcid));
81 -
64 + if ( '' == $wpfcid ) {
65 + $wpfcid = 'A';
66 + }
67 + $count = wpf_get_option( 'wp-forecast-count' );
68 + $fout .= "<div class='wpf-selector'><form action='#'>" . wpf__( 'Locations:', $wpf_vars['wpf_language'] );
69 + $fout .= "<select id='wpf_selector' size='1' onchange='wpf_update();' >";
82 70
83 - if ($header) {
84 - echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n";
85 - echo '<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="de-DE">'."\n";
86 - echo "<head><title>wp-forecast iframe</title>\n";
87 - echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n";
88 - }
71 + for ( $i = 0;$i < $count;$i++ ) {
72 + $id = get_widget_id( $i );
73 + $v = get_wpf_opts( $id );
74 + $fout .= "<option value='" . esc_attr( $id ) . "' ";
89 75
90 - if ($header)
91 - {
92 - wp_forecast_css_nowp($wpfcid);
93 - echo "</head>\n<body>\n";
94 - }
76 + if ( $id == $wpfcid ) {
77 + $fout .= "selected='selected' ";
78 + }
79 + $fout .= '>' . esc_attr( $v['locname'] ) . '</option>';
80 + }
81 + $fout .= '</select>';
82 + $fout .= "<input id='wpf_selector_site' type='hidden' value='" . esc_attr( $plugin_path ) . "' />";
83 + $fout .= "<input id='wpf_language' type='hidden' value='" . esc_attr( $wpf_language ) . "' />";
84 + $fout .= '</form>';
85 + $fout .= '<script type="text/javascript">window.onDomReady(wpf_load);</script>';
86 + $fout .= '</div>';
87 + }
88 + $w = wp_forecast_data( $wpfcid, $wpf_vars['wpf_language'] );
89 + // current conditions nur ausgeben, wenn mindestens ein feld aktiv ist.
95 90
96 - show($selector . $wpfcid,$args,$wpf_vars);
91 + if ( strpos( substr( $wpf_vars['dispconfig'], 0, 9 ), '1' ) >= 0 || substr( $wpf_vars['dispconfig'], 18, 1 ) == '1' || substr( $wpf_vars['dispconfig'], 21, 1 ) == '1' || substr( $wpf_vars['dispconfig'], 22, 1 ) == '1' ) {
92 + // output current conditions.
93 + $out = '';
94 + $out .= "\n<div class=\"wp-forecast-curr\">\n";
95 + // if the provider sends us a failure notice print it and return.
97 96
98 - if ($header)
99 - echo "</body></html>\n";
100 -}
97 + if ( '' != $w['failure'] ) {
98 + $out .= wpf__( 'Failure notice from provider', $wpf_language ) . ':<br />';
99 + $out .= esc_attr( $w['failure'] ) . '</div>';
100 + // print it.
101 101
102 -function show($wpfcid,$args,$wpfvars)
103 -{
104 - pdebug(1,"Start of show ()");
102 + if ( 1 == $show_from_widget ) {
103 + echo wp_kses( $args['before_widget'] . $args['before_title'] . $title . $args['after_title'] . $out . $args['after_widget'], wpf_allowed_tags() );
104 + } else {
105 + echo wp_kses( $out, wpf_allowed_tags() );
106 + }
107 + return false;
108 + }
109 + // if error print an error message and return.
105 110
106 - // check how we are called as a widget or from sidebar
107 - if (sizeof($args)==0)
108 - $show_from_widget=0;
109 - else
110 - $show_from_widget=1;
111 + if ( count( $w ) <= 0 ) {
112 + $out .= wpf__( 'Sorry, no valid weather data available.', $wpf_language ) . '<br />';
113 + $out .= wpf__( 'Please try again later.', $wpf_language ) . '</div>';
114 + // print it.
111 115
112 - // order is important to override old title in wpfvars with new in args
113 - extract($wpfvars);
114 - extract($args);
115 -
116 + if ( 1 == $show_from_widget ) {
117 + echo wp_kses( $args['before_widget'] . $args['before_title'] . $title . $args['after_title'] . $out . $args['after_widget'], wpf_allowed_tags() );
118 + } else {
119 + echo wp_kses( $out, wpf_allowed_tags() );
120 + }
121 + return false;
122 + }
123 + // ortsnamen ausgeben parameter fuer open in new window berücksichtigen.
124 + $servicelink = '';
125 + $servicelink_end = '';
116 126
117 - // get translations
118 - if(function_exists('load_textdomain')) {
119 - global $l10n;
120 - if (!isset($l10n["wp-forecast_".$wpf_language]))
121 - load_textdomain("wp-forecast_".$wpf_language, ABSPATH . "wp-content/plugins/wp-forecast/lang/".$wpf_language.".mo");
122 - }
127 + if ( substr( $wpf_vars['dispconfig'], 25, 1 ) == '1' ) {
128 + $servicelink = '<a href="' . esc_url( $w['servicelink'] ) . '"';
129 + $servicelink_end = '</a>';
123 130
124 - $plugin_path = get_settings('siteurl') . '/wp-content/plugins/wp-forecast';
131 + if ( substr( $wpf_vars['dispconfig'], 26, 1 ) == '1' ) {
132 + $servicelink = $servicelink . ' target="_blank" >';
133 + } else {
134 + $servicelink = $servicelink . ' >';
135 + }
136 + }
125 137
126 - // show location selection dialog and handle it ajax like
127 - $fout="";
128 - $selector = substr($wpfcid,0,1);
129 - if ($selector == "?")
130 - {
131 - $wpfcid = substr($wpfcid,1);
132 - if ($wpfcid == "")
133 - $wpfcid = "A";
138 + $out .= '<div class="wp-forecast-curr-head">';
134 139
135 - $count = wpf_get_option('wp-forecast-count');
136 - $fout .= "<div class='wpf-selector'><form action=''>" .
137 - __("Locations:","wp-forecast_".$wpf_language);
138 - $fout .= "<select id='wpf_selector' size='1' onchange='wpf_update();' >";
139 - for ($i=0;$i<$count;$i++) {
140 - $id = get_widget_id( $i );
141 - $v = get_wpf_opts($id);
142 - $fout .="<option value='".$id."' ";
143 - if ($id == $wpfcid)
144 - $fout .= "selected='selected' ";
145 - $fout .=">".$v['locname']."</option>";
146 - }
147 - $fout .= "</select>";
148 - $fout .="<input id='wpf_selector_site' type='hidden' value='" .
149 - site_url("/wp-content/plugins/wp-forecast")."' />";
150 - $fout .= "</form>";
151 - $fout .='<script type="text/javascript">window.onDomReady(wpf_update);</script>';
152 - $fout .= "</div>";
153 -
154 - }
140 + if ( '' == $w['location'] || ( isset( $wpf_vars['visitorlocation'] ) && 1 == $wpf_vars['visitorlocation'] ) ) {
141 + $out .= '<div>' . $servicelink . esc_attr( $w['locname'] ) . $servicelink_end . "</div>\n";
142 + } elseif ( '' != trim( $w['location'] ) && '&nbsp;' != $w['location'] ) {
143 + $out .= '<div>' . $servicelink . esc_attr( $w['location'] ) . $servicelink_end . "</div>\n";
144 + }
155 145
156 - $w = wp_forecast_data($wpfcid, $wpf_language);
146 + // show date / time.
147 + // if current time should be used.
148 + if ( '1' == $wpf_vars['currtime'] ) {
149 + $cd = $w['blogdate'];
150 + $ct = $w['blogtime'];
151 + } else {
152 + // else take given weather time.
153 + $cd = $w['accudate'];
154 + $ct = $w['accutime'];
155 + }
157 156
158 - // current conditions nur ausgeben, wenn mindestens ein feld aktiv ist
159 - if ( strpos(substr($dispconfig,0,9),"1") >= 0 or
160 - substr($dispconfig,18,1) == "1" or
161 - substr($dispconfig,21,1) == "1" or
162 - substr($dispconfig,22,1) == "1" )
163 - {
164 - // ouput current conditions
165 - $out ="";
166 - $out .="\n<div class=\"wp-forecast-curr\">\n";
167 -
168 - // if the provider sends us a failure notice print it and return
169 - if ( $w['failure'] != "" )
170 - {
171 - $out .= __("Failure notice from provider","wp-forecast_".$wpf_language).":<br />";
172 - $out .= $w['failure']."</div>";
173 -
174 - // print it
175 - if ( $show_from_widget == 1 )
176 - echo $before_widget . $before_title . $title . $after_title
177 - . $out . $after_widget;
178 - else
179 - echo $out;
180 -
181 - return false;
157 + if ( substr( $wpf_vars['dispconfig'], 18, 1 ) == '1' || substr( $wpf_vars['dispconfig'], 1, 1 ) == '1' ) {
158 + $out .= '<div>';
159 +
160 + if ( substr( $wpf_vars['dispconfig'], 18, 1 ) == '1' ) {
161 + $out .= esc_attr( $cd );
162 + } else {
163 + $out .= wpf__( 'time', $wpf_language ) . ': ';
164 + }
165 +
166 + if ( substr( $wpf_vars['dispconfig'], 18, 1 ) == '1' && substr( $wpf_vars['dispconfig'], 1, 1 ) == '1' ) {
167 + $out .= ', ';
168 + }
169 +
170 + if ( substr( $wpf_vars['dispconfig'], 1, 1 ) == '1' ) {
171 + $out .= esc_attr( $ct );
172 + }
173 + $out .= "</div>\n";
174 + }
175 + $out .= "</div>\n";
176 + $out .= '<div class="wp-forecast-curr-block">';
177 +
178 + // show icon.
179 + $out .= "<div class='wp-forecast-curr-left'>";
180 +
181 + if ( substr( $wpf_vars['dispconfig'], 0, 1 ) == '1' ) {
182 + $breite = 0;
183 + $hoehe = 0;
184 +
185 + if ( ! $wpf_vars['fonticon'] ) {
186 + if ( file_exists( plugin_dir_path( __FILE__ ) . '/' . $w['icon'] ) ) {
187 + $isize = getimagesize( plugin_dir_path( __FILE__ ) . '/' . $w['icon'] );
188 +
189 + if ( false != $isize ) {
190 + $breite = $isize[0];
191 + $hoehe = $isize[1];
192 + }
193 + }
194 +
195 + if ( 1 == $wpf_vars['csssprites'] ) { // mit CSS Sprites.
196 + $cssid = substr( $w['icon'], strpos( $w['icon'], '/' ) + 1, strrpos( $w['icon'], '.' ) - strpos( $w['icon'], '/' ) - 1 );
197 + $out .= "<div class='wp-forecast-curr-left wpfico" . esc_attr( $cssid ) . "'>&nbsp;</div>\n";
198 + } else { // ohne CSS-Sprites.
199 + $out .= "<img class='wp-forecast-curr-left' src='" . esc_attr( $plugin_path ) . '/' . esc_attr( $w['icon'] ) . "' alt='" . esc_attr( $w['shorttext'] ) . "' width='" . esc_attr( $breite ) . "' height='" . esc_attr( $hoehe ) . "' />\n";
200 + }
201 + } else {
202 + $out .= "<i class='wpf-wi-icon wi " . esc_attr( $w['iconcode'] ) . "' style='color: " . $wpf_vars['fonticon_color'] . "'></i>\n";
203 + }
204 + }
205 + $out .= '<br />';
206 +
207 + // show windicon.
208 + if ( '1' == $wpf_vars['windicon'] ) {
209 + if ( ! $wpf_vars['fonticon'] ) {
210 + $breite = 48;
211 + $hoehe = 48;
212 + $wind_icon_url = $plugin_path . '/icons/wpf-' . $w['winddir_orig'] . '.png';
213 + $out .= "<img src='" . esc_url( $wind_icon_url ) . "' alt='" . esc_attr( $w['winddir'] ) . "' width='" . esc_attr( $breite ) . "' height='" . esc_attr( $hoehe ) . "' />\n";
214 + } else {
215 + $out .= "<i class='wpf-wi-icon wi wi-wind wi-from-" . esc_attr( strtolower( $w['winddir_orig'] ) ) . "' style='color: " . $wpf_vars['fonticon_color'] . "'></i>\n";
216 + }
217 + }
218 +
219 + $out .= '</div>';
220 + $out .= "<div class='wp-forecast-curr-right'>";
221 + $out .= '<div>';
222 +
223 + // show short description.
224 + if ( substr( $wpf_vars['dispconfig'], 2, 1 ) == '1' ) {
225 + $out .= esc_attr( wpf__( $w['shorttext'], $wpf_vars['wpf_language'] ) ) . '<br/>';
226 + }
227 +
228 + // show temperatur.
229 + if ( substr( $wpf_vars['dispconfig'], 3, 1 ) == '1' ) {
230 + $out .= esc_attr( $w['temperature'] );
231 + }
232 + $out .= '</div>';
233 + // show wind on the right side if windicon is active.
234 +
235 + if ( '1' == $wpf_vars['windicon'] ) {
236 + $out .= '<div class="wp-forecast-wind-right">' . esc_attr( $w['windspeed'] ) . "</div>\n";
237 + }
238 + $out .= "</div>\n"; // end of right.
239 + $out .= "</div>\n"; // end of block.
240 + $out .= '<div class="wp-forecast-curr-details">';
241 + // show realfeel.
242 +
243 + if ( substr( $wpf_vars['dispconfig'], 4, 1 ) == '1' ) {
244 + $out .= '<div>' . wpf__( 'Apparent', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w['realfeel'] ) . "</div>\n";
245 + }
246 + // show pressure.
247 +
248 + if ( substr( $wpf_vars['dispconfig'], 5, 1 ) == '1' ) {
249 + $out .= '<div>' . wpf__( 'Pressure', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w['pressure'] ) . "</div>\n";
250 + }
251 + // show humiditiy.
252 +
253 + if ( substr( $wpf_vars['dispconfig'], 6, 1 ) == '1' ) {
254 +
255 + // you can change the decimals of humditiy by switching.
256 +
257 + // the 0 to whatever you need.
258 +
259 + $out .= '<div>' . wpf__( 'Humidity', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w['humidity'] ) . "%</div>\n";
260 + }
261 + // show wind.
262 +
263 + if ( substr( $wpf_vars['dispconfig'], 7, 1 ) == '1' ) {
264 + $out .= '<div>' . wpf__( 'Winds', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w['windspeed'] ) . ' ' . esc_attr( $w['winddir'] ) . "</div>\n";
265 + }
266 + // show windgusts.
267 +
268 + if ( substr( $wpf_vars['dispconfig'], 22, 1 ) == '1' ) {
269 + $out .= '<div>' . wpf__( 'Windgusts', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w['windgusts'] ) . "</div>\n";
270 + }
271 +
272 + // show uvindex.
273 + if ( substr( $wpf_vars['dispconfig'], 27, 1 ) == '1' && trim( $wpf_vars['ouv_apikey'] ) == '' ) {
274 + $out .= '<div>' . wpf__( 'UV-Index', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w['uvindex'] ) . "</div>\n";
275 + }
276 +
277 + // show precipitation.
278 + if ( substr( $wpf_vars['dispconfig'], 30, 1 ) == '1' ) {
279 + $intensestr = $w['precipIntensity'];
280 + if ( 'mm' == $w['un_prec'] ) {
281 + $intensestr = round( $w['precipIntensity'] * 2.54 * 10, 1 );
282 + }
283 +
284 + $precipstr = '<span class="wp-forecast-precipIntense">' . esc_attr( $intensestr ) . esc_attr( $w['un_prec'] ) . '</span>';
285 + $precipstr .= ' /<span class="wp-forecast-precipProb">' . esc_attr( $w['precipProbability'] ) . '%</span>';
286 + if ( '' != $w['precipType'] ) {
287 + $precipstr .= ' / <span class="wp-forecast-precipType">' . wpf__( $w['precipType'], $wpf_language ) . '</span>';
288 + }
289 + $out .= '<div>' . wpf__( 'Precip.', $wpf_language ) . ': ' . $precipstr . "</div>\n";
290 + }
291 +
292 + // show sunrise.
293 + if ( substr( $wpf_vars['dispconfig'], 8, 1 ) == '1' ) {
294 + $out .= '<div>' . wpf__( 'Sunrise', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w['sunrise'] ) . "</div>\n";
295 + }
296 +
297 + // show sunset.
298 + if ( substr( $wpf_vars['dispconfig'], 9, 1 ) == '1' ) {
299 + $out .= '<div>' . wpf__( 'Sunset', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w['sunset'] ) . "</div>\n";
300 + }
301 +
302 + // show data from OpenUV.io if applicable.
303 + if ( isset( $wpf_vars['ouv_apikey'] ) && trim( $wpf_vars['ouv_apikey'] ) != '' ) {
304 +
305 + if ( $wpf_vars['ouv_uv'] ) {
306 + $out .= '<div>' . wpf__( 'Current UV index', $wpf_language ) . ': ' . esc_attr( $w['openuv']['uv'] ) . "</div>\n";
307 + }
308 +
309 + if ( $wpf_vars['ouv_uvmax'] ) {
310 + $out .= '<div>' . wpf__( 'Max. UV index', $wpf_language ) . ': ' . esc_attr( $w['openuv']['uv_max'] ) . "</div>\n";
311 + }
312 +
313 + if ( $wpf_vars['ouv_ozone'] ) {
314 + $out .= '<div>' . wpf__( 'Ozone', $wpf_language ) . ': ' . esc_attr( $w['openuv']['ozone'] ) . " DU</div>\n";
315 + }
316 +
317 + if ( $wpf_vars['ouv_safetime'] ) {
318 + $j = 1;
319 +
320 + foreach ( $w['openuv']['safe_exposure_time'] as $set ) {
321 +
322 + if ( trim( $set ) != '' ) {
323 + $out .= '<div>' . wpf_esc_attr__( 'Safe Exposure Time for Skin Type', $wpf_language ) . " $j: " . esc_attr( $set ) . " Min.</div>\n";
324 + } else {
325 + $out .= '<div>' . wpf_esc_attr__( 'Safe Exposure Time for Skin Type', $wpf_language ) . " $j: &infin; Min.</div>\n";
326 + }
327 + $j++;
328 + }
329 + }
330 + $out .= '<div class="wp-forecast-copyright">' . wpf_esc_attr__( $w['openuv']['copyright'], $wpf_language ) . '</div>';
331 + }
332 + // show copyright.
333 +
334 + if ( substr( $wpf_vars['dispconfig'], 21, 1 ) == '1' ) {
335 + $out .= '<div class="wp-forecast-copyright">' . $w['copyright'] . '</div>';
336 + }
337 + $out .= "</div>\n"; // end of details.
338 + $out .= "</div>\n"; // end of curr.
339 +
182 340 }
341 + // ------------------
183 342
343 + // output forecast.
184 344
185 - // if error print an error message and return
186 - if ( count($w)<=0)
187 - {
188 - $out .= __("Sorry, no valid weather data available.","wp-forecast_".$wpf_language)."<br />";
189 - $out .= __("Please try again later.","wp-forecast_".$wpf_language)."</div>";
190 - // print it
191 - if ( $show_from_widget == 1 )
192 - echo $before_widget . $before_title . $title . $after_title .
193 - $out . $after_widget;
194 - else
195 - echo $out;
196 -
197 - return false;
345 + // -------------------
346 +
347 + // calc max forecast days depending on provider.
348 + $maxdays = 7; // for openweathermap v3.
349 + if ( 'openmeteo' == $wpf_vars['service'] ) {
350 + $maxdays = 6;
198 351 }
352 + if ( 'openweathermap' == $wpf_vars['service'] ) {
353 + $maxdays = 5;
354 + }
199 355
200 - // ortsnamen ausgeben parameter fuer open in new window berücksichtigen
201 - $servicelink="";
202 - $servicelink_end="";
203 - if (substr($dispconfig,25,1) == "1") {
204 - $servicelink= '<a href="'.$w['servicelink'].'"';
205 - $servicelink_end="</a>";
206 -
207 - if (substr($dispconfig,26,1) == "1")
208 - $servicelink= $servicelink . ' target="_blank" >';
209 - else
210 - $servicelink= $servicelink.' >';
211 - }
212 -
356 + $out1 = "<div class=\"wp-forecast-fc\">\n";
357 + $out2 = '';
213 358
214 - $out .= '<div class="wp-forecast-curr-head">';
215 - if ( $w['location'] == "" )
216 - $out .= "<div>".$servicelink.$w['locname']. $servicelink_end."</div>\n";
217 - else if ( trim($w['location']) !="" and $w['location'] != "&nbsp;")
218 - $out .= "<div>".$servicelink.$w['location'].$servicelink_end."</div>\n";
219 -
220 - // show date / time
221 - // if current time should be used
222 - if ($currtime=="1")
223 - {
224 - $cd = $w['blogdate'];
225 - $ct = $w['blogtime'];
226 - } else if ($service=="accu")
227 - {
228 - // else take given accuweather time
229 - $cd = $w['accudate'];
230 - $ct = $w['accutime'];
231 - } else if ($service=="bug")
232 - {
233 - // else take given weatherbug time
234 - $cd = $w['bugdate'];
235 - $ct = $w['bugtime'];
236 - }
237 -
238 - if (substr($dispconfig,18,1) == "1" or substr($dispconfig,1,1) == "1") {
239 - $out .= "<div>";
240 - if (substr($dispconfig,18,1) == "1")
241 - $out .= $cd;
242 - else
243 - $out .= __('time',"wp-forecast_".$wpf_language).": ";
244 -
245 - if (substr($dispconfig,18,1) == "1" and substr($dispconfig,1,1) == "1")
246 - $out .= ", ";
247 -
248 - if (substr($dispconfig,1,1) == "1")
249 - $out .= $ct;
250 - $out .= "</div>\n";
251 - }
252 - $out .= "</div>\n";
253 -
254 - $out .= '<div class="wp-forecast-curr-block">';
359 + for ( $i = 1;$i <= $maxdays;$i++ ) {
360 + // check active forecast for day number i.
361 + if ( ! isset( $w[ 'fc_obsdate_' . $i ] ) || trim( $w[ 'fc_obsdate_' . $i ] ) == '' ) {
362 + continue;
363 + }
255 364
256 - // show icon
257 - if (substr($dispconfig,0,1) == "1") {
258 - if ($service=="accu")
259 - $out .= "<div class='wp-forecast-curr-left'><img class='wp-forecast-curr-left' src='" . $plugin_path . "/" . $w['icon']."' alt='".$w['shorttext']."' /></div>\n";
260 - if ($service=="bug")
261 - $out .= "<div class='wp-forecast-curr-left'><img class='wp-forecast-curr-left' src='" . $w['icon']."' alt='".$w['shorttext']."' /></div>\n";
262 - }
263 -
264 - $out .= "<div class='wp-forecast-curr-right'>";
265 -
266 - // show short description
267 - if (substr($dispconfig,2,1) == "1")
268 - $out .= "<div>". $w["shorttext"]."</div>";
269 -
270 - // show temperatur
271 - if (substr($dispconfig,3,1) == "1")
272 - $out .= $w["temperature"];
273 - //$out .= __('tmp',"wp-forecast_".$wpf_language).": ".$w["temperature"];
274 - $out .= "</div>\n"; // end of right
275 - $out .= "</div>\n"; // end of block
276 -
277 - $out .= "<div class=\"wp-forecast-curr-details\">";
278 - // show realfeel
279 - if (substr($dispconfig,4,1) == "1")
280 - $out .= "<div>".__('flik',"wp-forecast_".$wpf_language).": ".$w["realfeel"]."</div>\n";
281 - // show pressure
282 - if (substr($dispconfig,5,1) == "1")
283 - $out .= "<div>".__('barr',"wp-forecast_".$wpf_language).": ".$w["pressure"]."</div>\n";
284 -
285 - // show humiditiy
286 - if (substr($dispconfig,6,1) == "1")
287 - //
288 - // you can change the decimals of humditiy by switching
289 - // the 0 to whatever you need
290 - //
291 - $out .= "<div>".__('hmid',"wp-forecast_".$wpf_language).": ".$w["humidity"]."%</div>\n";
292 -
293 - // show wind
294 - if (substr($dispconfig,7,1) == "1")
295 - $out .= "<div>".__('winds',"wp-forecast_".$wpf_language).": ".$w['windspeed']." " . $w['winddir']."</div>\n";
296 -
297 -
298 - // show windgusts
299 - if (substr($dispconfig,22,1) == "1")
300 - $out .= "<div>".__('Windgusts',"wp-forecast_".$wpf_language).": ".$w['windgusts']."</div>\n";
301 -
302 -
303 - // show sunrise
304 - if (substr($dispconfig,8,1) == "1")
305 - $out .="<div>". __('sunrise',"wp-forecast_".$wpf_language).": ".$w['sunrise']."</div>\n";
306 -
307 - // show sunset
308 - if (substr($dispconfig,9,1) == "1")
309 - $out .= "<div>".__('sunset',"wp-forecast_".$wpf_language).": ".$w['sunset']."</div>\n";
310 -
311 - // show copyright
312 - if (substr($dispconfig,21,1) == "1")
313 - $out .= "<div class=\"wp-forecast-copyright\">".$w['copyright']."</div>";
314 -
315 - $out .="</div>\n"; // end of details
316 - $out .="</div>\n"; // end of curr
365 + if ( substr( $wpf_vars['daytime'], $i - 1, 1 ) == '1' || substr( $wpf_vars['nighttime'], $i - 1, 1 ) == '1' ) {
366 + $out1 .= "<div class=\"wp-forecast-fc-oneday\">\n";
367 + $out1 .= '<div class="wp-forecast-fc-head">';
368 + $out1 .= '<div class="wp-forecast-fc-label">' . wpf__( 'Forecast', $wpf_vars['wpf_language'] ) . ' </div>';
369 + $out1 .= ' ' . esc_attr( $w[ 'fc_obsdate_' . $i ] ) . "</div>\n";
370 + }
371 + // check for daytime information.
317 372
318 -
319 - }
320 -
321 -
322 - // ------------------
323 - //
324 - // output forecast
325 - //
326 - // -------------------
327 - // calc max forecast days depending on provider
328 - switch ($service)
329 - {
330 - case "accu":
331 - $maxdays=9; break;
332 - case "bug":
333 - $maxdays=7; break;
334 - case "com":
335 - // to be done
336 - break;
337 - }
373 + if ( substr( $wpf_vars['daytime'], $i - 1, 1 ) == '1' ) {
374 + $out1 .= "<div class=\"wp-forecast-fc-block\">\n";
375 + $out1 .= "<div class=\"wp-forecast-fc-left\">\n";
376 + $out1 .= '<div>' . wpf__( 'Day', $wpf_vars['wpf_language'] ) . "</div>\n";
377 + // show icon.
338 378
339 - $out1 = "<div class=\"wp-forecast-fc\">\n";
340 - $out2 = "";
341 - for ($i = 1; $i <= $maxdays; $i++)
342 - {
343 - // check active forecast for day number i
344 - if (substr($daytime,$i-1,1)=="1" or substr($nighttime,$i-1,1) =="1")
345 - {
346 - $out1 .="<div class=\"wp-forecast-fc-oneday\">\n";
347 -
348 - $out1 .="<div class=\"wp-forecast-fc-head\">";
349 - $out1 .= __("Forecast","wp-forecast_".$wpf_language)." ";
350 - $out1 .= $w['fc_obsdate_'.$i]."</div>\n";
351 - }
352 -
353 - // check for daytime information
354 - if (substr($daytime,$i-1,1)=="1" )
355 - {
356 - $out1 .="<div class=\"wp-forecast-fc-block\">\n";
357 - $out1 .="<div class=\"wp-forecast-fc-left\">\n";
358 - $out1 .= "<div>".__('day',"wp-forecast_".$wpf_language)."</div>\n";
359 -
360 - // show icon
361 - if (substr($dispconfig,10,1) == "1")
362 - {
363 - if ($service=="accu")
364 - $out1 .= "<img class='wp-forecast-fc-left' src='".$plugin_path."/".
365 - $w['fc_dt_icon_'.$i]."' alt='".
366 - __($w["fc_dt_iconcode_".$i],"wp-forecast_".$wpf_language)."' />";
379 + if ( substr( $wpf_vars['dispconfig'], 10, 1 ) == '1' ) {
380 + $breite = 0;
381 + $hoehe = 0;
367 382
368 - if ($service=="bug")
369 - $out1 .= "<img class='wp-forecast-fc-left' src='".$w['fc_dt_icon_'.$i].
370 - "' alt='".$w["fc_dt_desc_".$i]."' />";
371 - }
372 - else
373 - {
374 - $out1 .= "&nbsp;";
375 - }
376 - $out1 .= "\n</div>\n"; // end of wp-forecast-fc-left
377 - $out1 .= "<div class='wp-forecast-fc-right'>";
378 -
379 - // show short description
380 - if (substr($dispconfig,11,1) == "1")
381 - $out1 .= "<div>".$w["fc_dt_desc_".$i]."</div>";
382 -
383 - // show temperature
384 - if (substr($dispconfig,12,1) == "1")
385 - {
386 - $out1 .= "<div>";
387 - $out1 .= ($service=="bug" ? $w["fc_dt_ltemp_".$i]." - ":"");
388 - $out1 .= $w["fc_dt_htemp_".$i]. "</div>";
389 - }
390 -
391 - // show wind
392 - if (substr($dispconfig,13,1) == "1")
393 - $out1 .= "<div>".__('winds',"wp-forecast_".$wpf_language).": ".
394 - $w["fc_dt_windspeed_".$i]." ".$w["fc_dt_winddir_".$i]."</div>";
395 -
396 - // show windgusts
397 - if (substr($dispconfig,23,1) == "1")
398 - $out1 .= "<div>".__('Windgusts',"wp-forecast_".$wpf_language).": ".
399 - $w["fc_dt_wgusts_".$i]."</div>\n";
400 -
401 - $out1 .= "</div></div>\n"; // end of wp-forecast-fc-right / block
402 - }
403 -
404 -
405 - // check for nighttime information
406 - if (substr($nighttime,$i-1,1)=="1" and $service != "bug")
407 - {
408 - $out1 .="<div class=\"wp-forecast-fc-block\">\n";
409 - $out1 .="<div class=\"wp-forecast-fc-left\">\n";
410 - $out1 .= "<div>". __('night',"wp-forecast_".$wpf_language)."</div>\n";
411 - if (substr($dispconfig,14,1) == "1")
412 - {
413 - $iconfile=find_icon($w["fc_nt_icon_".$i]);
414 - $out1 .= "<img class='wp-forecast-fc-left' src='"
415 - .$plugin_path."/".$w['fc_nt_icon_'.$i]."' alt='"
416 - .__($w["fc_nt_iconcode_".$i],"wp-forecast_".$wpf_language)."' />";
417 - }
418 - else
419 - {
420 - $out1 .= "&nbsp;";
421 - }
422 - $out1 .= "\n</div>\n<div class='wp-forecast-fc-right'>";
423 -
424 - // show short description
425 - if (substr($dispconfig,15,1) == "1")
426 - $out1 .= "<div>".$w["fc_nt_desc_".$i]."</div>";
427 -
428 - // show temperature
429 - if (substr($dispconfig,16,1) == "1")
430 - $out1 .= "<div>".$w["fc_nt_ltemp_".$i]."</div>";
431 -
432 -
433 - // show wind
434 - if (substr($dispconfig,17,1) == "1")
435 - $out1 .= "<div>".__('winds',"wp-forecast_".$wpf_language)
436 - .": ".$w["fc_nt_windspeed_".$i]." "
437 - . $w["fc_nt_winddir_".$i] ."</div>";
438 -
439 -
440 - // show windgusts
441 - if (substr($dispconfig,24,1) == "1")
442 - $out1 .= "<div>".__('Windgusts',"wp-forecast_".$wpf_language)
443 - .": ".$w["fc_nt_wgusts_".$i]."</div>\n";
444 -
445 -
446 - $out1 .= "</div></div>\n"; // end of wp-forecast-fc-right / block
447 - }
383 + if ( ! $wpf_vars['fonticon'] ) {
384 + if ( file_exists( plugin_dir_path( __FILE__ ) . '/' . $w[ 'fc_dt_icon_' . $i ] ) ) {
385 + $isize = getimagesize( plugin_dir_path( __FILE__ ) . '/' . $w[ 'fc_dt_icon_' . $i ] );
448 386
449 -
450 -
451 - // close div block
452 - if (substr($daytime,$i-1,1)=="1" or substr($nighttime,$i-1,1) =="1")
453 - $out1 .="</div>\n";
387 + if ( false != $isize ) {
388 + $breite = $isize[0];
389 + $hoehe = $isize[1];
390 + }
391 + }
454 392
455 - // store first shown forecast in case pulldown is active
456 - if ( $pdforecast == 1 and $pdfirstday == $i ) {
457 - $out2 = $out1 . "</div>\n";
458 - }
459 - }
393 + if ( 1 == $wpf_vars['csssprites'] ) { // mit CSS Sprites.
394 + $cssid = substr( $w[ 'fc_dt_icon_' . $i ], strpos( $w[ 'fc_dt_icon_' . $i ], '/' ) + 1, strrpos( $w[ 'fc_dt_icon_' . $i ], '.' ) - strpos( $w[ 'fc_dt_icon_' . $i ], '/' ) - 1 );
395 + $out1 .= "<div class='wp-forecast-curr-left wpfico" . esc_attr( $cssid ) . "'>&nbsp;</div>\n";
396 + } else { // ohne CSS-Sprites.
397 + $out1 .= "<img class='wp-forecast-fc-left' src='" . esc_attr( $plugin_path ) . '/' . esc_attr( $w[ 'fc_dt_icon_' . $i ] ) . "' alt='" . wpf__( $w[ 'fc_dt_iconcode_' . $i ], $wpf_vars['wpf_language'] ) . "' width='$breite' height='$hoehe' />";
398 + }
399 + } else {
400 + $out1 .= "<i class='wpf-wi-icon wi " . esc_attr( $w[ 'fc_dt_iconcode_' . $i ] ) . "' style='color: " . $wpf_vars['fonticon_color'] . "'></i>\n";
401 + }
402 + } else {
403 + $out1 .= '&nbsp;';
404 + }
405 + $out1 .= '<br />';
460 406
461 - $out1 .= "</div>\n"; // end of wp-forecast-fc
407 + // show windicon.
408 + if ( isset( $wpf_vars['windicon'] ) && '1' == $wpf_vars['windicon'] ) {
409 + if ( ! $wpf_vars['fonticon'] ) {
410 + $breite = 48;
411 + $hoehe = 48;
412 + $wind_icon_url = $plugin_path . '/icons/wpf-' . $w[ 'fc_dt_winddir_orig_' . $i ] . '.png';
413 + $out1 .= "<img src='" . esc_url( $wind_icon_url ) . "' alt='" . esc_attr( $w[ 'fc_dt_winddir_' . $i ] ) . "' width='" . esc_attr( $breite ) . "' height='" . esc_attr( $hoehe ) . "' />\n";
414 + } else {
415 + $out1 .= "<i class='wpf-wi-icon wi wi-wind wi-from-" . esc_attr( strtolower( $w[ 'fc_dt_winddir_orig_' . $i ] ) ) . "' style='color: " . $wpf_vars['fonticon_color'] . "'></i>\n";
416 + }
417 + }
462 418
463 - //
464 - // wrap a div around for pulldown and switch off complete forecast
465 - //
466 - // mark ids: wpfbl wpfc1 wpfc2 wpfbm with widget id have disjunct ods when using more than one pulldown widget
467 - if ( $pdforecast == 1 ) {
468 - $out1 .= "<div class='wpff_nav' id='wpfbl".$wpfcid."' onclick=\"document.getElementById('wpfc1".$wpfcid."').style.display='none';document.getElementById('wpfc2".$wpfcid."').style.display='block';return false;\">" . __("Less forecast...","wp-forecast_" . $wpf_language) . "</div>\n";
469 - $out1 = "<div class='wpff_nav' id='wpfbl".$wpfcid."' onclick=\"document.getElementById('wpfc1".$wpfcid."').style.display='none';document.getElementById('wpfc2".$wpfcid."').style.display='block';return false;\">" . __("Less forecast...","wp-forecast_" . $wpf_language) . "</div>\n" . $out1;
470 - $out2 .= "<div class='wpff_nav' id='wpfbm".$wpfcid."' onclick=\"document.getElementById('wpfc2".$wpfcid."').style.display='none';document.getElementById('wpfc1".$wpfcid."').style.display='block';return false;\">" . __("More forecast...","wp-forecast_" . $wpf_language) . "</div>\n";
471 -
472 - $out1 = '<div id="wpfc1'.$wpfcid.'" style="display:none;">' . $out1 . "</div>\n";
473 - $out2 = '<div id="wpfc2'.$wpfcid.'" style="display:block;">' . $out2 . "</div>\n";
474 - }
475 -
476 -
477 - // print it
478 - if ( $show_from_widget == 1 )
479 - echo $before_widget . $before_title . $title . $after_title;
480 -
481 - echo '<div id="wp-forecast'.$wpfcid.'" class="wp-forecast">' . $fout . $out . $out1 . $out2 . '</div>'."\n";
482 - // to come back to theme floating status
483 - echo '<div style="clear:inherit;">&nbsp;</div>';
484 -
485 - if ( $show_from_widget == 1 )
486 - echo $after_widget;
487 -
488 - pdebug(1,"End of show ()");
489 -
419 + $out1 .= "\n</div>\n"; // end of wp-forecast-fc-left.
420 + $out1 .= "<div class='wp-forecast-fc-right'>";
421 +
422 + // show short description.
423 + if ( substr( $wpf_vars['dispconfig'], 11, 1 ) == '1' ) {
424 + $out1 .= '<div>' . esc_attr( wpf__( $w[ 'fc_dt_desc_' . $i ], $wpf_vars['wpf_language'] ) ) . '</div>';
425 + }
426 +
427 + // show temperature.
428 + if ( substr( $wpf_vars['dispconfig'], 12, 1 ) == '1' ) {
429 + $out1 .= '<div>';
430 + $out1 .= esc_attr( $w[ 'fc_dt_htemp_' . $i ] ) . '</div>';
431 + }
432 +
433 + // show wind.
434 + if ( substr( $wpf_vars['dispconfig'], 13, 1 ) == '1' ) {
435 + $out1 .= '<div>' . wpf__( 'Winds', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w[ 'fc_dt_windspeed_' . $i ] ) . ' ' . esc_attr( $w[ 'fc_dt_winddir_' . $i ] ) . '</div>';
436 + }
437 +
438 + // show precipitation.
439 + if ( substr( $wpf_vars['dispconfig'], 31, 1 ) == '1' ) {
440 + $intensestr = $w[ 'fc_dt_precipIntensity' . $i ];
441 + if ( 'mm' == $w['un_prec'] ) {
442 + $intensestr = round( $w[ 'fc_dt_precipIntensity' . $i ] * 2.54 * 10, 1 );
443 + }
444 + $precipstr = '<span class="wp-forecast-precipIntense">' . esc_attr( $intensestr ) . esc_attr( $w['un_prec'] ) . '</span>';
445 + $precipstr .= ' / <span class="wp-forecast-precipProb">' . esc_attr( $w[ 'fc_dt_precipProbability' . $i ] ) . '%</span>';
446 + if ( '' != $w[ 'fc_dt_precipType' . $i ] ) {
447 + $precipstr .= ' / <span class="wp-forecast-precipType">' . wpf__( $w[ 'fc_dt_precipType' . $i ], $wpf_vars['wpf_language'] ) . '</span>';
448 + }
449 + $out1 .= '<div>' . wpf__( 'Precip.', $wpf_vars['wpf_language'] ) . ': ' . $precipstr . "</div>\n";
450 + }
451 +
452 + if ( substr( $wpf_vars['dispconfig'], 23, 1 ) == '1' ) {
453 + $out1 .= '<div>' . wpf__( 'Windgusts', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w[ 'fc_dt_wgusts_' . $i ] ) . "</div>\n";
454 + }
455 + // show max uv index.
456 +
457 + if ( substr( $wpf_vars['dispconfig'], 28, 1 ) == '1' ) {
458 + $out1 .= '<div>' . wpf__( 'max. UV index', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w[ 'fc_dt_maxuv_' . $i ] ) . "</div>\n";
459 + }
460 + $out1 .= "</div></div>\n"; // end of wp-forecast-fc-right / block.
461 +
462 + }
463 + // check for nighttime information.
464 +
465 + if ( substr( $wpf_vars['nighttime'], $i - 1, 1 ) == '1' ) {
466 + $out1 .= "<div class=\"wp-forecast-fc-block\">\n";
467 + $out1 .= "<div class=\"wp-forecast-fc-left\">\n";
468 + $out1 .= '<div>' . wpf__( 'Night', $wpf_vars['wpf_language'] ) . "</div>\n";
469 +
470 + if ( substr( $wpf_vars['dispconfig'], 14, 1 ) == '1' ) {
471 + $iconfile = find_icon( $w[ 'fc_nt_icon_' . $i ] );
472 + $breite = 64;
473 + $hoehe = 40;
474 +
475 + if ( ! $wpf_vars['fonticon'] ) {
476 + if ( file_exists( plugin_dir_path( __FILE__ ) . '/' . $w[ 'fc_nt_icon_' . $i ] ) ) {
477 + $isize = getimagesize( plugin_dir_path( __FILE__ ) . '/' . $w[ 'fc_nt_icon_' . $i ] );
478 +
479 + if ( false != $isize ) {
480 + $breite = $isize[0];
481 + $hoehe = $isize[1];
482 + }
483 + }
484 +
485 + if ( 1 == $wpf_vars['csssprites'] ) { // mit CSS Sprites.
486 + $cssid = substr( $w[ 'fc_nt_icon_' . $i ], strpos( $w[ 'fc_nt_icon_' . $i ], '/' ) + 1, strrpos( $w[ 'fc_nt_icon_' . $i ], '.' ) - strpos( $w[ 'fc_nt_icon_' . $i ], '/' ) - 1 );
487 + $out1 .= "<div class='wp-forecast-curr-left wpfico" . esc_attr( $cssid ) . "'>&nbsp;</div>\n";
488 + } else { // ohne CSS-Sprites.
489 + $out1 .= "<img class='wp-forecast-fc-left' src='" . esc_attr( $plugin_path ) . '/' . esc_attr( $w[ 'fc_nt_icon_' . $i ] ) . "' alt='" . wpf__( $w[ 'fc_nt_iconcode_' . $i ], $wpf_vars['wpf_language'] ) . "' width='$breite' height='$hoehe' />";
490 + }
491 + } else {
492 + $out1 .= "<i class='wpf-wi-icon wi " . esc_attr( $w[ 'fc_nt_iconcode_' . $i ] ) . "' style='color: " . $wpf_vars['fonticon_color'] . "'></i>\n";
493 + }
494 + } else {
495 + $out1 .= '&nbsp;';
496 + }
497 + $out1 .= '<br />';
498 +
499 + // show windicon.
500 + if ( isset( $wpf_vars['windicon'] ) && '1' == $wpf_vars['windicon'] ) {
501 + if ( ! $wpf_vars['fonticon'] ) {
502 + $breite = 48;
503 + $hoehe = 48;
504 + $wind_icon_url = $plugin_path . '/icons/wpf-' . $w[ 'fc_nt_winddir_orig_' . $i ] . '.png';
505 + $out1 .= "<img src='" . esc_url( $wind_icon_url ) . "' alt='" . esc_attr( $w[ 'fc_nt_winddir_' . $i ] ) . "' width='" . esc_attr( $breite ) . "' height='" . esc_attr( $hoehe ) . "' />\n";
506 + } else {
507 + $out1 .= "<i class='wpf-wi-icon wi wi-wind wi-from-" . esc_attr( strtolower( $w[ 'fc_nt_winddir_orig_' . $i ] ) ) . "' style='color: " . $wpf_vars['fonticon_color'] . "'></i>\n";
508 + }
509 + }
510 + $out1 .= "\n</div>\n<div class='wp-forecast-fc-right'>";
511 +
512 + // show short description.
513 + if ( substr( $wpf_vars['dispconfig'], 15, 1 ) == '1' ) {
514 + $out1 .= '<div>' . esc_attr( wpf__( $w[ 'fc_nt_desc_' . $i ], $wpf_vars['wpf_language'] ) ) . '</div>';
515 + }
516 +
517 + // show temperature.
518 + if ( substr( $wpf_vars['dispconfig'], 16, 1 ) == '1' ) {
519 + $out1 .= '<div>' . esc_attr( $w[ 'fc_nt_ltemp_' . $i ] ) . '</div>';
520 + }
521 +
522 + // show wind.
523 + if ( substr( $wpf_vars['dispconfig'], 17, 1 ) == '1' ) {
524 + $out1 .= '<div>' . wpf__( 'Winds', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w[ 'fc_nt_windspeed_' . $i ] ) . ' ' . esc_attr( $w[ 'fc_nt_winddir_' . $i ] ) . '</div>';
525 + }
526 +
527 + // show windgusts.
528 + if ( substr( $wpf_vars['dispconfig'], 24, 1 ) == '1' ) {
529 + $out1 .= '<div>' . wpf__( 'Windgusts', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w[ 'fc_nt_wgusts_' . $i ] ) . "</div>\n";
530 + }
531 +
532 + // show max uv index.
533 + if ( substr( $wpf_vars['dispconfig'], 29, 1 ) == '1' ) {
534 + $out1 .= '<div>' . wpf__( 'max. UV-Index', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w[ 'fc_nt_maxuv_' . $i ] ) . "</div>\n";
535 + }
536 + $out1 .= "</div></div>\n"; // end of wp-forecast-fc-right / block.
537 + }
538 + // close div block.
539 +
540 + if ( substr( $wpf_vars['daytime'], $i - 1, 1 ) == '1' || substr( $wpf_vars['nighttime'], $i - 1, 1 ) == '1' ) {
541 + $out1 .= "</div>\n";
542 + }
543 + // store first shown forecast in case pulldown is active.
544 +
545 + if ( isset( $wpf_vars['pdforecast'] ) && 1 == $wpf_vars['pdforecast'] && $wpf_vars['pdfirstday'] == $i ) {
546 + $out2 = $out1 . "</div>\n";
547 + }
548 + }
549 + $out1 .= "</div>\n"; // end of wp-forecast-fc.
550 +
551 + // wrap a div around for pulldown and switch off complete forecast.
552 +
553 + // mark ids: wpfbl wpfc1 wpfc2 wpfbm with widget id have disjunct ods when using more than one pulldown widget.
554 + if ( isset( $wpf_vars['pdforecast'] ) && 1 == $wpf_vars['pdforecast'] ) {
555 + $out1 .= "<div class='wpff_nav' id='wpfbl1" . esc_attr( $wpfcid ) . "' onclick=\"document.getElementById('wpfc1" . esc_attr( $wpfcid ) . "').style.display='none';document.getElementById('wpfc2" . $wpfcid . "').style.display='block';return false;\">" . wpf__( 'Less forecast...', $wpf_vars['wpf_language'] ) . "</div>\n";
556 + $out1 = "<div class='wpff_nav' id='wpfbl2" . esc_attr( $wpfcid ) . "' onclick=\"document.getElementById('wpfc1" . esc_attr( $wpfcid ) . "').style.display='none';document.getElementById('wpfc2" . $wpfcid . "').style.display='block';return false;\">" . wpf__( 'Less forecast...', $wpf_vars['wpf_language'] ) . "</div>\n" . $out1;
557 + $out2 .= "<div class='wpff_nav' id='wpfbm" . esc_attr( $wpfcid ) . "' onclick=\"document.getElementById('wpfc2" . esc_attr( $wpfcid ) . "').style.display='none';document.getElementById('wpfc1" . $wpfcid . "').style.display='block';return false;\">" . wpf__( 'More forecast...', $wpf_vars['wpf_language'] ) . "</div>\n";
558 + $out1 = '<div id="wpfc1' . esc_attr( $wpfcid ) . '" style="display:none;">' . $out1 . "</div>\n";
559 + $out2 = '<div id="wpfc2' . esc_attr( $wpfcid ) . '" style="display:block;">' . $out2 . "</div>\n";
560 + }
561 +
562 + // print it.
563 + if ( 1 == $show_from_widget ) {
564 + echo wp_kses( $args['before_widget'] . $args['before_title'] . $wpf_vars['title'] . $args['after_title'], wpf_allowed_tags() );
565 + }
566 + echo '<div id="wp-forecast' . esc_attr( $wpfcid ) . '" class="wp-forecast">' . wp_kses( $fout . $out . $out1 . $out2, wpf_allowed_tags() ) . '</div>' . "\n";
567 + // if called as iframe hide pulldown content.
568 + if ( 0 == $show_from_widget && 1 == $wpf_vars['pdforecast'] ) {
569 + echo "<script>document.getElementById('wpfc1" . esc_attr( $wpfcid ) . "').style.display='none';document.getElementById('wpfc2" . esc_attr( $wpfcid ) . "').style.display='block';</script>";
570 + }
571 + // to come back to theme floating status.
572 + echo '<div style="clear:inherit;">&nbsp;</div>';
573 +
574 + if ( 1 == $show_from_widget ) {
575 + echo wp_kses( $args['after_widget'], wpf_allowed_tags() );
576 + }
490 577 }
491 -?>