Пример #1
0
 public static function textilize($text, $lite = '', $encode = '', $noimage = '', $strict = '', $rel = '')
 {
     $textile = new Textile();
     if ($rel) {
         $textile->rel = ' rel="' . $rel . '" ';
     }
     $text = $textile->incomingEntities($text);
     if ($encode) {
         $text = str_replace("x%x%", "&", $text);
         return $text;
     }
     if (!$strict) {
         $text = $textile->fixEntities($text);
         $text = $textile->cleanWhiteSpace($text);
     }
     $text = $textile->getRefs($text);
     $text = $textile->noTextile($text);
     $text = $textile->links($text);
     if (!$noimage) {
         $text = $textile->image($text);
     }
     $text = $textile->code($text);
     $text = $textile->span($text);
     $text = $textile->superscript($text);
     $text = $textile->footnoteRef($text);
     $text = $textile->glyphs($text);
     $text = $textile->retrieve($text);
     if (!$lite) {
         $text = $textile->lists($text);
         $text = $textile->table($text);
         $text = $textile->block($text);
     }
     // clean up <notextile>
     $text = preg_replace('/<\\/?notextile>/', "", $text);
     // turn the temp char back to an ampersand entity
     $text = str_replace("x%x%", "&#38;", $text);
     // just to be tidy
     $text = str_replace("<br />", "<br />\n", $text);
     return trim($text);
 }