当前位置: 首页>>代码示例>>PHP>>正文


PHP TimezoneInterface::getDefaultTimezonePath方法代码示例

本文整理汇总了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;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:24,代码来源:Full.php

示例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;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:24,代码来源:Full.php

示例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;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:57,代码来源:Installer.php


注:本文中的Magento\Framework\Stdlib\DateTime\TimezoneInterface::getDefaultTimezonePath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。