function XBBCodeFilter::generate_tag in Extensible BBCode 6
Same name and namespace in other branches
- 5 xbbcode-filter.php \XBBCodeFilter::generate_tag()
File
- ./
xbbcode.filter.inc, line 130
Class
Code
function generate_tag($tagname, $args, $content) {
$content = stripslashes($content);
$args = stripslashes($args);
$args = _xbbcode_parse_args($args);
if (!is_array($args)) {
$option = $args;
}
if (!$this->tags[$tagname]['dynamic']) {
$replace = array(
'{content}' => $content,
);
if ($option) {
$replace['{option}'] = $option;
}
else {
foreach ($args as $name => $value) {
$replace['{' . $name . '}'] = $value;
}
}
$code = str_replace(array_keys($replace), array_values($replace), $this->tags[$tagname]['replacewith']);
return $code;
}
/* we now know it is dynamic, evaluate it. */
$tag = new stdClass();
$tag->name = $tagname;
$tag->content = $content;
$tag->option = $option;
$tag->args = $args;
return module_invoke($this->tags[$tagname]['module'], 'xbbcode', 'render', $tag->name, $tag);
}