aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/datetime.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2012-06-18 11:03:10 +0200
committerJoas Schilling <nickvergessen@gmx.de>2012-06-18 15:10:22 +0200
commit2a880dafdfacb1bc56652976078a3bd3104ceaf9 (patch)
treeb724f81c0f6d0af13673a3baab28a93163510078 /phpBB/includes/datetime.php
parentc21275fa951bd4d8608cc335a5c39d9a05bc4904 (diff)
downloadforums-2a880dafdfacb1bc56652976078a3bd3104ceaf9.tar
forums-2a880dafdfacb1bc56652976078a3bd3104ceaf9.tar.gz
forums-2a880dafdfacb1bc56652976078a3bd3104ceaf9.tar.bz2
forums-2a880dafdfacb1bc56652976078a3bd3104ceaf9.tar.xz
forums-2a880dafdfacb1bc56652976078a3bd3104ceaf9.zip
[feature/new-tz-handling] Do not use underscore as prefix for user
PHPBB3-9558
Diffstat (limited to 'phpBB/includes/datetime.php')
-rw-r--r--phpBB/includes/datetime.php18
1 files changed, 9 insertions, 9 deletions
diff --git a/phpBB/includes/datetime.php b/phpBB/includes/datetime.php
index 15e3c8b0b7..745c3372f1 100644
--- a/phpBB/includes/datetime.php
+++ b/phpBB/includes/datetime.php
@@ -21,7 +21,7 @@ class phpbb_datetime extends DateTime
/**
* @var user User who is the context for this DateTime instance
*/
- protected $_user;
+ protected $user;
/**
* @var array Date formats are preprocessed by phpBB, to save constant recalculation they are cached.
@@ -38,9 +38,9 @@ class phpbb_datetime extends DateTime
*/
public function __construct($time = 'now', DateTimeZone $timezone = null, $user = null)
{
- $this->_user = $user ? $user : $GLOBALS['user'];
+ $this->user = $user ?: $GLOBALS['user'];
- $timezone = (!$timezone && $this->_user->tz instanceof DateTimeZone) ? $this->_user->tz : $timezone;
+ $timezone = (!$timezone && $this->user->tz instanceof DateTimeZone) ? $this->user->tz : $timezone;
parent::__construct($time, $timezone);
}
@@ -72,10 +72,10 @@ class phpbb_datetime extends DateTime
*/
public function format($format = '', $force_absolute = false)
{
- $format = $format ? $format : $this->_user->date_format;
- $format = self::_format_cache($format, $this->_user);
+ $format = $format ? $format : $this->user->date_format;
+ $format = self::_format_cache($format, $this->user);
$relative = ($format['is_short'] && !$force_absolute);
- $now = new self('now', $this->_user->tz, $this->_user);
+ $now = new self('now', $this->user->tz, $this->user);
$timestamp = $this->getTimestamp();
$now_ts = $now->getTimeStamp();
@@ -88,9 +88,9 @@ class phpbb_datetime extends DateTime
// and the delta not more than a minute in the past
// and the delta is either greater than -5 seconds or timestamp and current time are of the same minute (they must be in the same hour already)
// finally check that relative dates are supported by the language pack
- if ($delta <= 3600 && $delta > -60 && ($delta >= -5 || (($now_ts / 60) % 60) == (($timestamp / 60) % 60)) && isset($this->_user->lang['datetime']['AGO']))
+ if ($delta <= 3600 && $delta > -60 && ($delta >= -5 || (($now_ts / 60) % 60) == (($timestamp / 60) % 60)) && isset($this->user->lang['datetime']['AGO']))
{
- return $this->_user->lang(array('datetime', 'AGO'), max(0, (int) floor($delta / 60)));
+ return $this->user->lang(array('datetime', 'AGO'), max(0, (int) floor($delta / 60)));
}
else
{
@@ -117,7 +117,7 @@ class phpbb_datetime extends DateTime
if ($day !== false)
{
// Format using the short formatting and finally swap out the relative token placeholder with the correct value
- return str_replace(self::RELATIVE_WRAPPER . self::RELATIVE_WRAPPER, $this->_user->lang['datetime'][$day], strtr(parent::format($format['format_short']), $format['lang']));
+ return str_replace(self::RELATIVE_WRAPPER . self::RELATIVE_WRAPPER, $this->user->lang['datetime'][$day], strtr(parent::format($format['format_short']), $format['lang']));
}
}
}