[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/libraries/pattemplate/patTemplate/Modifier/ -> Numberformat.php (source)

   1  <?PHP
   2  /**
   3   * patTemplate modfifier Numberformat
   4   *
   5   * $Id: Numberformat.php 10381 2008-06-01 03:35:53Z pasamio $
   6   *
   7   * @package        patTemplate
   8   * @subpackage    Modifiers
   9   * @author        Stephan Schmidt <schst@php.net>
  10   */
  11  
  12  // Check to ensure this file is within the rest of the framework
  13  defined('JPATH_BASE') or die();
  14  
  15  /**
  16   * patTemplate modfifier Numberformat
  17   *
  18   * formats dates and times according to a format string.
  19   *
  20   * Possible attributes are:
  21   * - decimals (int)
  22   * - point
  23   * - separator
  24   *
  25   * See the PHP documentation for number_format() for
  26   * more information.
  27   *
  28   * @package        patTemplate
  29   * @subpackage    Modifiers
  30   * @author        Stephan Schmidt <schst@php.net>
  31   * @link        http://www.php.net/manual/en/function.strftime.php
  32   */
  33  class patTemplate_Modifier_Numberformat extends patTemplate_Modifier
  34  {
  35      var $defaults = array(
  36                          'decimals'  => 2,
  37                          'point'     => '.',
  38                          'separator' => ','
  39                      );
  40      /**
  41      * modify the value
  42      *
  43      * @access    public
  44      * @param    string        value
  45      * @return    string        modified value
  46      */
  47  	function modify($value, $params = array())
  48      {
  49          $params = array_merge($this->defaults, $params);
  50          return @number_format($value, $params['decimals'], $params['point'], $params['separator']);
  51      }
  52  }
  53  ?>


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1