/**
  * Process bbcode inside a string
  * @since Version 3.10.0
  * @param string|DOMDocument $string The HTML or text block to process
  * @return DOMDocument
  */
 public static function Process($string, $doBbcode = true)
 {
     if (!$doBbcode) {
         return $string;
     }
     $timer = Debug::getTimer();
     /**
      * Pre-process the string before we send it through the BBCode parser
      */
     $string = self::preProcessBBCodeUIDs($string);
     $parser = new Decoda($string);
     $parser->addPath(__DIR__ . DIRECTORY_SEPARATOR . 'BbcodeEtc' . DIRECTORY_SEPARATOR);
     $emoticonConfig = ['path' => '//static.railpage.com.au/images/smiles/', 'extension' => 'gif'];
     $engine = new DecodaPhpEngine();
     $engine->addPath(__DIR__ . DIRECTORY_SEPARATOR . 'BbcodeEtc' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR);
     $parser->setEngine($engine);
     $parser->defaults();
     $parser->setStrict(false);
     $parser->setLineBreaks(false);
     $parser->removeHook('Emoticon');
     $parser->addFilter(new RailpageImageFilter());
     $string = $parser->parse();
     $string = html_entity_decode($string);
     // Fix: if I set escapeHtml in the Decoda options, it fails to auto linkify links
     //$string = wpautop($string);
     Debug::LogEvent(__METHOD__, $timer);
     return $string;
 }
Exemple #2
0
 /**
  * Remove hook(s).
  *
  * @param string|array $hooks
  *
  * @return \Decoda\Decoda
  */
 public function removeHook($ids)
 {
     return parent::removeHook(array_map('strtolower', (array) $ids));
 }