home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / Image / Graph / DataPreprocessor / NumberText.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  2.9 KB  |  89 lines

  1. <?php
  2.  
  3. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  4.  
  5. /**
  6.  * Image_Graph - PEAR PHP OO Graph Rendering Utility.
  7.  *
  8.  * PHP versions 4 and 5
  9.  *
  10.  * LICENSE: This library is free software; you can redistribute it and/or modify
  11.  * it under the terms of the GNU Lesser General Public License as published by
  12.  * the Free Software Foundation; either version 2.1 of the License, or (at your
  13.  * option) any later version. This library is distributed in the hope that it
  14.  * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  15.  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
  16.  * General Public License for more details. You should have received a copy of
  17.  * the GNU Lesser General Public License along with this library; if not, write
  18.  * to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  19.  * 02111-1307 USA
  20.  *
  21.  * @category   Images
  22.  * @package    Image_Graph
  23.  * @subpackage DataPreprocessor
  24.  * @author     Jesper Veggerby <pear.nosey@veggerby.dk>
  25.  * @copyright  Copyright (C) 2003, 2004 Jesper Veggerby Hansen
  26.  * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  27.  * @version    CVS: $Id: NumberText.php,v 1.6 2005/08/24 20:35:59 nosey Exp $
  28.  * @link       http://pear.php.net/package/Image_Graph
  29.  */
  30.  
  31. /**
  32.  * Include file Image/Graph/DataPreprocessor.php
  33.  */
  34. require_once 'Image/Graph/DataPreprocessor.php';
  35.  
  36. /**
  37.  * Formatting a number as its written in languages supported by Numbers_Words.
  38.  *
  39.  * Used to display values as text, i.e. 123 is displayed as one hundred and twenty three.
  40.  * Requires Numbers_Words
  41.  *
  42.  * @category   Images
  43.  * @package    Image_Graph
  44.  * @subpackage DataPreprocessor
  45.  * @author     Jesper Veggerby <pear.nosey@veggerby.dk>
  46.  * @copyright  Copyright (C) 2003, 2004 Jesper Veggerby Hansen
  47.  * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  48.  * @version    Release: 0.7.2
  49.  * @link       http://pear.php.net/package/Image_Graph
  50.  */
  51. class Image_Graph_DataPreprocessor_NumberText extends Image_Graph_DataPreprocessor
  52. {
  53.  
  54.     /**
  55.      * The language identifier
  56.      * @var string
  57.      * @access private
  58.      */
  59.     var $_language;
  60.  
  61.     /**
  62.      * Image_Graph_NumberText [Constructor].
  63.      *
  64.      * Supported languages see {@link http://pear.php.net/package/Numbers_Words Numbers_Words}
  65.      *
  66.      * @param string $langugage The language identifier for the language.
  67.      */
  68.     function Image_Graph_DataPreprocessor_NumberText($language = 'en_US')
  69.     {
  70.         parent::Image_Graph_DataPreprocessor();
  71.         $this->_language = $language;
  72.         require_once 'Numbers/Words.php';
  73.     }
  74.  
  75.     /**
  76.      * Process the value
  77.      *
  78.      * @param var $value The value to process/format
  79.      * @return string The processed value
  80.      * @access private
  81.      */
  82.     function _process($value)
  83.     {
  84.         return Numbers_Words::toWords($value, $this->_language);
  85.     }
  86.  
  87. }
  88.  
  89. ?>