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 if(! function_exists('babel_content')) {
13 function babel_content(&$a) {
15 $o .= '<h1>Babel Diagnostic</h1>';
17 $o .= '<form action="babel" method="post">';
18 $o .= t('Source (bbcode) text:') . EOL . '<textarea name="text" >' . htmlspecialchars($_REQUEST['text']) .'</textarea>' . EOL;
19 $o .= '<input type="submit" name="submit" value="Submit" /></form>';
23 $o .= '<form action="babel" method="post">';
24 $o .= t('Source (Diaspora) text to convert to BBcode:') . EOL . '<textarea name="d2bbtext" >' . htmlspecialchars($_REQUEST['d2bbtext']) .'</textarea>' . EOL;
25 $o .= '<input type="submit" name="submit" value="Submit" /></form>';
29 if(x($_REQUEST,'text')) {
31 $text = trim($_REQUEST['text']);
32 $o .= "<h2>" . t("Source input: ") . "</h2>" . EOL. EOL;
33 $o .= visible_lf($text) . EOL. EOL;
35 $html = bbcode($text);
36 $o .= "<h2>" . t("bb2html (raw HTML): ") . "</h2>" . EOL. EOL;
37 $o .= htmlspecialchars($html). EOL. EOL;
39 //$html = bbcode($text);
40 $o .= "<h2>" . t("bb2html: ") . "</h2>" . EOL. EOL;
41 $o .= $html. EOL. EOL;
43 $bbcode = html2bbcode($html);
44 $o .= "<h2>" . t("bb2html2bb: ") . "</h2>" . EOL. EOL;
45 $o .= visible_lf($bbcode) . EOL. EOL;
47 $diaspora = bb2diaspora($text);
48 $o .= "<h2>" . t("bb2md: ") . "</h2>" . EOL. EOL;
49 $o .= visible_lf($diaspora) . EOL. EOL;
51 $html = Markdown($diaspora);
52 $o .= "<h2>" . t("bb2md2html: ") . "</h2>" . EOL. EOL;
53 $o .= $html. EOL. EOL;
55 $bbcode = diaspora2bb($diaspora);
56 $o .= "<h2>" . t("bb2dia2bb: ") . "</h2>" . EOL. EOL;
57 $o .= visible_lf($bbcode) . EOL. EOL;
59 $bbcode = html2bbcode($html);
60 $o .= "<h2>" . t("bb2md2html2bb: ") . "</h2>" . EOL. EOL;
61 $o .= visible_lf($bbcode) . EOL. EOL;
67 if(x($_REQUEST,'d2bbtext')) {
69 $d2bbtext = trim($_REQUEST['d2bbtext']);
70 $o .= "<h2>" . t("Source input (Diaspora format): ") . "</h2>" . EOL. EOL;
71 $o .= visible_lf($d2bbtext) . EOL. EOL;
74 $bb = diaspora2bb($d2bbtext);
75 $o .= "<h2>" . t("diaspora2bb: ") . "</h2>" . EOL. EOL;
76 $o .= visible_lf($bb) . EOL. EOL;