Jump to content
xisto Community
Sign in to follow this  
TubeOfMommment

Need Help .... Word And Symbol Replacement Vbulletin hook

Recommended Posts

hello i got this problem.. i need symbol "_" replacement code

 

i got this one :

 

$find = "_";

$replace = " "

$this->post['message'] = str_replace($find, $replace, $this->post['message']);


but this core replaces in all text .. and [img"] and [url'] bbcode ... how to fix this problem .. i cant post links images..

 

if any 1 help solve this prob i give VIP in my forum

 

 

ty .. w8ting for solutions :/

Share this post


Link to post
Share on other sites
Quote
 

ty .. w8ting for solutions ?

 

For the love of all things fluffy dont use "w8ting" anyhoo, i digress!

 

Can you post a sample of the string you want to clean?

 

If so all you need to do is a string search for "=" and save the position in a variable

$pos = strpos($string, "=");

* $find = "_";

* $replace = " "

* $this->post['message'] = str_replace($find, $replace, $this->post['message'], OFFSET(will be $pos));

So now your script starts after the first = sign and is now searching the image SRC. You can then find the string [/img]http://forums.xisto.com/and record the position of the first bracket and using the $pos variable calculate the length of the string to search and use that as a limit:

$pos = (5)

$end = (32)

$len = $end - $pos (27)

 

The numbers in brackets are to show fake values that ive used to illustrate it.

Im a bit rusty with my PHP, its been a while, but i think you can set a LENGTH parameter for str_replace, which will be 27 in this example.

I think....

 

 

Share this post


Link to post
Share on other sites

Well unless you can paste that line here theres nothing anyone can do to help. Just make sure you have put in all the quotes and double quotes (if possible a syntax highlighted editor should show unquoted and quoted sections of code)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.