- add concept unique_resource to combat potentially ambiguous template_resource values when custom resource handlers are used (Forum Topic 2012)

http://www.smarty.net/forums/viewtopic.php?t=2012

thereby DRYed and optimized the resource handler identification method.
This commit is contained in:
rodneyrehm
2011-10-13 13:10:06 +00:00
parent 806c51fdcf
commit 6979b4efb0
11 changed files with 216 additions and 118 deletions
+8 -20
View File
@@ -24,13 +24,14 @@ class Smarty_Config_Source extends Smarty_Template_Source {
/**
* create Config Object container
*
* @param Smarty_Resource $handler Resource Handler this source object communicates with
* @param Smarty $smarty Smarty instance this source object belongs to
* @param string $resource full config_resource
* @param string $type type of resource
* @param string $name resource name
* @param Smarty_Resource $handler Resource Handler this source object communicates with
* @param Smarty $smarty Smarty instance this source object belongs to
* @param string $resource full config_resource
* @param string $type type of resource
* @param string $name resource name
* @param string $unique_resource unqiue resource name
*/
public function __construct(Smarty_Resource $handler, Smarty $smarty, $resource, $type, $name)
public function __construct(Smarty_Resource $handler, Smarty $smarty, $resource, $type, $name, $unique_resource)
{
$this->handler = $handler; // Note: prone to circular references
@@ -43,22 +44,9 @@ class Smarty_Config_Source extends Smarty_Template_Source {
$this->resource = $resource;
$this->type = $type;
$this->name = $name;
$this->unique_resource = $unique_resource;
}
/**
* get a Compiled Object of this source
*
* @param Smarty_Internal_Template $_template template objet
* @return Smarty_Template_Compiled compiled object
*
public function getCompiled(Smarty_Internal_Template $_template)
{
$compiled = new Smarty_Template_Compiled($this);
$this->handler->populateCompiledFilepath($compiled, $_template);
return $compiled;
}
*/
/**
* <<magic>> Generic setter.
*