/** * Helper function to render a string of HTML direct to BB code. * * @param string $html * @param array $options * * @return string BB code */ public static function renderFromHtml($html, array $options = array()) { //echo '<pre>' . htmlspecialchars($html) . '</pre>'; exit; $parser = new XenForo_Html_Parser($html); $renderer = new self($options); $parsed = $parser->parse(); //$parser->printTags($parsed); $rendered = $renderer->render($parsed); //echo '<pre>' . htmlspecialchars($rendered) . '</pre>'; exit; return self::filterBbCode($rendered); }
public static function renderFromHtml($html, array $options = array()) { //echo $html; exit; //echo '<pre>' . htmlspecialchars($html) . '</pre>'; exit; $class = XenForo_Application::resolveDynamicClass(__CLASS__); /** @var $renderer XenForo_Html_Renderer_BbCode */ $renderer = new $class($options); $html = $renderer->preFilter($html); $parser = new XenForo_Html_Parser($html); $parsed = $parser->parse(); //$parser->printTags($parsed); $rendered = $renderer->render($parsed); //echo '<pre>' . htmlspecialchars($rendered) . '</pre>'; exit; return $rendered; }