first commit

This commit is contained in:
2025-08-02 16:30:27 +02:00
commit 23646bfcee
14851 changed files with 1750626 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
<?php
/**
* Smarty plugin.
*/
/**
* Smarty {translate} function plugin.
*
* @param $date DateTime
* @param null $format
* @param string $default_date
* @param string $formatter
*
* @return string
*/
function smarty_modifier_format_date_pretty($date, $format = null, $default_date = '', $formatter = 'auto')
{
if ($format === null) {
$format = 'd. m. Y';
}
if (!($date instanceof DateTime)) {
$date = new DateTime($date);
}
$today = new DateTime('midnight');
$tomorrow = new DateTime('+1 day midnight');
$dayAfterTomorrow = new DateTime('+2 day midnight');
if ($date > $today && $date < $tomorrow) {
return 'dnes';
}
if ($date > $tomorrow && $date < $dayAfterTomorrow) {
return 'zítra';
}
$format_date = $date->format($format);
$en_days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
$cz_days = ['Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota', 'Neděle', 'leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'];
$format_date = str_replace($en_days, $cz_days, $format_date);
return $format_date;
}