Not Solved Will This Code Work?
#1
Not Solved
will this code work to filter profanity in the myshoutbox plugin? if so, where in the php do i insert it?

//Function written by Blueblib, [email protected]
//Do whatever you want with it just please leave credit where credit is due.
function censor($bb_content) {
    $bb_profanity_delimiter_array = array(" ", ";", ":", ".", ",", "/", "-", "_");
    $bb_profanity_array = array("badword", "crap");
    $bb_clean_array = array("fiddle stick", "sugared blueberry", "kawabunga", "apple pie", "fairy pamper");
    shuffle($bb_profanity_array);
    shuffle($bb_clean_array);
    $bb_profanity_destroy_array = array();
    foreach ($bb_profanity_array as $bb_profanity) {
            if (array_search($bb_profanity, $bb_profanity_destroy_array)===FALSE) {
                $bb_profanity_destroy_array[] = $bb_profanity;
            }
        foreach ($bb_profanity_delimiter_array as $bb_profanity_delimiter) {
            $bb_profanity_length = strlen($bb_profanity);
            $bb_profanity_unique = array();
            $bb_profanity_counter = 0;
            while ($bb_profanity_counter<$bb_profanity_length) {
                $bb_profanity_unique[] = $bb_profanity[$bb_profanity_counter];
                $bb_profanity_counter++;
            }
            $bb_profanity_counter_minimum = -2;
            while ($bb_profanity_counter_minimum<=$bb_profanity_length) {
            $bb_profanity_counter_sub = 0;
            while ($bb_profanity_counter_sub<=$bb_profanity_length) {
            $bb_profanity_compiled = "";
            $bb_profanity_counter_sub_sub = 0;
            foreach ($bb_profanity_unique as $bb_profanity_part) {
                $bb_profanity_compiled .= $bb_profanity_part;
                if ($bb_profanity_counter_sub_sub<($bb_profanity_counter_sub-1)&&$bb_profanity_counter_sub_sub>$bb_profanity_counter_minimum) {
                    $bb_profanity_compiled .= $bb_profanity_delimiter;
                }
            $bb_profanity_counter_sub_sub++;
            }
            if (array_search($bb_profanity_compiled, $bb_profanity_destroy_array)===FALSE) {
                $bb_profanity_destroy_array[] = $bb_profanity_compiled;
            }
            $bb_profanity_counter_sub++;
            }
            $bb_profanity_counter_minimum++;
            }
        }
    }
    foreach ($bb_profanity_destroy_array as $bb_profanity_destroy) {
    $bb_content = str_ireplace($bb_profanity_destroy, $bb_clean_array[rand(0, count($bb_clean_array)-1)], $bb_content);
    }
    return $bb_content;
    }
    echo censor("this is a crap comment, it's extremely hard to bypass this cra.p");// I got "this is a sugared blueberry comment, it's extremely hard to bypass this fairy pamper"  
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)