mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
replace property array by object properties
This commit is contained in:
@@ -96,6 +96,7 @@ require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_template.php';
|
||||
require_once SMARTY_SYSPLUGINS_DIR . 'smarty_resource.php';
|
||||
require_once SMARTY_SYSPLUGINS_DIR . 'smarty_variable.php';
|
||||
require_once SMARTY_SYSPLUGINS_DIR . 'smarty_template_source.php';
|
||||
require_once SMARTY_SYSPLUGINS_DIR . 'smarty_template_resource_base.php';
|
||||
|
||||
/**
|
||||
* This is the main Smarty class
|
||||
@@ -555,13 +556,6 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
*/
|
||||
public $caching_type = 'file';
|
||||
|
||||
/**
|
||||
* internal config properties
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $properties = array();
|
||||
|
||||
/**
|
||||
* config type
|
||||
*
|
||||
|
@@ -73,7 +73,7 @@ abstract class Smarty_CacheResource
|
||||
{
|
||||
if ($_template->cached->handler->process($_template)) {
|
||||
ob_start();
|
||||
$_template->properties['unifunc']($_template);
|
||||
$_template->cached->unifunc($_template);
|
||||
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
@@ -42,12 +42,12 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
|
||||
$compiler->has_code = false;
|
||||
if ($_attr['type'] == 'xml') {
|
||||
$compiler->tag_nocache = true;
|
||||
$save = $compiler->template->has_nocache_code;
|
||||
$save = $compiler->template->compiled->has_nocache_code;
|
||||
$output = addcslashes($_attr['code'], "'\\");
|
||||
$compiler->parser->current_buffer->append_subtree($compiler->parser, new Smarty_Internal_ParseTree_Tag($compiler->parser, $compiler->processNocacheCode("<?php echo '" .
|
||||
$output .
|
||||
"';?>", $compiler, true)));
|
||||
$compiler->template->has_nocache_code = $save;
|
||||
$compiler->template->compiled->has_nocache_code = $save;
|
||||
return '';
|
||||
}
|
||||
if ($_attr['type'] != 'tag') {
|
||||
@@ -60,12 +60,12 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
|
||||
return '';
|
||||
} elseif ($compiler->php_handling == Smarty::PHP_PASSTHRU || $_attr['type'] == 'unmatched') {
|
||||
$compiler->tag_nocache = true;
|
||||
$save = $compiler->template->has_nocache_code;
|
||||
$save = $compiler->template->compiled->has_nocache_code;
|
||||
$output = addcslashes($_attr['code'], "'\\");
|
||||
$compiler->parser->current_buffer->append_subtree($compiler->parser, new Smarty_Internal_ParseTree_Tag($compiler->parser, $compiler->processNocacheCode("<?php echo '" .
|
||||
$output .
|
||||
"';?>", $compiler, true)));
|
||||
$compiler->template->has_nocache_code = $save;
|
||||
$compiler->template->compiled->has_nocache_code = $save;
|
||||
return '';
|
||||
} elseif ($compiler->php_handling == Smarty::PHP_ALLOW) {
|
||||
if (!($compiler->smarty instanceof SmartyBC)) {
|
||||
|
@@ -101,7 +101,7 @@ class Smarty_Internal_Config_File_Compiler
|
||||
public function compileTemplate(Smarty_Internal_Template $template)
|
||||
{
|
||||
$this->template = $template;
|
||||
$this->template->properties['file_dependency'][$this->template->source->uid] = array($this->template->source->filepath,
|
||||
$this->template->compiled->file_dependency[$this->template->source->uid] = array($this->template->source->filepath,
|
||||
$this->template->source->getTimeStamp(),
|
||||
$this->template->source->type);
|
||||
if ($this->smarty->debugging) {
|
||||
|
@@ -29,7 +29,7 @@ class Smarty_Internal_Extension_Config
|
||||
Smarty_Internal_Debug::end_render($confObj);
|
||||
}
|
||||
if ($obj instanceof Smarty_Internal_Template) {
|
||||
$obj->properties['file_dependency'][$confObj->source->uid] = array($confObj->source->filepath, $confObj->source->getTimeStamp(), $confObj->source->type);
|
||||
$obj->compiled->file_dependency[$confObj->source->uid] = array($confObj->source->filepath, $confObj->source->getTimeStamp(), $confObj->source->type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -46,6 +46,6 @@ class Smarty_Internal_Nocache_Insert
|
||||
$_tpl = $_tpl->parent;
|
||||
}
|
||||
|
||||
return "/*%%SmartyNocache:{$_tpl->properties['nocache_hash']}%%*/" . $_output . "/*/%%SmartyNocache:{$_tpl->properties['nocache_hash']}%%*/";
|
||||
return "/*%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/" . $_output . "/*/%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/";
|
||||
}
|
||||
}
|
||||
|
@@ -71,7 +71,7 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom
|
||||
$this->parser = new $this->parser_class(new $this->lexer_class(str_replace(array("\r\n",
|
||||
"\r"), "\n", $_content), $this), $this);
|
||||
if ($isTemplateSource) {
|
||||
$this->parser->insertPhpCode("<?php\n\$_smarty_tpl->properties['nocache_hash'] = '{$this->nocache_hash}';\n?>\n");
|
||||
$this->parser->insertPhpCode("<?php\n\$_smarty_tpl->compiled->nocache_hash = '{$this->nocache_hash}';\n?>\n");
|
||||
}
|
||||
if ($this->inheritance_child) {
|
||||
// start state on child templates
|
||||
|
@@ -1451,9 +1451,9 @@ class Smarty_Internal_Templateparser
|
||||
function yy_r7()
|
||||
{
|
||||
$this->compiler->tag_nocache = true;
|
||||
$save = $this->template->has_nocache_code;
|
||||
$save = $this->template->compiled->has_nocache_code;
|
||||
$this->_retvalue = new Smarty_Internal_ParseTree_Tag($this, $this->compiler->processNocacheCode("<?php echo '{$this->yystack[$this->yyidx + 0]->minor}';?>\n", $this->compiler, true));
|
||||
$this->template->has_nocache_code = $save;
|
||||
$this->template->compiled->has_nocache_code = $save;
|
||||
}
|
||||
|
||||
#line 263 "../smarty/lexer/smarty_internal_templateparser.y"
|
||||
|
@@ -205,7 +205,7 @@ class Smarty_Template_Source
|
||||
list($name, $type) = Smarty_Resource::parseResourceName($template_resource, $smarty->default_resource_type);
|
||||
$resource = Smarty_Resource::load($smarty, $type);
|
||||
// if resource is not recompiling and resource name is not dotted we can check the source cache
|
||||
if ($smarty->resource_caching && !$resource->recompiled && !(isset($name[1]) && $name[0] == '.' && ($name[1] == '.' || $name[1] == '/'))) {
|
||||
if (($smarty->resource_cache_mode & Smarty::RESOURCE_CACHE_ON) && !$resource->recompiled && !(isset($name[1]) && $name[0] == '.' && ($name[1] == '.' || $name[1] == '/'))) {
|
||||
$unique_resource = $resource->buildUniqueResourceName($smarty, $name);
|
||||
if (isset($smarty->source_objects[$unique_resource])) {
|
||||
return $smarty->source_objects[$unique_resource];
|
||||
@@ -220,7 +220,7 @@ class Smarty_Template_Source
|
||||
Smarty_Internal_Extension_DefaultTemplateHandler::_getDefault($_template, $source);
|
||||
}
|
||||
// on recompiling resources we are done
|
||||
if ($smarty->resource_caching && !$resource->recompiled) {
|
||||
if (($smarty->resource_cache_mode & Smarty::RESOURCE_CACHE_ON) && !$resource->recompiled) {
|
||||
// may by we have already $unique_resource
|
||||
$is_relative = false;
|
||||
if (!isset($unique_resource)) {
|
||||
|
Reference in New Issue
Block a user