dwoo-project / dwoo

[UNMAINTAINED] php template engine
http://dwoo.org
GNU Lesser General Public License v3.0
167 stars 58 forks source link

[Fatal error] Add custom plugin class #45

Closed emulienfou closed 8 years ago

emulienfou commented 8 years ago

When trying to add a custom plugin as a PHP class, such as:

<?php
class Dwoo_Filter_fix_address_class extends Dwoo_Filter
{
    public function process($str)
    {
        return str_replace(
            array('@', '.', '-'),
            array(' at ', ' dot ', ' dash '),
            $str
        );
    }
}
$dwoo->addPlugin('email_safe_class', 'fix_address_class');

Get the next error code:

Fatal error: Uncaught exception 'Dwoo_Exception' with message 'Callback could not be processed correctly, please check that the function/class you used exists'
Dwoo_Exception: Callback could not be processed correctly, please check that the function/class you used exists in /var/www/lib/Dwoo/Core.php on line 497
emulienfou commented 8 years ago

Not an error! Just an error, in this case, we need to use the full name of the class, such as: $dwoo->addPlugin('email_safe_class', 'Dwoo_Filter_fix_address_class');