112 lines
5.2 KiB
PHP
112 lines
5.2 KiB
PHP
<?php
|
||
/**
|
||
* ZBE cards view.
|
||
*
|
||
* @package Fontdelbosc_Transit
|
||
*
|
||
* @var array<string, mixed> $fontdelbosc_data Template data.
|
||
*/
|
||
|
||
defined( 'ABSPATH' ) || exit;
|
||
|
||
$fontdelbosc_zones = $fontdelbosc_data['zones'] ?? array();
|
||
$fontdelbosc_options = Fontdelbosc_Transit_Plugin::get_options();
|
||
?>
|
||
<section class="fdbt fdbt--zbe">
|
||
<h2 class="fdbt__title">
|
||
<?php esc_html_e( 'Low Emission Zones (ZBE)', 'fontdelbosc-transit' ); ?>
|
||
<?php if ( array() !== $fontdelbosc_zones ) : ?>
|
||
<span class="fdbt-count">
|
||
<?php
|
||
/* translators: %s: number of zones. */
|
||
echo esc_html( '(' . sprintf( _n( '%s zone', '%s zones', count( $fontdelbosc_zones ), 'fontdelbosc-transit' ), number_format_i18n( count( $fontdelbosc_zones ) ) ) . ')' );
|
||
?>
|
||
</span>
|
||
<?php endif; ?>
|
||
</h2>
|
||
|
||
<?php if ( ! empty( $fontdelbosc_options['show_zbe_2026_notice'] ) ) : ?>
|
||
<div class="fdbt-notice">
|
||
<span class="fdbt-notice__icon" aria-hidden="true"><?php echo Fontdelbosc_Transit_Shortcode::icon( 'info' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- trusted static SVG markup. ?></span>
|
||
<p><?php esc_html_e( 'From 1 January 2026, label B vehicles are banned in Catalan ZBEs when high-pollution protocols are activated.', 'fontdelbosc-transit' ); ?></p>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if ( array() === $fontdelbosc_zones ) : ?>
|
||
<p class="fdbt__empty fdbt__empty--unavailable">
|
||
<span class="fdbt-empty__icon fdbt-empty__icon--muted" aria-hidden="true"><?php echo Fontdelbosc_Transit_Shortcode::icon( 'info' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- trusted static SVG markup. ?></span>
|
||
<?php esc_html_e( 'Data unavailable.', 'fontdelbosc-transit' ); ?>
|
||
</p>
|
||
<?php else : ?>
|
||
<div class="fdbt-grid">
|
||
<?php foreach ( $fontdelbosc_zones as $fontdelbosc_zone ) : ?>
|
||
<?php $fontdelbosc_stickers = Fontdelbosc_Transit_Payload::arr( $fontdelbosc_zone['stickers'] ?? null ); ?>
|
||
<article class="fdbt-card fdbt-card--zbe">
|
||
<header class="fdbt-card__head">
|
||
<span class="fdbt-card__type fdbt-type--zbe">
|
||
<span class="fdbt-icon fdbt-icon--zbe" aria-hidden="true"><?php echo Fontdelbosc_Transit_Shortcode::icon( 'zbe' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- trusted static SVG markup. ?></span>
|
||
<?php esc_html_e( 'Low Emission Zone', 'fontdelbosc-transit' ); ?>
|
||
</span>
|
||
<?php if ( 'active' === (string) ( $fontdelbosc_zone['status'] ?? '' ) ) : ?>
|
||
<span class="fdbt-card__status"><span class="fdbt-dot" aria-hidden="true"></span><?php esc_html_e( 'Active', 'fontdelbosc-transit' ); ?></span>
|
||
<?php endif; ?>
|
||
</header>
|
||
|
||
<p class="fdbt-card__title"><?php echo esc_html( (string) $fontdelbosc_zone['name'] ); ?></p>
|
||
|
||
<?php if ( array() !== $fontdelbosc_stickers ) : ?>
|
||
<p class="fdbt-card__chips">
|
||
<?php
|
||
/* translators: %s: list of restricted vehicle labels. */
|
||
esc_html_e( 'Restricted vehicle types:', 'fontdelbosc-transit' );
|
||
?>
|
||
<?php foreach ( $fontdelbosc_stickers as $fontdelbosc_sticker ) : ?>
|
||
<span class="fdbt-chip fdbt-chip--<?php echo esc_attr( Fontdelbosc_Transit_Maps::sticker_class( (string) $fontdelbosc_sticker ) ); ?>"><?php echo esc_html( Fontdelbosc_Transit_Maps::sticker_label( (string) $fontdelbosc_sticker ) ); ?></span>
|
||
<?php endforeach; ?>
|
||
</p>
|
||
<?php endif; ?>
|
||
|
||
<?php foreach ( Fontdelbosc_Transit_Payload::arr( $fontdelbosc_zone['periods'] ?? null ) as $fontdelbosc_period ) : ?>
|
||
<?php
|
||
if ( ! is_array( $fontdelbosc_period ) ) {
|
||
continue; }
|
||
?>
|
||
<p class="fdbt-card__meta-item fdbt-card__meta-item--hours">
|
||
<span class="fdbt-meta__icon" aria-hidden="true"><?php echo Fontdelbosc_Transit_Shortcode::icon( 'clock' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- trusted static SVG markup. ?></span>
|
||
<?php
|
||
printf(
|
||
/* translators: 1: days, 2: start time, 3: end time. */
|
||
esc_html__( 'Operating hours: %1$s %2$s–%3$s', 'fontdelbosc-transit' ),
|
||
esc_html( (string) $fontdelbosc_period['days'] ),
|
||
esc_html( (string) $fontdelbosc_period['start'] ),
|
||
esc_html( (string) $fontdelbosc_period['end'] )
|
||
);
|
||
?>
|
||
</p>
|
||
<?php endforeach; ?>
|
||
|
||
<?php if ( '' !== (string) ( $fontdelbosc_zone['url'] ?? '' ) ) : ?>
|
||
<p class="fdbt-card__link">
|
||
<a href="<?php echo esc_url( (string) $fontdelbosc_zone['url'] ); ?>" target="_blank" rel="nofollow noopener">
|
||
<?php esc_html_e( 'Municipal regulations', 'fontdelbosc-transit' ); ?>
|
||
<span class="fdbt-link__icon" aria-hidden="true"><?php echo Fontdelbosc_Transit_Shortcode::icon( 'external' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- trusted static SVG markup. ?></span>
|
||
</a>
|
||
</p>
|
||
<?php endif; ?>
|
||
</article>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<footer class="fdbt-footer">
|
||
<p class="fdbt-footer__source">
|
||
<?php
|
||
printf(
|
||
/* translators: %s: source name. */
|
||
esc_html__( 'Source: %s', 'fontdelbosc-transit' ),
|
||
'<a href="https://nap.dgt.es/dataset/zonas-de-bajas-emisiones" target="_blank" rel="nofollow noopener">' . esc_html__( 'DGT / Punt d\'Accés Nacional', 'fontdelbosc-transit' ) . '</a>'
|
||
);
|
||
?>
|
||
</p>
|
||
</footer>
|
||
</section>
|