Arbit - project tracking

Dwoo

History

Diff

cf4be6 454339 a/CHANGELOG
29 29 * Fixed a bug when accessing global vars from a sub-template
30 30 * Fixed a couple bugs in the {dynamic} plugin with regard to using plugins
31 31 within a dynamic block
32 +* Fixed a {load_templates} bug, plugins used in external templates were not
33 + loaded correctly
32 34 * Cached templates now check the source template for modification before
33 35 outputting the cached version
34 36 * Removed a couple of @-operator calls to file_get_contents
cf4be6 454339 a/lib/Dwoo/Compiler.php
472 472 }
473 473
474 474 /**
475 - * adds a template plugin, this is reserved for use by the {function} plugin
475 + * adds an used plugin, this is reserved for use by the {template} plugin
476 + *
477 + * this is required so that plugin loading bubbles up from loaded
478 + * template files to the current one
479 + *
480 + * @private
481 + * @param string $name function name
482 + * @param int $type plugin type (Dwoo::*_PLUGIN)
483 + */
484 + public function addUsedPlugin($name, $type)
485 + {
486 + $this->usedPlugins[$name] = $type;
487 + }
488 +
489 + /**
490 + * returns all the plugins this template uses
491 + *
492 + * @private
493 + * @return array the list of used plugins in the parsed template
494 + */
495 + public function getUsedPlugins()
496 + {
497 + return $this->usedPlugins;
498 + }
499 +
500 + /**
501 + * adds a template plugin, this is reserved for use by the {template} plugin
476 502 *
477 503 * this is required because the template functions are not declared yet
478 504 * during compilation, so we must have a way of validating their argument
2893 2919 }
2894 2920
2895 2921 if (($pluginType & Dwoo::COMPILABLE_PLUGIN) === 0 && ($pluginType & Dwoo::NATIVE_PLUGIN) === 0 && ($pluginType & Dwoo::PROXY_PLUGIN) === 0) {
2896 - $this->usedPlugins[$name] = $pluginType;
2922 + $this->addUsedPlugin($name, $pluginType);
2897 2923 }
2898 2924
2899 2925 return $pluginType;
cf4be6 454339 a/lib/plugins/builtin/functions/load_templates.php
48 48 foreach ($cmp->getTemplatePlugins() as $template=>$args) {
49 49 $compiler->addTemplatePlugin($template, $args['params'], $args['uuid'], $args['body']);
50 50 }
51 + foreach ($cmp->getUsedPlugins() as $plugin=>$type) {
52 + $compiler->addUsedPlugin($plugin, $type);
53 + }
51 54
52 55 $out = '\'\';// checking for modification in '.$resource.':'.$identifier."\r\n";
53 56