';
if ( '' == $w['location'] || ( isset( $wpf_vars['visitorlocation'] ) && 1 == $wpf_vars['visitorlocation'] ) ) {
$out .= '
' . $servicelink . esc_attr( $w['locname'] ) . $servicelink_end . "
\n";
} elseif ( '' != trim( $w['location'] ) && ' ' != $w['location'] ) {
$out .= '
' . $servicelink . esc_attr( $w['location'] ) . $servicelink_end . "
\n";
}
// show date / time.
// if current time should be used.
if ( '1' == $wpf_vars['currtime'] ) {
$cd = $w['blogdate'];
$ct = $w['blogtime'];
} else {
// else take given weather time.
$cd = $w['accudate'];
$ct = $w['accutime'];
}
if ( substr( $wpf_vars['dispconfig'], 18, 1 ) == '1' || substr( $wpf_vars['dispconfig'], 1, 1 ) == '1' ) {
$out .= '
';
if ( substr( $wpf_vars['dispconfig'], 18, 1 ) == '1' ) {
$out .= esc_attr( $cd );
} else {
$out .= wpf__( 'time', $wpf_language ) . ': ';
}
if ( substr( $wpf_vars['dispconfig'], 18, 1 ) == '1' && substr( $wpf_vars['dispconfig'], 1, 1 ) == '1' ) {
$out .= ', ';
}
if ( substr( $wpf_vars['dispconfig'], 1, 1 ) == '1' ) {
$out .= esc_attr( $ct );
}
$out .= "
\n";
}
$out .= "
\n";
$out .= '';
// show icon.
$out .= "
";
if ( substr( $wpf_vars['dispconfig'], 0, 1 ) == '1' ) {
$breite = 0;
$hoehe = 0;
if ( ! $wpf_vars['fonticon'] ) {
if ( file_exists( plugin_dir_path( __FILE__ ) . '/' . $w['icon'] ) ) {
$isize = getimagesize( plugin_dir_path( __FILE__ ) . '/' . $w['icon'] );
if ( false != $isize ) {
$breite = $isize[0];
$hoehe = $isize[1];
}
}
if ( 1 == $wpf_vars['csssprites'] ) { // mit CSS Sprites.
$cssid = substr( $w['icon'], strpos( $w['icon'], '/' ) + 1, strrpos( $w['icon'], '.' ) - strpos( $w['icon'], '/' ) - 1 );
$out .= "
\n";
} else { // ohne CSS-Sprites.
$out .= "
 . )
\n";
}
} else {
$out .= "
\n";
}
}
$out .= '
';
// show windicon.
if ( '1' == $wpf_vars['windicon'] ) {
if ( ! $wpf_vars['fonticon'] ) {
$breite = 48;
$hoehe = 48;
$wind_icon_url = $plugin_path . '/icons/wpf-' . $w['winddir_orig'] . '.png';
$out .= "
 . ")
\n";
} else {
$out .= "
\n";
}
}
$out .= '
';
$out .= "
";
$out .= '
';
// show short description.
if ( substr( $wpf_vars['dispconfig'], 2, 1 ) == '1' ) {
$out .= esc_attr( wpf__( $w['shorttext'], $wpf_vars['wpf_language'] ) ) . '
';
}
// show temperatur.
if ( substr( $wpf_vars['dispconfig'], 3, 1 ) == '1' ) {
$out .= esc_attr( $w['temperature'] );
}
$out .= '
';
// show wind on the right side if windicon is active.
if ( '1' == $wpf_vars['windicon'] ) {
$out .= '
' . esc_attr( $w['windspeed'] ) . "
\n";
}
$out .= "
\n"; // end of right.
$out .= "
\n"; // end of block.
$out .= '';
// show realfeel.
if ( substr( $wpf_vars['dispconfig'], 4, 1 ) == '1' ) {
$out .= '
' . wpf__( 'Apparent', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w['realfeel'] ) . "
\n";
}
// show pressure.
if ( substr( $wpf_vars['dispconfig'], 5, 1 ) == '1' ) {
$out .= '
' . wpf__( 'Pressure', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w['pressure'] ) . "
\n";
}
// show humiditiy.
if ( substr( $wpf_vars['dispconfig'], 6, 1 ) == '1' ) {
// you can change the decimals of humditiy by switching.
// the 0 to whatever you need.
$out .= '
' . wpf__( 'Humidity', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w['humidity'] ) . "%
\n";
}
// show wind.
if ( substr( $wpf_vars['dispconfig'], 7, 1 ) == '1' ) {
$out .= '
' . wpf__( 'Winds', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w['windspeed'] ) . ' ' . esc_attr( $w['winddir'] ) . "
\n";
}
// show windgusts.
if ( substr( $wpf_vars['dispconfig'], 22, 1 ) == '1' ) {
$out .= '
' . wpf__( 'Windgusts', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w['windgusts'] ) . "
\n";
}
// show uvindex.
if ( substr( $wpf_vars['dispconfig'], 27, 1 ) == '1' && trim( $wpf_vars['ouv_apikey'] ) == '' ) {
$out .= '
' . wpf__( 'UV-Index', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w['uvindex'] ) . "
\n";
}
// show precipitation.
if ( substr( $wpf_vars['dispconfig'], 30, 1 ) == '1' ) {
$intensestr = $w['precipIntensity'];
if ( 'mm' == $w['un_prec'] ) {
$intensestr = round( $w['precipIntensity'] * 2.54 * 10, 1 );
}
$precipstr = '
' . esc_attr( $intensestr ) . esc_attr( $w['un_prec'] ) . '';
$precipstr .= ' /
' . esc_attr( $w['precipProbability'] ) . '%';
if ( '' != $w['precipType'] ) {
$precipstr .= ' /
' . wpf__( $w['precipType'], $wpf_language ) . '';
}
$out .= '
' . wpf__( 'Precip.', $wpf_language ) . ': ' . $precipstr . "
\n";
}
// show sunrise.
if ( substr( $wpf_vars['dispconfig'], 8, 1 ) == '1' ) {
$out .= '
' . wpf__( 'Sunrise', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w['sunrise'] ) . "
\n";
}
// show sunset.
if ( substr( $wpf_vars['dispconfig'], 9, 1 ) == '1' ) {
$out .= '
' . wpf__( 'Sunset', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w['sunset'] ) . "
\n";
}
// show data from OpenUV.io if applicable.
if ( isset( $wpf_vars['ouv_apikey'] ) && trim( $wpf_vars['ouv_apikey'] ) != '' ) {
if ( $wpf_vars['ouv_uv'] ) {
$out .= '
' . wpf__( 'Current UV index', $wpf_language ) . ': ' . esc_attr( $w['openuv']['uv'] ) . "
\n";
}
if ( $wpf_vars['ouv_uvmax'] ) {
$out .= '
' . wpf__( 'Max. UV index', $wpf_language ) . ': ' . esc_attr( $w['openuv']['uv_max'] ) . "
\n";
}
if ( $wpf_vars['ouv_ozone'] ) {
$out .= '
' . wpf__( 'Ozone', $wpf_language ) . ': ' . esc_attr( $w['openuv']['ozone'] ) . " DU
\n";
}
if ( $wpf_vars['ouv_safetime'] ) {
$j = 1;
foreach ( $w['openuv']['safe_exposure_time'] as $set ) {
if ( trim( $set ) != '' ) {
$out .= '
' . wpf_esc_attr__( 'Safe Exposure Time for Skin Type', $wpf_language ) . " $j: " . esc_attr( $set ) . " Min.
\n";
} else {
$out .= '
' . wpf_esc_attr__( 'Safe Exposure Time for Skin Type', $wpf_language ) . " $j: ∞ Min.
\n";
}
$j++;
}
}
$out .= '
' . wpf_esc_attr__( $w['openuv']['copyright'], $wpf_language ) . '
';
}
// show copyright.
if ( substr( $wpf_vars['dispconfig'], 21, 1 ) == '1' ) {
$out .= '
' . $w['copyright'] . '
';
}
$out .= "
\n"; // end of details.
$out .= "\n"; // end of curr.
}
// ------------------
// output forecast.
// -------------------
// calc max forecast days depending on provider.
$maxdays = 7; // for openweathermap v3.
if ( 'openmeteo' == $wpf_vars['service'] ) {
$maxdays = 6;
}
if ( 'openweathermap' == $wpf_vars['service'] ) {
$maxdays = 5;
}
$out1 = "\n";
$out2 = '';
for ( $i = 1;$i <= $maxdays;$i++ ) {
// check active forecast for day number i.
if ( ! isset( $w[ 'fc_obsdate_' . $i ] ) || trim( $w[ 'fc_obsdate_' . $i ] ) == '' ) {
continue;
}
if ( substr( $wpf_vars['daytime'], $i - 1, 1 ) == '1' || substr( $wpf_vars['nighttime'], $i - 1, 1 ) == '1' ) {
$out1 .= "
\n";
$out1 .= '
';
$out1 .= '
' . wpf__( 'Forecast', $wpf_vars['wpf_language'] ) . '
';
$out1 .= ' ' . esc_attr( $w[ 'fc_obsdate_' . $i ] ) . "
\n";
}
// check for daytime information.
if ( substr( $wpf_vars['daytime'], $i - 1, 1 ) == '1' ) {
$out1 .= "
\n";
$out1 .= "
\n";
$out1 .= '
' . wpf__( 'Day', $wpf_vars['wpf_language'] ) . "
\n";
// show icon.
if ( substr( $wpf_vars['dispconfig'], 10, 1 ) == '1' ) {
$breite = 0;
$hoehe = 0;
if ( ! $wpf_vars['fonticon'] ) {
if ( file_exists( plugin_dir_path( __FILE__ ) . '/' . $w[ 'fc_dt_icon_' . $i ] ) ) {
$isize = getimagesize( plugin_dir_path( __FILE__ ) . '/' . $w[ 'fc_dt_icon_' . $i ] );
if ( false != $isize ) {
$breite = $isize[0];
$hoehe = $isize[1];
}
}
if ( 1 == $wpf_vars['csssprites'] ) { // mit CSS Sprites.
$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 );
$out1 .= "
\n";
} else { // ohne CSS-Sprites.
$out1 .= "
 . )
";
}
} else {
$out1 .= "
\n";
}
} else {
$out1 .= ' ';
}
$out1 .= '
';
// show windicon.
if ( isset( $wpf_vars['windicon'] ) && '1' == $wpf_vars['windicon'] ) {
if ( ! $wpf_vars['fonticon'] ) {
$breite = 48;
$hoehe = 48;
$wind_icon_url = $plugin_path . '/icons/wpf-' . $w[ 'fc_dt_winddir_orig_' . $i ] . '.png';
$out1 .= "
 . ")
\n";
} else {
$out1 .= "
\n";
}
}
$out1 .= "\n
\n"; // end of wp-forecast-fc-left.
$out1 .= "
";
// show short description.
if ( substr( $wpf_vars['dispconfig'], 11, 1 ) == '1' ) {
$out1 .= '
' . esc_attr( wpf__( $w[ 'fc_dt_desc_' . $i ], $wpf_vars['wpf_language'] ) ) . '
';
}
// show temperature.
if ( substr( $wpf_vars['dispconfig'], 12, 1 ) == '1' ) {
$out1 .= '
';
$out1 .= esc_attr( $w[ 'fc_dt_htemp_' . $i ] ) . '
';
}
// show wind.
if ( substr( $wpf_vars['dispconfig'], 13, 1 ) == '1' ) {
$out1 .= '
' . wpf__( 'Winds', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w[ 'fc_dt_windspeed_' . $i ] ) . ' ' . esc_attr( $w[ 'fc_dt_winddir_' . $i ] ) . '
';
}
// show precipitation.
if ( substr( $wpf_vars['dispconfig'], 31, 1 ) == '1' ) {
$intensestr = $w[ 'fc_dt_precipIntensity' . $i ];
if ( 'mm' == $w['un_prec'] ) {
$intensestr = round( $w[ 'fc_dt_precipIntensity' . $i ] * 2.54 * 10, 1 );
}
$precipstr = '
' . esc_attr( $intensestr ) . esc_attr( $w['un_prec'] ) . '';
$precipstr .= ' /
' . esc_attr( $w[ 'fc_dt_precipProbability' . $i ] ) . '%';
if ( '' != $w[ 'fc_dt_precipType' . $i ] ) {
$precipstr .= ' /
' . wpf__( $w[ 'fc_dt_precipType' . $i ], $wpf_vars['wpf_language'] ) . '';
}
$out1 .= '
' . wpf__( 'Precip.', $wpf_vars['wpf_language'] ) . ': ' . $precipstr . "
\n";
}
if ( substr( $wpf_vars['dispconfig'], 23, 1 ) == '1' ) {
$out1 .= '
' . wpf__( 'Windgusts', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w[ 'fc_dt_wgusts_' . $i ] ) . "
\n";
}
// show max uv index.
if ( substr( $wpf_vars['dispconfig'], 28, 1 ) == '1' ) {
$out1 .= '
' . wpf__( 'max. UV index', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w[ 'fc_dt_maxuv_' . $i ] ) . "
\n";
}
$out1 .= "
\n"; // end of wp-forecast-fc-right / block.
}
// check for nighttime information.
if ( substr( $wpf_vars['nighttime'], $i - 1, 1 ) == '1' ) {
$out1 .= "
\n";
$out1 .= "
\n";
$out1 .= '
' . wpf__( 'Night', $wpf_vars['wpf_language'] ) . "
\n";
if ( substr( $wpf_vars['dispconfig'], 14, 1 ) == '1' ) {
$iconfile = find_icon( $w[ 'fc_nt_icon_' . $i ] );
$breite = 64;
$hoehe = 40;
if ( ! $wpf_vars['fonticon'] ) {
if ( file_exists( plugin_dir_path( __FILE__ ) . '/' . $w[ 'fc_nt_icon_' . $i ] ) ) {
$isize = getimagesize( plugin_dir_path( __FILE__ ) . '/' . $w[ 'fc_nt_icon_' . $i ] );
if ( false != $isize ) {
$breite = $isize[0];
$hoehe = $isize[1];
}
}
if ( 1 == $wpf_vars['csssprites'] ) { // mit CSS Sprites.
$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 );
$out1 .= "
\n";
} else { // ohne CSS-Sprites.
$out1 .= "
 . )
";
}
} else {
$out1 .= "
\n";
}
} else {
$out1 .= ' ';
}
$out1 .= '
';
// show windicon.
if ( isset( $wpf_vars['windicon'] ) && '1' == $wpf_vars['windicon'] ) {
if ( ! $wpf_vars['fonticon'] ) {
$breite = 48;
$hoehe = 48;
$wind_icon_url = $plugin_path . '/icons/wpf-' . $w[ 'fc_nt_winddir_orig_' . $i ] . '.png';
$out1 .= "
 . ")
\n";
} else {
$out1 .= "
\n";
}
}
$out1 .= "\n
\n
";
// show short description.
if ( substr( $wpf_vars['dispconfig'], 15, 1 ) == '1' ) {
$out1 .= '
' . esc_attr( wpf__( $w[ 'fc_nt_desc_' . $i ], $wpf_vars['wpf_language'] ) ) . '
';
}
// show temperature.
if ( substr( $wpf_vars['dispconfig'], 16, 1 ) == '1' ) {
$out1 .= '
' . esc_attr( $w[ 'fc_nt_ltemp_' . $i ] ) . '
';
}
// show wind.
if ( substr( $wpf_vars['dispconfig'], 17, 1 ) == '1' ) {
$out1 .= '
' . wpf__( 'Winds', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w[ 'fc_nt_windspeed_' . $i ] ) . ' ' . esc_attr( $w[ 'fc_nt_winddir_' . $i ] ) . '
';
}
// show windgusts.
if ( substr( $wpf_vars['dispconfig'], 24, 1 ) == '1' ) {
$out1 .= '
' . wpf__( 'Windgusts', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w[ 'fc_nt_wgusts_' . $i ] ) . "
\n";
}
// show max uv index.
if ( substr( $wpf_vars['dispconfig'], 29, 1 ) == '1' ) {
$out1 .= '
' . wpf__( 'max. UV-Index', $wpf_vars['wpf_language'] ) . ': ' . esc_attr( $w[ 'fc_nt_maxuv_' . $i ] ) . "
\n";
}
$out1 .= "
\n"; // end of wp-forecast-fc-right / block.
}
// close div block.
if ( substr( $wpf_vars['daytime'], $i - 1, 1 ) == '1' || substr( $wpf_vars['nighttime'], $i - 1, 1 ) == '1' ) {
$out1 .= "
\n";
}
// store first shown forecast in case pulldown is active.
if ( isset( $wpf_vars['pdforecast'] ) && 1 == $wpf_vars['pdforecast'] && $wpf_vars['pdfirstday'] == $i ) {
$out2 = $out1 . "
\n";
}
}
$out1 .= "\n"; // end of wp-forecast-fc.
// wrap a div around for pulldown and switch off complete forecast.
// mark ids: wpfbl wpfc1 wpfc2 wpfbm with widget id have disjunct ods when using more than one pulldown widget.
if ( isset( $wpf_vars['pdforecast'] ) && 1 == $wpf_vars['pdforecast'] ) {
$out1 .= "" . wpf__( 'Less forecast...', $wpf_vars['wpf_language'] ) . "
\n";
$out1 = "" . wpf__( 'Less forecast...', $wpf_vars['wpf_language'] ) . "
\n" . $out1;
$out2 .= "" . wpf__( 'More forecast...', $wpf_vars['wpf_language'] ) . "
\n";
$out1 = '' . $out1 . "
\n";
$out2 = '' . $out2 . "
\n";
}
// print it.
if ( 1 == $show_from_widget ) {
echo wp_kses( $args['before_widget'] . $args['before_title'] . $wpf_vars['title'] . $args['after_title'], wpf_allowed_tags() );
}
echo '' . wp_kses( $fout . $out . $out1 . $out2, wpf_allowed_tags() ) . '
' . "\n";
// if called as iframe hide pulldown content.
if ( 0 == $show_from_widget && 1 == $wpf_vars['pdforecast'] ) {
echo "";
}
// to come back to theme floating status.
echo '