Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools
Replace Text Details »»
Replace Text
Version: 1.00, by amykhar amykhar is offline
Developer Last Online: Nov 2013 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 03-12-2003 Last Update: Never Installs: 18
 
No support by the author.

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

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #42  
Old 06-07-2003, 08:10 AM
Darax The Good Darax The Good is offline
 
Join Date: Jan 2003
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #43  
Old 06-07-2003, 08:26 AM
Darax The Good Darax The Good is offline
 
Join Date: Jan 2003
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #44  
Old 06-08-2003, 05:19 AM
limey's Avatar
limey limey is offline
 
Join Date: Dec 2001
Location: -
Posts: 187
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #45  
Old 06-08-2003, 08:37 AM
Darax The Good Darax The Good is offline
 
Join Date: Jan 2003
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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;
	
}
Reply With Quote
  #46  
Old 06-19-2003, 10:03 PM
ryancooper ryancooper is offline
 
Join Date: Jul 2002
Posts: 433
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #47  
Old 06-19-2003, 10:49 PM
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Location: PA
Posts: 4,438
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You have HTML turned off in the forum. Either change the code to replace to vbb, or turn on HTML.
Reply With Quote
  #48  
Old 06-19-2003, 11:16 PM
ryancooper ryancooper is offline
 
Join Date: Jul 2002
Posts: 433
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!!
Reply With Quote
  #49  
Old 06-23-2003, 03:10 PM
limey's Avatar
limey limey is offline
 
Join Date: Dec 2001
Location: -
Posts: 187
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeh the VB code version would be great. This was my problem as well.

Not turning on HTML that is.
Reply With Quote
  #50  
Old 06-25-2003, 03:22 PM
limey's Avatar
limey limey is offline
 
Join Date: Dec 2001
Location: -
Posts: 187
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So does anyone know how to convert to VB code?
Reply With Quote
  #51  
Old 06-29-2003, 05:47 PM
limey's Avatar
limey limey is offline
 
Join Date: Dec 2001
Location: -
Posts: 187
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nothing on this eh?
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:33 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.04425 seconds
  • Memory Usage 2,299KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete