/** * Apply markup rules on plain text. * * @param TextFormat $markup Markup rules applied on marked-up text. * @param string $text Marked-up text on which rules are applied. * * @return string HTML code computed from marked-up text. */ private static function markupText($markup, $text) { return symbol(smile($markup->format($text), false)); }
/** * Simplified version of formatReady that handles link formatting only. * * @param string $text Marked-up text. * @param bool $nl2br Convert newlines to <br>. * @return string Marked-up text with markup-links converted to * HTML-links. */ function formatLinks($text, $nl2br = TRUE) { $link_markup_rule = StudipFormat::getStudipMarkup('links'); $markup = new TextFormat(); $markup->addMarkup('links', $link_markup_rule['start'], $link_markup_rule['end'], $link_markup_rule['callback']); if ($nl2br) { // fix newlines $text = nl2br($text, FALSE); } return Markup::purify($markup->format(trim($text))); }