habe mir einen bbcode class runtergeladen:
link doch die liste funkt. nicht
Obwohl ich es gena so gemacht habe wie es da steht hier mein bbcode.php
woran kann das liegen
link doch die liste funkt. nicht
Obwohl ich es gena so gemacht habe wie es da steht hier mein bbcode.php
PHP:
// Zeilenumbrüche verschiedener Betriebsysteme vereinheitlichen
function convertlinebreaks ($text) {
return preg_replace ("/\015\012|\015|\012/", "\n", $text);
}
// Alles bis auf Neuezeile-Zeichen entfernen
function bbcode_stripcontents ($text) {
return preg_replace ("/[^\n]/", '', $text);
}
function do_bbcode_url ($action, $attributes, $content, $params, $node_object) {
if (!isset ($attributes['default'])) {
$url = $content;
$text = htmlspecialchars ($content);
} else {
$url = $attributes['default'];
$text = $content;
}
if ($action == 'validate') {
if (substr ($url, 0, 5) == 'data:' || substr ($url, 0, 5) == 'file:'|| substr ($url, 0, 11) == 'javascript:' || substr ($url, 0, 4) == 'jar:') {
return false;
}
return true;
}
return '<a href="'.htmlspecialchars ($url).'">'.$text.'</a>';
}
// Funktion zum Einbinden von Bildern
function do_bbcode_img ($action, $attributes, $content, $params, $node_object) {
if ($action == 'validate') {
if (substr ($content, 0, 5) == 'data:' || substr ($content, 0, 5) == 'file:'|| substr ($content, 0, 11) == 'javascript:' || substr ($content, 0, 4) == 'jar:') {
return false;
}
return true;
}
return '<img src="'.htmlspecialchars($content).'" alt="">';
}
//neue classe setzten
$bbcode = new StringParser_BBCode ();
//neuer Filter
$bbcode->addFilter (STRINGPARSER_FILTER_PRE, 'convertlinebreaks');
$bbcode->addParser (array ('block', 'inline', 'link', 'listitem'), 'htmlspecialchars');
$bbcode->addParser (array ('block', 'inline', 'link', 'listitem'), 'nl2br');
$bbcode->addParser ('list', 'bbcode_stripcontents');
// alles replace
$bbcode->addCode ('b', 'simple_replace', null, array ('start_tag' => '<b>', 'end_tag' => '</b>'),'inline', array ('listitem', 'block', 'inline', 'link'), array ());
$bbcode->addCode ('i', 'simple_replace', null, array ('start_tag' => '<i>', 'end_tag' => '</i>'),'inline', array ('listitem', 'block', 'inline', 'link'), array ());
$bbcode->addCode ('u', 'simple_replace', null, array ('start_tag' => '<u>', 'end_tag' => '</u>'),'inline', array ('listitem', 'block', 'inline', 'link'), array ());
$bbcode->setOccurrenceType ('img', 'image');
$bbcode->setMaxOccurrences ('image', 2);
//smilies
$bbcode->addCode (':arrow:', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_arrow.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode ('8-)', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_cool.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode (':cry:', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_cry.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode (':D', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_e_biggrin.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode (':?', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_e_confused.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode (':geek:', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_e_geek.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode (':(', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_e_sad.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode (':)', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_e_smile.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode (':o', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_e_surprised.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode (':ugeek:', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_e_ugeek.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode (';)', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_e_wink.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode (':shock:', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_ekk.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode (':evil:', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_evil.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode (':!:', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_exclaim.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode (':idea:', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_idea.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode (':lol:', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_lol.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode (':x', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_mad.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode (':mrgreen:', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_mrgreen.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode (':|', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_neutral.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode (':?:', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_question.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode (':P', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_razz.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode (':oops:', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_redface.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode (':roll:', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_rolleyes.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
$bbcode->addCode (':twisted:', 'simple_replace', null, array ('start_tag' => '<img src="Picture/icon_twisted.gif">', 'end_tag' => ''),'inline', array ('list'), array ());
//end smilies
$bbcode->addCode ('list', 'simple_replace', null, array ('start_tag' => '<ul>', 'end_tag' => '</ul>'),'list', array ('block', 'listitem'), array ());
$bbcode->addCode ('*', 'simple_replace', null, array ('start_tag' => '<li>', 'end_tag' => '</li>'),'listitem', array ('list'), array ());
$bbcode->addCode ('url', 'usecontent?', 'do_bbcode_url', array ('usecontent_param' => 'default'),'link', array ('listitem', 'block', 'inline'), array ('link'));
$bbcode->addCode ('img', 'usecontent', 'do_bbcode_img', array (),'image', array ('listitem', 'block', 'inline', 'link'), array ());
$bbcode->setCodeFlag ('*', 'closetag', BBCODE_CLOSETAG_OPTIONAL);
$bbcode->setCodeFlag ('*', 'paragraphs', true);
$bbcode->setCodeFlag ('list', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT);
$bbcode->setCodeFlag ('list', 'opentag.before.newline', BBCODE_NEWLINE_DROP);
$bbcode->setCodeFlag ('list', 'closetag.before.newline', BBCODE_NEWLINE_DROP);
$bbcode->setRootParagraphHandling (true);