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


PHP CurrencyDisplay::_instance方法代码示例

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


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

示例1: getInstance

 /**
 *
 * Gives back the format of the currency, gets $style if none is set, with the currency Id, when nothing is found it tries the vendorId.
 * When no param is set, you get the format of the mainvendor
 *
 * @author Max Milbers
 * @param int 		$currencyId Id of the currency
 * @param int 		$vendorId Id of the vendor
 * @param string 	$style The vendor_currency_display_code
 *   FORMAT:
 1: id,
 2: CurrencySymbol,
 3: NumberOfDecimalsAfterDecimalSymbol,
 4: DecimalSymbol,
 5: Thousands separator
 6: Currency symbol position with Positive values :
 7: Currency symbol position with Negative values :
 
 EXAMPLE: ||€|2|,||1|8
 * @return string
 */
 public static function getInstance($currencyId = 0, $vendorId = 0)
 {
     // 		vmdebug('hmmmmm getInstance given $currencyId '.$currencyId,self::$_instance->_currency_id);
     // 		if(empty(self::$_instance) || empty(self::$_instance->_currency_id) || ($currencyId!=self::$_instance->_currency_id && !empty($currencyId)) ){
     if (empty(self::$_instance) || (!empty($currencyId) and $currencyId != self::$_instance->_currency_id)) {
         self::$_instance = new CurrencyDisplay($vendorId);
         if (empty($currencyId)) {
             if (self::$_instance->_app->isSite()) {
                 self::$_instance->_currency_id = self::$_instance->_app->getUserStateFromRequest("virtuemart_currency_id", 'virtuemart_currency_id', JRequest::getInt('virtuemart_currency_id', 0));
             }
             if (empty(self::$_instance->_currency_id)) {
                 self::$_instance->_currency_id = self::$_instance->_vendorCurrency;
             }
         } else {
             self::$_instance->_currency_id = $currencyId;
         }
         $q = 'SELECT * FROM `#__virtuemart_currencies` WHERE `virtuemart_currency_id`="' . (int) self::$_instance->_currency_id . '"';
         self::$_instance->_db->setQuery($q);
         $style = self::$_instance->_db->loadObject();
         if (!empty($style)) {
             self::$_instance->setCurrencyDisplayToStyleStr($style);
         } else {
             $uri = JFactory::getURI();
             if (empty(self::$_instance->_currency_id)) {
                 $link = $uri->root() . 'administrator/index.php?option=com_virtuemart&view=user&task=editshop';
                 JError::raiseWarning('1', JText::sprintf('COM_VIRTUEMART_CONF_WARN_NO_CURRENCY_DEFINED', '<a href="' . $link . '">' . $link . '</a>'));
             } else {
                 if (JRequest::getWord('view') != 'currency') {
                     $link = $uri->root() . 'administrator/index.php?option=com_virtuemart&view=currency&task=edit&cid[]=' . self::$_instance->_currency_id;
                     JError::raiseWarning('1', JText::sprintf('COM_VIRTUEMART_CONF_WARN_NO_FORMAT_DEFINED', '<a href="' . $link . '">' . $link . '</a>'));
                 }
             }
             //				self::$_instance->setCurrencyDisplayToStyleStr($currencyId);
             //would be nice to automatically unpublish the product/currency or so
         }
     }
     self::$_instance->setPriceArray();
     return self::$_instance;
 }
开发者ID:Gskflute,项目名称:joomla25,代码行数:60,代码来源:currencydisplay.php

示例2: getInstance

 /**
 *
 * Gives back the format of the currency, gets $style if none is set, with the currency Id, when nothing is found it tries the vendorId.
 * When no param is set, you get the format of the mainvendor
 *
 * @author Max Milbers
 * @param int 		$currencyId Id of the currency
 * @param int 		$vendorId Id of the vendor
 * @param string 	$style The vendor_currency_display_code
 *   FORMAT:
 1: id,
 2: CurrencySymbol,
 3: NumberOfDecimalsAfterDecimalSymbol,
 4: DecimalSymbol,
 5: Thousands separator
 6: Currency symbol position with Positive values :
 7: Currency symbol position with Negative values :
 
 EXAMPLE: ||&euro;|2|,||1|8
 * @return string
 */
 public static function getInstance($currencyId = 0, $vendorId = 0)
 {
     // 		if(empty(self::$_instance) || empty(self::$_instance->_currency_id) || ($currencyId!=self::$_instance->_currency_id && !empty($currencyId)) ){
     if (empty(self::$_instance) || (!empty($currencyId) and $currencyId != self::$_instance->_currency_id)) {
         self::$_instance = new CurrencyDisplay($vendorId);
         if (empty($currencyId)) {
             if (self::$_instance->_app->isSite()) {
                 self::$_instance->_currency_id = self::$_instance->_app->getUserStateFromRequest("virtuemart_currency_id", 'virtuemart_currency_id', vRequest::getInt('virtuemart_currency_id', 0));
             }
             if (empty(self::$_instance->_currency_id)) {
                 self::$_instance->_currency_id = self::$_instance->_vendorCurrency;
             }
         } else {
             self::$_instance->_currency_id = $currencyId;
         }
         $vendorM = VmModel::getModel('currency');
         $style = $vendorM->getData((int) self::$_instance->_currency_id);
         if (!empty($style)) {
             self::$_instance->setCurrencyDisplayToStyleStr($style);
         } else {
             $uri = JFactory::getURI();
             VmConfig::loadJLang('com_virtuemart');
             if (empty(self::$_instance->_currency_id)) {
                 $link = $uri->root() . 'administrator/index.php?option=com_virtuemart&view=user&task=editshop';
                 vmWarn(vmText::sprintf('COM_VIRTUEMART_CONF_WARN_NO_CURRENCY_DEFINED', '<a href="' . $link . '">' . $link . '</a>'));
             } else {
                 if (vRequest::getCmd('view') != 'currency') {
                     $link = $uri->root() . 'administrator/index.php?option=com_virtuemart&view=currency&task=edit&cid[]=' . self::$_instance->_currency_id;
                     vmWarn(vmText::sprintf('COM_VIRTUEMART_CONF_WARN_NO_FORMAT_DEFINED', '<a href="' . $link . '">' . $link . '</a>'));
                 }
             }
             //				self::$_instance->setCurrencyDisplayToStyleStr($currencyId);
             //would be nice to automatically unpublish the product/currency or so
         }
     }
     self::$_instance->setPriceArray();
     return self::$_instance;
 }
开发者ID:lenard112,项目名称:cms,代码行数:59,代码来源:currencydisplay.php


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