예제 #1
0
/**
 * Parsing intro or body
 */
function parse_intro_or_body($text, $strip = "")
{
    global $db, $Weblogs, $Current_weblog;
    $output = $text;
    if ($strip == "strip") {
        $output = strip_tags($output, "<a><b><i><u><embed><strong><ol><li><ul>");
    }
    $output = parse_step4($output);
    /* text processing: nl2br, Textile or Markdown/SmartyPants
    	   We ensure that newlines aren't converted to br elements in script 
    	   blocks - currently handling PHP and JavaScript.
    	   More exclusions will/can be added.
    	*/
    // Use the ACK (006) ASCII symbol to replace all script elements temporarily
    $output = str_replace("", "", $output);
    $regexp = "#(<script[ >].*?</script>)|(<\\?php\\s.*?\\?>)#is";
    preg_match_all($regexp, $output, $scripts);
    $output = preg_replace($regexp, "", $output);
    if ($db->entry['convert_lb'] == 1) {
        $output = strip_trailing_space(nl2br($output));
    } else {
        if ($db->entry['convert_lb'] == 2) {
            $output = pivot_textile($output);
        } else {
            if ($db->entry['convert_lb'] == 3 || $db->entry['convert_lb'] == 4) {
                $output = pivot_markdown($output, $db->entry['convert_lb']);
            }
        }
    }
    // Put captured scripts back into the output
    foreach ($scripts[0] as $script) {
        $output = preg_replace("//", $script, $output, 1);
    }
    // targetblank
    if ($Weblogs[$Current_weblog]['target_blank'] > 0) {
        $output = targetblank($output);
    }
    // emoticons..
    if ($Weblogs[$Current_weblog]['emoticons'] == 1) {
        $output = emoticonize($output);
    }
    // There's a silly quirk in TinyMCE, that prevents transparent Flash. We
    // need to fix this, to make Youtube videos work properly.
    $output = str_replace("<param name=\"wmode\" value=\"\" />", "<param name=\"wmode\" value=\"transparent\" />", $output);
    $output = str_replace(" wmode=\"\" ", " wmode=\"transparent\" ", $output);
    return tidy_html($output);
}
예제 #2
0
function snippet_atombutton()
{
    global $Weblogs, $Current_weblog, $Paths;
    $filename = fixpath($Paths['pivot_url'] . $Weblogs[$Current_weblog]['rss_path']) . $Weblogs[$Current_weblog]['atom_filename'];
    $image = $Paths['pivot_url'] . 'pics/atombutton.png';
    list($width, $height) = @getimagesize($Paths['pivot_path'] . 'pics/atombutton.png');
    $alttext = lang('weblog_text', 'atom_feed');
    $output = '<a href="' . $filename . '" title="' . $alttext . '" rel="nofollow" class="badge">';
    $output .= '<img src="' . $image . '" width="' . $width . '" height="' . $height . '"';
    $output .= ' alt="' . $alttext . '" class="badge" longdesc="' . $filename . '" /></a>';
    $output = targetblank($output);
    return $output;
}