Source for file capitalize.php

Documentation is available at capitalize.php

  1. <?php
  2.  
  3. /**
  4.  * Capitalizes the first letter of each word
  5.  * <pre>
  6.  *  * value : the string to capitalize
  7.  *  * numwords : if true, the words containing numbers are capitalized as well
  8.  * </pre>
  9.  * This software is provided 'as-is', without any express or implied warranty.
  10.  * In no event will the authors be held liable for any damages arising from the use of this software.
  11.  *
  12.  * This file is released under the LGPL
  13.  * "GNU Lesser General Public License"
  14.  * More information can be found here:
  15.  * {@link http://www.gnu.org/copyleft/lesser.html}
  16.  *
  17.  * @author     Jordi Boggiano <j.boggiano@seld.be>
  18.  * @copyright  Copyright (c) 2008, Jordi Boggiano
  19.  * @license    http://www.gnu.org/copyleft/lesser.html  GNU Lesser General Public License
  20.  * @link       http://dwoo.org/
  21.  * @version    0.9.1
  22.  * @date       2008-05-30
  23.  * @package    Dwoo
  24.  */
  25. function Dwoo_Plugin_capitalize(Dwoo $dwoo$value$numwords=false)
  26. {
  27.     if ($numwords || preg_match('#^[^0-9]+$#',$value))
  28.     {
  29.         if ($dwoo->getCharset(=== 'iso-8859-1'{
  30.             return ucwords((string) $value);
  31.         }
  32.         return mb_convert_case((string) $value,MB_CASE_TITLE$dwoo->getCharset());
  33.     else {
  34.         $bits explode(' '(string) $value);
  35.         $out '';
  36.         while (list(,$veach($bits)) {
  37.             if (preg_match('#^[^0-9]+$#'$v)) {
  38.                 $out .=    ' '.mb_convert_case($vMB_CASE_TITLE$dwoo->getCharset());
  39.             else {
  40.                 $out .=    ' '.$v;
  41.             }
  42.         }
  43.  
  44.         return substr($out1);
  45.     }
  46. }

Documentation generated on Sun, 07 Sep 2008 23:57:32 +0200 by phpDocumentor 1.4.0