<?php
/**
* Child theme stylesheet einbinden
*/
function child_theme_styles() {
wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );
wp_enqueue_style( ‘child-theme-css’, get_stylesheet_directory_uri() .’/style.css’ , array(‘parent-style’));
}
add_action( ‘wp_enqueue_scripts’, ‘child_theme_styles’ );?>
<?php
add_action( ‘elementor_pro/forms/validation’, function( $record, $ajax_handler ) {
$blackwords = explode(“\n”,get_option( ‘disallowed_keys’ ));
// Error Messages
$error_msg = [
‘de-DE’ => ‘Das Feld enthält unzulässige Wörter’,
‘en-GB’ => ‘The field contains blacklisted words!’
];
$lang = get_bloginfo(‘language’);
// Set Fallbacklang
if($error_msg[$lang] == null) {
$lang = ‘en-GB’;
}
// Get all Filds
$raw_fields = $record->get( ‘fields’ );
// Iterate fields
foreach ( $raw_fields as $id => $field ) {
// Check filed for blacklisted words
foreach($blackwords as $blackword) {
$regex = ‘/(‘.$blackword.’)/i’;
if (preg_match($regex, $field[‘value’], $matches, PREG_OFFSET_CAPTURE, 0)) {
$ajax_handler->add_error( $field[‘id’], $error_msg[$lang] );
}
}
}
return;
}, 10, 2 );