The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
![]() |
|||||||||||||||||||||||||
This is more of a getting you started piece of code than a copy and paste your board is hacked kind of release. If you don't know how to code in PHP, this hack is NOT for you.
What this "hack" does is it allows you to replace a word in a post with something else. It doesn't replace the word in titles or anywhere else like replacements do. Just in a post. What I use it for: I replace the word Netflix in every post with a link to my Netflix affilliate. What you might use it for: affilliate links, swear word replacements with style, pranks, whatever ![]() You will need to modify the function that I have included to set up your own replacement words. You might want to replace more than one thing. It's up to you. Have fun with this and share what you have done. Demo: http://www.eaforums.com/forums/showt...threadid=22557 I will help as much as I can in customizing this for you within reason. Show Your Support
|
Comments |
#42
|
|||
|
|||
![]()
I shoved the code from stri_replace into the handler for the text replacer and it works. Now the trick is-how do I get this to execute before the censor?
|
#43
|
|||
|
|||
![]()
okay, I'm calling the handler function from the CensorText(). This allows the hack to work for titles too. There might be perf implications that I'm not aware of.
|
#44
|
||||
|
||||
![]()
darax: the bit of [code ]?[/code ] is a mistake...its not in the functions file. Its meant to place that code above the ? at the end of the file.
|
#45
|
|||
|
|||
![]()
coo limey-I tried that and bugger it didn't work, so I just put the code straight into the first function.
I'm not sure if anyone would care what I did, but I essentially replaced the swearbot. I call the below function toward the beginning of CensorText- I have a feeling you'll see a lot of ****'s there, but on the board we're setting up, we replace s... with poop, etc. If anything falls through the swearbot will catch it. Code:
function CustomTextReplace($text){ // //These two arrays should be obvious-but please take care that MyStrings has a counterpart in MyReplacements, or crash // $MyStrings = array(1=> "++++","++++","ass","+++++", "penis", "Garp", 7=>"promoteme", "kingsofchaos", "facial", "rotten.com", "outwar", 12=>"druglords", "goatse", "dildo", "nigger", "pussy", 17=>"++++++", "somethingawful", "Kazaa", "imesh", 21=>"Grokster", "feetman", "XoloX"); $MyReplacements = array(1=>"poop", "fark", "mule", "turkey", "chicken", "Flavor Dog", 7=>"teamxbox", "teamxbox", "manicure", "teamxbox.com", "teamxbox", 12=>"teamxbox", "teamxbox", "Bilbo Baggins", "I am a total moron", "kitten", 17=>"cat", "teamxbox", "(I would like to point out that I buy my music)", "what", 21=>"(stealing music is wrong BTW)", "what", "what"); $a=1; // //Loop through the strings-can we use a foreach here? // while($MyStrings[$a] <> ""){ // //This section of code I got from vb.org, I know it scans the string and replaces //but I'm not sure how... // $parts = explode( strtolower($MyStrings[$a]), strtolower($text) ); $pos = 0; // //This is especially cryptic...key...part? What? // foreach( $parts as $key=>$part ) { $parts[ $key ] = substr($text, $pos, strlen($part)); $pos += strlen($part) + strlen($MyStrings[$a]); } $text=join( $MyReplacements[$a], $parts); $a++; } // //And Back We Go // return $text; } |
#46
|
|||
|
|||
![]()
OK I got this working but when it puts the link in I get the code on the screen? check it out: http://talkdisney.com/forums/showthr...384#post189384
|
#47
|
||||
|
||||
![]()
You have HTML turned off in the forum. Either change the code to replace to vbb, or turn on HTML.
|
#48
|
|||
|
|||
![]()
Amy Thank you for your response. I have altered the code to VBB but it still gives me the code?
Also I get a error when I try to change the image to a [img] tag could you post the vbb version? I am turning on html for the mean time! :banana: Thanks!! |
#49
|
||||
|
||||
![]()
Yeh the VB code version would be great. This was my problem as well.
Not turning on HTML that is. |
#50
|
||||
|
||||
![]()
So does anyone know how to convert to VB code?
|
#51
|
||||
|
||||
![]()
nothing on this eh?
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|