PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
give / src / Framework / WordPressShims / time.php

time.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at src/Framework/WordPressShims/time.php

61 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 if (!function_exists('wp_timezone_string')) {
6 /**
7 * Function is introduced in WP 5.3.
8 *
9 * @since 2.20.0
10 *
11 * @see https://developer.wordpress.org/reference/functions/wp_timezone_string
12 */
13 function wp_timezone_string()
14 {
15 $timezone_string = get_option('timezone_string');
16
17 if ($timezone_string) {
18 return $timezone_string;
19 }
20
21 $offset = (float)get_option('gmt_offset');
22 $hours = (int)$offset;
23 $minutes = ($offset - $hours);
24
25 $sign = ($offset < 0) ? '-' : '+';
26 $abs_hour = abs($hours);
27 $abs_mins = abs($minutes * 60);
28 $tz_offset = sprintf('%s%02d:%02d', $sign, $abs_hour, $abs_mins);
29
30 return $tz_offset;
31 }
32 }
33
34 if (!function_exists('wp_timezone')) {
35 /**
36 * Function is introduced in WP 5.3.
37 *
38 * @since 2.20.0
39 *
40 * @see https://developer.wordpress.org/reference/functions/wp_timezone
41 */
42 function wp_timezone()
43 {
44 return new DateTimeZone(wp_timezone_string());
45 }
46 }
47
48 if (!function_exists('current_datetime')) {
49 /**
50 * Function is introduced in WP 5.3.
51 *
52 * @since 2.20.0
53 *
54 * @see https://developer.wordpress.org/reference/functions/current_datetime
55 */
56 function current_datetime()
57 {
58 return date_create_immutable('now', wp_timezone());
59 }
60 }
61