forked from LiveCarta/LiveCartaWP
Changed source root directory
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
/* BB PRESS */
|
||||
|
||||
if (!function_exists('wpae_get_blocked_integrations') || !in_array('bbpress', wpae_get_blocked_integrations())) :
|
||||
add_action( 'bbp_new_topic_pre_extras','wpa_bbp_extra_validation');
|
||||
add_action( 'bbp_new_reply_pre_extras','wpa_bbp_extra_validation');
|
||||
|
||||
function wpa_bbp_extra_validation(){
|
||||
if (wpa_check_is_spam($_POST)){
|
||||
do_action('wpa_handle_spammers','bbpress', $_POST);
|
||||
bbp_add_error( 'bbp_extra_email', __( $GLOBALS['wpa_error_message'], 'bbpress' ) );
|
||||
}
|
||||
}
|
||||
|
||||
endif;
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if (!function_exists('wpae_get_blocked_integrations') || !in_array('calderaforms', wpae_get_blocked_integrations())) :
|
||||
function wpa_calderaforms_extra_validation( ) {
|
||||
if (wpa_check_is_spam($_POST)){
|
||||
do_action('wpa_handle_spammers','calderaforms', $_POST);
|
||||
die($GLOBALS['wpa_error_message']);
|
||||
}
|
||||
};
|
||||
add_action( 'caldera_forms_pre_load_processors', 'wpa_calderaforms_extra_validation', 10, 0 );
|
||||
endif;
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if (!function_exists('wpae_get_blocked_integrations') || !in_array('contactform7', wpae_get_blocked_integrations())) :
|
||||
|
||||
add_filter( 'wpcf7_validate', 'wpa_contactform7_extra_validation', 10, 2 );
|
||||
|
||||
function wpa_contactform7_extra_validation($result, $tags){
|
||||
if ( empty( $result->get_invalid_fields() ) ) { // only check spam if validation OK (Imp for Level 2)
|
||||
if (wpa_check_is_spam($_POST)){
|
||||
do_action('wpa_handle_spammers','contactform7', $_POST);
|
||||
$result->invalidate('', $GLOBALS['wpa_error_message']);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
endif;
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if (!function_exists('wpae_get_blocked_integrations') || !in_array('diviengineform', wpae_get_blocked_integrations())) :
|
||||
|
||||
function my_df_before_process($form_id,$post_array,$form_type){
|
||||
if (wpa_check_is_spam($_POST)){
|
||||
foreach($_POST as $param => $value){
|
||||
if(strpos($param, 'divi-form-submit') === 0){
|
||||
$is_divi_engine_form = 'true';
|
||||
$divi_engine_form_additional = esc_attr(str_replace('divi-form-submit', '', $param));
|
||||
}
|
||||
}
|
||||
do_action('wpa_handle_spammers','divi_engine_form', $_POST);
|
||||
if (str_ends_with($_SERVER["REQUEST_URI"],"admin-ajax.php")){
|
||||
// ajax post
|
||||
$result = array( 'result' => 'failed', 'redirect' => '', 'message' => '<B>' . esc_html($GLOBALS['wpa_error_message']) . '</B>', 'message_position' => 'after_button');
|
||||
wp_send_json( $result );
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<div id='fb_form{$divi_engine_form_additional}'><p>".$GLOBALS['wpa_error_message']."</p><div></div></div>";
|
||||
}
|
||||
|
||||
die();
|
||||
}
|
||||
}
|
||||
add_action( 'df_before_process', 'my_df_before_process', 10, 3 );
|
||||
|
||||
endif;
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if (!function_exists('wpae_get_blocked_integrations') || !in_array('diviform', wpae_get_blocked_integrations())) :
|
||||
|
||||
foreach($_POST as $param => $value){
|
||||
if(strpos($param, 'et_pb_contactform_submit') === 0){
|
||||
$is_divi_form = 'true';
|
||||
$divi_form_additional = esc_attr(str_replace('et_pb_contactform_submit', '', $param));
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($is_divi_form) && $is_divi_form == 'true'){
|
||||
if (wpa_check_is_spam($_POST)){
|
||||
do_action('wpa_handle_spammers','divi_form', $_POST);
|
||||
echo "<div id='et_pb_contact_form{$divi_form_additional}'><p>".esc_html($GLOBALS['wpa_error_message'])."</p><div></div></div>";
|
||||
die();
|
||||
} else { // REMOVE OUR TEST FIELD BEFORE SENDING TO DIVI
|
||||
$fields_data_json = str_replace( '\\', '',$_POST['et_pb_contact_email_fields'.$divi_form_additional]);
|
||||
$fields_data_array = json_decode( $fields_data_json, true );
|
||||
if (is_array($fields_data_array)) {
|
||||
$filteredArray = array_filter($fields_data_array, function ($item) {
|
||||
return $item['field_id'] !== 'alt_s'
|
||||
&& $item['field_id'] !== $GLOBALS['wpa_field_name'];
|
||||
});
|
||||
$_POST['et_pb_contact_email_fields'.$divi_form_additional] = json_encode( $filteredArray, JSON_UNESCAPED_UNICODE );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
endif;
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if (!function_exists('wpae_get_blocked_integrations') || !in_array('elementor', wpae_get_blocked_integrations())) :
|
||||
|
||||
function wpa_elementor_extra_validation( $record, $ajax_handler ) {
|
||||
if (wpa_check_is_spam($_POST)){
|
||||
$all_fields = $record->get( 'fields' );
|
||||
$firstField = array_key_first($all_fields);
|
||||
do_action('wpa_handle_spammers','elementor', $_POST);
|
||||
$ajax_handler->add_error($all_fields[$firstField]['id'], $GLOBALS['wpa_error_message']);
|
||||
}
|
||||
};
|
||||
add_action( 'elementor_pro/forms/validation', 'wpa_elementor_extra_validation', 10, 2 );
|
||||
|
||||
endif;
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if (!function_exists('wpae_get_blocked_integrations') || !in_array('fluentform', wpae_get_blocked_integrations())) :
|
||||
|
||||
function wpa_fluent_form_extra_validation($insertData, $data, $form) {
|
||||
if (wpa_check_is_spam($data)){
|
||||
do_action('wpa_handle_spammers','fluent_forms', $data);
|
||||
//die($GLOBALS['wpa_error_message']);
|
||||
wp_send_json_error(['errors' => $GLOBALS['wpa_error_message']]);
|
||||
wp_die();
|
||||
}
|
||||
};
|
||||
//add_action( 'fluentform_before_insert_submission', 'wpa_fluent_form_extra_validation', 10, 3 );
|
||||
add_action( 'fluentform/before_insert_submission', 'wpa_fluent_form_extra_validation', 10, 3 );
|
||||
|
||||
endif;
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if (!function_exists('wpae_get_blocked_integrations') || !in_array('formidable', wpae_get_blocked_integrations())) :
|
||||
|
||||
add_filter( 'frm_validate_entry', 'wpa_formidable_extra_validation', 10, 2 );
|
||||
|
||||
function wpa_formidable_extra_validation($errors, $values){
|
||||
if (wpa_check_is_spam($_POST)){
|
||||
do_action('wpa_handle_spammers','formidable', $_POST);
|
||||
$errors['my_error'] = $GLOBALS['wpa_error_message'];
|
||||
}
|
||||
return $errors;
|
||||
}
|
||||
|
||||
endif;
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if (!function_exists('wpae_get_blocked_integrations') || !in_array('gravityforms', wpae_get_blocked_integrations())) :
|
||||
|
||||
add_action( 'gform_validation', 'wpa_gravityforms_extra_validation');
|
||||
|
||||
function wpa_gravityforms_extra_validation($validation_result ){
|
||||
if (wpa_check_is_spam($_POST)){
|
||||
$form = $validation_result['form'];
|
||||
do_action('wpa_handle_spammers','gravityforms', $_POST);
|
||||
$validation_result['is_valid'] = false;
|
||||
$form['fields'][0]->failed_validation = true;
|
||||
$form['fields'][0]->validation_message = $GLOBALS['wpa_error_message'];
|
||||
$validation_result['form'] = $form;
|
||||
}
|
||||
return $validation_result;
|
||||
}
|
||||
endif;
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if (!function_exists('wpae_get_blocked_integrations') || !in_array('toolsetform', wpae_get_blocked_integrations())) :
|
||||
|
||||
add_filter('cred_form_validate','wpa_toolsetform_extra_validation',20,2);
|
||||
|
||||
function wpa_toolsetform_extra_validation($error_fields, $form_data)
|
||||
{
|
||||
list($fields,$errors)=$error_fields;
|
||||
if (wpa_check_is_spam($_POST)){
|
||||
do_action('wpa_handle_spammers','toolset_form', $_POST);
|
||||
die($GLOBALS['wpa_error_message']);
|
||||
}
|
||||
return array($fields,$errors);
|
||||
}
|
||||
|
||||
endif;
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
// WP Comments // TESTED WITH LEVEL2. Working FINE
|
||||
|
||||
if (!function_exists('wpae_get_blocked_integrations') || !in_array('wpcomment', wpae_get_blocked_integrations())) :
|
||||
|
||||
add_filter( 'preprocess_comment', 'wpa_wpcomment_extra_validation' );
|
||||
|
||||
function wpa_wpcomment_extra_validation( $commentdata ) {
|
||||
if (wpa_check_is_spam($_POST)){
|
||||
do_action('wpa_handle_spammers','wpcomment', $_POST);
|
||||
wp_die( __( $GLOBALS['wpa_error_message'] ) );
|
||||
}
|
||||
return $commentdata;
|
||||
}
|
||||
|
||||
endif;
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if (!function_exists('wpae_get_blocked_integrations') || !in_array('wpforms', wpae_get_blocked_integrations())) :
|
||||
|
||||
add_filter( 'wpforms_process_before', 'wpa_wpforms_extra_validation', 10, 2 );
|
||||
|
||||
function wpa_wpforms_extra_validation($entry, $form_data){
|
||||
if (wpa_check_is_spam($_POST)){
|
||||
do_action('wpa_handle_spammers','wpforms', $_POST);
|
||||
wpforms()->process->errors[ $form_data['id'] ][ '0' ] = $GLOBALS['wpa_error_message'];
|
||||
}
|
||||
}
|
||||
|
||||
endif;
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if (!function_exists('wpae_get_blocked_integrations') || !in_array('wp_login_form', wpae_get_blocked_integrations())) :
|
||||
|
||||
function wpa_wplogin_add_initiator_field() {
|
||||
echo '<input type="hidden" id="wpa_initiator" class="wpa_initiator" name="wpa_initiator" value="" />';
|
||||
}
|
||||
|
||||
add_action('lostpassword_form', 'wpa_wplogin_add_initiator_field');
|
||||
add_action('woocommerce_lostpassword_form', 'wpa_wplogin_add_initiator_field');
|
||||
|
||||
add_action( 'login_form', 'wpa_wplogin_add_initiator_field' );
|
||||
add_action( 'woocommerce_login_form', 'wpa_wplogin_add_initiator_field' ); // FIX FOR WOOCOMMERCE LOGIN.
|
||||
|
||||
|
||||
function wpae_wplogin_extra_validation( $user, $username, $password ) {
|
||||
if ( ! empty( $_POST ) ) {
|
||||
if (wpa_check_is_spam($_POST)){
|
||||
$postData = $_POST;
|
||||
$postData['pwd'] = '**removed**';
|
||||
do_action('wpa_handle_spammers','wplogin', $postData);
|
||||
return new WP_Error( 'error', $GLOBALS['wpa_error_message']);
|
||||
}
|
||||
}
|
||||
//return $user;
|
||||
}
|
||||
add_filter( 'authenticate', 'wpae_wplogin_extra_validation', 10, 3 );
|
||||
|
||||
|
||||
function wpae_lostpassword_extra_validation( $errors ) {
|
||||
if ( is_admin() ) { return; }
|
||||
|
||||
if (wpa_check_is_spam($_POST)){
|
||||
do_action('wpa_handle_spammers','losspassword', $_POST);
|
||||
$errors->add( 'user_login', __($GLOBALS['wpa_error_message']) );
|
||||
}
|
||||
}
|
||||
add_action( 'lostpassword_post', 'wpae_lostpassword_extra_validation' );
|
||||
|
||||
endif;
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if (!function_exists('wpae_get_blocked_integrations') || !in_array('wpregistration', wpae_get_blocked_integrations())) :
|
||||
|
||||
add_action( 'register_form', 'wpa_wpregistration_add_initiator_field' );
|
||||
function wpa_wpregistration_add_initiator_field() {
|
||||
echo '<input type="hidden" id="wpa_initiator" class="wpa_initiator" name="wpa_initiator" value="" />';
|
||||
}
|
||||
|
||||
add_filter( 'registration_errors', 'wpa_wpregistration_extra_validation', 10, 3 );
|
||||
|
||||
function wpa_wpregistration_extra_validation( $errors, $sanitized_user_login, $user_email ) {
|
||||
|
||||
if (wpa_check_is_spam($_POST)){
|
||||
do_action('wpa_handle_spammers','wpregistration', $_POST);
|
||||
|
||||
if ( !is_object( $errors ) ) { $errors = new WP_Error(); }
|
||||
|
||||
$errors->add( 'wpa_extra_email', __($GLOBALS['wpa_error_message']) );
|
||||
}
|
||||
return $errors;
|
||||
}
|
||||
|
||||
endif;
|
||||
Reference in New Issue
Block a user