Make backward compatible to PHP 8.3
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
$events = collection('termine');
|
||||
|
||||
// Aktuelles Datum
|
||||
$today = new DateTime()->format('Ymd');
|
||||
// Aktuelles Datum - PHP 8.3 kompatibel
|
||||
$today = (new DateTime('now'))->format('Ymd');
|
||||
|
||||
// Nur zukünftige Termine anzeigen
|
||||
$future_events = array_filter($events, function ($event) use ($today) {
|
||||
@@ -49,12 +49,24 @@ $de_months = [
|
||||
$location = $event['LOCATION'] ?? '';
|
||||
$desc = $event['DESCRIPTION'] ?? '';
|
||||
$timezone = $event['DTSTART_TZID'] ?? null;
|
||||
$date_info = format_ics_date_with_timezone($start, $timezone);
|
||||
$date = $date_info['display'];
|
||||
$time = $date_info['has_time'] ? substr($date, 11) : 'ganztägig';
|
||||
|
||||
// Sichere Funktionsaufrufe mit Null-Checks
|
||||
$date_info = function_exists('format_ics_date_with_timezone')
|
||||
? format_ics_date_with_timezone($start, $timezone)
|
||||
: ['display' => '', 'has_time' => false, 'iso' => ''];
|
||||
|
||||
$date = $date_info['display'] ?? '';
|
||||
$time = ($date_info['has_time'] ?? false) ? substr($date, 11) : 'ganztägig';
|
||||
$day = substr($date, 0, 2);
|
||||
$month = substr($date, 3, 2);
|
||||
$iso_date = $date_info['iso'];
|
||||
$iso_date = $date_info['iso'] ?? '';
|
||||
|
||||
// Sichere Array-Zugriffe
|
||||
$month_name = $de_months[$month] ?? 'Unbek';
|
||||
$event_summary = htmlspecialchars($summary, ENT_QUOTES, 'UTF-8');
|
||||
$safe_day = htmlspecialchars($day, ENT_QUOTES, 'UTF-8');
|
||||
$safe_iso_date = htmlspecialchars($iso_date, ENT_QUOTES, 'UTF-8');
|
||||
$safe_time = htmlspecialchars($time, ENT_QUOTES, 'UTF-8');
|
||||
?>
|
||||
|
||||
<div class="termine-card flex-none w-full md:w-1/2 bg-gradient-to-br from-blue-50 to-blue-100 rounded-2xl transform hover:scale-102 transition-all duration-300 ease-in-out border border-blue-200">
|
||||
@@ -64,14 +76,12 @@ $de_months = [
|
||||
<div class="relative flex-shrink-0 bg-white rounded-lg shadow-md overflow-hidden w-16 h-16 flex flex-col border border-blue-200">
|
||||
<!-- Kopfzeile des Kalenders mit Monat -->
|
||||
<div class="bg-blue-600 text-white text-xs font-semibold py-1 text-center uppercase">
|
||||
<span data-month><?php echo $de_months[$month]; ?></span>
|
||||
<span data-month><?= $month_name ?></span>
|
||||
</div>
|
||||
|
||||
<!-- Datumsanzeige -->
|
||||
<div class="flex-grow flex items-center justify-center">
|
||||
<div class="text-3xl font-bold text-sf_grau-800" data-day><?php echo htmlspecialchars(
|
||||
$day,
|
||||
); ?></div>
|
||||
<div class="text-3xl font-bold text-sf_grau-800" data-day><?= $safe_day ?></div>
|
||||
</div>
|
||||
|
||||
<!-- Dekorative Elemente - kleine Punkte für Kalendertage -->
|
||||
@@ -86,12 +96,10 @@ $de_months = [
|
||||
</div>
|
||||
</div>
|
||||
<div class="ml-5 flex-grow">
|
||||
<pack class="text-xl font-medium text-sf_grau-900"><?= $event['SUMMARY'] ?></p>
|
||||
<p class="text-xl font-medium text-sf_grau-900"><?= $event_summary ?></p>
|
||||
<p class="text-sf_blau-700 text-lg font-medium mt-1">
|
||||
<?php if ($date_info['has_time']): ?>
|
||||
ab <span class="local-time" data-iso-date="<?php echo htmlspecialchars(
|
||||
$iso_date,
|
||||
); ?>"><?php echo htmlspecialchars($time); ?></span> Uhr
|
||||
<?php if ($date_info['has_time'] ?? false): ?>
|
||||
ab <span class="local-time" data-iso-date="<?= $safe_iso_date ?>"><?= $safe_time ?></span> Uhr
|
||||
<?php else: ?>
|
||||
ganztägig
|
||||
<?php endif; ?>
|
||||
|
||||
Reference in New Issue
Block a user