vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Override built-in function? (https://vborg.vbsupport.ru/showthread.php?t=268654)

vgevolution 08-17-2011 04:14 AM

Override built-in function?
 
Is it possible, via the plug-in system, to override built-in vbulletin functions, like those in functions.php?

Specifically, every time I apply an upgrade, I have to edit functions.php and tweak the function, "fetch_censored_text", and I add one additional supporting function. This gives me a slightly more robust censor mechanism which has served me well for many years. I can essentially use a replacement word/phrase rather than a character -- and no, I can't do what I'm doing with Replacement Variables.

I've been searching for hours, but haven't found any resource discussing this. If it's not possible, that's fine, but I'd sure love to avoid making function edits every upgrade.

I also end up modifying template.php to accommodate Lynne's awesome code edit detailed here: https://vborg.vbsupport.ru/showthread.php?t=258614

Being able to avoid making those edits over and over would be great. I'm not going to hold my breath, however. :D

kh99 08-17-2011 12:34 PM

Quote:

Originally Posted by vgevolution (Post 2234375)
Is it possible, via the plug-in system, to override built-in vbulletin functions, like those in functions.php?

No. Well, maybe. As it says in the php manual, "PHP does not support function overloading, nor is it possible to undefine or redefine previously-declared functions." However, there is an add-on that apparently allows you to do that called "runkit", but it doesn't come with PHP by default, you'd have to get it and install it. http://www.php.net/manual/en/book.runkit.php

Of course another option would be to make a plugin with your additional function and your version of fetch_censor_text(). Then when you update vbulletin, all you'd have to do is comment out or rename the existing fetch_censor_text().


All times are GMT. The time now is 05:45 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.00966 seconds
  • Memory Usage 1,713KB
  • 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_quote_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