Example #1
0
            $title = $date;
        } else {
            $title = "{$title} ({$date})";
        }
        // Pre-parse the code out
        $match_cnt = preg_match_all("/\\[code\\](.*?)\\[\\/code\\]/s", $data_plan, $tags_out, PREG_SET_ORDER);
        for ($i = 0; $i < $match_cnt; $i++) {
            $tag_data = ltrim($tags_out[$i][1]);
            $replace = "\\begin{Verbatim}[fontsize=\\small]\n{$tag_data}\nnd{Verbatim}\n";
            $data_plan = replacement_anchor($data_plan, $tags_out[$i][0], $replace);
        }
        // Problem characters
        $data_plan = str_replace(array("&", "<", ">"), array("&amp;", "&lt;", "&gt;"), $data_plan);
        // url
        $data_plan = preg_replace(array("/((http|ftp):\\/\\/[^ \n,]*)/S", "/([^<>\"\\/])((www|ftp)\\.[a-zA-Z]*\\....?)([^<>\"\\/])/S", "/\r+\n?@(.*?)@\r+\n?/"), array("<a href=\"\\1\">\\1</a>", "\\1<a href=\"http://\\2\">\\2</a>\\4", "\n[bold]\\1[/bold]\n"), $data_plan);
        $data_plan = html2tex($data_plan);
        $data_plan = preg_replace(array("/(\n\n|\r\n\r\n)(\n|\r\n)*/", "/(\n|\r\n)/"), array("\\par ", "\\newline\n"), $data_plan);
        // Put the code tags back in
        for ($i = 0; $i < count($replace_anchors); $i++) {
            $data_plan = str_replace($replace_anchors[$i]["anchor_index"], $replace_anchors[$i]["replacement"], $data_plan);
        }
        $body .= "\\section{" . html2tex($title) . "}\n";
        $body .= $data_plan . "\n\n";
    }
    $body .= "nd{document}";
    fputs($fp, $head);
    fputs($fp, $body);
    fclose($fp);
    chmod($output_file, 0666);
}
// exec( "gzip -f ../$conf->user_????.html" );
Example #2
0
        $tag = $tags_out[$i][1];
        $tag_args = ltrim(rtrim($tags_out[$i][2]));
        $tag_text = ltrim(rtrim($tags_out[$i][3]));
        switch ($tag) {
            case "desc":
                $body .= "\\section*{Prologue}\n" . html2tex($tag_text) . "\n\\section*{Questions}\n";
                break;
            case "q":
                if ($tag_args == "") {
                    $tag_args = $interviewer_in;
                }
                $question_id = "q" . str_pad($questions_cnt++, 6, "0", STR_PAD_LEFT);
                $body .= "\\textbf{" . $tag_args . "}: " . html2tex($tag_text) . "\n\n";
                break;
            case "a":
                if ($tag_args == "") {
                    $tag_args = $conf->fullname;
                }
                $body .= "\\textbf{" . $tag_args . "}: " . html2tex($tag_text) . "\n\n";
                break;
            case "section":
                $body .= "\\section{" . $tag_text . "}\n";
                break;
        }
    }
}
$body .= "nd{document}";
fputs($fp, $head);
fputs($fp, $body);
fclose($fp);
// exec( "gzip -f ../$globaluser_????.html" );