Commit 454339d0 by seldaek

fixes #43

Fixes a {load_templates} bug, plugins used in external templates were not loaded correctly git-svn-id: http://svn.dwoo.org/trunk@315 0598d79b-80c4-4d41-97ba-ac86fbbd088b
parent cf4be68f
......@@ -28,6 +28,8 @@
* Fixed a bug when accessing global vars from a sub-template
* Fixed a couple bugs in the {dynamic} plugin with regard to using plugins
within a dynamic block
* Fixed a {load_templates} bug, plugins used in external templates were not
loaded correctly
* Cached templates now check the source template for modification before
outputting the cached version
* Removed a couple of @-operator calls to file_get_contents
......
......@@ -471,7 +471,33 @@ class Dwoo_Compiler implements Dwoo_ICompiler
}
/**
* adds a template plugin, this is reserved for use by the {function} plugin
* adds an used plugin, this is reserved for use by the {template} plugin
*
* this is required so that plugin loading bubbles up from loaded
* template files to the current one
*
* @private
* @param string $name function name
* @param int $type plugin type (Dwoo::*_PLUGIN)
*/
public function addUsedPlugin($name, $type)
{
$this->usedPlugins[$name] = $type;
}
/**
* returns all the plugins this template uses
*
* @private
* @return array the list of used plugins in the parsed template
*/
public function getUsedPlugins()
{
return $this->usedPlugins;
}
/**
* adds a template plugin, this is reserved for use by the {template} plugin
*
* this is required because the template functions are not declared yet
* during compilation, so we must have a way of validating their argument
......@@ -2892,7 +2918,7 @@ class Dwoo_Compiler implements Dwoo_ICompiler
}
if (($pluginType & Dwoo::COMPILABLE_PLUGIN) === 0 && ($pluginType & Dwoo::NATIVE_PLUGIN) === 0 && ($pluginType & Dwoo::PROXY_PLUGIN) === 0) {
$this->usedPlugins[$name] = $pluginType;
$this->addUsedPlugin($name, $pluginType);
}
return $pluginType;
......
......@@ -47,6 +47,9 @@ function Dwoo_Plugin_load_templates_compile(Dwoo_Compiler $compiler, $file)
foreach ($cmp->getTemplatePlugins() as $template=>$args) {
$compiler->addTemplatePlugin($template, $args['params'], $args['uuid'], $args['body']);
}
foreach ($cmp->getUsedPlugins() as $plugin=>$type) {
$compiler->addUsedPlugin($plugin, $type);
}
$out = '\'\';// checking for modification in '.$resource.':'.$identifier."\r\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment