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> <entry>
<title>{$subject}</title> <title>{$subject}</title>
<link href="{$id|link:post_link}" /> <link href="{$id|link:post_link}" />
<id>{$id|link:post_link}</id> <id>{$id|link:post_link}</id>
{assign var=the_date value=$date|date_rfc3339} {assign var=the_date value=$date|date_rfc3339}
<published>{$the_date}</published> <published>{$the_date}</published>
@ -29,6 +30,15 @@
{$content|tag:the_content} {$content|tag:the_content}
</div> </div>
</content> </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} {/entry}
{/entry_block} {/entry_block}

View File

@ -23,6 +23,10 @@
<pubDate>{$date|date_format:"%a, %d %b %Y %H:%M:%S %z"}</pubDate> <pubDate>{$date|date_format:"%a, %d %b %Y %H:%M:%S %z"}</pubDate>
<comments>{$id|link:comments_link}</comments> <comments>{$id|link:comments_link}</comments>
{foreach from=$enclosure item=encl}
<enclosure url="{$encl.url}" length="{$encl.length}" type="{$encl.type}" />
{/foreach}
</item> </item>
{/entry} {/entry}

View File

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