| @@ -1,10 +1,13 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -function acym_getTimeOffsetCMS() | |
| 3 | +defined('ABSPATH') || die('Restricted Access'); | |
| 4 | + | |
| 5 | +function acym_getTimeOffsetCMS(): int | |
| 4 | 6 | { |
| 5 | 7 | static $timeoffset = null; |
| 6 | 8 | if ($timeoffset === null) { |
| 9 | + //We replace the . with : WordPress give format like UTC+5.45, but we want something like UTC+5:45 | |
| 7 | 10 | $timeoffset = str_replace('.', ':', acym_getCMSConfig('offset')); |
| 8 | 11 | |
| 9 | 12 | if (!is_numeric($timeoffset)) { |
| 10 | 13 | $timezone = new DateTimeZone($timeoffset); |
| @@ -14,14 +17,14 @@ | ||
| 14 | 17 | |
| 15 | 18 | return $timeoffset; |
| 16 | 19 | } |
| 17 | 20 | |
| 18 | -function acym_dateTimeCMS($time) | |
| 21 | +function acym_dateTimeCMS(int $time) | |
| 19 | 22 | { |
| 20 | - return date('Y-m-d H:i:s', $time); | |
| 23 | + return gmdate('Y-m-d H:i:s', $time); | |
| 21 | 24 | } |
| 22 | 25 | |
| 23 | -function acym_getDateTimeFormat($default = '') | |
| 26 | +function acym_getDateTimeFormat(string $default = ''): string | |
| 24 | 27 | { |
| 25 | 28 | $noTimeDate = [ |
| 26 | 29 | 'ACYM_DATE_FORMAT_LC1', |
| 27 | 30 | 'ACYM_DATE_FORMAT_LC3', |