Example #1
0
$xmlg['page_title'] = $title;
$format = strtolower(get_param('format', 'xhtml'));
$content_provider->basedir = $base_text_dir;
$text = $content_provider->get_wiki_text($title);
$xml = $converter->article2xml($title, $text, $xmlg);
if ($format == "xml") {
    # XML
    header('Content-type: text/xml; charset=utf-8');
    print "<?xml version='1.0' encoding='UTF-8' ?>\n";
    print $xml;
} else {
    if ($format == "text") {
        # Plain text
        $xmlg['plaintext_markup'] = true;
        $xmlg['plaintext_prelink'] = true;
        $out = $converter->articles2text($xml, $xmlg);
        $out = str_replace("\n", "<br/>", $out);
        header('Content-type: text/html; charset=utf-8');
        print $out;
    } else {
        # XHTML
        if (stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml")) {
            # Skipping the "strict" part ;-)
            header("Content-type: text/html; charset=utf-8");
            #		header("Content-type: application/xhtml+xml");
        } else {
            # Header hack for IE
            header("Content-type: text/html; charset=utf-8");
        }
        print $converter->articles2xhtml($xml, $xmlg);
    }