Load and use the strftime replacement function only if needed
This commit is contained in:
parent
7d6ca43395
commit
0284c3f460
|
@ -1,8 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
require 'php-8.1-strftime.php';
|
$strftimeDeprecated = version_compare(PHP_VERSION, '8.1.0', '>=');
|
||||||
use function PHP81_BC\strftime;
|
|
||||||
|
if ($strftimeDeprecated) {
|
||||||
|
require 'php-8.1-strftime.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
$strftime = fn(...$args) => $strftimeDeprecated ? PHP81_BC\strftime(...$args) : \strftime(...$args);
|
||||||
|
|
||||||
function parseData($config, $data) {
|
function parseData($config, $data) {
|
||||||
|
global $strftime;
|
||||||
|
|
||||||
$languages = array(
|
$languages = array(
|
||||||
'en' => array(
|
'en' => array(
|
||||||
'name' => 'English',
|
'name' => 'English',
|
||||||
|
@ -237,7 +244,7 @@ function parseData($config, $data) {
|
||||||
$columns = [];
|
$columns = [];
|
||||||
|
|
||||||
if (date('d.m', $microslots[$slot_index][0]) !== date('d.m', $lastTs)) {
|
if (date('d.m', $microslots[$slot_index][0]) !== date('d.m', $lastTs)) {
|
||||||
$schedule_body .= '<tr><th colspan="' . (count($events_data) + 1) . '">' . strftime('%d %B - %A', $microslots[$slot_index][0]) . '</th></tr>';
|
$schedule_body .= '<tr><th colspan="' . (count($events_data) + 1) . '">' . $strftime('%d %B - %A', $microslots[$slot_index][0]) . '</th></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$lastTs = $microslots[$slot_index][0];
|
$lastTs = $microslots[$slot_index][0];
|
||||||
|
|
Loading…
Reference in New Issue