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.  * @author     Jordi Boggiano <j.boggiano@seld.be>
  13.  * @copyright  Copyright (c) 2008, Jordi Boggiano
  14.  * @license    http://dwoo.org/LICENSE   Modified BSD License
  15.  * @link       http://dwoo.org/
  16.  * @version    1.0.0
  17.  * @date       2008-10-23
  18.  * @package    Dwoo
  19.  */
  20. function Dwoo_Plugin_capitalize(Dwoo $dwoo$value$numwords=false)
  21. {
  22.     if ($numwords || preg_match('#^[^0-9]+$#',$value))
  23.     {
  24.         if ($dwoo->getCharset(=== 'iso-8859-1'{
  25.             return ucwords((string) $value);
  26.         }
  27.         return mb_convert_case((string) $value,MB_CASE_TITLE$dwoo->getCharset());
  28.     else {
  29.         $bits explode(' '(string) $value);
  30.         $out '';
  31.         while (list(,$veach($bits)) {
  32.             if (preg_match('#^[^0-9]+$#'$v)) {
  33.                 $out .=    ' '.mb_convert_case($vMB_CASE_TITLE$dwoo->getCharset());
  34.             else {
  35.                 $out .=    ' '.$v;
  36.             }
  37.         }
  38.  
  39.         return substr($out1);
  40.     }
  41. }

Documentation generated on Wed, 24 Dec 2008 02:13:17 +0100 by phpDocumentor 1.4.0