function textile($text, $lite = '')
 {
     if (get_magic_quotes_gpc() == 1) {
         $text = stripslashes($text);
     }
     $text = incomingEntities($text);
     $text = encodeEntities($text);
     $text = fixEntities($text);
     $text = cleanWhiteSpace($text);
     $text = getRefs($text);
     $text = noTextile($text);
     $text = image($text);
     $text = links($text);
     $text = span($text);
     $text = superscript($text);
     $text = footnoteRef($text);
     $text = code($text);
     $text = glyphs($text);
     $text = retrieve($text);
     if ($lite == '') {
         $text = lists($text);
         $text = table($text);
         $text = block($text);
     }
     /* clean up <notextile> */
     $text = preg_replace('/<\\/?notextile>/', "", $text);
     /* turn the temp char back to an ampersand entity */
     $text = str_replace("x%x%", "&amp;", $text);
     $text = str_replace("<br />", "<br />\n", $text);
     return trim($text);
 }
示例#2
0
function block($text)
{
    $text = preg_replace("/&(?![#a-z0-9]+;)/i", "x%x%", $text);
    $text = str_replace("x%x%", "&#38;", $text);
    $text = cleanWhiteSpace($text);
    $that = array();
    $that = explode("\n\n", $text);
    foreach ($that as $key => $value) {
        $value = cleaningOutput($value);
        $value = glyphs($value);
        // to make it work with 'plug:'
        //if (preg_match("/<(h[12345]|code.*|h[12345].*|p.*|style.*|div.*|\/div)>/i", $value))
        if (preg_match("/<(h[12345]|code.*|h[12345].*|p|style.*|div.*|\\/div)>/i", $value)) {
            $s[] = $value;
        } else {
            $s[] = '<p>' . $value . '</p>';
        }
    }
    $out = implode("\n\n", $s);
    return $out;
}