3 require_once('include/bbcode.php');
4 require_once('library/markdown.php');
5 require_once('include/bb2diaspora.php');
6 require_once('include/html2bbcode.php');
8 function visible_lf($s) {
9 return str_replace("\n",'<br />', $s);
12 function babel_content(&$a) {
14 $o .= '<h1>Babel Diagnostic</h1>';
16 $o .= '<form action="babel" method="post">';
17 $o .= t('Source (bbcode) text:') . EOL . '<textarea name="text" >' . htmlspecialchars($_REQUEST['text']) .'</textarea>' . EOL;
18 $o .= '<input type="submit" name="submit" value="Submit" /></form>';
22 $o .= '<form action="babel" method="post">';
23 $o .= t('Source (Diaspora) text to convert to BBcode:') . EOL . '<textarea name="d2bbtext" >' . htmlspecialchars($_REQUEST['d2bbtext']) .'</textarea>' . EOL;
24 $o .= '<input type="submit" name="submit" value="Submit" /></form>';
28 if(x($_REQUEST,'text')) {
30 $text = trim($_REQUEST['text']);
31 $o .= "<h2>" . t("Source input: ") . "</h2>" . EOL. EOL;
32 $o .= visible_lf($text) . EOL. EOL;
34 $html = bbcode($text);
35 $o .= "<h2>" . t("bb2html (raw HTML): ") . "</h2>" . EOL. EOL;
36 $o .= htmlspecialchars($html). EOL. EOL;
38 //$html = bbcode($text);
39 $o .= "<h2>" . t("bb2html: ") . "</h2>" . EOL. EOL;
40 $o .= $html. EOL. EOL;
42 $bbcode = html2bbcode($html);
43 $o .= "<h2>" . t("bb2html2bb: ") . "</h2>" . EOL. EOL;
44 $o .= visible_lf($bbcode) . EOL. EOL;
46 $diaspora = bb2diaspora($text);
47 $o .= "<h2>" . t("bb2md: ") . "</h2>" . EOL. EOL;
48 $o .= visible_lf($diaspora) . EOL. EOL;
50 $html = Markdown($diaspora);
51 $o .= "<h2>" . t("bb2md2html: ") . "</h2>" . EOL. EOL;
52 $o .= $html. EOL. EOL;
54 $bbcode = diaspora2bb($diaspora);
55 $o .= "<h2>" . t("bb2dia2bb: ") . "</h2>" . EOL. EOL;
56 $o .= visible_lf($bbcode) . EOL. EOL;
58 $bbcode = html2bbcode($html);
59 $o .= "<h2>" . t("bb2md2html2bb: ") . "</h2>" . EOL. EOL;
60 $o .= visible_lf($bbcode) . EOL. EOL;
66 if(x($_REQUEST,'d2bbtext')) {
68 $d2bbtext = trim($_REQUEST['d2bbtext']);
69 $o .= "<h2>" . t("Source input (Diaspora format): ") . "</h2>" . EOL. EOL;
70 $o .= visible_lf($d2bbtext) . EOL. EOL;
73 $bb = diaspora2bb($d2bbtext);
74 $o .= "<h2>" . t("diaspora2bb: ") . "</h2>" . EOL. EOL;
75 $o .= visible_lf($bb) . EOL. EOL;