/** * Returns an <abbr> tag with a date suitable for Javascript refreshing * * @param integer $timestamp * @param array $attributes * * @return string <abbr class="DateTime" data-unixtime="$timestamp"... */ public static function helperDateTimeHtml($timestamp, $attributes = array()) { $class = empty($attributes['class']) ? '' : ' ' . htmlspecialchars($attributes['class']); unset($attributes['time'], $attributes['class']); $attribs = self::getAttributes($attributes); $time = XenForo_Locale::dateTime($timestamp, 'separate', self::$_language); if ($time['relative']) { $tag = 'abbr'; $data = ' data-time="' . $timestamp . '" data-diff="' . (XenForo_Application::$time - $timestamp) . '" data-datestring="' . $time['date'] . '" data-timestring="' . $time['time'] . '"'; $value = $time['string']; } else { $tag = 'span'; if (!isset($attributes['title'])) { $data = ' title="' . $time['string'] . '"'; // empty this to remove tooltip from non-relative dates } else { $data = ''; } $value = $time['date']; } $rtlPrefix = XenForo_Locale::getRtlDateTimeMarker(self::$_language); return "<{$tag} class=\"DateTime{$class}\"{$attribs}{$data}>{$rtlPrefix}{$value}</{$tag}>"; }