v1.0.0
This commit is contained in:
commit
06153e387d
47 changed files with 5116 additions and 0 deletions
47
templates/current.php
Normal file
47
templates/current.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
/**
|
||||
* Current conditions template.
|
||||
*
|
||||
* @var array<string,mixed> $data Normalized current conditions.
|
||||
*
|
||||
* @package FontdelboscEltemps
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$fontdelbosc_night = Fontdelbosc_Conditions::is_night( (int) wp_date( 'G', (int) ( $data['time'] ?? time() ) ) );
|
||||
$fontdelbosc_show_attribution = ! empty( Fontdelbosc_Plugin::get_options()['display_attribution'] );
|
||||
?>
|
||||
<div class="fdb-weather fdb-current">
|
||||
<div class="fdb-current__main">
|
||||
<?php if ( ! empty( $data['condition'] ) ) : ?>
|
||||
<img class="fdb-icon fdb-icon--lg" src="<?php echo esc_url( Fontdelbosc_Conditions::icon( (string) $data['condition'], $fontdelbosc_night ) ); ?>" alt="" width="96" height="96" loading="lazy" />
|
||||
<?php endif; ?>
|
||||
<?php if ( null !== $data['temperature'] ) : ?>
|
||||
<span class="fdb-current__temp"><?php echo esc_html( number_format_i18n( round( (float) $data['temperature'] ) ) ); ?>°C</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if ( ! empty( $data['condition'] ) ) : ?>
|
||||
<p class="fdb-current__label"><?php echo esc_html( Fontdelbosc_Conditions::label( (string) $data['condition'] ) ); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<ul class="fdb-current__meta">
|
||||
<?php if ( null !== $data['apparent'] ) : ?>
|
||||
<li><?php echo esc_html__( 'Feels like', 'fontdelbosc-eltemps' ); ?>: <?php echo esc_html( number_format_i18n( round( (float) $data['apparent'] ) ) ); ?>°C</li>
|
||||
<?php endif; ?>
|
||||
<?php if ( null !== $data['humidity'] ) : ?>
|
||||
<li><?php echo esc_html__( 'Humidity', 'fontdelbosc-eltemps' ); ?>: <?php echo esc_html( number_format_i18n( (float) $data['humidity'] ) ); ?>%</li>
|
||||
<?php endif; ?>
|
||||
<?php if ( null !== $data['wind_speed'] ) : ?>
|
||||
<li><?php echo esc_html__( 'Wind', 'fontdelbosc-eltemps' ); ?>: <?php echo esc_html( number_format_i18n( round( (float) $data['wind_speed'] ) ) ); ?> km/h</li>
|
||||
<?php endif; ?>
|
||||
<?php if ( null !== $data['precipitation'] ) : ?>
|
||||
<li><?php echo esc_html__( 'Precipitation', 'fontdelbosc-eltemps' ); ?>: <?php echo esc_html( number_format_i18n( (float) $data['precipitation'], 1 ) ); ?> mm</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
|
||||
<?php if ( $fontdelbosc_show_attribution ) : ?>
|
||||
<p class="fdb-attribution"><?php echo esc_html( Fontdelbosc_Data_Manager::attribution( (string) $data['source'] ) ); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
Loading…
Reference in a new issue