PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / trunk
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress vtrunk
11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 10.3.0 10.4.0 All 60 releases
acymailing / back / Core / wordpress / date.php

date.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress trunk, at back/Core/wordpress/date.php

41 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined('ABSPATH') || die('Restricted Access');
4
5 function acym_getTimeOffsetCMS(): int
6 {
7 static $timeoffset = null;
8 if ($timeoffset === null) {
9 //We replace the . with : WordPress give format like UTC+5.45, but we want something like UTC+5:45
10 $timeoffset = str_replace('.', ':', acym_getCMSConfig('offset'));
11
12 if (!is_numeric($timeoffset)) {
13 $timezone = new DateTimeZone($timeoffset);
14 $timeoffset = $timezone->getOffset(new DateTime());
15 }
16 }
17
18 return $timeoffset;
19 }
20
21 function acym_dateTimeCMS(int $time)
22 {
23 return gmdate('Y-m-d H:i:s', $time);
24 }
25
26 function acym_getDateTimeFormat(string $default = ''): string
27 {
28 $noTimeDate = [
29 'ACYM_DATE_FORMAT_LC1',
30 'ACYM_DATE_FORMAT_LC3',
31 'ACYM_DATE_FORMAT_LC4',
32 'ACYM_DATE_FORMAT_LC5',
33 ];
34
35 $dateFormat = get_option('date_format', 'Y-m-d');
36
37 $timeFormat = in_array($default, $noTimeDate) ? '' : ' '.get_option('time_format', 'H:i');
38
39 return $dateFormat.$timeFormat;
40 }
41