• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Zend_Filter_NormalizedToLocalized类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Zend_Filter_NormalizedToLocalized的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Filter_NormalizedToLocalized类的具体用法?PHP Zend_Filter_NormalizedToLocalized怎么用?PHP Zend_Filter_NormalizedToLocalized使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Zend_Filter_NormalizedToLocalized类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: outputFilter

 /**
  * Returns the result of filtering $value
  *
  * @param string $value
  * @return string
  */
 public function outputFilter($value)
 {
     $filterInput = new Zend_Filter_LocalizedToNormalized(array('date_format' => Varien_Date::DATETIME_INTERNAL_FORMAT, 'locale' => $this->_locale));
     $filterInternal = new Zend_Filter_NormalizedToLocalized(array('date_format' => $this->_dateFormat, 'locale' => $this->_locale));
     $value = $filterInput->filter($value);
     $value = $filterInternal->filter($value);
     return $value;
 }
开发者ID:test3metizsoft,项目名称:test,代码行数:14,代码来源:Datetime.php


示例2: _convertDate

 /**
  * Convert date from localized to internal format
  *
  * @param string $date
  * @param string $locale
  * @return string
  */
 protected function _convertDate($date, $locale)
 {
     $filterInput = new Zend_Filter_LocalizedToNormalized(array('date_format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)));
     $filterInternal = new Zend_Filter_NormalizedToLocalized(array('date_format' => Varien_Date::DATE_INTERNAL_FORMAT));
     $date = $filterInput->filter($date);
     $date = $filterInternal->filter($date);
     return $date;
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:15,代码来源:Date.php


示例3: filterDateValue

 public function filterDateValue($value)
 {
     $filterInput = new Zend_Filter_LocalizedToNormalized(array('date_format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)));
     $filterInternal = new Zend_Filter_NormalizedToLocalized(array('date_format' => Varien_Date::DATE_INTERNAL_FORMAT));
     $value = $filterInput->filter($value);
     $value = $filterInternal->filter($value);
     return $value;
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:8,代码来源:Editor.php


示例4: outputFilter

 /**
  * Returns the result of filtering $value
  *
  * @param string $value
  * @return string
  */
 public function outputFilter($value)
 {
     $filterInput = new \Zend_Filter_LocalizedToNormalized(['date_format' => DateTime::DATE_INTERNAL_FORMAT, 'locale' => $this->localeResolver->getLocale()]);
     $filterInternal = new \Zend_Filter_NormalizedToLocalized(['date_format' => $this->_dateFormat, 'locale' => $this->localeResolver->getLocale()]);
     $value = $filterInput->filter($value);
     $value = $filterInternal->filter($value);
     return $value;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:14,代码来源:Date.php


示例5: _get

 public function _get($fieldName, $load = true)
 {
     $value = parent::_get($fieldName, $load);
     if (strstr($fieldName, 'week_')) {
         $zendFilter = new Zend_Filter_NormalizedToLocalized();
         return $zendFilter->filter($value);
     }
     return $value;
 }
开发者ID:jaspermeijaard,项目名称:home-booking-system,代码行数:9,代码来源:Percentage.php


示例6: _filterDates

 protected function _filterDates($array, $dateFields)
 {
     if (empty($dateFields)) {
         return $array;
     }
     $filterInput = new Zend_Filter_LocalizedToNormalized(array('date_format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)));
     $filterInternal = new Zend_Filter_NormalizedToLocalized(array('date_format' => Varien_Date::DATE_INTERNAL_FORMAT));
     foreach ($dateFields as $dateField) {
         if (array_key_exists($dateField, $array) && !empty($dateField)) {
             $array[$dateField] = $filterInput->filter($array[$dateField]);
             $array[$dateField] = $filterInternal->filter($array[$dateField]);
         }
     }
     return $array;
 }
开发者ID:xiaoguizhidao,项目名称:devfashion,代码行数:15,代码来源:Arraypointsusage.php


示例7: saveAction

 public function saveAction()
 {
     if (!$this->_validateProducts()) {
         return;
     }
     /* Collect Data */
     $inventoryData = $this->getRequest()->getParam('inventory', array());
     $attributesData = $this->getRequest()->getParam('attributes', array());
     $websiteRemoveData = $this->getRequest()->getParam('remove_website_ids', array());
     $websiteAddData = $this->getRequest()->getParam('add_website_ids', array());
     /* Prepare inventory data item options (use config settings) */
     foreach (Mage::helper('Mage_CatalogInventory_Helper_Data')->getConfigItemOptions() as $option) {
         if (isset($inventoryData[$option]) && !isset($inventoryData['use_config_' . $option])) {
             $inventoryData['use_config_' . $option] = 0;
         }
     }
     try {
         if ($attributesData) {
             $dateFormat = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
             $storeId = $this->_getHelper()->getSelectedStoreId();
             foreach ($attributesData as $attributeCode => $value) {
                 $attribute = Mage::getSingleton('Mage_Eav_Model_Config')->getAttribute(Mage_Catalog_Model_Product::ENTITY, $attributeCode);
                 if (!$attribute->getAttributeId()) {
                     unset($attributesData[$attributeCode]);
                     continue;
                 }
                 if ($attribute->getBackendType() == 'datetime') {
                     if (!empty($value)) {
                         $filterInput = new Zend_Filter_LocalizedToNormalized(array('date_format' => $dateFormat));
                         $filterInternal = new Zend_Filter_NormalizedToLocalized(array('date_format' => Varien_Date::DATE_INTERNAL_FORMAT));
                         $value = $filterInternal->filter($filterInput->filter($value));
                     } else {
                         $value = null;
                     }
                     $attributesData[$attributeCode] = $value;
                 } else {
                     if ($attribute->getFrontendInput() == 'multiselect') {
                         if (is_array($value)) {
                             $value = implode(',', $value);
                         }
                         $attributesData[$attributeCode] = $value;
                     }
                 }
             }
             Mage::getSingleton('Mage_Catalog_Model_Product_Action')->updateAttributes($this->_getHelper()->getProductIds(), $attributesData, $storeId);
         }
         if ($inventoryData) {
             $stockItem = Mage::getModel('Mage_CatalogInventory_Model_Stock_Item');
             $stockItem->setProcessIndexEvents(false);
             $stockItemSaved = false;
             foreach ($this->_getHelper()->getProductIds() as $productId) {
                 $stockItem->setData(array());
                 $stockItem->loadByProduct($productId)->setProductId($productId);
                 $stockDataChanged = false;
                 foreach ($inventoryData as $k => $v) {
                     $stockItem->setDataUsingMethod($k, $v);
                     if ($stockItem->dataHasChangedFor($k)) {
                         $stockDataChanged = true;
                     }
                 }
                 if ($stockDataChanged) {
                     $stockItem->save();
                     $stockItemSaved = true;
                 }
             }
             if ($stockItemSaved) {
                 Mage::getSingleton('Mage_Index_Model_Indexer')->indexEvents(Mage_CatalogInventory_Model_Stock_Item::ENTITY, Mage_Index_Model_Event::TYPE_SAVE);
             }
         }
         if ($websiteAddData || $websiteRemoveData) {
             /* @var $actionModel Mage_Catalog_Model_Product_Action */
             $actionModel = Mage::getSingleton('Mage_Catalog_Model_Product_Action');
             $productIds = $this->_getHelper()->getProductIds();
             if ($websiteRemoveData) {
                 $actionModel->updateWebsites($productIds, $websiteRemoveData, 'remove');
             }
             if ($websiteAddData) {
                 $actionModel->updateWebsites($productIds, $websiteAddData, 'add');
             }
             Mage::dispatchEvent('catalog_product_to_website_change', array('products' => $productIds));
             $this->_getSession()->addNotice($this->__('Please refresh "Catalog URL Rewrites" and "Product Attributes" in System -> <a href="%s">Index Management</a>', $this->getUrl('adminhtml/process/list')));
         }
         $this->_getSession()->addSuccess($this->__('Total of %d record(s) were updated', count($this->_getHelper()->getProductIds())));
     } catch (Mage_Core_Exception $e) {
         $this->_getSession()->addError($e->getMessage());
     } catch (Exception $e) {
         $this->_getSession()->addException($e, $this->__('An error occurred while updating the product(s) attributes.'));
     }
     $this->_redirect('*/catalog_product/', array('store' => $this->_getHelper()->getSelectedStoreId()));
 }
开发者ID:relue,项目名称:magento2,代码行数:90,代码来源:AttributeController.php


示例8: testLocalizationToFloat

 /**
  * Ensures that the filter follows expected behavior
  *
  * @return void
  */
 public function testLocalizationToFloat()
 {
     $filter = new Zend_Filter_NormalizedToLocalized(array('locale' => 'de', 'precision' => 2));
     $valuesExpected = array(1 => '1234.5678', 2 => 1234.5678, 3 => '1.234', 4 => 1.234, 5 => '1234', 6 => 1234);
     $valuesReceived = array(1 => '1.234,57', 2 => '1.234,57', 3 => '1,23', 4 => '1,23', 5 => '1.234,00', 6 => '1.234,00');
     foreach ($valuesExpected as $key => $value) {
         $this->assertEquals($valuesReceived[$key], $filter->filter($value), 'failed filter of ' . var_export($value, 1));
     }
 }
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:14,代码来源:NormalizedToLocalizedTest.php


示例9: filterDateTimeOnly

 /**
  * Convert dates with time in array from localized to internal format
  *
  * @param   array $array
  * @param $isDb
  * @internal param array $dateFields
  * @return  array
  */
 public static function filterDateTimeOnly($array, $isDb)
 {
     $filterInput = new Zend_Filter_LocalizedToNormalized(array('date_format' => Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)));
     if (!$isDb) {
         $filterInternal = new Zend_Filter_NormalizedToLocalized(array('date_format' => Varien_Date::DATETIME_INTERNAL_FORMAT));
     } else {
         $filterInternal = new Zend_Filter_NormalizedToLocalized(array('date_format' => 'yyyy-MM-dd HH:mm:ss'));
     }
     foreach ($array as $dateField => $val) {
         $array[$dateField] = $filterInput->filter($array[$dateField]);
         $array[$dateField] = $filterInternal->filter($array[$dateField]);
     }
     return $array;
 }
开发者ID:hueyl77,项目名称:fourwindsgear,代码行数:22,代码来源:Date.php


示例10: getDay7

 public function getDay7()
 {
     $zv = new Zend_Filter_NormalizedToLocalized();
     return $zv->filter($this->_get('day_7'));
 }
开发者ID:jaspermeijaard,项目名称:home-booking-system,代码行数:5,代码来源:Percentage.php


示例11: getExtraPercentage

 /**
  * Get localized Extra Percentage 
  */
 public function getExtraPercentage()
 {
     $zf = new Zend_Filter_NormalizedToLocalized();
     $price = $this->_get('extra_percentage');
     return $zf->filter($price);
 }
开发者ID:jaspermeijaard,项目名称:home-booking-system,代码行数:9,代码来源:Home.php


示例12: execute

 /**
  * Update product attributes
  *
  * @return void
  */
 public function execute()
 {
     if (!$this->_validateProducts()) {
         return;
     }
     /* Collect Data */
     $inventoryData = $this->getRequest()->getParam('inventory', array());
     $attributesData = $this->getRequest()->getParam('attributes', array());
     $websiteRemoveData = $this->getRequest()->getParam('remove_website_ids', array());
     $websiteAddData = $this->getRequest()->getParam('add_website_ids', array());
     /* Prepare inventory data item options (use config settings) */
     $options = $this->_objectManager->get('Magento\\CatalogInventory\\Helper\\Data')->getConfigItemOptions();
     foreach ($options as $option) {
         if (isset($inventoryData[$option]) && !isset($inventoryData['use_config_' . $option])) {
             $inventoryData['use_config_' . $option] = 0;
         }
     }
     try {
         if ($attributesData) {
             $dateFormat = $this->_objectManager->get('Magento\\Framework\\Stdlib\\DateTime\\TimezoneInterface')->getDateFormat(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::FORMAT_TYPE_SHORT);
             $storeId = $this->attributeHelper->getSelectedStoreId();
             foreach ($attributesData as $attributeCode => $value) {
                 $attribute = $this->_objectManager->get('Magento\\Eav\\Model\\Config')->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $attributeCode);
                 if (!$attribute->getAttributeId()) {
                     unset($attributesData[$attributeCode]);
                     continue;
                 }
                 if ($attribute->getBackendType() == 'datetime') {
                     if (!empty($value)) {
                         $filterInput = new \Zend_Filter_LocalizedToNormalized(array('date_format' => $dateFormat));
                         $filterInternal = new \Zend_Filter_NormalizedToLocalized(array('date_format' => \Magento\Framework\Stdlib\DateTime::DATE_INTERNAL_FORMAT));
                         $value = $filterInternal->filter($filterInput->filter($value));
                     } else {
                         $value = null;
                     }
                     $attributesData[$attributeCode] = $value;
                 } elseif ($attribute->getFrontendInput() == 'multiselect') {
                     // Check if 'Change' checkbox has been checked by admin for this attribute
                     $isChanged = (bool) $this->getRequest()->getPost($attributeCode . '_checkbox');
                     if (!$isChanged) {
                         unset($attributesData[$attributeCode]);
                         continue;
                     }
                     if (is_array($value)) {
                         $value = implode(',', $value);
                     }
                     $attributesData[$attributeCode] = $value;
                 }
             }
             $this->_objectManager->get('Magento\\Catalog\\Model\\Product\\Action')->updateAttributes($this->attributeHelper->getProductIds(), $attributesData, $storeId);
         }
         if ($inventoryData) {
             /** @var \Magento\CatalogInventory\Service\V1\StockItemService $stockItemService */
             $stockItemService = $this->_objectManager->create('Magento\\CatalogInventory\\Service\\V1\\StockItemService');
             foreach ($this->_helper->getProductIds() as $productId) {
                 $stockItemDo = $stockItemService->getStockItem($productId);
                 if (!$stockItemDo->getProductId()) {
                     $inventoryData[] = $productId;
                 }
                 $stockItemService->saveStockItem($this->stockItemBuilder->mergeDataObjectWithArray($stockItemDo, $inventoryData));
             }
             $this->_stockIndexerProcessor->reindexList($this->_helper->getProductIds());
         }
         if ($websiteAddData || $websiteRemoveData) {
             /* @var $actionModel \Magento\Catalog\Model\Product\Action */
             $actionModel = $this->_objectManager->get('Magento\\Catalog\\Model\\Product\\Action');
             $productIds = $this->attributeHelper->getProductIds();
             if ($websiteRemoveData) {
                 $actionModel->updateWebsites($productIds, $websiteRemoveData, 'remove');
             }
             if ($websiteAddData) {
                 $actionModel->updateWebsites($productIds, $websiteAddData, 'add');
             }
             $this->_eventManager->dispatch('catalog_product_to_website_change', array('products' => $productIds));
             $this->messageManager->addNotice(__('Please refresh "Catalog URL Rewrites" and "Product Attributes" in System -> ' . '<a href="%1">Index Management</a>.', $this->getUrl('adminhtml/process/list')));
         }
         $this->messageManager->addSuccess(__('A total of %1 record(s) were updated.', count($this->attributeHelper->getProductIds())));
         $this->_productFlatIndexerProcessor->reindexList($this->attributeHelper->getProductIds());
         if ($this->_catalogProduct->isDataForPriceIndexerWasChanged($attributesData) || !empty($websiteRemoveData) || !empty($websiteAddData)) {
             $this->_productPriceIndexerProcessor->reindexList($this->attributeHelper->getProductIds());
         }
     } catch (\Magento\Framework\Model\Exception $e) {
         $this->messageManager->addError($e->getMessage());
     } catch (\Exception $e) {
         $this->messageManager->addException($e, __('Something went wrong while updating the product(s) attributes.'));
     }
     $this->_redirect('catalog/product/', array('store' => $this->attributeHelper->getSelectedStoreId()));
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:93,代码来源:Save.php


示例13: _filterDate

 /**
  * Convert date in from <$formatIn> to internal format
  *
  * @param   string $value
  * @param   string $formatIn    -  FORMAT_TYPE_FULL, FORMAT_TYPE_LONG, FORMAT_TYPE_MEDIUM, FORMAT_TYPE_SHORT
  * @return  string
  */
 public function _filterDate($value, $formatIn = false)
 {
     if ($formatIn === false) {
         return $value;
     } else {
         $formatIn = Mage::app()->getLocale()->getDateFormat($formatIn);
     }
     $filterInput = new Zend_Filter_LocalizedToNormalized(array('date_format' => $formatIn, 'locale' => Mage::app()->getLocale()->getLocaleCode()));
     $filterInternal = new Zend_Filter_NormalizedToLocalized(array('date_format' => Varien_Date::DATE_INTERNAL_FORMAT));
     $value = $filterInput->filter($value);
     $value = $filterInternal->filter($value);
     return $value;
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:20,代码来源:Data.php


示例14: execute

 /**
  * Update product attributes
  *
  * @return \Magento\Backend\Model\View\Result\Redirect
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function execute()
 {
     if (!$this->_validateProducts()) {
         return $this->resultRedirectFactory->create()->setPath('catalog/product/', ['_current' => true]);
     }
     /* Collect Data */
     $inventoryData = $this->getRequest()->getParam('inventory', []);
     $attributesData = $this->getRequest()->getParam('attributes', []);
     $websiteRemoveData = $this->getRequest()->getParam('remove_website_ids', []);
     $websiteAddData = $this->getRequest()->getParam('add_website_ids', []);
     /* Prepare inventory data item options (use config settings) */
     $options = $this->_objectManager->get('Magento\\CatalogInventory\\Api\\StockConfigurationInterface')->getConfigItemOptions();
     foreach ($options as $option) {
         if (isset($inventoryData[$option]) && !isset($inventoryData['use_config_' . $option])) {
             $inventoryData['use_config_' . $option] = 0;
         }
     }
     try {
         $storeId = $this->attributeHelper->getSelectedStoreId();
         if ($attributesData) {
             $dateFormat = $this->_objectManager->get('Magento\\Framework\\Stdlib\\DateTime\\TimezoneInterface')->getDateFormat(\IntlDateFormatter::SHORT);
             foreach ($attributesData as $attributeCode => $value) {
                 $attribute = $this->_objectManager->get('Magento\\Eav\\Model\\Config')->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $attributeCode);
                 if (!$attribute->getAttributeId()) {
                     unset($attributesData[$attributeCode]);
                     continue;
                 }
                 if ($attribute->getBackendType() == 'datetime') {
                     if (!empty($value)) {
                         $filterInput = new \Zend_Filter_LocalizedToNormalized(['date_format' => $dateFormat]);
                         $filterInternal = new \Zend_Filter_NormalizedToLocalized(['date_format' => \Magento\Framework\Stdlib\DateTime::DATE_INTERNAL_FORMAT]);
                         $value = $filterInternal->filter($filterInput->filter($value));
                     } else {
                         $value = null;
                     }
                     $attributesData[$attributeCode] = $value;
                 } elseif ($attribute->getFrontendInput() == 'multiselect') {
                     // Check if 'Change' checkbox has been checked by admin for this attribute
                     $isChanged = (bool) $this->getRequest()->getPost($attributeCode . '_checkbox');
                     if (!$isChanged) {
                         unset($attributesData[$attributeCode]);
                         continue;
                     }
                     if (is_array($value)) {
                         $value = implode(',', $value);
                     }
                     $attributesData[$attributeCode] = $value;
                 }
             }
             $this->_objectManager->get('Magento\\Catalog\\Model\\Product\\Action')->updateAttributes($this->attributeHelper->getProductIds(), $attributesData, $storeId);
         }
         if ($inventoryData) {
             // TODO why use ObjectManager?
             /** @var \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry */
             $stockRegistry = $this->_objectManager->create('Magento\\CatalogInventory\\Api\\StockRegistryInterface');
             /** @var \Magento\CatalogInventory\Api\StockItemRepositoryInterface $stockItemRepository */
             $stockItemRepository = $this->_objectManager->create('Magento\\CatalogInventory\\Api\\StockItemRepositoryInterface');
             foreach ($this->attributeHelper->getProductIds() as $productId) {
                 $stockItemDo = $stockRegistry->getStockItem($productId, $this->attributeHelper->getStoreWebsiteId($storeId));
                 if (!$stockItemDo->getProductId()) {
                     $inventoryData[] = $productId;
                 }
                 $stockItemId = $stockItemDo->getId();
                 $this->dataObjectHelper->populateWithArray($stockItemDo, $inventoryData, '\\Magento\\CatalogInventory\\Api\\Data\\StockItemInterface');
                 $stockItemDo->setItemId($stockItemId);
                 $stockItemRepository->save($stockItemDo);
             }
             $this->_stockIndexerProcessor->reindexList($this->attributeHelper->getProductIds());
         }
         if ($websiteAddData || $websiteRemoveData) {
             /* @var $actionModel \Magento\Catalog\Model\Product\Action */
             $actionModel = $this->_objectManager->get('Magento\\Catalog\\Model\\Product\\Action');
             $productIds = $this->attributeHelper->getProductIds();
             if ($websiteRemoveData) {
                 $actionModel->updateWebsites($productIds, $websiteRemoveData, 'remove');
             }
             if ($websiteAddData) {
                 $actionModel->updateWebsites($productIds, $websiteAddData, 'add');
             }
             $this->_eventManager->dispatch('catalog_product_to_website_change', ['products' => $productIds]);
         }
         $this->messageManager->addSuccess(__('A total of %1 record(s) were updated.', count($this->attributeHelper->getProductIds())));
         $this->_productFlatIndexerProcessor->reindexList($this->attributeHelper->getProductIds());
         if ($this->_catalogProduct->isDataForPriceIndexerWasChanged($attributesData) || !empty($websiteRemoveData) || !empty($websiteAddData)) {
             $this->_productPriceIndexerProcessor->reindexList($this->attributeHelper->getProductIds());
         }
     } catch (\Magento\Framework\Exception\LocalizedException $e) {
         $this->messageManager->addError($e->getMessage());
     } catch (\Exception $e) {
         $this->messageManager->addException($e, __('Something went wrong while updating the product(s) attributes.'));
     }
     return $this->resultRedirectFactory->create()->setPath('catalog/product/', ['store' => $this->attributeHelper->getSelectedStoreId()]);
//.........这里部分代码省略.........
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:101,代码来源:Save.php


示例15: getPrice

 public function getPrice()
 {
     $zf = new Zend_Filter_NormalizedToLocalized();
     $price = $this->_get('price');
     return $zf->filter($price);
 }
开发者ID:jaspermeijaard,项目名称:home-booking-system,代码行数:6,代码来源:Home.php


示例16: formatValue

 /**
  * Format value according to attribute display options
  *
  * @param mixed $value The value to format
  *
  * @return string
  */
 private function formatValue($value)
 {
     $attribute = $this->getAttributeModel();
     if ((int) $attribute->getDisplayPrecision() > 0) {
         $locale = $this->localeResolver->getLocale();
         $options = ['locale' => $locale, 'precision' => (int) $attribute->getDisplayPrecision()];
         $valueFormatter = new \Zend_Filter_NormalizedToLocalized($options);
         $value = $valueFormatter->filter($value);
     }
     if ((string) $attribute->getDisplayPattern() != "") {
         $value = sprintf((string) $attribute->getDisplayPattern(), $value);
     }
     return $value;
 }
开发者ID:smile-sa,项目名称:elasticsuite,代码行数:21,代码来源:Decimal.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Zend_Filter_PregReplace类代码示例发布时间:2022-05-23
下一篇:
PHP Zend_Filter_LocalizedToNormalized类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap