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/Dateformat.php

Documentation is available at Dateformat.php

  1. <?PHP
  2. /**
  3.  * patTemplate modfifier Dateformat
  4.  *
  5.  * $Id: Dateformat.php 403 2005-05-21 12:55:15Z schst $
  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 Dateformat
  17.  *
  18.  * formats dates and times according to a format string.
  19.  *
  20.  * Possible attributes are:
  21.  * - format (string)
  22.  *
  23.  * See the PHP documentation for strftime() for
  24.  * more information.
  25.  *
  26.  * @package        patTemplate
  27.  * @subpackage    Modifiers
  28.  * @author        Stephan Schmidt <[email protected]>
  29.  * @link        http://www.php.net/manual/en/function.strftime.php
  30.  */
  31. {
  32.    /**
  33.     * modify the value
  34.     *
  35.     * @access    public
  36.     * @param    string        value
  37.     * @return    string        modified value
  38.     */
  39.     function modify$value$params array() )
  40.     {
  41.         if (!isset($params['format'])) {
  42.             return $value;
  43.         }
  44.  
  45.         if (!preg_match('/^[0-9]+$/'$value)) {
  46.             $value strtotime($value);
  47.         }
  48.  
  49.         return strftime($params['format']$value);
  50.     }
  51. }
  52. ?>

Documentation generated on Mon, 05 Mar 2007 20:56:21 +0000 by phpDocumentor 1.3.1