v1.0.0
This commit is contained in:
commit
e1f5a47c96
22 changed files with 3155 additions and 0 deletions
56
templates/station-list.php
Normal file
56
templates/station-list.php
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
/**
|
||||
* Station list template (card grid).
|
||||
*
|
||||
* @package FontdelboscCombustible
|
||||
*/
|
||||
|
||||
declare( strict_types=1 );
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Template data.
|
||||
*
|
||||
* @var array{stations:array<int,array<mixed>>,fecha:string,stale:bool,radius:int,fuels:array<int>,fields:array<int,string>} $fontdelbosc_data
|
||||
*/
|
||||
?>
|
||||
<div class="fdbc-list">
|
||||
<?php if ( array() === $fontdelbosc_data['stations'] ) : ?>
|
||||
<p class="fdbc-list__empty">
|
||||
<?php
|
||||
/* translators: %d: search radius in kilometers. */
|
||||
echo esc_html( sprintf( __( 'No stations found within %d km.', 'fontdelbosc-combustible' ), $fontdelbosc_data['radius'] ) );
|
||||
?>
|
||||
</p>
|
||||
<?php else : ?>
|
||||
<ul class="fdbc-list__items">
|
||||
<?php foreach ( $fontdelbosc_data['stations'] as $fontdelbosc_station ) : ?>
|
||||
<li class="fdbc-list__item"><?php echo wp_kses_post( Fontdelbosc_Combustible_Shortcode::view( 'station-card', array( 'station' => $fontdelbosc_station ) ) ); ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( '' !== $fontdelbosc_data['fecha'] ) : ?>
|
||||
<p class="fdbc-list__updated">
|
||||
<?php
|
||||
/* translators: %s: data timestamp from the API. */
|
||||
echo esc_html( sprintf( __( 'Last update: %s', 'fontdelbosc-combustible' ), $fontdelbosc_data['fecha'] ) );
|
||||
?>
|
||||
<?php if ( $fontdelbosc_data['stale'] ) : ?>
|
||||
<em><?php esc_html_e( 'Showing cached data.', 'fontdelbosc-combustible' ); ?></em>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
<?php elseif ( array() === $fontdelbosc_data['stations'] ) : ?>
|
||||
<p class="fdbc-list__updated"><?php esc_html_e( 'Data unavailable.', 'fontdelbosc-combustible' ); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<details class="fdbc-list__source">
|
||||
<summary><?php esc_html_e( 'Source: Ministry of Ecological Transition (MITECO), Spain.', 'fontdelbosc-combustible' ); ?></summary>
|
||||
<p>
|
||||
<a href="https://datos.gob.es/es/catalogo/e05068001-precio-de-carburantes-en-las-gasolineras-espanolas" rel="nofollow noopener" target="_blank">
|
||||
<?php esc_html_e( 'Open data catalog (datos.gob.es)', 'fontdelbosc-combustible' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
</details>
|
||||
</div>
|
||||
Loading…
Reference in a new issue