ID: 38595 Comment by: php at xmlnode dot com Reported By: goliath dot mailinglist at gmx dot de Status: Open Bug Type: Feature/Change Request Operating System: Linux PHP Version: 5.1.5 New Comment:
I'm not sure how important this really is. I too was disappointed at the lack of flexibility with registerPHPFunctions, but it was hard to be too upset about it because for us, the decision to use XSL as a template is an acknowledgment of standards and registerPHPFunctions is not standard... What we've done, if the value can't be passed as a parameter using XSLTProcessor::setParameter() is created a class with a bunch of static methods which are then called using something like this: php:function('XSL::<function name>',0) If objects need to be instantiated, that work is done inside of those respective methods -- not throughout the XSL. The approach here has the added benefit of being able to periodically scrutinize what others on the team are wanting access to within the XSL and make adjustments for security, performance, etc. YMMV Previous Comments: ------------------------------------------------------------------------ [2006-08-25 17:09:21] goliath dot mailinglist at gmx dot de Description: ------------ XSLTProcessor::registerPHPFunctions() has very limited use. It is only possible to register static callable functions. Some nicer API would be: $xslt = new XSLTProcessor() $xslt->registerPHPFunctions(array( 'func1' => 'functionblah', 'func2' => array('class', 'method'), 'func3' => array($obj, 'method') // this would be the real advantage )); Or even better: $xslt->registerPHPFunction('func1', 'functionblah'); $xslt->registerPHPFunction('func2', array('class', 'method')); $xslt->registerPHPFunction('func3', array($obj, 'method')); $xslt->removePHPFunction('func1'); This would be similar to the set/get/removeParameter-API.... btw.: Your CAPCHA only works with cookies enabled, that really sucks. Reproduce code: --------------- None, not possible Expected result: ---------------- Be able to have instance-methods as callbacks for the XSLTProcessor. (Note: Not global accessibly objects) Actual result: -------------- Not possible ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38595&edit=1