PDA

View Full Version : URL in custom BBCode


mad@Max
08-14-2009, 09:18 PM
Let's say i wrote my bbcode through a bbcode_create.
All fine, but if i post a link, like [mybb]http://somelink.com/[mybb], link will be parsed after reload page (if it was ajax). And after reload page posted link not will be trimmed.
That doesn't happen, if before of link will be exist a whitespace or a new line, like
[mybb] http://somelink.com/[mybb]
[mybb]
http://somelink.com/[mybb]
It's are the bug or my curves hands? :)

PS A similar situation can be replicated in the hack BB Code [table] (https://vborg.vbsupport.ru/showthread.php?t=107985).

Dismounted
08-15-2009, 06:41 AM
You shouldn't need to be creating BB codes themselves in bbcode_create. You should be creating them in bbcode_fetch_tags. Please provide code as to what you're doing currently.

mad@Max
08-15-2009, 04:48 PM
Should... I tried different ways, include bbcode_fetch_tags, but nothing changes.
I talk about only url bbcode, other bbcodes (inside custom bbcode) normally spend this situation.

Dismounted
08-16-2009, 01:17 AM
So what are you trying to do again - you are not very clear about that.

mad@Max
08-16-2009, 01:11 PM
Ok, this example
<hookname>bbcode_create</hookname>
<phpcode><![CDATA[if (!function_exists('handle_bbcode_custom'))
{
function handle_bbcode_custom(&$parser, $code, $options)
{
$code = 'code';
return $code;
}
}]]></phpcode>
<hookname>bbcode_fetch_tags</hookname>
<phpcode><![CDATA[$tag_list['no_option']['custom'] = array(
'callback' => 'handle_external',
'external_callback' => 'handle_bbcode_custom',
'strip_empty' => true
);
$tag_list['option']['custom'] = array(
'callback' => 'handle_external',
'external_callback' => 'handle_bbcode_custom',
'strip_empty' => true
);]]></phpcode>
This is are template of creating custom bbcode? I'm a right?

mad@Max
08-16-2009, 05:56 PM
Another example in images on custom bbcode "spoiler".
First attach: we open the post in ajax editor and add couple links into bbcode spoiler
Second attach: we save the edited post
Third attach: we refresh the page
So, how can we see the first link isn't processed as needed.

mad@Max
08-17-2009, 07:52 PM
So, i found out, this is a bag of function convert_url_to_bbcode, precisely convert_url_to_bbcode_callback.