[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/libraries/pattemplate/patTemplate/Modifier/ -> Dateformat.php (source)

   1  <?PHP
   2  /**
   3   * patTemplate modfifier Dateformat
   4   *
   5   * $Id: Dateformat.php 10381 2008-06-01 03:35:53Z pasamio $
   6   *
   7   * @package        patTemplate
   8   * @subpackage    Modifiers
   9   * @author        Stephan Schmidt <schst@php.net>
  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 <schst@php.net>
  29   * @link        http://www.php.net/manual/en/function.strftime.php
  30   */
  31  class patTemplate_Modifier_Dateformat extends patTemplate_Modifier
  32  {
  33      /**
  34      * modify the value
  35      *
  36      * @access    public
  37      * @param    string        value
  38      * @return    string        modified value
  39      */
  40  	function modify( $value, $params = array() )
  41      {
  42          if (!isset($params['format'])) {
  43              return $value;
  44          }
  45  
  46          if (!preg_match('/^[0-9]+$/', $value)) {
  47              $value = strtotime($value);
  48          }
  49  
  50          return strftime($params['format'], $value);
  51      }
  52  }
  53  ?>


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1