I18N
[ class tree: I18N ] [ index: I18N ] [ all elements ]

Source for file Currency.php

Documentation is available at Currency.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | PHP version 4.0                                                      |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003 The PHP Group       |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.0 of the PHP license,       |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: Wolfram Kriesing <wk@visionp.de>                            |
  17. // |                                                                      |
  18. // +----------------------------------------------------------------------+//
  19. // $Id: Currency.php 113734 2003-01-28 11:19:35Z cain $
  20.  
  21. require_once 'I18N/Number.php';
  22.  
  23. /**
  24. *
  25. *   @package    I18N
  26. *
  27. */
  28. class I18N_Currency extends I18N_Number
  29. {
  30.     /**
  31.     *   this var contains the current locale this instace works with
  32.     *
  33.     *   @access     protected
  34.     *   @var        string  this is a string like 'de_DE' or 'en_US', etc.
  35.     */
  36.     var $_locale;
  37.  
  38.     /**
  39.     *   the locale object which contains all the formatting specs
  40.     *
  41.     *   @access     protected
  42.     *   @var        object 
  43.     */
  44.     var $_localeObj = null;
  45.  
  46.  
  47.     function format$amount $format=I18N_CURRENCY_LOCAL )
  48.     {
  49.         if$format == null ){
  50.             $format $this->getFormat();
  51.         }
  52.                                          
  53.         // normally this is used
  54.         $numberFormat $this->_localeObj->currencyFormats[$format];
  55.         // handle custom formats too
  56.         if$format >= I18N_CUSTOM_FORMATS_OFFSET )
  57.         {
  58.             ifisset($this->_customFormats[$format]) )
  59.             {
  60.                 $numberFormat $this->_customFormats[$format];
  61.             }
  62.         }
  63.         // remove the currency symbol, which is the first value
  64.         $currencyFormat array_shift($numberFormat);
  65.  
  66.         $formattedAmount call_user_func_array'number_format' array_mergearray($amount),$numberFormat) );
  67.  
  68.         return str_replace'%' $formattedAmount $currencyFormat );
  69.     }
  70.  
  71. }
  72. ?>

Documentation generated on Mon, 11 Mar 2019 15:36:10 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.