uawdijnntqw1x1x1
IP : 18.117.156.19
Hostname : axolotl
Kernel : Linux axolotl 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
OS : Linux
PATH:
/
var
/
www
/
axolotl
/
data
/
www
/
perm.axolotls.ru
/
bitrix
/
modules
/
documentgenerator
/
lib
/
value
/
datetime.php
/
/
<?php namespace Bitrix\DocumentGenerator\Value; use Bitrix\DocumentGenerator\DataProviderManager; use Bitrix\DocumentGenerator\Nameable; use Bitrix\DocumentGenerator\Value; use Bitrix\Main\Loader; use Bitrix\Main\Localization\Loc; use Bitrix\Main\Type; class DateTime extends Value implements Nameable { /** * DateTime constructor. * @param $value * @param array $options */ public function __construct($value, array $options = []) { $options = $this->getOptions($options); $format = $options['format']; if(!$value instanceof Type\Date) { $value = $this->getFromString($value, $format); } parent::__construct($value, $options); } /** * @param $string * @param null $format * @return Type\DateTime|null */ protected function getFromString($string, $format = null) { if(is_array($string) || is_object($string)) { return null; } $value = Type\DateTime::tryParse($string); if(!$value instanceof Type\Date) { $value = Type\DateTime::tryParse($string, $format); } if(!$value instanceof Type\Date && Loader::includeModule('rest')) { $convertedDate = \CRestUtil::unConvertDateTime($string); if($convertedDate) { $value = Type\DateTime::tryParse($convertedDate); } } if(!$value) { $value = null; } return $value; } /** * @param null $modifier * @return string */ public function toString($modifier = null) { $date = $this->value; $options = $this->getOptions($modifier); $format = $options['format']; if($date instanceof Type\Date) { $interfaceLanguage = LANGUAGE_ID; $templateLanguage = DataProviderManager::getInstance()->getRegionLanguageId(); if($templateLanguage != $interfaceLanguage) { Loc::setCurrentLang($templateLanguage); } $result = FormatDate($format, $date->getTimestamp()); if($templateLanguage != $interfaceLanguage) { Loc::setCurrentLang($interfaceLanguage); } return $result; } if(!$date) { $date = ''; } return $date; } /** * @return array */ protected static function getDefaultOptions() { return ['format' => Type\Date::getFormat(DataProviderManager::getInstance()->getCulture())]; } /** * @param string|array $modifier * @return array */ public static function parseModifier($modifier) { $data = parent::parseModifier($modifier); if(is_array($modifier)) { return $data; } if(empty($data)) { $data = ['format' => $modifier]; } elseif(!empty($modifier)) { $format = $data['format'] ?? ''; $parts = explode(',', $modifier); foreach($parts as $part) { if(empty(trim($part))) { continue; } if(mb_strpos($part, '=') === false) { if(!empty($format)) { $format .= ','; } $format .= $part; } else { [$name, $value] = explode('=', $part); if(!$name || !$value) { if(!empty($format)) { $format .= ','; } $format .= $part; } } } $data['format'] = $format; } return $data; } /** * @return string */ public static function getLangName() { Loc::loadLanguageFile(__FILE__); return Loc::getMessage('DOCGEN_VALUE_DATETIME_TITLE'); } }
/var/www/axolotl/data/www/perm.axolotls.ru/bitrix/modules/documentgenerator/lib/value/datetime.php