allowing plugins to override bbcode tags; added support for enclosures: needs plugin

This commit is contained in:
real_nowhereman 2009-02-01 14:15:40 +00:00
parent 4e339aa4e9
commit 5aa714b47e
3 changed files with 18 additions and 1 deletions

View File

@ -20,6 +20,7 @@
<entry>
<title>{$subject}</title>
<link href="{$id|link:post_link}" />
<id>{$id|link:post_link}</id>
{assign var=the_date value=$date|date_rfc3339}
<published>{$the_date}</published>
@ -29,6 +30,15 @@
{$content|tag:the_content}
</div>
</content>
{foreach from=$enclosure item=encl}
<link rel="enclosure"
href="{$encl.url}"
title="{$encl.title}"
length="{$encl.length}"
type="{$encl.type}" />
{/foreach}
</entry>
{/entry}
{/entry_block}

View File

@ -22,7 +22,11 @@
<author>{$flatpress.email} ({$flatpress.author})</author>
<pubDate>{$date|date_format:"%a, %d %b %Y %H:%M:%S %z"}</pubDate>
<comments>{$id|link:comments_link}</comments>
{foreach from=$enclosure item=encl}
<enclosure url="{$encl.url}" length="{$encl.length}" type="{$encl.type}" />
{/foreach}
</item>
{/entry}

View File

@ -156,9 +156,12 @@ class StringParser_BBCode extends StringParser {
* @return bool
*/
function addCode ($name, $callback_type, $callback_func, $callback_params, $content_type, $allowed_within, $not_allowed_within) {
// allow override
/*
if (isset ($this->_codes[$name])) {
return false; // already exists
}
*/
if (!preg_match ('/^[a-zA-Z0-9*_!+-]+$/', $name, $code)) {
return false; // invalid
}