vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Trying to replace text in postbit (https://vborg.vbsupport.ru/showthread.php?t=304571)

cric2k 11-15-2013 11:26 AM

Trying to replace text in postbit
 
Hi,

I'm trying to resolve an issue where Google have banned Advertisements because of some dodgey images somewhere (the site is 500,000 pages and despite my best efforts at deleting I still haven't found one of the pages Google doesn't like).

I've come across this plugin which should do the job Google wants (I only show ads to guests) https://vborg.vbsupport.ru/showthrea...=256054&page=2 although it isn't working for me.

The code:

PHP Code:

$this->post['pagetext_html'] = preg_replace('/\[IMG\](.*)\[\/IMG\]/im'construct_phrase($vbphrase['hideimg_message'], $session['sessionurl_q']), $this->post['pagetext_html']); 

Is hooked into postbit_display_start, but is doing nothing (as the pagetext_html variable is either over written at a later stage, or not used).

So basically, however rough I do it (hard coding or whatever) I want to replace text in the string in the postbit to remove images for Guests. Anyone any ideas?

squidsk 11-15-2013 08:58 PM

Your problem is post['pagetext_html'] is just that the html version of the post, your regex replacement is looking for the bbcode for image, which would have been previously replaced with the xhtml equivalent.

cric2k 11-16-2013 08:21 AM

I've just figured out that I had have two problems. One of them was that another plugin was over writing the variable before it was displayed.

Now that I have disabled that plugin it appears that $post['pagetext_html'] is only populated in about 60% of threads (and the above regex replace works fine on it), on the other 40% of threads it seems this variable is not used.

I have no idea what the difference is between threads, I've tried clearing the cache etc - but it seems for a random number of entire threads the $post['pagetext_html'] variable is not used at all (it's coming back blank and something else I don't know is populating the postbit).

Anyone any ideas?

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

Got it, for some reason it's sometimes stored as $post['pagetext'] - the replace works on that also.


All times are GMT. The time now is 02:16 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.01003 seconds
  • Memory Usage 1,718KB
  • 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
  • (3)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