Upload via GUI (39 Dateien)
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* WP Multi – Modul: Sperre Trash-Mail-Adressen
|
||||
*
|
||||
* Automatisch aus wp-multi.php ausgelagert. Wird über den Loader in
|
||||
* wp-multi.php eingebunden (nur wenn das WP Multi Toolkit aktiv ist).
|
||||
*/
|
||||
|
||||
if (!defined('ABSPATH')) { exit; }
|
||||
|
||||
/*
|
||||
* Sperre Trash Mail Adressen
|
||||
*/
|
||||
|
||||
|
||||
// Funktion zum Laden der Liste von Einweg-Mail-Anbietern
|
||||
function load_disposable_email_list() {
|
||||
$file_path = plugin_dir_path(WP_MULTI_FILE) . 'includes/disposable_email_blocklist.conf'; // Pfad zur Datei im includes-Ordner
|
||||
if (file_exists($file_path)) {
|
||||
return file($file_path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
// Funktion zum Überprüfen der E-Mail-Adresse eines Kommentators
|
||||
function check_disposable_email($commentdata) {
|
||||
$disposable_list = load_disposable_email_list();
|
||||
$email = $commentdata['comment_author_email'];
|
||||
$domain = substr(strrchr($email, "@"), 1); // Nur die Domain extrahieren
|
||||
|
||||
// Überprüfen, ob die Domain auf der Liste steht
|
||||
if (in_array($domain, $disposable_list)) {
|
||||
wp_die(__('Fehler: Trash-Mail-Adressen sind in Kommentaren nicht erlaubt.'));
|
||||
}
|
||||
|
||||
return $commentdata;
|
||||
}
|
||||
|
||||
// Die Funktion wird beim Absenden eines Kommentars ausgeführt
|
||||
add_filter('preprocess_comment', 'check_disposable_email');
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user