So, ich hab jetzt noch ein bisschen rumprobiert und anscheinend eine Lösung gefunden, die ich aber gerne noch bestätigt haben würde, nicht das dadurch irgendwas nicht mehr so läuft wie es soll...
Die folgenden Codes sind für die Umwandlung der Texte verantwortlich:
includes/functions.php:
Code: Alles auswählen
//
// Start drunk create functions...
//
function drunk_letters($rand, $higher)
{
$alpha = array_merge(range("a", "z"));
$return_alpha = array();
for ($i = 0; $i < 26; $i++)
{
if ( rand(1,$rand) > $higher ) { $return_alpha[] = $alpha[$i]; }
}
return $return_alpha;
}
function drunk_replace($alpha)
{
$alpha_count = count($alpha);
$replaces = array();
for ($i = 0; $i < $alpha_count; $i++)
{
$replaces[] = "/" . $alpha[$i] . "/";
}
return $replaces;
}
function drunk_replaces($alpha)
{
//
// Create drunk replacement vars!
//
$drunk_a = array('aa', 'ah', 'oa', 'aa', 'ah', 'oa', 'A', 'ahhh');
$drunk_b = array('B', 'vb', 'vb');
$drunk_c = array('C', 'cj', 'sj', 'zj', 'cj', 'sj', 'zj');
$drunk_d = array('D');
$drunk_e = array('E', 'eh', 'eh');
$drunk_f = array('F', 'fFf', 'fff', 'fFf', 'fff');
$drunk_g = array('G');
$drunk_h = array('H', 'hh', 'hhh', 'Hhh', 'HhH', 'hh', 'hhh', 'Hhh', 'HhH');
$drunk_i = array('I', 'Ii', 'ii', 'Iii', 'iI', 'Ii', 'ii', 'Iii', 'iI');
$drunk_j = array('J', 'jj', 'Jj', 'jj', 'Jj');
$drunk_k = array('K');
$drunk_l = array('L');
$drunk_m = array('M', 'mM', 'MmM', 'mm', 'mmm', 'mmmm', 'mmmmm', 'mM', 'MmM', 'mm', 'mmm', 'mmmm', 'mmmmm');
$drunk_n = array('N', 'Nn', 'nn', 'nnn', 'nNn', 'Nn', 'nn', 'nnn', 'nNn');
$drunk_o = array('ao', 'oo', 'aOoo', 'ooo', 'Ooo', 'ooOo');
$drunk_p = array('P', 'pah');
$drunk_q = array('Q', 'ku', 'kukeleku', 'ququ', 'ku', 'kukeleku', 'ququ');
$drunk_r = array('R', 'erR', 'Rr');
$drunk_s = array('ss', 'sSss', 'ZSssS', 'sSzzsss', 'zzZzssZ');
$drunk_t = array('T');
$drunk_u = array('U', 'Uh', 'uhhu', 'uhU', 'Uhuhhuh');
$drunk_v = array('V', 'vz');
$drunk_w = array('W', 'Ww');
$drunk_x = array('X', 'xz', 'kz', 'iks', 'xz', 'kz', 'iks');
$drunk_y = array('Y');
$drunk_z = array('Z', 'zZ', 'Zzz', 'ZSz', 'ZzzZz', 'szz', 'sZZz', 'Zsszzsz', 'zZ', 'Zzz', 'ZSz', 'ZzzZz', 'szz', 'sZZz', 'Zsszzsz');
//
// End drunk replacement vars!
//
$alpha_count = count($alpha);
$replaces = array();
for ($i = 0; $i < $alpha_count; $i++)
{
$temp_var = 'drunk_' . $alpha[$i];
$rand = rand(0, count(${$temp_var})-1);
$replaces[] = ${$temp_var}[$rand];
}
return $replaces;
}
//
// End drunk create functions...
//
includes/functions_post.php:
Code: Alles auswählen
// Drunk Code //
if ( $userdata['user_drunk'] > time() )
{
$message_words = explode(' ', str_replace("\r\n", ' ', $post_message));
$msg_num = count($message_words);
for ($ix = 0; $ix < $msg_num; $ix++)
{
$word_array = '';
if ( trim($message_words[$ix]) != '<br />' && trim($message_words[$ix]) != '<br>' )
{
if ( is_numeric(trim($message_words[$ix])) )
{
$word_len = strlen($message_words[$ix]);
$message_words[$ix] = rand('0', str_repeat('9', $word_len));
}
else
{
$switch = ((time() - $userdata['user_drunk']) / 600);
switch ($switch)
{
case $switch > 6:
$rand = 10;
$higher = 1;
break;
case $switch > 5:
$rand = 7;
$higher = 1;
break;
case $switch > 4:
$rand = 4;
$higher = 1;
break;
case $switch > 3:
$rand = 5;
$higher = 2;
break;
case $switch > 2:
$rand = 5;
$higher = 3;
break;
case $switch > 1:
$rand = 3;
$higher = 2;
break;
default:
$rand = 7;
$higher = 5;
}
$str_letters = drunk_letters($rand, $higher);
$str_replace = drunk_replace($str_letters);
$str_replaces = drunk_replaces($str_letters);
$message_words[$ix] = preg_replace($str_replace, $str_replaces, $message_words[$ix]);
}
}
}
$post_message = implode(' ', $message_words);
}
Soweit wie ich das verstanden habe, wird in der functions.php NUR geschrieben, was verändert werden soll, der eigentliche Vorgang wird aber durch die functions_post.php ausgeführt, oder?
Deswegen habe ich jetzt einfach den Code der functions_post.php so verändert, dass ich vor dem Codeblock
und danach ein
eingefügt habe. für die "xxx" kann ich jetzt die Foren-IDs eintragen, wo der Beitragstext verändert werden soll und in allen anderen Foren bleibt der Beitrag normal.
Müsste alles passen, oder?