/**
  * Parse bbcode into safe HTML
  *
  * @access protected
  * @param  string $text
  * @return string
  */
 protected function _parseBBcode($text)
 {
     JLoader::register('Decoda', JPATH_COMPONENT_ADMINISTRATOR . '/libraries/decoda/Decoda.php');
     $code = new Decoda($text);
     $code->setEscapeHtml(!$this->params->get('html.allow', true));
     $filters = $this->params->get('bbcode.filters', array('default' => 1, 'text' => 1, 'image' => 1, 'quote' => 1, 'url' => 1, 'video' => 1));
     foreach ($filters as $filter => $enabled) {
         if ($enabled) {
             $class = ucfirst($filter) . 'Filter';
             $code->addFilter(new $class());
         }
     }
     $whitelist = $this->params->get('bbcode.whitelist', '');
     $whitelist = array_map('trim', explode(',', $whitelist));
     call_user_func_array(array($code, 'whitelist'), $whitelist);
     return $code->parse();
 }