forked from LiveCarta/LiveCartaWP
Changed source root directory
This commit is contained in:
4
html/wp-content/plugins/honeypot/includes/css/wpa.css
Normal file
4
html/wp-content/plugins/honeypot/includes/css/wpa.css
Normal file
@@ -0,0 +1,4 @@
|
||||
.wpa-test-msg{background: #d1ecf1 !important; border: 1px solid #bee5eb !important; border-radius: 5px !important;color: #0c5460 !important; font-size: 14px !important; padding:.75rem 1.25rem !important; font-family: Arial !important; margin-top:5px !important;}
|
||||
span.wpa-button{ display: inline-block !important; padding-top: 5px !important; color: #fff !important;background-color: #6c757d !important;border-color: #6c757d !important; padding: 5px 10px !important; border-radius: 5px !important; margin-top:5px !important; cursor: pointer !important; }
|
||||
|
||||
#altEmail_container, .altEmail_container{position:absolute !important; overflow: hidden !important; display: inline !important; height:1px !important; width: 1px !important;z-index:-1000 !important;}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
BIN
html/wp-content/plugins/honeypot/includes/img/route_pricing.jpg
Normal file
BIN
html/wp-content/plugins/honeypot/includes/img/route_pricing.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 46 KiB |
@@ -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;
|
||||
128
html/wp-content/plugins/honeypot/includes/js/wpa.js
Normal file
128
html/wp-content/plugins/honeypot/includes/js/wpa.js
Normal file
@@ -0,0 +1,128 @@
|
||||
var wpa_field_name, wpa_unique_id, wpa_add_test, wpa_hidden_field;
|
||||
|
||||
jQuery(document).ready(function(){
|
||||
wpa_field_name = wpa_field_info.wpa_field_name;
|
||||
wpa_unique_id = wpa_field_info.wpa_field_value;
|
||||
wpa_add_test = wpa_field_info.wpa_add_test;
|
||||
|
||||
wpa_hidden_field = "<div id='altEmail_container' class='altEmail_container'><label for='alt_s'>Alternative:</label><input type='text' id='alt_s' name='alt_s' ></div><span class='wpa_hidden_field' style='display:none;height:0;width:0;'><label>WPA <input type='text' name='"+wpa_field_name+"' value='"+wpa_unique_id+"' /></label></span>";
|
||||
|
||||
wpa_add_honeypot_field();
|
||||
|
||||
if (typeof wpae_add_honeypot_field == 'function') { // IF EXTENDED version exists.
|
||||
wpae_add_honeypot_field();
|
||||
}
|
||||
|
||||
if (wpa_add_test == 'yes'){
|
||||
wpa_add_test_block();
|
||||
}
|
||||
});
|
||||
|
||||
function wpa_act_as_spam(){
|
||||
actiontype = jQuery('span.wpa-button').data('actiontype');
|
||||
if (actiontype == 'remove'){
|
||||
wpa_remove_honeypot_field();
|
||||
jQuery('span.wpa-button').data('actiontype','add');
|
||||
jQuery('span.wpa-button').html('Acting as Spam Bot');
|
||||
} else {
|
||||
wpa_add_honeypot_field();
|
||||
jQuery('span.wpa-button').data('actiontype','remove');
|
||||
jQuery('span.wpa-button').html('Act as Spam Bot');
|
||||
}
|
||||
}
|
||||
|
||||
function wpa_add_honeypot_field(){
|
||||
|
||||
// Combined form selectors
|
||||
var allFormSelectors = [
|
||||
// Main forms
|
||||
'form.wpcf7-form, .wpcf7 form', // CONTACT FORM 7
|
||||
'form.wpforms-form', // WPForms
|
||||
'.gform_wrapper form', // Gravity Forms
|
||||
'.frm_forms form', // Formidable Forms
|
||||
'.caldera-grid form', // Caldera Forms
|
||||
'.wp-block-toolset-cred-form form', // Toolset Forms
|
||||
'form.cred-user-form', // Toolset Forms
|
||||
'form.cred-form', // Toolset Forms
|
||||
'form.et_pb_contact_form', // Divi Form
|
||||
'form.fb_form', // Divi Form Builder - Divi Engine
|
||||
'form.elementor-form', // Elementor
|
||||
'form.form-contribution', // WooCommerce Reviews Pro
|
||||
'form.cart', // WooCommerce Cart
|
||||
'form#learn-press-checkout-form', // LearnPress Checkout Form
|
||||
|
||||
'form.wpa_form', // Generic Class
|
||||
'.wpa_form form', // Generic Class
|
||||
|
||||
'.um-form form', // Ulimate Membership Form
|
||||
|
||||
// Login forms
|
||||
'form.spectra-pro-login-form', // SPECTRA LOGIN FORM
|
||||
'form#loginform', // Default Login Form
|
||||
'form#edd_login_form', // EDD LOGIN FORM
|
||||
'form.uwp-login-form', // USER WP LOGIN FORM
|
||||
'.et_pb_login_form form', // For Elementor login form
|
||||
'form.eael-login-form', // essential-addons login form
|
||||
'form.user-registration-form-login', // User Registration & Membership for WordPress
|
||||
|
||||
'form#lostpasswordform', // Lost Password Form
|
||||
'form.lost_reset_password', // Tutor Password Form
|
||||
'form.ur_lost_reset_password', // User Registration & Membership for WordPress
|
||||
|
||||
|
||||
//Registration Forms
|
||||
'form.register', // User Registration & Membership for WordPress
|
||||
|
||||
// Comment forms
|
||||
'form#commentform', // WP Comment with ID
|
||||
'form.ast-commentform', // Astra Comment Form with class
|
||||
'form#fl-comment-form', // Beaver Builder Theme Form with ID
|
||||
'form.comment-form', // WP Comment with class
|
||||
'.review-form form', // LearnPress Review
|
||||
'form#edd-reviews-form', // EDD Reviews with ID
|
||||
'form.wpr-comment-form',
|
||||
|
||||
// BBPress forms
|
||||
'.bbp-topic-form form', // BBPress Topic Form
|
||||
'.bbp-reply-form form' // BBPress Reply Form
|
||||
];
|
||||
|
||||
// Append hidden field to all forms in the combined selector list
|
||||
jQuery(allFormSelectors.join(', ')).append(wpa_hidden_field);
|
||||
|
||||
// FOR FLUENT FORMS
|
||||
jQuery('form.frm-fluent-form').append(wpa_hidden_field); // FOR Fluent Forms
|
||||
jQuery('.ff_conv_app').append(wpa_hidden_field); // FOR Fluent Convertional Forms
|
||||
|
||||
if (typeof fluent_forms_global_var_1 !== 'undefined') { // QUICK HACK FOR FLUENT FORMS CONVERSIONAL
|
||||
fluent_forms_global_var_1.extra_inputs[wpa_field_name] = wpa_unique_id;
|
||||
fluent_forms_global_var_1.extra_inputs['alt_s'] = '';
|
||||
}
|
||||
// EOF FLUENT FORMS
|
||||
|
||||
jQuery('input.wpa_initiator').each(function() {
|
||||
var $form = jQuery(this).closest('form'); // Get the parent form of input.wpa_initiator
|
||||
|
||||
// Check if wpa_hidden_field exists in the form, if not, insert it after input.wpa_initiator
|
||||
if ($form.find('.wpa_hidden_field').length === 0) {
|
||||
jQuery(wpa_hidden_field).insertAfter(this);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function wpa_add_test_block(){
|
||||
checkingTest = '<div class="wpa-test-msg"><strong>WP Armour ( Only visible to site administrators. Not visible to other users. )</strong><br />This form has a honeypot trap enabled. If you want to act as spam bot for testing purposes, please click the button below.<br/><span class="wpa-button" onclick="wpa_act_as_spam()" data-actiontype="remove">Act as Spam Bot</span></div>';
|
||||
jQuery('.wpa-test-msg').remove(); // Clear First
|
||||
jQuery('span.wpa_hidden_field').after(checkingTest);
|
||||
}
|
||||
|
||||
function wpa_remove_honeypot_field(){
|
||||
jQuery('.wpa_hidden_field').remove();
|
||||
jQuery('#altEmail_container, .altEmail_container').remove();
|
||||
|
||||
if (typeof fluent_forms_global_var_1 !== 'undefined') {
|
||||
delete fluent_forms_global_var_1.extra_inputs[wpa_field_name];
|
||||
delete fluent_forms_global_var_1.extra_inputs['alt_s'];
|
||||
}
|
||||
}
|
||||
131
html/wp-content/plugins/honeypot/includes/js/wpa_vanilla.js
Normal file
131
html/wp-content/plugins/honeypot/includes/js/wpa_vanilla.js
Normal file
@@ -0,0 +1,131 @@
|
||||
var wpa_field_name, wpa_unique_id, wpa_add_test, wpa_hidden_field;
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
wpa_field_name = wpa_field_info.wpa_field_name;
|
||||
wpa_unique_id = wpa_field_info.wpa_field_value;
|
||||
wpa_add_test = wpa_field_info.wpa_add_test;
|
||||
|
||||
wpa_hidden_field = "<div id='altEmail_container' class='altEmail_container'><label for='alt_s'>Alternative:</label><input type='text' id='alt_s' name='alt_s' ></div><span class='wpa_hidden_field' style='display:none;height:0;width:0;'><label>WPA <input type='text' name='"+wpa_field_name+"' value='"+wpa_unique_id+"' /></label></span>";
|
||||
|
||||
wpa_add_honeypot_field();
|
||||
|
||||
if (typeof wpae_add_honeypot_field === 'function') { // IF EXTENDED version exists.
|
||||
wpae_add_honeypot_field();
|
||||
}
|
||||
|
||||
if (wpa_add_test === 'yes') {
|
||||
wpa_add_test_block();
|
||||
}
|
||||
});
|
||||
|
||||
function wpa_act_as_spam() {
|
||||
const wpaButton = document.querySelector('span.wpa-button');
|
||||
const actiontype = wpaButton.dataset.actiontype;
|
||||
|
||||
if (actiontype === 'remove') {
|
||||
wpa_remove_honeypot_field();
|
||||
wpaButton.dataset.actiontype = 'add';
|
||||
wpaButton.textContent = 'Acting as Spam Bot';
|
||||
} else {
|
||||
wpa_add_honeypot_field();
|
||||
wpaButton.dataset.actiontype = 'remove';
|
||||
wpaButton.textContent = 'Act as Spam Bot';
|
||||
}
|
||||
}
|
||||
|
||||
function wpa_add_honeypot_field() {
|
||||
// Combined form selectors
|
||||
const allFormSelectors = [
|
||||
// Main forms
|
||||
'form.wpcf7-form, .wpcf7 form', // CONTACT FORM 7
|
||||
'form.wpforms-form', // WPForms
|
||||
'.gform_wrapper form', // Gravity Forms
|
||||
'.frm_forms form', // Formidable Forms
|
||||
'.caldera-grid form', // Caldera Forms
|
||||
'.wp-block-toolset-cred-form form', // Toolset Forms
|
||||
'form.cred-user-form', // Toolset Forms
|
||||
'form.cred-form', // Toolset Forms
|
||||
'form.et_pb_contact_form', // Divi Form
|
||||
'form.fb_form', // Divi Form Builder - Divi Engine
|
||||
'form.elementor-form', // Elementor
|
||||
'form.form-contribution', // WooCommerce Reviews Pro
|
||||
'form.cart', // WooCommerce Cart
|
||||
'form#learn-press-checkout-form', // LearnPress Checkout Form
|
||||
|
||||
'form.wpa_form', // Generic Class
|
||||
'.wpa_form form', // Generic Class
|
||||
|
||||
'.um-form form', // Ulimate Membership Form
|
||||
|
||||
// Login forms
|
||||
'form.spectra-pro-login-form', // SPECTRA LOGIN FORM
|
||||
'form#loginform', // Default Login Form
|
||||
'form#edd_login_form', // EDD LOGIN FORM
|
||||
'form.uwp-login-form', // USER WP LOGIN FORM
|
||||
'.et_pb_login_form form', // For Elementor login form
|
||||
'form.eael-login-form', // essential-addons login form
|
||||
'form.user-registration-form-login', // User Registration & Membership for WordPress
|
||||
|
||||
'form#lostpasswordform', // Lost Password Form
|
||||
'form.lost_reset_password', // Tutor Password Form
|
||||
'form.ur_lost_reset_password', // User Registration & Membership for WordPress
|
||||
|
||||
//Registration Forms
|
||||
'form.register', // User Registration & Membership for WordPress
|
||||
|
||||
// Comment forms
|
||||
'form#commentform', // WP Comment with ID
|
||||
'form.ast-commentform', // Astra Comment Form with class
|
||||
'form#fl-comment-form', // Beaver Builder Theme Form with ID
|
||||
'form.comment-form', // WP Comment with class
|
||||
'.review-form form', // LearnPress Review
|
||||
'form#edd-reviews-form', // EDD Reviews with ID
|
||||
'form.wpr-comment-form',
|
||||
|
||||
// BBPress forms
|
||||
'.bbp-topic-form form', // BBPress Topic Form
|
||||
'.bbp-reply-form form' // BBPress Reply Form
|
||||
];
|
||||
|
||||
const forms = document.querySelectorAll(allFormSelectors.join(', '));
|
||||
forms.forEach(form => {
|
||||
form.insertAdjacentHTML('beforeend', wpa_hidden_field);
|
||||
});
|
||||
|
||||
// FOR FLUENT FORMS
|
||||
const fluentForms = document.querySelectorAll('form.frm-fluent-form, .ff_conv_app');
|
||||
fluentForms.forEach(form => {
|
||||
form.insertAdjacentHTML('beforeend', wpa_hidden_field);
|
||||
});
|
||||
|
||||
if (typeof fluent_forms_global_var_1 !== 'undefined') { // QUICK HACK FOR FLUENT FORMS CONVERSIONAL
|
||||
fluent_forms_global_var_1.extra_inputs[wpa_field_name] = wpa_unique_id;
|
||||
fluent_forms_global_var_1.extra_inputs['alt_s'] = '';
|
||||
}
|
||||
// EOF FLUENT FORMS
|
||||
|
||||
const wpaInitiators = document.querySelectorAll('input.wpa_initiator');
|
||||
wpaInitiators.forEach(initiator => {
|
||||
const form = initiator.closest('form');
|
||||
if (form && !form.querySelector('.wpa_hidden_field')) {
|
||||
initiator.insertAdjacentHTML('afterend', wpa_hidden_field);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function wpa_add_test_block() {
|
||||
const checkingTest = '<div class="wpa-test-msg"><strong>WP Armour ( Only visible to site administrators. Not visible to other users. )</strong><br />This form has a honeypot trap enabled. If you want to act as spam bot for testing purposes, please click the button below.<br/><span class="wpa-button" onclick="wpa_act_as_spam()" data-actiontype="remove">Act as Spam Bot</span></div>';
|
||||
document.querySelectorAll('.wpa-test-msg').forEach(el => el.remove());
|
||||
document.querySelectorAll('span.wpa_hidden_field').forEach(span => {
|
||||
span.insertAdjacentHTML('afterend', checkingTest);
|
||||
});
|
||||
}
|
||||
|
||||
function wpa_remove_honeypot_field() {
|
||||
document.querySelectorAll('.wpa_hidden_field, #altEmail_container, .altEmail_container').forEach(el => el.remove());
|
||||
|
||||
if (typeof fluent_forms_global_var_1 !== 'undefined') {
|
||||
delete fluent_forms_global_var_1.extra_inputs[wpa_field_name];
|
||||
delete fluent_forms_global_var_1.extra_inputs['alt_s'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
|
||||
<style type="text/css">
|
||||
.why_extended{padding: 10px; font-size: 14px;}
|
||||
.why_extended ul li{ padding-bottom: 20px; width: 285px; float: left; margin:10px 20px 10px 0px;border: 1px solid #d0d0d0; background: #d8d8d8; height: 150px; border-radius: 5px; padding: 10px; line-height: 1.5;}
|
||||
.why_extended ul label{display: block;padding-bottom: 10px; font-size: 15px; color: #000; font-weight: 500;}
|
||||
</style>
|
||||
<div class="why_extended">
|
||||
<h3>Extra Tools that WP Armour Extended offers to make WP Armour more powerfull.</h3>
|
||||
<ul>
|
||||
<li><label>Additional Support</label>
|
||||
* WooCommerce & Easy Digital Downloads <br/>
|
||||
* QuForm, MC4WP, HTMLform plugin<br/>
|
||||
* BuddyPress, BuddyBoss<br/>
|
||||
* NinjaForms, S2 Member, Avia Enfold Theme<br/>
|
||||
* Gravity Forms (For Ajax enabled and multi page form) and more..
|
||||
</li>
|
||||
|
||||
<!--
|
||||
<li><label>2 Level Spam Check</label>
|
||||
Our lite version should block most of the spam bot submission. But if you are still getting spam submission, you can enable 2 level spam check in Extended version from Extended Settings tab.
|
||||
</li> -->
|
||||
|
||||
<li><label>Record Spammer IP</label>
|
||||
Record spammers' IPs to block them from future submissions.
|
||||
</li>
|
||||
|
||||
<li><label>View Spam Submission</label>
|
||||
See what data spam bot was trying to submit.
|
||||
</li>
|
||||
|
||||
<li><label>Auto Block Spam Bot IP</label>
|
||||
Allows you to block the spam bot IP so that they can't visit your website.
|
||||
</li>
|
||||
|
||||
<li><label>Get HoneyPot Extended Now !</label>
|
||||
Get WP Armour Extended and make WP Armour more powerful.
|
||||
<br/>
|
||||
<a href="https://dineshkarki.com.np/buy-wp-armour-extended" target="_blank" class="button" style="float: right;">GET IT NOW</a>
|
||||
</li>
|
||||
|
||||
<li><label>Don't need WP Armour Extended Tools ?</label>
|
||||
In the long run, spam bots learn how to bypass antispam systems. Staying on top of new methodologies is key. You can motivate us to continue development of the plugin by getting a license for the WP Armour Extended.
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
52
html/wp-content/plugins/honeypot/includes/views/wpa_main.php
Normal file
52
html/wp-content/plugins/honeypot/includes/views/wpa_main.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
if (isset($_POST['submit-wpa-general-settings'])){
|
||||
$saveReturn = wpa_save_settings();
|
||||
}
|
||||
|
||||
if (isset($_POST['submit-wpae-general-settings'])){
|
||||
$saveReturn = wpae_save_settings();
|
||||
}
|
||||
|
||||
if (isset($_POST['submit-wpae-whitelist_ips'])){
|
||||
$saveReturn = wpae_save_whitelist_ips();
|
||||
}
|
||||
|
||||
if (isset($_POST['submit-wpae-integrations'])){
|
||||
$saveReturn = wpae_save_integrations();
|
||||
}
|
||||
|
||||
if (isset($_GET['tab']) && array_key_exists($_GET['tab'],$wpa_tabs)){
|
||||
$currentTab = $_GET['tab'];
|
||||
} else {
|
||||
$currentTab = 'settings';
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if (isset($saveReturn)):?>
|
||||
<div class="updated <?php echo $saveReturn['status']; ?>" id="message"><p><?php echo $saveReturn['body']; ?></p></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="wrap">
|
||||
|
||||
<h1>WP Armour - HoneyPot Anti Spam</h1>
|
||||
|
||||
<nav class="nav-tab-wrapper">
|
||||
<?php foreach ($wpa_tabs as $tabKey => $tabData) { ?>
|
||||
<a href="<?php echo admin_url(); ?>admin.php?page=wp-armour&tab=<?php echo $tabKey; ?>" class="nav-tab <?php echo $currentTab == $tabKey?'nav-tab-active':''; ?>"><?php echo $tabData['name']; ?></a>
|
||||
<?php } ?>
|
||||
</nav>
|
||||
|
||||
<div class="tab-content">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<?php include($wpa_tabs[$currentTab]['path']); ?>
|
||||
</td>
|
||||
<td width="15"> </td>
|
||||
<td width="250" valign="top"><?php include('wpa_sidebar.php'); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
103
html/wp-content/plugins/honeypot/includes/views/wpa_notice.php
Normal file
103
html/wp-content/plugins/honeypot/includes/views/wpa_notice.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
add_action('admin_notices', 'wpa_admin_notices');
|
||||
|
||||
if (isset($_GET['wpa_reviews_notice_hide']) == 1){
|
||||
update_option('wpa_reviews_notice_hide','yes');
|
||||
}
|
||||
|
||||
if (isset($_GET['wpa_pateron_notice_hide']) == 1){
|
||||
update_option('wpa_pateron_notice_hide','yes');
|
||||
}
|
||||
|
||||
if (isset($_GET['wpa_extended_notice_hide']) == 1){
|
||||
update_option('wpa_extended_notice_hide','yes');
|
||||
}
|
||||
|
||||
function wpa_admin_notices(){
|
||||
// FOR OLD EXTENDED VERSION
|
||||
if(is_plugin_active( 'wp-armour-extended/wp-armour-extended.php' ) ) {
|
||||
if ($GLOBALS['wpae_version'] < 1.17 ){
|
||||
echo '<div class="notice notice-error is-dismissible">
|
||||
<p><strong style="color:#900;">IMPORTANT : </strong> Your are using older version of WP Armour Extended. Please update to 1.17 or above for it to work properly.</p>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (current_user_can( 'manage_options' )): // ONLY SHOW IF ADMIN
|
||||
|
||||
// FOR REVIEWS
|
||||
if (get_option('wpa_reviews_notice_hide') != 'yes'){
|
||||
$installedDate = strtotime(get_option('wpa_installed_date'));
|
||||
$todayDate = time();
|
||||
$installedDays = round(($todayDate - $installedDate) / (60 * 60 * 24));
|
||||
$wpa_stats = json_decode(get_option('wpa_stats'),true);
|
||||
$all_spam_blocked = $wpa_stats ? $wpa_stats['total']['all_time'] : 0;
|
||||
|
||||
|
||||
if ($installedDays > 30 && $all_spam_blocked > 30){
|
||||
echo '<div class="updated success" style="padding:10px; font-size:16px; line-height:1.6;color:#205225;">
|
||||
Hey, WP Armour has blocked <strong>'.$all_spam_blocked.'</strong> spam submissions till date - that’s awesome! Could you please do us a BIG favor and give it a 5-star rating on WordPress ? Just to help us spread the word and boost our motivation.<br/><br/>
|
||||
|
||||
<ul style="padding-left:50px;list-style-type: square;">
|
||||
<li><a href="https://wordpress.org/support/plugin/honeypot/reviews/?filter=5" target="_blank">Ok, you deserve it</a></li>
|
||||
<li><a href="https://dineshkarki.com.np/contact" target="_blank">I still have problem !!</a></li>
|
||||
<li><a href="'.admin_url("admin.php?page=wp-armour&wpa_reviews_notice_hide=1").'">I already did</a></li>
|
||||
<li><a href="'.admin_url("admin.php?page=wp-armour&wpa_reviews_notice_hide=1").'">Hide this message</a></li>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
// FOR PATERON
|
||||
if (!is_plugin_active('wp-armour-extended/wp-armour-extended.php')){
|
||||
if (get_option('wpa_pateron_notice_hide') != 'yes'){
|
||||
$installedDate = strtotime(get_option('wpa_installed_date'));
|
||||
$todayDate = time();
|
||||
$installedDays = round(($todayDate - $installedDate) / (60 * 60 * 24));
|
||||
$wpa_stats = json_decode(get_option('wpa_stats'),true);
|
||||
$all_spam_blocked = $wpa_stats ? $wpa_stats['total']['all_time'] : 0;
|
||||
|
||||
|
||||
if ($installedDays > 100 && $all_spam_blocked > 300 ){
|
||||
echo '<div class="updated success" style="padding:10px; font-size:16px; line-height:1.6;color:#205225;">
|
||||
Your support is vital for us to keep fighting spam. By supporting us on <a href="https://www.patreon.com/wp_armour" target="_blank">Patreon</a> with as little as USD 1, you will help us continue developing of <strong>WP Armour</strong> Anti Spam Plugin.
|
||||
<ul style="padding-left:50px;list-style-type: square;">
|
||||
<li><a href="https://www.patreon.com/wp_armour" target="_blank">WP Armour Patreon Page</a></li>
|
||||
<li><a href="'.admin_url("admin.php?page=wp-armour&wpa_pateron_notice_hide=1").'">Hide this message</a></li>
|
||||
</ul>
|
||||
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// UPSELLING EXTENDED VERSION
|
||||
if (get_option('wpa_extended_notice_hide') != 'yes' && !is_plugin_active('wp-armour-extended/wp-armour-extended.php') ){
|
||||
$installedDate = strtotime(get_option('wpa_installed_date'));
|
||||
$todayDate = time();
|
||||
$installedDays = round(($todayDate - $installedDate) / (60 * 60 * 24));
|
||||
$wpa_stats = json_decode(get_option('wpa_stats'),true);
|
||||
$all_spam_blocked = $wpa_stats ? $wpa_stats['total']['all_time'] : 0;
|
||||
|
||||
|
||||
if ($installedDays > 90 && $all_spam_blocked > 1000){
|
||||
echo '<div class="updated success" style="padding:10px; font-size:16px; line-height:1.6;color:#205225;">
|
||||
Hey, WP Armour has blocked <strong>'.$all_spam_blocked.'</strong> spam submissions till date - that’s awesome!<br/><br/>
|
||||
|
||||
Can you help us by purchasing our Extended Version ? This will helps up maintain and support the plugin in upcoming days and make it even better. Our Extended version starts from 19.99 USD and comes with yearly license, No API calls & Fully GDPR Complaint. <br/><br/>
|
||||
|
||||
It has additional support including WooCommerce ( Blocks card testing orders), Ajax and Multi page Gravity Forms, Easy Digital Downloads, QuForm, MC4WP: Mailchimp for WordPress and have Spammer blocking based on IP, Record Spam Submission and many more.
|
||||
|
||||
<ul style="padding-left:50px;list-style-type: square;">
|
||||
<li><a href="https://dineshkarki.com.np/buy-wp-armour-extended" target="_blank">I will help</a></li>
|
||||
<li><a href="'.admin_url("admin.php?page=wp-armour&wpa_extended_notice_hide=1").'">Hide this message</a></li>
|
||||
</ul>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
endif; // CAN MANAGE OPTION
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
|
||||
<br/>
|
||||
<table class="wp-list-table widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><strong>General Settings</strong></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2"><strong>This plugin should work with default settings, however if you begin to get spam, update the field name below.</strong></td>
|
||||
</tr>
|
||||
|
||||
<form method="post" action="">
|
||||
<tr>
|
||||
<td width="250">Honey Pot Field Name</td>
|
||||
<td>
|
||||
<input id="wpa_field_name" name="wpa_field_name" style="width:300px;" value="<?php echo esc_attr(get_option('wpa_field_name'));?>" type="text" readonly="readonly" />
|
||||
|
||||
<span class="dashicons dashicons-update" style="font-size: 28px; cursor: pointer;" onclick="wpa_unqiue_field_name()"></span>
|
||||
|
||||
<br/>
|
||||
<em>Changing the field name regularly is a good idea. Please click on icon above to generate new field name.</em>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Honey Pot Error Message</td>
|
||||
<td>
|
||||
<input name="wpa_error_message" style="width:300px;" value="<?php echo esc_attr(get_option('wpa_error_message'));?>" type="text" /><br/><em>Mesage for bots. No average human users will see though.</em>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Disable Honeypot Test Widget</td>
|
||||
<td>
|
||||
<select name="wpa_disable_test_widget">
|
||||
<option value="no" <?php echo get_option('wpa_disable_test_widget') == 'no'?'selected="selected"':''; ?> >No</option>
|
||||
<option value="yes" <?php echo get_option('wpa_disable_test_widget') == 'yes'?'selected="selected"':''; ?> >Yes</option>
|
||||
</select>
|
||||
<em>Only visible when Admin user is logged in.</em>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Disable jQuery?</td>
|
||||
<td>
|
||||
<select name="wpa_disable_jquery">
|
||||
<option value="no" <?php echo get_option('wpa_disable_jquery') == 'no' ? 'selected="selected"' : ''; ?> >No</option>
|
||||
<option value="yes" <?php echo get_option('wpa_disable_jquery') == 'yes' ? 'selected="selected"' : ''; ?> >Yes</option>
|
||||
</select>
|
||||
<em>⚠️ This is a new feature. Please test carefully before using on a live site.</em>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if (current_user_can('manage_options')) { ?>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<?php wp_nonce_field( 'wpa_save_settings', 'wpa_nonce' ); ?>
|
||||
<input type="submit" name="submit-wpa-general-settings" class="button-primary" value="Save General Settings" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php } else { ?>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<p style="color: red;">Only Administrators can make changes to these settings.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
</form>
|
||||
|
||||
</tbody>
|
||||
</table><br/>
|
||||
|
||||
<script type="text/javascript">
|
||||
function wpa_unqiue_field_name(){
|
||||
var randomChars = 'abcdefghijklmnopqrstuvwxyz';
|
||||
var length = 6;
|
||||
var string = '';
|
||||
for ( var i = 0; i < length; i++ ) {
|
||||
string += randomChars.charAt(Math.floor(Math.random() * randomChars.length));
|
||||
}
|
||||
var number = Math.floor(1000 + Math.random() * 9000);
|
||||
|
||||
jQuery('#wpa_field_name').val(string+number);
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
|
||||
<style type="text/css">
|
||||
ul.uaf_list{ list-style-type:square;margin-left: 2em;}
|
||||
.sidebar_image{max-width: 100%;}
|
||||
</style>
|
||||
<br/>
|
||||
|
||||
<?php if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) { ?>
|
||||
<a href="https://hcn.im/routepricing" target="_blank"><img class="sidebar_image" src="<?php echo plugin_dir_url( dirname( __FILE__ ) ) . 'img/route_pricing.jpg'; ?>" /></a>
|
||||
<br/><br/>
|
||||
<?php } ?>
|
||||
|
||||
<table class="wp-list-table widefat fixed bookmarks">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><strong>Quick Link</strong></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<ul class="uaf_list">
|
||||
<li><a href="https://wordpress.org/support/plugin/honeypot/" target="_blank">Support Forum</a></li>
|
||||
<li><a href="https://www.facebook.com/Dnesscarkey-77553779916" target="_blank">Send Us Msg via Facebook</a></li>
|
||||
<li><a href="https://dineshkarki.com.np/buy-wp-armour-extended" target="_blank">Get WP Armour Extended</a></li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br/>
|
||||
|
||||
<table class="wp-list-table widefat fixed bookmarks">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><strong>Plugins You May Like</strong></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<ul class="uaf_list">
|
||||
<li><a href="https://wordpress.org/plugins/use-any-font/" target="_blank">Use Any Font</a></li>
|
||||
<li><a href="https://dineshkarki.com.np/jquery-validation-for-gravity-forms" target="_blank">Jquery Validation For Gravity Form</a></li>
|
||||
<li><a href="https://wordpress.org/extend/plugins/any-mobile-theme-switcher/" target="_blank">Any Mobile Theme Switcher</a></li>
|
||||
<li><a href="https://wordpress.org/extend/plugins/jquery-validation-for-contact-form-7/" target="_blank">Jquery Validation For Contact Form 7</a></li>
|
||||
<li><a href="https://wordpress.org/extend/plugins/block-specific-plugin-updates/" target="_blank">Block Specific Plugin Updates</a></li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br/>
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
$wpae_nonce = '&_wpnonce='.wp_create_nonce( 'wpae_action_nonce' );
|
||||
|
||||
if ( isset( $_GET['action'] ) && isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'wpae_action_nonce' ) ) {
|
||||
switch ($_GET['action']) {
|
||||
case 'resetstats':
|
||||
if (function_exists('wpae_reset_stats')){
|
||||
wpae_reset_stats();
|
||||
$actionReturn = array('status' => 'ok','body'=>'Stats Reset' );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
$currentStats = json_decode(get_option('wpa_stats'), true);
|
||||
?>
|
||||
|
||||
<?php if (isset($actionReturn)):?>
|
||||
<div class="updated <?php echo $actionReturn['status']; ?>" id="message"><p><?php echo $actionReturn['body']; ?></p></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<br/>
|
||||
|
||||
<?php if (function_exists('wpae_reset_stats')){ ?>
|
||||
<div class="wpae_bulk_actions">
|
||||
<a href="admin.php?page=wp-armour&tab=stats&action=resetstats<?php echo $wpae_nonce ?>" onclick="return confirm('Are you sure? This action is irreversible.')">Reset Stats</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<table class="wp-list-table widefat fixed bookmarks">
|
||||
<?php
|
||||
/*
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="5"><strong>Quick Stats</strong></th>
|
||||
</tr>
|
||||
</thead>
|
||||
*/ ?>
|
||||
<thead>
|
||||
<tr>
|
||||
<th><strong>Source</strong></th>
|
||||
<th><strong>Today</strong></th>
|
||||
<th><strong>This Week</strong></th>
|
||||
<th><strong>This Month</strong></th>
|
||||
<th><strong>All Time</strong></th>
|
||||
</tr>
|
||||
<thead>
|
||||
<tbody>
|
||||
<?php
|
||||
if (!empty($currentStats)){
|
||||
foreach ($currentStats as $source=>$statData): ?>
|
||||
<tr>
|
||||
<td><strong><?php echo ucfirst($source); ?></strong></td>
|
||||
<td><?php echo @wpa_check_date($statData['today']['date'],'today')?$statData['today']['count']:'0'; ?></td>
|
||||
<td><?php echo @wpa_check_date($statData['week']['date'],'week')?$statData['week']['count']:'0'; ?></td>
|
||||
<td><?php echo @wpa_check_date($statData['month']['date'],'month')?$statData['month']['count']:'0'; ?></td>
|
||||
<td><?php echo $statData['all_time']; ?></td>
|
||||
</tr>
|
||||
<?php endforeach;
|
||||
} else { ?>
|
||||
<tr><td colspan="5">No Record Found</td></tr>
|
||||
<?php } ?>
|
||||
|
||||
</tbody>
|
||||
</table><br/>
|
||||
<br/>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
|
||||
<style type="text/css">
|
||||
.wpa_stat_table{max-width: 100%;filter: blur(2px);-webkit-filter: blur(2px);}
|
||||
.wpa_stat_table_holder{position: relative;}
|
||||
.wpa_stat_overlay{position: absolute; z-index: 10; width: 80%; height: 80%;top: 10%; left: 10%;box-shadow: 0 0 25px 10px rgba(0,0,0,0.08); background: #fff; border-radius: 5px; text-align:center;}
|
||||
.wpa_stat_overlay .wpa_stat_headline{font-size: 20px; margin-top: 20px; padding: 5px;}
|
||||
.wpa_stat_overlay .wpa_stat_content{padding: 5px;}
|
||||
.wpa_stat_button a{ padding: 5px 30px !important; }
|
||||
</style>
|
||||
|
||||
|
||||
<div class="wpa_stat_table_holder">
|
||||
<img class="wpa_stat_table" src="<?php echo plugin_dir_url( dirname( __FILE__ ) ) . 'img/dashboard_stats.png'; ?>" />
|
||||
<div class="wpa_stat_overlay">
|
||||
<div class="wpa_stat_headline">
|
||||
View all spam statistics from dashboard
|
||||
</div>
|
||||
<div class="wpa_stat_content">
|
||||
<p>Enable stats widgets with WP Armour Extended.</p>
|
||||
<p>Also, it can auto block spammer's IP and record what spammer are trying to submit.</p>
|
||||
</div>
|
||||
<div class="wpa_stat_button">
|
||||
<a href="https://dineshkarki.com.np/buy-wp-armour-extended" target="_blank" class="button button-primary">Get WP Armour Extended</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
6
html/wp-content/plugins/honeypot/includes/wpa_config.php
Normal file
6
html/wp-content/plugins/honeypot/includes/wpa_config.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
$GLOBALS['wpa_version'] = '2.3.04';
|
||||
$GLOBALS['wpa_field_name'] = get_option('wpa_field_name');
|
||||
$GLOBALS['wpa_error_message'] = get_option('wpa_error_message');
|
||||
$GLOBALS['wpa_disable_test_widget'] = get_option('wpa_disable_test_widget');
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
add_action("wp_dashboard_setup", "wpa_dashboard_widget");
|
||||
function wpa_dashboard_widget()
|
||||
{
|
||||
//add_meta_box( 'wpa_dashboard_widget', 'WP Armour Anti Spam Statistics', 'wpa_dashboard_widget_function', 'dashboard', 'side', 'high');
|
||||
if ( current_user_can('administrator') ) {
|
||||
add_meta_box(
|
||||
'wpa_dashboard_widget',
|
||||
'WP Armour Anti Spam Statistics',
|
||||
'wpa_dashboard_widget_function',
|
||||
'dashboard',
|
||||
'side',
|
||||
'high'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function wpa_dashboard_widget_function(){
|
||||
ob_start();
|
||||
include('views/wpa_stats_widget.php');
|
||||
$widget_content = ob_get_contents();
|
||||
ob_end_clean ();
|
||||
$widget_content = apply_filters( 'wpa_widget_content', $widget_content);
|
||||
echo $widget_content;
|
||||
}
|
||||
169
html/wp-content/plugins/honeypot/includes/wpa_functions.php
Normal file
169
html/wp-content/plugins/honeypot/includes/wpa_functions.php
Normal file
@@ -0,0 +1,169 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
function wpa_load_scripts(){
|
||||
if( get_option('wpa_disable_jquery') === 'yes' ) {
|
||||
wp_enqueue_script( 'wpascript', plugins_url( '/js/wpa_vanilla.js', __FILE__ ), array(), $GLOBALS['wpa_version'], true );
|
||||
} else {
|
||||
wp_enqueue_script( 'wpascript', plugins_url( '/js/wpa.js', __FILE__ ), array('jquery'), $GLOBALS['wpa_version'], true );
|
||||
}
|
||||
|
||||
wp_add_inline_script( 'wpascript', 'wpa_field_info = '.json_encode(wpa_field_info()));
|
||||
wp_enqueue_style( 'wpa-css', plugins_url( '/css/wpa.css', __FILE__ ), array(), $GLOBALS['wpa_version']);
|
||||
}
|
||||
|
||||
function wpa_plugin_menu(){
|
||||
add_menu_page( 'WP Armour', 'WP Armour', 'edit_pages', 'wp-armour', 'wpa_options','dashicons-shield');
|
||||
}
|
||||
|
||||
function wpa_options(){
|
||||
$wpa_tabs = array(
|
||||
'settings' => array('name'=>'Settings','path'=>'wpa_settings.php'),
|
||||
'stats' => array('name'=>'Statistics','path'=>'wpa_stats.php'),
|
||||
'extended_version' => array('name'=>"What's in WP Armour Extended ?",'path'=>'wpa_extended_version.php')
|
||||
);
|
||||
|
||||
$wpa_tabs = apply_filters( 'wpa_tabs_filter', $wpa_tabs);
|
||||
|
||||
include 'views/wpa_main.php';
|
||||
}
|
||||
|
||||
function wpa_save_settings(){
|
||||
if ( isset($_POST['wpa_nonce']) && wp_verify_nonce($_POST['wpa_nonce'], 'wpa_save_settings')) {
|
||||
if (empty($_POST['wpa_field_name'])){
|
||||
$return['status'] = 'error';
|
||||
$return['body'] = "Honey Pot Field Name can't be empty";
|
||||
} else {
|
||||
update_option('wpa_field_name',sanitize_title_with_dashes($_POST['wpa_field_name']));
|
||||
update_option('wpa_error_message',sanitize_text_field(stripslashes($_POST['wpa_error_message'])));
|
||||
update_option('wpa_disable_test_widget',sanitize_text_field($_POST['wpa_disable_test_widget']));
|
||||
update_option('wpa_disable_jquery', sanitize_text_field($_POST['wpa_disable_jquery']));
|
||||
|
||||
$GLOBALS['wpa_field_name'] = get_option('wpa_field_name');
|
||||
$GLOBALS['wpa_error_message'] = get_option('wpa_error_message');
|
||||
|
||||
$return['status'] = 'ok';
|
||||
$return['body'] = 'Settings Saved';
|
||||
}
|
||||
} else {
|
||||
$return['status'] = 'error';
|
||||
$return['body'] = 'Sorry, your nonce did not verify. Please try again.';
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
function wpa_save_stats($wp_system, $data){
|
||||
$currentStats = json_decode(get_option('wpa_stats'), true) ?? array();
|
||||
$timeArray = array('today','week','month');
|
||||
|
||||
if (!array_key_exists($wp_system,$currentStats)){
|
||||
$currentStats[$wp_system]['today']['count'] = 0;
|
||||
$currentStats[$wp_system]['week']['count'] = 0;
|
||||
$currentStats[$wp_system]['month']['count'] = 0;
|
||||
$currentStats[$wp_system]['today']['date'] = date('Ymd');
|
||||
$currentStats[$wp_system]['week']['date'] = date('Ymd');
|
||||
$currentStats[$wp_system]['month']['date'] = date('Ymd');
|
||||
}
|
||||
|
||||
foreach ($timeArray as $key => $time) {
|
||||
if (wpa_check_date($currentStats['total'][$time]['date'],$time)){
|
||||
$currentStats['total'][$time]['count'] += 1;
|
||||
} else {
|
||||
$currentStats['total'][$time]['count'] = 1;
|
||||
}
|
||||
|
||||
if (wpa_check_date($currentStats[$wp_system][$time]['date'],$time)){
|
||||
$currentStats[$wp_system][$time]['count'] += 1;
|
||||
} else {
|
||||
$currentStats[$wp_system][$time]['count'] = 1;
|
||||
}
|
||||
|
||||
$currentStats['total'][$time]['date'] = date('Ymd');
|
||||
$currentStats[$wp_system][$time]['date'] = date('Ymd');
|
||||
}
|
||||
|
||||
$currentStats['total']['all_time'] += 1;
|
||||
@$currentStats[$wp_system]['all_time'] += 1;
|
||||
update_option('wpa_stats', json_encode($currentStats));
|
||||
}
|
||||
|
||||
function wpa_check_date($timestamp, $comparision){
|
||||
switch ($comparision) {
|
||||
case 'today':
|
||||
if (date('Ymd') == $timestamp){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'week':
|
||||
$firstWeekDay = date("Ymd", strtotime('monday this week'));
|
||||
$lastWeekDay = date("Ymd", strtotime('sunday this week'));
|
||||
|
||||
if($timestamp >= $firstWeekDay && $timestamp <= $lastWeekDay) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'month':
|
||||
if(date('Ym',strtotime($timestamp)) == date('Ym')) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function wpa_unqiue_field_name(){
|
||||
$permitted_chars = 'abcdefghijklmnopqrstuvwxyz';
|
||||
return substr(str_shuffle($permitted_chars), 0, 6).rand(1,9999);
|
||||
}
|
||||
|
||||
function wpa_unqiue_field_value(){
|
||||
/* DEPRECATED LEVEL 2
|
||||
if (function_exists('wpae_unqiue_field_value')){ // IF EXTENDED VERSION AVAILABLE
|
||||
return wpae_unqiue_field_value();
|
||||
} else {
|
||||
return rand(1111, 999999);
|
||||
}*/
|
||||
return rand(1111, 999999);
|
||||
}
|
||||
|
||||
function wpa_check_is_spam($form_data){
|
||||
if (
|
||||
(isset($form_data[$GLOBALS['wpa_field_name']])) &&
|
||||
(isset($form_data['alt_s'])) &&
|
||||
(empty($form_data['alt_s']))
|
||||
|
||||
){
|
||||
/* DEPRECATED LEVEL 2
|
||||
if (function_exists('wpae_2level_spam_check')){
|
||||
return wpae_2level_spam_check($form_data[$GLOBALS['wpa_field_name']]);
|
||||
} else {
|
||||
return false; // FALSE MEANS NOT SPAM
|
||||
}*/
|
||||
return false; // FALSE MEANS NOT SPAM
|
||||
} else {
|
||||
return true; // TRUE MEANS SPAM
|
||||
}
|
||||
}
|
||||
|
||||
function wpa_field_info(){
|
||||
if (current_user_can('activate_plugins') && (get_option('wpa_disable_test_widget') != 'yes')){
|
||||
$wpa_add_test = 'yes';
|
||||
} else {
|
||||
$wpa_add_test = 'no';
|
||||
}
|
||||
|
||||
$return = array(
|
||||
'wpa_field_name' => $GLOBALS['wpa_field_name'],
|
||||
'wpa_field_value' => wpa_unqiue_field_value(),
|
||||
'wpa_add_test' => $wpa_add_test
|
||||
);
|
||||
|
||||
return $return;
|
||||
}
|
||||
Reference in New Issue
Block a user