|\n\n)(\w+)/', function($m) use ($chaos_rate, &$stats, &$has_changes, $dynamic_chaos, $sentence_info, &$previous_changes, $anti_pattern) {
$current_chaos = $dynamic_chaos ? mt_rand(max(5, $chaos_rate - 10), min(95, $chaos_rate + 10)) : $chaos_rate;
if (p_chaos_decide($current_chaos, 'paragraph_start', $previous_changes, $anti_pattern)) {
$has_changes = true;
// Verschiedene Absatzanfänge
$prefixes = [
'Übrigens: ', 'Nebenbei: ', 'Apropos: ', 'Ehrlich gesagt, ', 'Also, ',
'Tja, ', 'Nun, ', 'Okay, ', 'Hm, ', 'Weißt du, ',
'Ich meine, ', 'Natürlich, ', 'Eigentlich, ', 'Erstaunlicherweise, ', 'Interessanterweise, '
];
// Vermeidung von wiederholten Präfixen
$used_prefixes = [];
foreach ($previous_changes as $change) {
if (isset($change['paragraph_start_prefix'])) {
$used_prefixes[] = $change['paragraph_start_prefix'];
}
}
$available_prefixes = array_diff($prefixes, $used_prefixes);
if (empty($available_prefixes)) {
$available_prefixes = $prefixes;
}
$prefix = $available_prefixes[array_rand($available_prefixes)];
// Speichere Änderung für Anti-Pattern
array_unshift($previous_changes, ['paragraph_start' => true, 'paragraph_start_prefix' => $prefix]);
return $m[1] . $prefix . lcfirst($m[2]);
}
return $m[0];
}, $text);
// Regel 10: Komma vor UND/ODER/ABER entfernen
$text = preg_replace_callback('/,\s+(und|oder|aber)\b/i', function($m) use ($chaos_rate, &$stats, &$has_changes, $dynamic_chaos, $sentence_info, &$previous_changes, $anti_pattern) {
$current_chaos = $dynamic_chaos && !empty($stats['chaos_rates']) ? $stats['chaos_rates'][mt_rand(0, count($stats['chaos_rates'])-1)] : $chaos_rate;
if (p_chaos_decide($current_chaos, 'conjunction_comma', $previous_changes, $anti_pattern)) {
$stats['conjunction_removed']++;
$has_changes = true;
// Speichere Änderung für Anti-Pattern
array_unshift($previous_changes, ['conjunction_comma' => true]);
return ' ' . $m[1];
}
return $m[0];
}, $text);
// Regel 11: Mehrfach-Sonderzeichen bereinigen oder variieren
$text = preg_replace_callback('/([[:punct:]])\\1{2,}/', function($m) use ($chaos_rate, &$stats, &$has_changes, $dynamic_chaos, $sentence_info, &$previous_changes, $anti_pattern) {
$current_chaos = $dynamic_chaos && !empty($stats['chaos_rates']) ? $stats['chaos_rates'][mt_rand(0, count($stats['chaos_rates'])-1)] : $chaos_rate;
if (p_chaos_decide($current_chaos, 'special_clean', $previous_changes, $anti_pattern)) {
// Berechne eine zufällige Anzahl von Wiederholungen (1-3)
$repeat = mt_rand(1, 3);
$cleaned = str_repeat($m[1], $repeat);
$stats['special_cleaned']++;
$has_changes = true;
// Speichere Änderung für Anti-Pattern
array_unshift($previous_changes, ['special_clean' => true]);
return $cleaned;
}
return $m[0];
}, $text);
// Regel 13: Leerzeichenvariation nach Punkten
$text = preg_replace_callback('/\.\s+/', function($m) use ($chaos_rate, &$stats, &$has_changes, $dynamic_chaos, $sentence_info, &$previous_changes, $anti_pattern) {
$current_chaos = $dynamic_chaos && !empty($stats['chaos_rates']) ? $stats['chaos_rates'][mt_rand(0, count($stats['chaos_rates'])-1)] : $chaos_rate;
if (p_chaos_decide($current_chaos, 'spacing_modify', $previous_changes, $anti_pattern)) {
$stats['spacing_modified']++;
$has_changes = true;
// Verschiedene Leerzeichenvarianten
$space_types = [
str_repeat(' ', mt_rand(1, 3)), // 1-3 normale Leerzeichen
" \t", // Leerzeichen + Tab
" \n", // Leerzeichen + Zeilenumbruch
" " // Doppeltes Leerzeichen
];
$spacing = $space_types[array_rand($space_types)];
// Speichere Änderung für Anti-Pattern
array_unshift($previous_changes, ['spacing_modify' => true]);
return '.' . $spacing;
}
return $m[0];
}, $text);
// Regel 14: Natürliche Tippfehler einfügen
$words = preg_split('/\s+/', $text);
$typo_chance = $dynamic_chaos ? max(1, min(5, round($chaos_rate / 10))) : max(1, min(3, round($chaos_rate / 10)));
for ($i = 0; $i < count($words); $i++) {
$word = $words[$i];
// Überprüfe, ob das Wort für einen Tippfehler geeignet ist
$is_candidate = false;
foreach ($typo_candidates as $candidate) {
if (stripos($word, $candidate) === 0 && strlen($word) >= 3) {
$is_candidate = true;
break;
}
}
// Wende Tippfehler nur auf geeignete Wörter an
if ($is_candidate && $word !== strtoupper($word) && mt_rand(1, 100) <= $typo_chance) {
$current_chaos = $dynamic_chaos && !empty($stats['chaos_rates']) ? $stats['chaos_rates'][mt_rand(0, count($stats['chaos_rates'])-1)] : $chaos_rate;
if (p_chaos_decide($current_chaos, 'typo', $previous_changes, $anti_pattern)) {
$stats['typos_applied']++;
$has_changes = true;
// Erzeuge einen natürlichen Tippfehler
$words[$i] = p_create_natural_typo($word);
// Speichere Änderung für Anti-Pattern
array_unshift($previous_changes, ['typo' => true]);
}
}
}
$text = implode(' ', $words);
// Regel 15: Zufällige Anführungszeichen einfügen
$text = preg_replace_callback('/\b([a-zA-ZäöüÄÖÜß]{4,})\b/u', function($m) use ($chaos_rate, &$stats, &$has_changes, $dynamic_chaos, $sentence_info, &$previous_changes, $anti_pattern) {
// Nicht zu viele Anführungszeichen einfügen
if ($stats['quote_applied'] >= min(5, round($stats['quote_total'] * 0.05))) {
return $m[0];
}
$current_chaos = $dynamic_chaos && !empty($stats['chaos_rates']) ? $stats['chaos_rates'][mt_rand(0, count($stats['chaos_rates'])-1)] : $chaos_rate;
if (p_chaos_decide($current_chaos * 0.3, 'quote', $previous_changes, $anti_pattern)) {
$stats['quote_applied']++;
$has_changes = true;
// Verschiedene Anführungszeichentypen
$quote_type = p_get_random_quote_type();
$close_quote = ($quote_type == '"' ? '"' : ($quote_type == '„' ? '"' : ($quote_type == '‚' ? ''' : $quote_type)));
// Speichere Änderung für Anti-Pattern
array_unshift($previous_changes, ['quote' => true]);
return $quote_type . $m[1] . $close_quote;
}
return $m[0];
}, $text, 5); // Begrenze auf 5 Ersetzungen
// Geschützte Inhalte wiederherstellen
foreach ($protected_content as $placeholder => $original) {
$text = str_replace($placeholder, $original, $text);
}
// Effektive Chaos-Rate berechnen
$total_modifiable = $stats['dot_total'] + $stats['comma_total'] + $stats['conjunction_total'] +
$stats['special_total'] + $stats['question_total'] + $stats['exclamation_total'] +
$stats['spacing_total'] + $stats['typos_total'] + $stats['quote_total'];
$modified = $stats['dot_replaced'] + $stats['comma_replaced'] + $stats['conjunction_removed'] +
$stats['special_cleaned'] + $stats['question_modified'] + $stats['exclamation_modified'] +
$stats['spacing_modified'] + $stats['typos_applied'] + $stats['quote_applied'];
$stats['effective_chaos_rate'] = $total_modifiable ? round(($modified / $total_modifiable) * 100) : 0;
// Zusätzliche Textmanipulation
if ($text_manipulation && $has_changes) {
$text = apply_human_text_patterns($text, $stats['avg_chaos_rate'], $previous_changes, $sentence_info, $anti_pattern);
}
// Nur loggen, wenn Änderung stattgefunden hat
if ($has_changes) {
p_log_detailed_stats($stats, $chaos_rate, get_the_title());
}
return $text;
}S
Warning: Cannot modify header information - headers already sent by (output started at /var/customers/webs/Muhsin/muhsin.de/wp-content/plugins/punctuation/punctuation.php:1) in /var/customers/webs/Muhsin/muhsin.de/wp-includes/pluggable.php on line 1435
Warning: Cannot modify header information - headers already sent by (output started at /var/customers/webs/Muhsin/muhsin.de/wp-content/plugins/punctuation/punctuation.php:1) in /var/customers/webs/Muhsin/muhsin.de/wp-includes/pluggable.php on line 1438