Révision ee46a8ed
Ajouté par Assos Assos il y a plus de 7 ans
drupal7/sites/all/modules/date/date_api/date_api.module | ||
---|---|---|
1833 | 1833 |
/** |
1834 | 1834 |
* A date object for the current time. |
1835 | 1835 |
* |
1836 |
* @param object $timezone |
|
1837 |
* (optional) Optionally force time to a specific timezone, defaults to user |
|
1838 |
* timezone, if set, otherwise site timezone. Defaults to NULL. |
|
1836 |
* @param object|string|null $timezone |
|
1837 |
* (optional) PHP DateTimeZone object, string or NULL allowed. Optionally |
|
1838 |
* force time to a specific timezone, defaults to user timezone, if set, |
|
1839 |
* otherwise site timezone. Defaults to NULL. |
|
1839 | 1840 |
* |
1840 | 1841 |
* @param bool $reset |
1841 | 1842 |
* (optional) Static cache reset. |
... | ... | |
1844 | 1845 |
* The current time as a date object. |
1845 | 1846 |
*/ |
1846 | 1847 |
function date_now($timezone = NULL, $reset = FALSE) { |
1848 |
$static_var = __FUNCTION__ . $timezone; |
|
1849 |
if ($timezone instanceof DateTimeZone) { |
|
1850 |
$static_var = __FUNCTION__ . $timezone->getName(); |
|
1851 |
} |
|
1852 |
|
|
1847 | 1853 |
if ($reset) { |
1848 |
drupal_static_reset(__FUNCTION__ . $timezone);
|
|
1854 |
drupal_static_reset($static_var);
|
|
1849 | 1855 |
} |
1850 | 1856 |
|
1851 |
$now = &drupal_static(__FUNCTION__ . $timezone);
|
|
1857 |
$now = &drupal_static($static_var);
|
|
1852 | 1858 |
|
1853 | 1859 |
if (!isset($now)) { |
1854 | 1860 |
$now = new DateObject('now', $timezone); |
... | ... | |
2075 | 2081 |
date_timezone_set($min_date, date_default_timezone_object()); |
2076 | 2082 |
|
2077 | 2083 |
// Find the first day of the first ISO week in the year. |
2084 |
// If it's already a Monday, date_modify won't add a Monday, |
|
2085 |
// it will remain the same day. So add a Sunday first, then a Monday. |
|
2086 |
date_modify($min_date, '+1 Sunday'); |
|
2078 | 2087 |
date_modify($min_date, '+1 Monday'); |
2079 | 2088 |
|
2080 | 2089 |
// Jump ahead to the desired week for the beginning of the week range. |
Formats disponibles : Unified diff
Update date 7.x-2.9 -> 7.x-2.10-rc1