On Wed, Dec 21, 2011 at 10:47 AM, Happy Melon happy.melon.wiki@gmail.com wrote:
I don't know if you can access that data directly from the extension callback, but you can certainly wire it in without *too* bad a hack:
foreach( array( 'foo', 'bar', 'baz', quok' ) as $var ){ $parser->setHook( $var, "WrapperClass::myCallback_$var" ); }
class WrapperClass { function __callStatic( $fname, $args ){ list( $junk, $var ) = explode( '_', $fname ); $args[] = $var; return call_user_func_array( 'myCallback', $args ); } }
function myCallback( $input, $args, $parser, $frame, $var ) { return 'hello world'; }
It's pretty obviously a retrofitted design change, but it's fairly robust, especially if you keep the first two bits of code together...
Of course this would only work in 5.3+
-Chad