Commit e1d4ca24 by Seldaek

* Fixed parsing bug in {func()->propertyOfReturnedObject}

git-svn-id: svn://dwoo.org/dwoo/trunk@190 0598d79b-80c4-4d41-97ba-ac86fbbd088b
parent 512b3d74
[2008--] 1.0.0
! BC Break: Small one that probably won't affect anyone, but it makes the
PluginProxy feature much stronger. Basically if you used a custom one you
will get a fatal error and need to update it to conform to the new
! BC Break: Small one that probably won't affect anyone, but it makes the
PluginProxy feature much stronger. Basically if you used a custom one you
will get a fatal error and need to update it to conform to the new
IPluginProxy interface, that's it
* Plugins: improved the dump plugin, it now displays object's properties
and optionally public methods (if the new show_methods arg is set to true)
......@@ -10,6 +10,7 @@
* Adapters: Zend: Added parameters to provide a custom engine (extends Dwoo)
or a custom data class (extends Dwoo_Data) - thanks to Maxime Mérian for
the patch
* Fixed parsing bug in {func()->propertyOfReturnedObject}
* Fixed file template class reading from the string compiler factory - thanks
to MrOxiMoron for the patch
* Fixed a 1.0.0beta regression that messed with custom plugin directories
......
......@@ -1209,7 +1209,7 @@ class Dwoo_Compiler implements Dwoo_ICompiler
}
}
if (isset($parsed) && $parsed==='func' && preg_match('#^->[a-z0-9_]+(\s*\(.+)?#is', $substr, $match)) {
if (isset($parsed) && $parsed==='func' && preg_match('#^->[a-z0-9_]+(\s*\(.+|->[a-z].*)?#is', $substr, $match)) {
$ptr = 0;
if (is_array($parsingParams)) {
......
......@@ -556,6 +556,16 @@ replace="BAR"
$this->assertEquals('valid', $dwoo->get($tpl, array(), $this->compiler));
}
public function testCallingMethodOnPropery()
{
$tpl = new Dwoo_Template_String('{getobj()->instance->Bar("hoy")}');
$tpl->forceCompilation();
$dwoo = new Dwoo(DWOO_COMPILE_DIR, DWOO_CACHE_DIR);
$dwoo->addPlugin('getobj', array(new PluginHelper(), 'call'));
$this->assertEquals('HOY', $dwoo->get($tpl, array(), $this->compiler));
}
}
class ProxyHelper implements Dwoo_IPluginProxy
......@@ -602,6 +612,12 @@ class ProxyHelper implements Dwoo_IPluginProxy
class PluginHelper
{
public $moo = "yay";
public $instance;
public function __construct()
{
$this->instance = $this;
}
public function callWithDwoo(Dwoo $dwoo)
{
......
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