This commit is contained in:
Javier Casares 2026-10-12 11:55:23 +00:00
commit 06153e387d
47 changed files with 5116 additions and 0 deletions

View file

@ -0,0 +1,43 @@
<?php
/**
* Hourly forecast template (horizontally scrollable strip).
*
* @var array<string,mixed> $data Normalized hourly forecast.
*
* @package FontdelboscEltemps
*/
defined( 'ABSPATH' ) || exit;
$fontdelbosc_show_attribution = ! empty( Fontdelbosc_Plugin::get_options()['display_attribution'] );
?>
<div class="fdb-weather fdb-hourly">
<h3 class="fdb-weather__title"><?php esc_html_e( 'Forecast', 'fontdelbosc-eltemps' ); ?></h3>
<div class="fdb-hourly__scroll">
<?php foreach ( $data['hours'] as $fontdelbosc_hour ) : ?>
<?php $fontdelbosc_night = Fontdelbosc_Conditions::is_night( (int) $fontdelbosc_hour['hour'] ); ?>
<div class="fdb-hourly__item">
<span class="fdb-hourly__time"><?php echo esc_html( sprintf( '%02d:00', (int) $fontdelbosc_hour['hour'] ) ); ?></span>
<?php if ( ! empty( $fontdelbosc_hour['condition'] ) ) : ?>
<img class="fdb-icon" src="<?php echo esc_url( Fontdelbosc_Conditions::icon( (string) $fontdelbosc_hour['condition'], $fontdelbosc_night ) ); ?>" alt="" width="48" height="48" loading="lazy" />
<?php else : ?>
<span class="fdb-hourly__icon-placeholder"></span>
<?php endif; ?>
<?php if ( null !== $fontdelbosc_hour['temperature'] ) : ?>
<span class="fdb-hourly__temp"><?php echo esc_html( number_format_i18n( round( (float) $fontdelbosc_hour['temperature'] ) ) ); ?>°</span>
<?php endif; ?>
<?php if ( null !== $fontdelbosc_hour['pop'] ) : ?>
<span class="fdb-hourly__pop"><?php echo esc_html( number_format_i18n( (float) $fontdelbosc_hour['pop'] ) ); ?>%</span>
<?php endif; ?>
<?php if ( null !== $fontdelbosc_hour['wind'] ) : ?>
<span class="fdb-hourly__wind"><?php echo esc_html( number_format_i18n( round( (float) $fontdelbosc_hour['wind'] ) ) ); ?> km/h</span>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<?php if ( $fontdelbosc_show_attribution ) : ?>
<p class="fdb-attribution"><?php echo esc_html( Fontdelbosc_Data_Manager::attribution( (string) $data['source'] ) ); ?></p>
<?php endif; ?>
</div>