Update Smarty und RedBean
Smarty: 3.1.30 - Redbean: 5.0.0
This commit is contained in:
parent
eb0835ff74
commit
0795a87ecd
193 changed files with 22035 additions and 14455 deletions
|
@ -9,8 +9,15 @@
|
|||
* @author Uwe Tews
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
class Smarty_Internal_Resource_PHP extends Smarty_Resource_Uncompiled
|
||||
class Smarty_Internal_Resource_Php extends Smarty_Internal_Resource_File
|
||||
{
|
||||
/**
|
||||
* Flag that it's an uncompiled resource
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $uncompiled = true;
|
||||
|
||||
/**
|
||||
* container for short_open_tag directive's value before executing PHP templates
|
||||
*
|
||||
|
@ -19,52 +26,20 @@ class Smarty_Internal_Resource_PHP extends Smarty_Resource_Uncompiled
|
|||
protected $short_open_tag;
|
||||
|
||||
/**
|
||||
* Create a new PHP Resource
|
||||
* Resource does implement populateCompiledFilepath() method
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $hasCompiledHandler = true;
|
||||
|
||||
/**
|
||||
* Create a new PHP Resource
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->short_open_tag = ini_get('short_open_tag');
|
||||
}
|
||||
|
||||
/**
|
||||
* populate Source Object with meta data from Resource
|
||||
*
|
||||
* @param Smarty_Template_Source $source source object
|
||||
* @param Smarty_Internal_Template $_template template object
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
|
||||
{
|
||||
$source->filepath = $this->buildFilepath($source, $_template);
|
||||
|
||||
if ($source->filepath !== false) {
|
||||
if (is_object($source->smarty->security_policy)) {
|
||||
$source->smarty->security_policy->isTrustedResourceDir($source->filepath);
|
||||
}
|
||||
|
||||
$source->uid = sha1($source->filepath);
|
||||
if ($source->smarty->compile_check) {
|
||||
$source->timestamp = @filemtime($source->filepath);
|
||||
$source->exists = !!$source->timestamp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* populate Source Object with timestamp and exists from Resource
|
||||
*
|
||||
* @param Smarty_Template_Source $source source object
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function populateTimestamp(Smarty_Template_Source $source)
|
||||
{
|
||||
$source->timestamp = @filemtime($source->filepath);
|
||||
$source->exists = !!$source->timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load template's source from file into current template object
|
||||
*
|
||||
|
@ -75,7 +50,7 @@ class Smarty_Internal_Resource_PHP extends Smarty_Resource_Uncompiled
|
|||
*/
|
||||
public function getContent(Smarty_Template_Source $source)
|
||||
{
|
||||
if ($source->timestamp) {
|
||||
if ($source->exists) {
|
||||
return '';
|
||||
}
|
||||
throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
|
||||
|
@ -96,12 +71,9 @@ class Smarty_Internal_Resource_PHP extends Smarty_Resource_Uncompiled
|
|||
throw new SmartyException("PHP templates are disabled");
|
||||
}
|
||||
if (!$source->exists) {
|
||||
if ($_template->parent instanceof Smarty_Internal_Template) {
|
||||
$parent_resource = " in '{$_template->parent->template_resource}'";
|
||||
} else {
|
||||
$parent_resource = '';
|
||||
}
|
||||
throw new SmartyException("Unable to load template {$source->type} '{$source->name}'{$parent_resource}");
|
||||
$parentIsTpl = isset($this->parent) && $this->parent->_objType == 2;
|
||||
throw new SmartyException("Unable to load template {$source->type} '{$source->name}'" .
|
||||
($parentIsTpl ? " in '{$this->parent->template_resource}'" : ''));
|
||||
}
|
||||
|
||||
// prepare variables
|
||||
|
@ -116,4 +88,20 @@ class Smarty_Internal_Resource_PHP extends Smarty_Resource_Uncompiled
|
|||
include($source->filepath);
|
||||
ini_set('short_open_tag', $this->short_open_tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* populate compiled object with compiled filepath
|
||||
*
|
||||
* @param Smarty_Template_Compiled $compiled compiled object
|
||||
* @param Smarty_Internal_Template $_template template object (is ignored)
|
||||
*/
|
||||
public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template)
|
||||
{
|
||||
$compiled->filepath = $_template->source->filepath;
|
||||
$compiled->timestamp = $_template->source->timestamp;
|
||||
$compiled->exists = $_template->source->exists;
|
||||
$compiled->file_dependency[ $_template->source->uid ] =
|
||||
array($compiled->filepath, $compiled->timestamp,
|
||||
$_template->source->type,);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue