/** * Fetches timestamps for the start of today, yesterday or a week ago * * @return array [today, yesterday, week] */ public static function getDayStartTimestamps() { if (!self::$_dayStartTimestamps) { $date = new DateTime('@' . XenForo_Application::$time); $date->setTimezone(self::$_timeZone ? self::$_timeZone : new DateTimeZone('UTC')); $date->setTime(0, 0, 0); list($todayStamp, $todayDow) = explode('|', $date->format('U|w')); $date->modify('-1 day'); $yesterdayStamp = $date->format('U'); $date->modify('-5 days'); $weekStamp = $date->format('U'); self::$_dayStartTimestamps = array('now' => XenForo_Application::$time, 'today' => $todayStamp, 'todayDow' => $todayDow, 'yesterday' => $yesterdayStamp, 'week' => $weekStamp); } return self::$_dayStartTimestamps; }