/** * Обработать строку (только типография): */ public static function typo($text) { $texy = self::createTexyObject(); TexyConfigurator::safeMode($texy); TexyConfigurator::disableImages($texy); TexyConfigurator::disableLinks($texy); return $texy->processTypo(htmlspecialchars($text)); }
// processing $text = file_get_contents('sample.texy'); $html = $texy->process($text); // that's all folks! // echo formated output echo $html; // and echo generated HTML code echo '<pre>'; echo htmlSpecialChars($html); echo '</pre>'; echo '<hr />'; } header('Content-type: text/html; charset=utf-8'); echo '<h2>Enable nearly all valid tags</h2>'; // by default doIt($texy); echo '<h2>Texy::ALL - enables all tags</h2>'; $texy->allowedTags = Texy::ALL; doIt($texy); echo '<h2>safeMode() - enables only some "safe" tags</h2>'; TexyConfigurator::safeMode($texy); doIt($texy); echo '<h2>disableLinks() - disable all links</h2>'; TexyConfigurator::disableLinks($texy); doIt($texy); echo '<h2>Texy::NONE - disables all tags</h2>'; $texy->allowedTags = Texy::NONE; doIt($texy); echo '<h2>Enable custom tags</h2>'; $texy->allowedTags = array('myExtraTag' => array('attr1'), 'strong' => array()); doIt($texy);