Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-18-2006, 12:21 AM
Michael Morris's Avatar
Michael Morris Michael Morris is offline
 
Join Date: Nov 2003
Location: Knoxville TN
Posts: 774
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Bork! Bork! Bork! (Help!!!!!)

As a joke I'd like to punish certain users on my boards by making their posts into Swedish Chef speak. I found this code...

PHP Code:
#########################################################
#                                                       #
#  PHP Encheferizer 0.9 (20-5-2003)                     #
#  Convert English to Mock Swedish.                     #
#  Ported to PHP by eamelink (Erik Bakker)              #
#  PHP Encheferizer website : http://bork.eamelink.nl   #
#                                                       #     
#  Based on the original chef.x from John Hagerman.     #
#  More info about the original chef.x :                #
#  http://tbrowne.best.vwh.net/chef/                    #
#                                                       #
#  Works like :                                         #
#    $chef = new encheferizer();                        #
#    $swedish = $chef->encheferize($string);            #
#                                                       #
#########################################################
class encheferizer
{
    function 
encheferizer() {}

    function 
encheferize($string)
    {
        
$delimiters " \n\t\\,<.>/?;:'\"[{]}|=+-_!@#$%^&*()~`";
        
$newline "";
        
$word "";
        for(
$i 0$i strlen($string); $i++){
            
$s substr($string$i1);
                                      
            if((
$position strstr($delimiters$s)) === false){ 

                
$word .= $s;
  
             } else {
                if(!empty(
$word)){
                    
$newline .= $this->encheferizeWord($word);
                    
$word "";
                }
                if(
$s == "." || $s == "!"){
                    if(
rand(0,3) == 1){  
                        
$newline .= ", Bork Bork Bork!";
                        
                    } else {
                        
$newline .= ".";
                    }
                } else {
                    
$newline .= $s;
                }
            }
        }
        
$newline .= $this->encheferizeWord($word);
        return 
$newline;    
    }
    
