本文整理汇总了PHP中Magento\Framework\Stdlib\DateTime\TimezoneInterface::getDefaultTimezonePath方法的典型用法代码示例。如果您正苦于以下问题:PHP TimezoneInterface::getDefaultTimezonePath方法的具体用法?PHP TimezoneInterface::getDefaultTimezonePath怎么用?PHP TimezoneInterface::getDefaultTimezonePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Stdlib\DateTime\TimezoneInterface
的用法示例。
在下文中一共展示了TimezoneInterface::getDefaultTimezonePath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStoreDate
/**
* Retrieve Date value for store
*
* @param int $storeId
* @param string $date
* @return string|null
*/
protected function getStoreDate($storeId, $date = null)
{
if (!isset($this->dates[$storeId])) {
$timezone = $this->scopeConfig->getValue($this->localeDate->getDefaultTimezonePath(), \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
$this->localeResolver->emulate($storeId);
$dateObj = new \DateTime();
$dateObj->setTimezone(new \DateTimeZone($timezone));
$this->dates[$storeId] = $dateObj;
$this->localeResolver->revert();
}
if (!$this->dateTime->isEmptyDate($date)) {
/** @var \DateTime $dateObj */
$dateObj = $this->dates[$storeId];
return $this->localeDate->formatDateTime($dateObj, \IntlDateFormatter::MEDIUM, \IntlDateFormatter::NONE);
}
return null;
}
示例2: getStoreDate
/**
* Retrieve Date value for store
*
* @param int $storeId
* @param string $date
* @return string|null
*/
protected function getStoreDate($storeId, $date = null)
{
if (!isset($this->dates[$storeId])) {
$timezone = $this->scopeConfig->getValue($this->localeDate->getDefaultTimezonePath(), \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
$locale = $this->scopeConfig->getValue($this->localeResolver->getDefaultLocalePath(), \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
$locale = new \Zend_Locale($locale);
$dateObj = new \Magento\Framework\Stdlib\DateTime\Date(null, null, $locale);
$dateObj->setTimezone($timezone);
$this->dates[$storeId] = [$dateObj, $locale->getTranslation(null, 'date', $locale)];
}
if (!$this->dateTime->isEmptyDate($date)) {
list($dateObj, $format) = $this->dates[$storeId];
$dateObj->setDate($date, \Magento\Framework\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT);
return $dateObj->toString($format);
}
return null;
}
示例3: installDb
/**
* Database installation
*
* @return $this
*/
public function installDb()
{
$this->_dbUpdater->updateScheme();
$data = $this->getDataModel()->getConfigData();
/**
* Saving host information into DB
*/
if (!empty($data['use_rewrites'])) {
$this->_installSetup->setConfigData(\Magento\Store\Model\Store::XML_PATH_USE_REWRITES, 1);
}
if (!empty($data['enable_charts'])) {
$this->_installSetup->setConfigData(\Magento\Backend\Block\Dashboard::XML_PATH_ENABLE_CHARTS, 1);
} else {
$this->_installSetup->setConfigData(\Magento\Backend\Block\Dashboard::XML_PATH_ENABLE_CHARTS, 0);
}
if (!empty($data['admin_no_form_key'])) {
$this->_installSetup->setConfigData('admin/security/use_form_key', 0);
}
$unsecureBaseUrl = $this->_storeManager->getStore()->getBaseUrl('web');
if (!empty($data['unsecure_base_url'])) {
$unsecureBaseUrl = $data['unsecure_base_url'];
$this->_installSetup->setConfigData(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_URL, $unsecureBaseUrl);
}
if (!empty($data['use_secure'])) {
$this->_installSetup->setConfigData(\Magento\Store\Model\Store::XML_PATH_SECURE_IN_FRONTEND, 1);
$this->_installSetup->setConfigData(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL, $data['secure_base_url']);
if (!empty($data['use_secure_admin'])) {
$this->_installSetup->setConfigData(\Magento\Store\Model\Store::XML_PATH_SECURE_IN_ADMINHTML, 1);
}
} elseif (!empty($data['unsecure_base_url'])) {
$this->_installSetup->setConfigData(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL, $unsecureBaseUrl);
}
/**
* Saving locale information into DB
*/
$locale = $this->getDataModel()->getLocaleData();
if (!empty($locale['locale'])) {
$this->_installSetup->setConfigData($this->_localeResolver->getDefaultLocalePath(), $locale['locale']);
}
if (!empty($locale['timezone'])) {
$this->_installSetup->setConfigData($this->_localeDate->getDefaultTimezonePath(), $locale['timezone']);
}
if (!empty($locale['currency'])) {
$this->_installSetup->setConfigData(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, $locale['currency']);
$this->_installSetup->setConfigData(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_DEFAULT, $locale['currency']);
$this->_installSetup->setConfigData(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_ALLOW, $locale['currency']);
}
if (!empty($data['order_increment_prefix'])) {
$this->_setOrderIncrementPrefix($this->_installSetup, $data['order_increment_prefix']);
}
return $this;
}