/** * Parses a date value into a UNIX-Timestamp * * @param string $value string representing date * @param string $format the expected date format * @param string $locale string the locale ID that is used to localize the date parsing. * This is only effective when the [PHP intl extension](http://php.net/manual/en/book.intl.php) is installed. * If not set, the locale of the [[\yii\base\Application::formatter|formatter]] will be used. * See also [[\yii\i18n\Formatter::locale]]. * @param string $timeZone the timezone to use for parsing date and time values. * This can be any value that may be passed to [date_default_timezone_set()](http://www.php.net/manual/en/function.date-default-timezone-set.php) * e.g. `UTC`, `Europe/Berlin` or `America/Chicago`. * Refer to the [php manual](http://www.php.net/manual/en/timezones.php) for available timezones. * If this property is not set, [[\yii\base\Application::timeZone]] will be used. * @return integer|boolean a UNIX timestamp or `false` on failure. */ public static function parseFromDate($value, $format, $locale = null, $timeZone = 'UTC') { //default values $locale = $locale === null ? Yii::$app->language : $locale; //decide which parser to use if (strncmp($format, 'php:', 4) === 0) { $format = substr($format, 4); } else { if (ServerConfig::extIntlLoaded()) { return static::parseDateValueIntl($value, $format, $locale, $timeZone); } else { $format = FormatConverter::convertDateIcuToPhp($format, 'date'); } } return static::parseDateValuePHP($value, $format, $timeZone); }
/** * Prepares the server section * * @return array the configuration of the section */ protected function sectionServer() { $extCheck = ['Zend OPcache', 'memcache', 'apc', 'xcache', 'redis', 'wincache', 'Zend Data Cache', 'curl', 'odbc', 'intl', 'gd', 'imagick', 'openssl', 'xdebug']; $extensions = []; foreach ($extCheck as $ext) { $hasExt = extension_loaded($ext); $extensions[] = Html::tag('span', $ext, ['class' => 'label label-' . ($hasExt ? 'success' : 'danger')]); } $ret = ['Host' => AsiUrl::getHost(), 'Localhost detected' => $this->valueBool(AsiUrl::isLocalhost()), 'PHP version' => phpversion(), 'PHP info' => $this->valueModal('PHP info', $this->phpInfo), 'Relevant extensions' => implode(' ', $extensions)]; if (ServerConfig::extOpCacheLoaded()) { $ret['OpCache enabled'] = $this->valueBool(ServerConfig::opCacheEnabled()); } return $ret; }