    function 
encheferizeWord($word)
    {
        if(
strtolower($word) == "bork"){
            return 
$word;
        }
        
$newword "";    

        
$i 0;
        while(
$i strlen($word)){
            
$char substr($word$i1);
            
$isLast = ($i == strlen($word) - 1) ? true false;   
            
$iSeen false;
            if(
$i == 0){ 
                switch(
$char){
                case 
"e":
                    
$newword "i";
                    
$i++;
                    continue 
2;
                    break;
                case 
"E":
                    
$newword "I";
                    
$i++;
                    continue 
2;
                    break;
                case 
"o":
                    
$newword "oo";
                    
$i++;
                    continue 
2;
                    break;
                case 
"O":
                    
$newword "Oo";
                    
$i++;
                    continue 
2;
                    break;
                }
                
            } else {
                if(
$char == "e"){
                    if(!
$isLast && substr($word$i 11) == "w"){
                        
$newword .= 'oo';
                        
                        
$i+=2
                        continue;
                    } elseif(
$isLast){
                        
$newword .= 'e-a';
                        
$i++;
                        continue;
                    }
                    
                } elseif(
$char == "f"){
                    
$newword .= "ff"
                    
$i++;
                    continue;
                } elseif(
$char == "i"){
                    if(!
$isLast && substr($word$i 11) == "r"){
                        
$newword .= "ur";
                        
$i+=2;
                        continue;
                    } elseif(!
$iSeen){
                        
$newword .= "ee";
                        
$i++;
                        
                        
$iSeen true;
                        continue;
                    }
                } elseif(
$char == "o"){
                    if(!
$isLast && substr($word$i 11) == "w"){
                        
$newword .= "oo";
                        
$i+=2;
                        continue;
                    } else {
                        
$newword .= "u";
                        
$i++;
                        continue;
                    }
                } elseif(
$i <= strlen($word 4) && $char == "t" && substr($word$i 11) == "i" 
                            
&& substr($word$i 21) == "o" && substr($word$i 31) == "n"){  // Caption -> Capshun
                    
$newword .= "shun";
                    
$i += 4;
                    continue;
                } elseif(
$char == "u"){
                    
$newword .= "oo";
                    
$i++;
                    continue;
                } elseif(
$char == "U"){
                    
$newword .= "Oo";
                    
$i++;
                    continue;
                }
            } 
// En of In-word rules
            // Things that may be replaced anywhere
            
if($char == "A"){
                if(!
$isLast && substr($word$i+11) == "n"){
                    
$newword .= "Un";
                    
$i+=2;
                    continue;
                } elseif(!
$isLast && substr($word$i+11) == "u"){
                    
$newword .= "Oo";
                    
$i+=2;
                    continue;
                } elseif(!
$isLast){
                    
$newword .= "E";
                    
$i++;
                    continue;
                } 
            } elseif(
$char == "a"){
                if(!
$isLast && substr($word$i+11) == "n"){
                    
$newword .= "un";
                    
$i+=2;
                    continue;
                } elseif(!
$isLast && substr($word$i+11) == "u"){
                    
$newword .= "oo";
                    
$i+=2;
                    continue;
                } elseif(!
$isLast){
                    
$newword .= "e";
                    
$i++;
                    continue;
                } 
            } elseif(
$char == "e"){
                if(!
$isLast && substr($word$i+11) == "n" && $i == strlen($word) - 2){
                    
$newword .= "ee";
                    
$i+=2;
                    continue;
                } elseif (
$i 0){
                    
// Do nothing
                    
                
}
            } elseif(
$char == "t"){
                if(
$i == strlen($word) -&& substr($word$i+1$i) == "h"){
                    
$newword .= "t";
                    
$i+=2;
                    continue;
                } elseif(
$i <= strlen($word) - && substr($word$i+11) == "h" && substr($word$i+21) == "e"){
                    
$newword .= "zee";
                    
$i+=3;
                    continue;
                }
            } elseif(
$char == "T" && $i<= strlen($word)-&& substr($word$i+11) == "h"
                        
&& substr($word$i+21) == "e"){
                
$newword .= "Zee";
                
$i +=3;
                continue;
                
            } elseif(
$char == "v"){
                
$newword .= "f";
                
$i++;
                continue;
            } elseif(
$char == "V"){
                
$newword .= "F";
                
$i++;
                continue;
            } elseif(
$char == "w"){
                
$newword .= "v";
                
$i++;
                continue;
            } elseif(
$char == "W"){
                
$newword .= "V";
                
$i++;
                continue;
            } 
            
            
$newword .= $char;
            
$i++;   
                
                
                
        } 
// End of FOR lus
        
        
return $newword;
    }
}

// Now init our chefspeakers

$chefspeakers = array('438'); 
Problem with this code is it alters the text appearing in the bbcodes if I call it at postbit start and it messes with the html if I use it at postbit complete. Any ideas on how I might get this thing to leave any text occuring within html tags or bbcode tags alone?
Reply With Quote
  #2  
Old 07-18-2006, 01:04 AM
Wired1's Avatar
Wired1 Wired1 is offline
 
Join Date: Nov 2003
Location: Orlando, FL, USA
Posts: 1,361
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

man this would be an awesome hack
Reply With Quote
  #3  
Old 12-21-2006, 09:23 PM
cheesegrits's Avatar
cheesegrits cheesegrits is offline
 
Join Date: May 2006
Posts: 500
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I just noticed this thread. I recently posted an Encheferizer mod which does exactly what you want. You can find it here.

The Encheferizer allows you to choose an individual list of victims, and/or specify a list of forums to globally ancheferize.

FYI, I'm about to update it with a fully bbcode aware version, that doesn't just strip bbcode before encheferizing, but applies bbcode to encheferized text correctly.

-- hugh

[edit - I just realized who the original poster is ... Hey Michael ... I guess you already know about the Encheferizer, LOL]
Reply With Quote
Reply


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 04:45 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07176 seconds
  • Memory Usage 2,299KB
  • Queries Executed 13 (?)
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)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)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_postinfo_query
  • fetch_postinfo
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete