Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: patTemplate

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5
Source code for file /pattemplate/patTemplate/Modifier/Numberformat.php

Documentation is available at Numberformat.php

  1. <?PHP
  2. /**
  3.  * patTemplate modfifier Numberformat
  4.  *
  5.  * $Id$
  6.  *
  7.  * @package        patTemplate
  8.  * @subpackage    Modifiers
  9.  * @author        Stephan Schmidt <[email protected]>
  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 <[email protected]>
  31.  * @link        http://www.php.net/manual/en/function.strftime.php
  32.  */
  33. {
  34.     var $defaults = array(
  35.                         'decimals'  => 2,
  36.                         'point'     => '.',
  37.                         'separator' => ','
  38.                     );
  39.    /**
  40.     * modify the value
  41.     *
  42.     * @access    public
  43.     * @param    string        value
  44.     * @return    string        modified value
  45.     */
  46.     function modify($value$params array())
  47.     {
  48.         $params array_merge($this->defaults$params);
  49.         return @number_format($value$params['decimals']$params['point']$params['separator']);
  50.     }
  51. }
  52. ?>

Documentation generated on Mon, 05 Mar 2007 21:12:07 +0000 by phpDocumentor 1.3.1