CoreFiles by mySites.guru
Dateformat.php53 lines, 1,163 bytes, from Joomla_1.5.0-Stable-Full_Package.zip
Raw History Compare with 1.0.15
md5
080999154f698ed964bf317039807054
sha1
9084b98448b642263e023f29928bf80b0da47a01
sha256
4854affdd22cf7c078ca7c5d5062734a15f60e1bbee222ed6746c41a5952a7ca
<?PHP
/**
 * patTemplate modfifier Dateformat
 *
 * $Id: Dateformat.php 8287 2007-08-01 08:38:59Z eddieajau $
 *
 * @package		patTemplate
 * @subpackage	Modifiers
 * @author		Stephan Schmidt <[email protected]>
 */

// Check to ensure this file is within the rest of the framework
defined('JPATH_BASE') or die();

/**
 * patTemplate modfifier Dateformat
 *
 * formats dates and times according to a format string.
 *
 * Possible attributes are:
 * - format (string)
 *
 * See the PHP documentation for strftime() for
 * more information.
 *
 * @package		patTemplate
 * @subpackage	Modifiers
 * @author		Stephan Schmidt <[email protected]>
 * @link		http://www.php.net/manual/en/function.strftime.php
 */
class patTemplate_Modifier_Dateformat extends patTemplate_Modifier
{
	/**
	* modify the value
	*
	* @access	public
	* @param	string		value
	* @return	string		modified value
	*/
	function modify( $value, $params = array() )
	{
		if (!isset($params['format'])) {
			return $value;
		}

		if (!preg_match('/^[0-9]+$/', $value)) {
			$value = strtotime($value);
		}

		return strftime($params['format'], $value);
	}
}
?>

The same content is in 4 releases, Joomla 1.5.0 to 1.5.3. See them all, or every version of this file.