Переделка для composer autoload

This commit is contained in:
origami11 2017-02-09 14:57:40 +03:00
parent ad69746347
commit b5641db607
100 changed files with 14 additions and 325 deletions

34
src/tales.php Normal file
View file

@ -0,0 +1,34 @@
<?php
/**
* Расширения для PHPTAL для отображения времени и даты
* package utils
*/
class DateTime_Tales implements PHPTAL_Tales
{
static public function date ($expression, $nothrow = false)
{
return "phptal_date(".PHPTAL_TalesInternal::path ($expression).")";
}
static public function time ($expression, $nothrow = false)
{
return "phptal_time(".PHPTAL_TalesInternal::path ($expression).")";
}
}
/* Регистрация нового префикса для подключения компонента */
$registry = PHPTAL_TalesRegistry::getInstance();
$registry->registerPrefix('date', array('DateTime_Tales', 'date'));
$registry->registerPrefix('time', array('DateTime_Tales', 'time'));
function phptal_date ($e)
{
return date ("d.m.Y", $e);
}
function phptal_time ($e)
{
return date ("H:i", $e);
}