vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Multiple Plugins with Hook bbcode_fetch_tags (https://vborg.vbsupport.ru/showthread.php?t=213207)

noox 05-08-2009 11:57 PM

Multiple Plugins with Hook bbcode_fetch_tags
 
I wrote a plugin which changes some URLs. URLs are handeled in the callback function handle_bbcode_url(). With the hook "bbcode_fetch_tags" this function can be replaced by another one:

PHP Code:

// [URL]
$tag_list['no_option']['url']['callback'] = 'handle_external';
$tag_list['no_option']['url']['external_callback'] = 'MyBbCodeFetchTags';
// [URL=XXX]
$tag_list['option']['url']['callback'] = 'handle_external';
$tag_list['option']['url']['external_callback'] = 'MyBbCodeFetchTags'

In MyBbCodeFetchTags I can call bbcode_fetch_tags and work with the result. I saw this strategy also in another addon I just downloaded.

The problem is now that I want to create another plugin which also modifies the links. So I would need some sort of chaining. Of course not all plugins would work together when they all modify the links. But some would if the chaining can be done.

I have not tried it yet, but I assume I could check if an external callback is already set. If it's already set I save this function and call it in my hook instead of bbcode_fetch_tags.

Is there some sort of best practice? Because I think most of the plugins which changes the callback functions should do something like this that they could work together.

Dismounted 05-10-2009 07:21 AM

There is no "chaining" feature. Modifications that modify the same BB code definition will not be compatible.


All times are GMT. The time now is 08:58 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00918 seconds
  • Memory Usage 1,714KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete