| Server IP : 141.193.213.10 / Your IP : 216.73.216.101 Web Server : nginx System : Linux pod-400555 6.8.0-1055-gke #61-Ubuntu SMP Tue May 26 22:57:42 UTC 2026 x86_64 User : fpm200079 ( 200079) PHP Version : 8.2.36 Disable Function : apache_child_terminate,apache_get_modules,apache_get_version,apache_getenv,apache_note,apache_setenv,disk_free_space,disk_total_space,diskfreespace,dl,exec,fastcgi_finish_request,link,opcache_compile_file,opcache_get_configuration,opcache_invalidate,opcache_is_script_cached,opcache_reset,passthru,pclose,pcntl_exec,popen,posix_getpid,posix_getppid,posix_getpwuid,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,realpath_cache_get,shell_exec,show_source,symlink,system MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /nas/content/live/bartislaw/wp-content/plugins/speak-api/inc/ |
Upload File : |
<?php
/**
* Anti-Spam Configuration File
* Easy configuration for multiple sites
*
* Copy this file to each site and update the values
*
* @version 1.0
* @author SpeakEasy Marketing
*/
// ============================================================================
// RECAPTCHA CONFIGURATION
// ============================================================================
// reCAPTCHA v3 Configuration
define('ANTI_SPAM_RECAPTCHA_V3_SITE_KEY', '6LfeVDQsAAAAAFb4IkeITEwJpV5XcBtLvFh-9MgM');
define('ANTI_SPAM_RECAPTCHA_V3_SECRET', '6LfeVDQsAAAAALGAvtxd060aHdVsWuHox8cJ1AuR');
// reCAPTCHA v3 Score Threshold (0.0 to 1.0)
define('ANTI_SPAM_RECAPTCHA_V3_THRESHOLD', 0.5);
// ============================================================================
// TIMING CONFIGURATION
// ============================================================================
// Minimum time between page load and form submission (in seconds)
define('ANTI_SPAM_MIN_FORM_TIME', 2);
// ============================================================================
// HONEYPOT CONFIGURATION
// ============================================================================
// Honeypot field name (change this for each site)
define('ANTI_SPAM_HONEYPOT_FIELD_NAME', 'website_verification');
// ============================================================================
// LOGGING CONFIGURATION
// ============================================================================
// Enable detailed spam logging
define('ANTI_SPAM_ENABLE_LOGGING', true);
// Log to WordPress error log
define('ANTI_SPAM_LOG_TO_ERROR_LOG', true);
// Log to database
define('ANTI_SPAM_LOG_TO_DATABASE', true);
// ============================================================================
// ORIGIN VALIDATION
// ============================================================================
// Additional allowed origins (comma-separated)
define('ANTI_SPAM_ADDITIONAL_ORIGINS', '');
// ============================================================================
// SITE-SPECIFIC CONFIGURATION
// ============================================================================
// This configuration file is specific to the current site
// Each site should have its own copy with site-specific keys and settings
// ============================================================================
// ADVANCED CONFIGURATION
// ============================================================================
// Custom validation rules per form type
define('ANTI_SPAM_FORM_RULES', [
'cform' => [
'min_time' => 2,
'recaptcha_threshold' => 0.5,
'require_origin' => true
],
'book' => [
'min_time' => 1,
'recaptcha_threshold' => 0.4,
'require_origin' => true
],
'newsletter' => [
'min_time' => 1,
'recaptcha_threshold' => 0.3,
'require_origin' => false
]
]);
// IP whitelist (comma-separated)
define('ANTI_SPAM_IP_WHITELIST', '');
// User agent blacklist patterns (comma-separated)
define('ANTI_SPAM_UA_BLACKLIST', 'bot,crawler,spider,scraper');
// ============================================================================
// DEBUGGING
// ============================================================================
// Enable debug mode (logs more information)
define('ANTI_SPAM_DEBUG_MODE', false);
// Debug log file path
define('ANTI_SPAM_DEBUG_LOG_PATH', WP_CONTENT_DIR . '/debug/anti-spam.log');
// ============================================================================
// NOTIFICATIONS
// ============================================================================
// Email notifications for spam attempts
define('ANTI_SPAM_EMAIL_NOTIFICATIONS', false);
// Email address for notifications
define('ANTI_SPAM_NOTIFICATION_EMAIL', 'admin@' . (isset($current_domain)?$current_domain:''));
// Spam attempt threshold for email notifications
define('ANTI_SPAM_EMAIL_THRESHOLD', 10); // Send email after 10 spam attempts
// ============================================================================
// MAINTENANCE
// ============================================================================
// Auto-cleanup spam logs older than X days
define('ANTI_SPAM_LOG_RETENTION_DAYS', 30);
// Maximum number of spam logs to keep
define('ANTI_SPAM_MAX_LOG_ENTRIES', 10000);
// ============================================================================
// INTEGRATION HELPERS
// ============================================================================
/**
* Get configuration value with fallback
*/
function get_anti_spam_config($key, $default = null) {
$config_map = [
'recaptcha_v3_site_key' => ANTI_SPAM_RECAPTCHA_V3_SITE_KEY,
'recaptcha_v3_secret' => ANTI_SPAM_RECAPTCHA_V3_SECRET,
'recaptcha_v3_threshold' => ANTI_SPAM_RECAPTCHA_V3_THRESHOLD,
'min_form_time' => ANTI_SPAM_MIN_FORM_TIME,
'honeypot_field_name' => ANTI_SPAM_HONEYPOT_FIELD_NAME,
'enable_logging' => ANTI_SPAM_ENABLE_LOGGING,
'log_to_error_log' => ANTI_SPAM_LOG_TO_ERROR_LOG,
'log_to_database' => ANTI_SPAM_LOG_TO_DATABASE,
'additional_origins' => ANTI_SPAM_ADDITIONAL_ORIGINS,
'ip_whitelist' => ANTI_SPAM_IP_WHITELIST,
'ua_blacklist' => ANTI_SPAM_UA_BLACKLIST,
'debug_mode' => ANTI_SPAM_DEBUG_MODE,
'email_notifications' => ANTI_SPAM_EMAIL_NOTIFICATIONS,
'notification_email' => ANTI_SPAM_NOTIFICATION_EMAIL,
'email_threshold' => ANTI_SPAM_EMAIL_THRESHOLD,
'log_retention_days' => ANTI_SPAM_LOG_RETENTION_DAYS,
'max_log_entries' => ANTI_SPAM_MAX_LOG_ENTRIES
];
return $config_map[$key] ?? $default;
}
/**
* Get form-specific configuration
*/
function get_anti_spam_form_config($form_type) {
$rules = ANTI_SPAM_FORM_RULES;
return $rules[$form_type] ?? $rules['cform'];
}
/**
* Check if IP is whitelisted
*/
function is_ip_whitelisted($ip) {
$whitelist = explode(',', ANTI_SPAM_IP_WHITELIST);
return in_array(trim($ip), array_map('trim', $whitelist));
}
/**
* Check if user agent is blacklisted
*/
function is_user_agent_blacklisted($user_agent) {
$blacklist = explode(',', ANTI_SPAM_UA_BLACKLIST);
$user_agent_lower = strtolower($user_agent);
foreach ($blacklist as $pattern) {
if (strpos($user_agent_lower, trim($pattern)) !== false) {
return true;
}
}
return false;
}
/**
* Get additional allowed origins
*/
function get_additional_origins() {
$origins = explode(',', ANTI_SPAM_ADDITIONAL_ORIGINS);
return array_map('trim', array_filter($origins));
}