' . $content . ''; } } // Funktion zum Einbinden von Bildern function do_bbcode_img ($action, $attributes, $content, $params, $node_object) { if ($action == 'validate') { if (isset($attributes['caption'])) { $node_object->setFlag('paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT); if ($node_object->_parent->type() == STRINGPARSER_NODE_ROOT OR in_array($node_object->_parent->_codeInfo['content_type'], array('block', 'list', 'listitem'))) { return true; } else return false; } else return true; } $title = empty($attributes["title"]) ? "" : " title='".htmlspecialchars($attributes["title"])."'"; if (isset($attributes['class']) AND isset($attributes['caption'])) $class_caption = " class='img ".htmlspecialchars($attributes['class'])."'"; elseif (isset($attributes['class'])) $class = " class='".htmlspecialchars($attributes['class'])."'"; elseif (isset($attributes['caption'])) $class_caption = " class='img'"; // bugfix by Sebastian Kochendörfer #215 if (strpos($content, "http://") === 0) return "".htmlspecialchars($attributes["; else { list($img_width, $img_height, $img_type, $img_attr) = @getimagesize(JLOG_BASEPATH.'/img'.DIRECTORY_SEPARATOR.htmlspecialchars($content)); $img = "".htmlspecialchars($attributes["; } if(isset($attributes['caption'])) { return "\n\n
".$img."
\n
".htmlspecialchars($attributes['caption'])."
\n\n"; } else return $img; } // Funktion zum Einbinden von HTML Code, welcher vom Browser interpretiert wird function do_bbcode_html($action, $attributes, $content, $params, $node_object) { if ($action == 'validate') return true; return $content; } $bbcode = new StringParser_BBCode (); $bbcode->addFilter (STRINGPARSER_FILTER_PRE, 'convertlinebreaks'); $bbcode->addFilter (STRINGPARSER_FILTER_POST, 'special_character'); $bbcode->addParser (array ('block', 'inline', 'link', 'listitem'), 'htmlspecialchars'); $bbcode->addParser (array ('block', 'inline', 'link', 'listitem'), 'nl2br'); $bbcode->addParser ('list', 'bbcode_stripcontents'); $bbcode->setRootParagraphHandling (true); $bbcode->addCode ('b', 'simple_replace', null, array ('start_tag' => '', 'end_tag' => ''), 'inline', array ('listitem', 'block', 'inline', 'link'), array ()); $bbcode->addCode ('i', 'simple_replace', null, array ('start_tag' => '', 'end_tag' => ''), 'inline', array ('listitem', 'block', 'inline', 'link'), array ()); $bbcode->addCode ('headline', 'simple_replace', null, array('start_tag' => '

', 'end_tag' => '

'), 'block', array('block'), array('inline', 'link')); $bbcode->addCode ('quote', 'simple_replace', null, array('start_tag' => '
', 'end_tag' => '
'), 'block', array('block', 'listitem'), array('inline', 'link')); $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->addCode ('html', 'usecontent', 'do_bbcode_html', array (), 'html', array ('listitem', 'block', 'inline', 'link'), array ('image')); $bbcode->addCode ('list', 'simple_replace', null, array ('start_tag' => ''), 'list', array ('block', 'listitem'), array ()); $bbcode->addCode ('olist', 'simple_replace', null, array ('start_tag' => '
    ', 'end_tag' => '
'), 'list', array ('block', 'listitem'), array ()); $bbcode->addCode ('*', 'simple_replace', null, array ('start_tag' => '
  • ', 'end_tag' => '
  • '), 'listitem', array ('list', 'olist' ), array ()); $bbcode->setCodeFlag ('*', 'closetag', BBCODE_CLOSETAG_OPTIONAL); $bbcode->setCodeFlag ('*', 'paragraphs', false); $bbcode->setCodeFlag ('list', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT); $bbcode->setCodeFlag ('list', 'opentag.before.newline', BBCODE_NEWLINE_DROP); $bbcode->setCodeFlag ('list', 'closetag.after.newline', BBCODE_NEWLINE_DROP); $bbcode->setCodeFlag ('olist', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT); $bbcode->setCodeFlag ('olist', 'opentag.before.newline', BBCODE_NEWLINE_DROP); $bbcode->setCodeFlag ('olist', 'closetag.before.newline', BBCODE_NEWLINE_DROP); $bbcode->setCodeFlag ('headline', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT); $bbcode->setCodeFlag ('headline', 'opentag.before.newline', BBCODE_NEWLINE_DROP); $bbcode->setCodeFlag ('headline', 'closetag.after.newline', BBCODE_NEWLINE_DROP); $bbcode->setCodeFlag ('html', 'opentag.before.newline', BBCODE_NEWLINE_DROP); $bbcode->setCodeFlag ('html', 'closetag.after.newline', BBCODE_NEWLINE_DROP); $bbcode->setCodeFlag ('quote', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT); $bbcode->setCodeFlag ('quote', 'paragraphs', true); $bbcode->setCodeFlag ('quote', 'opentag.before.newline', BBCODE_NEWLINE_DROP); $bbcode->setCodeFlag ('quote', 'closetag.after.newline', BBCODE_NEWLINE_DROP); // BBCode for comments $bbcomments = new StringParser_BBCode (); $bbcomments->addFilter (STRINGPARSER_FILTER_PRE, 'convertlinebreaks'); $bbcomments->addFilter (STRINGPARSER_FILTER_POST, 'special_character'); $bbcomments->addParser (array ('block', 'inline', 'link'), 'htmlspecialchars'); $bbcomments->addParser (array ('block', 'inline', 'link'), 'nl2br'); $bbcomments->setRootParagraphHandling (true); $bbcomments->addCode ('b', 'simple_replace', null, array ('start_tag' => '', 'end_tag' => ''), 'inline', array ('block', 'inline', 'link'), array ()); $bbcomments->addCode ('i', 'simple_replace', null, array ('start_tag' => '', 'end_tag' => ''), 'inline', array ('block', 'inline', 'link'), array ()); $bbcomments->addCode ('url', 'usecontent?', 'do_bbcode_url', array ('usecontent_param' => 'default'), 'link', array ('block', 'inline'), array ('link')); $bbcomments->addCode ('quote', 'simple_replace', null, array('start_tag' => '
    ', 'end_tag' => '
    '), 'block', array('block'), array('inline', 'link')); $bbcomments->setCodeFlag ('quote', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT); $bbcomments->setCodeFlag ('quote', 'paragraphs', true); $bbcomments->setCodeFlag ('quote', 'opentag.before.newline', BBCODE_NEWLINE_DROP); $bbcomments->setCodeFlag ('quote', 'closetag.after.newline', BBCODE_NEWLINE_DROP); // eof