vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   php plugin (https://vborg.vbsupport.ru/showthread.php?t=227200)

Ghostt 11-17-2009 11:43 AM

why?

Ghostt 11-20-2009 02:55 PM

on normal site this code is working why not n the forum omg? oO

kh99 11-20-2009 03:52 PM

Instead of your plugin using global_start, try using this on global_complete:

Code:

$output = str_replace("example.com", "", $output);

but it does seem kind of dangerous (and slower) to replace it globally on the entire output, it would be better to figure out where to do it just for the post contents.

Ghostt 11-20-2009 08:40 PM

Quote:

Originally Posted by kh99 (Post 1917840)
Instead of your plugin using global_start, try using this on global_complete:

Code:

$output = str_replace("example.com", "", $output);

but it does seem kind of dangerous (and slower) to replace it globally on the entire output, it would be better to figure out where to do it just for the post contents.

wow finnay the solution ! big thanks at kh99!

you mean this code could make it faster?
or please give me a better solution i have a big forum so every slow plugin is bad.
PHP Code:

 if(THIS_SCRIPT == showthread)
{ } 


kh99 11-20-2009 08:51 PM

Yeah, you would defintely want to check "THIS_SCRIPT" if you only want it to work on that one page.

To be honest, while it's obviously wise to avoid any unnecessary operations (like checking the entire output when you only need to check the post contents), I don't know that it's enough to be worried about compared to everything else that's going on. If I get a chance I'll look to see if there's a hook to check only the posts. I think I looked a couple days ago and couldn't figure it out, but I'll check again.

--------------- Added [DATE]1258761881[/DATE] at [TIME]1258761881[/TIME] ---------------

OK, you got me curious so I had to go figure it out. :)

You could use:
Code:

global $vbulletin;
if ($vbulletin->userinfo['userid'])
{
  $post['message'] = str_replace("example.com", "", $post['message']);
}


for the plugin code, and use the "postbit_display_complete" hook, to do it only for posts. This won't do the post titles, if you want the replacement in the titles you'd have to add a second str_replace line for that. (Also I don't think you need to check THIS_SCRIPT this way).

BTW, this is what Lynne suggested back in post #16...

Ghostt 11-21-2009 11:17 AM

Good job kh99 ! working perfect. we thank you :)


All times are GMT. The time now is 08:10 AM.

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.01272 seconds
  • Memory Usage 1,728KB
  • 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
  • (3)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete