_question_module($text, $rate) {
rss_humanizer_log("QUESTION MODULE START (Rate: {$rate}%)");
$changes = 0;
$total_found = 0;
$replacements = ['?!', '???', '?!?', '??!', '?...', '!?'];
preg_match_all('/\?/', $text, $matches, PREG_OFFSET_CAPTURE);
$total_found = count($matches[0]);
rss_humanizer_log("QUESTION MODULE: {$total_found} Fragezeichen gefunden");
if ($total_found === 0) {
return $text;
}
$matches_reversed = array_reverse($matches[0]);
foreach ($matches_reversed as $match) {
$position = $match[1];
if (mt_rand(1, 100) <= $rate) {
$replacement = $replacements[array_rand($replacements)];
$text = substr_replace($text, $replacement, $position, 1);
$changes++;
rss_humanizer_log("QUESTION MODULE: ? → {$replacement} (Position {$position})");
}
}
rss_humanizer_log("QUESTION MODULE: {$changes} von {$total_found} Änderungen gemacht");
return $text;
}
private function apply_breathing_module($text, $rate) {
rss_humanizer_log("BREATHING MODULE START (Rate: {$rate} Geräusche ABSOLUT)");
$changes = 0;
$sounds = ['*hust*', '*räusper*', '*seufz*', '*hmm*', '*äh*', '*ähm*', '*puh*', '*hmpf*'];
$words = explode(' ', $text);
$total_words = count($words);
rss_humanizer_log("BREATHING MODULE: {$total_words} Wörter gefunden");
if ($total_words < 10) {
return $text;
}
// EXAKT $rate Geräusche einfügen (ABSOLUTE ANZAHL!)
$available_positions = [];
// Alle verfügbaren Positionen sammeln (außer Anfang und Ende)
for ($i = 2; $i < count($words) - 2; $i++) {
$available_positions[] = $i;
}
// Zufällige Positionen auswählen
shuffle($available_positions);
$selected_positions = array_slice($available_positions, 0, min($rate, count($available_positions)));
// Geräusche einfügen (von hinten nach vorne für korrekte Positionen)
rsort($selected_positions);
foreach ($selected_positions as $position) {
$sound = $sounds[array_rand($sounds)];
$words[$position] = $words[$position] . ' ' . $sound;
$changes++;
rss_humanizer_log("BREATHING MODULE: + {$sound} (Position {$position})");
}
rss_humanizer_log("BREATHING MODULE: EXAKT {$changes} Atmungsgeräusche eingefügt");
return implode(' ', $words);
}
private function apply_punctuation_module($text, $rate) {
rss_humanizer_log("PUNCTUATION MODULE START (Rate: {$rate}%)");
$changes = 0;
$total_found = 0;
$replacements = [
'. ' => ['... ', '.. ', '.! ', ': '],
'! ' => ['!! ', '!!! ', '!? ', '!: '],
', ' => [' UND ', ' ODER ', ' ABER ', '; '],
'? ' => ['??? ', '?! ', '?? ', '?: ']
];
foreach ($replacements as $original => $options) {
$count = substr_count($text, $original);
$total_found += $count;
if ($count > 0 && mt_rand(1, 100) <= $rate) {
$replacement = $options[array_rand($options)];
$replace_count = mt_rand(1, min(3, $count));
for ($i = 0; $i < $replace_count; $i++) {
$text = preg_replace('/' . preg_quote($original, '/') . '/', $replacement, $text, 1);
}
$changes += $replace_count;
rss_humanizer_log("PUNCTUATION MODULE: {$original} → {$replacement} ({$replace_count}x)");
}
}
rss_humanizer_log("PUNCTUATION MODULE: {$changes} von {$total_found} Änderungen gemacht");
return $text;
}
private function apply_hesitation_module($text, $rate) {
rss_humanizer_log("HESITATION MODULE START (Rate: {$rate} Zögerungen ABSOLUT)");
$changes = 0;
$hesitations = ['ähm...', 'nun ja...', 'also...', 'hmm...', 'wie soll ich sagen...', 'äh...', 'hm...', 'nun...'];
$sentences = preg_split('/([.!?]+\s*)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
$total_sentences = ceil(count($sentences) / 2);
rss_humanizer_log("HESITATION MODULE: {$total_sentences} Sätze gefunden");
if ($total_sentences === 0) {
return $text;
}
// EXAKT $rate Zögerungslaute einfügen (ABSOLUTE ANZAHL!)
$sentence_indices = [];
// Alle verfügbaren Sätze sammeln (nur echte Sätze, nicht leere)
for ($i = 0; $i < count($sentences); $i += 2) {
$sentence = $sentences[$i] ?? '';
if (!empty(trim($sentence))) {
$sentence_indices[] = $i;
}
}
// Zufällige Sätze auswählen
shuffle($sentence_indices);
$selected_sentences = array_slice($sentence_indices, 0, min($rate, count($sentence_indices)));
$result = '';
// Alle Sätze durchgehen und ausgewählte mit Zögerung versehen
for ($i = 0; $i < count($sentences); $i += 2) {
$sentence = $sentences[$i] ?? '';
$delimiter = $sentences[$i + 1] ?? '';
if (in_array($i, $selected_sentences) && !empty(trim($sentence))) {
$hesitation = $hesitations[array_rand($hesitations)];
$sentence = $hesitation . ' ' . $sentence;
$changes++;
rss_humanizer_log("HESITATION MODULE: + {$hesitation} (Satz {$i})");
}
$result .= $sentence . $delimiter;
}
rss_humanizer_log("HESITATION MODULE: EXAKT {$changes} Zögerungslaute eingefügt");
return $result;
}
private function apply
Warning: Cannot modify header information - headers already sent by (output started at /var/customers/webs/Muhsin/muhsin.de/wp-content/plugins/rss-humanizer/rss-humanizer.php:1183) in /var/customers/webs/Muhsin/muhsin.de/wp-includes/pluggable.php on line 1450
Warning: Cannot modify header information - headers already sent by (output started at /var/customers/webs/Muhsin/muhsin.de/wp-content/plugins/rss-humanizer/rss-humanizer.php:1183) in /var/customers/webs/Muhsin/muhsin.de/wp-includes/pluggable.php on line 1453