/** * @param Context $context * @return SafeString|string */ public function render($context) { // TODO Maybe get rid of USE_TZ? $use_tz = Dja::getSetting('USE_TZ'); if (!$use_tz) { $old_tz = date_default_timezone_get(); date_default_timezone_set('UTC'); } $d_ = dja_date(time(), $this->format_string); if (!$use_tz) { date_default_timezone_set($old_tz); } return $d_; }
return '[' . join(', ', array_merge($value, $arg)) . ']'; } return ''; }, array('is_safe' => False)); $lib->filter('get_digit', function ($value, $arg) { $arg = (string) $arg; if (!is_numeric($value) || !is_numeric($arg) || $arg < 1) { return $value; } return py_arr_get(str_split($value), -$arg, 0); }, array('is_safe' => False)); /* * DATES */ $lib->filter('date', function ($value, $arg = null) { return dja_date($value, $arg); }, array('is_safe' => False, $expects_localtime = True)); // TODO time // TODO timesince // TODO timeuntil /* * LOGIC */ $lib->filter('default', function ($value, $arg) { return $value ? $value : $arg; }, array('is_safe' => False)); $lib->filter('default_if_none', function ($value, $arg) { if ($value === null) { return $arg; } return $value;