Hi!
I tried to use CHtmlPurifier in console command, but failed.
Here is a code:
$purifier = new CHtmlPurifier();
$purifier->options = array(
'URI.AllowedSchemes' => 'http, https',
'HTML.Allowed' => 'p,b,i,u,s,strong,strike,big,small,a[href],ul,ol,li,blockquote,h3,h4,h5,h6,br,hr,code,pre,sub,sup'
);
Yii::log($purifier->purify('some html here'), 'info');
When I put this code to an action and run it from browser, it works fine.
But when I paste this code to CConsoleCommand extended class (run method)
I get the error
2011/05/13 09:04:10 [error] [exception.CException] exception 'CException' with message 'CConsoleApplication не содержит метода "getController".' in D:\_projects\External\bankrotstvo.rf\www\framework\base\CComponent.php:266
Stack trace:
#0 D:\_projects\External\bankrotstvo.rf\www\framework\web\widgets\CWidget.php(90): CComponent->__call('getController', Array)
#1 D:\_projects\External\bankrotstvo.rf\www\framework\web\widgets\CWidget.php(90): CConsoleApplication->getController()
#2 D:\_projects\External\bankrotstvo.rf\www\framework\web\widgets\CFilterWidget.php(45): CWidget->__construct(NULL)
#3 D:\_projects\External\bankrotstvo.rf\www\site\protected\commands\FeedAggregateCommand.php(7): CFilterWidget->__construct()
#4 D:\_projects\External\bankrotstvo.rf\www\framework\console\CConsoleCommandRunner.php(63): FeedAggregateCommand->run(Array)
#5 D:\_projects\External\bankrotstvo.rf\www\framework\console\CConsoleApplication.php(88): CConsoleCommandRunner->run(Array)
#6 D:\_projects\External\bankrotstvo.rf\www\framework\base\CApplication.php(155): CConsoleApplication->processRequest()
#7 D:\_projects\External\bankrotstvo.rf\www\framework\yiic.php(33): CApplication->run()
#8 D:\_projects\External\bankrotstvo.rf\www\site\protected\yiic.php(7): require_once('D:\_projects\Ex...')
#9 {main}
I suppose that that is because CHtmlPurifier is inherited from CWidget.
Is there any way to use CHtmlPurifier in console commands? Is it a bug and I should post it to google code issue tracker?