public function do_markup($content, $post = null) { static $textile; static $markdown; static $bbcode; $markup = 'html'; $process_comments = Options::get('Markup__process_comments'); // Posts are Post objects and comments are comment objects. if ($post instanceof Comment && $process_comments) { $markup = Options::get('Markup__comment_markup_type'); } else { if ($post instanceof Post) { $markup = Options::get('Markup__markup_type'); } } switch ($markup) { case 'markdown': if (!isset($markdown)) { $markdown = new MarkdownExtra_Parser(); } return $markdown->transform($content); break; case 'textile': if (!isset($textile)) { $textile = new Textile(); } return $textile->TextileThis($content); break; case 'bbcode': if (!isset($bbcode)) { $bbcode = new BBCode(); } return $bbcode->transform($content); break; case 'html': default: return $content; } }