| Server IP : 121.121.20.254 / Your IP : 216.73.216.142 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/6pocketz/wp-content/plugins/wpforms/src/Pro/AntiSpam/ |
Upload File : |
<?php
namespace WPForms\Pro\AntiSpam;
/**
* Class Helpers.
*
* @since 1.9.1
*/
class Helpers {
/**
* Get the number of days to delete spam entries.
*
* @since 1.9.1
*
* @return int|false
* @noinspection PhpUndefinedConstantInspection
*/
public static function get_delete_spam_entries_days() {
$last_n_days = defined( 'WPFORMS_DELETE_SPAM_ENTRIES' )
? WPFORMS_DELETE_SPAM_ENTRIES
: wpforms_setting( 'delete-spam-entries', 90 );
$last_n_days = is_bool( $last_n_days ) ? $last_n_days : absint( $last_n_days );
/**
* The $last_n_days variable can be boolean or integer.
*
* When false, then we do not delete spam entries.
* When true, then we delete entries for the last 90 days.
* When it is number, we take the number.
*/
return $last_n_days === true ? 90 : $last_n_days;
}
/**
* Get classes for the filtering message.
*
* @since 1.9.2
*
* @param array $form_data Form data and settings.
*
* @return string
*/
public static function get_filtering_message_classes( array $form_data ): string {
return self::is_store_filtering_spam( $form_data ) && empty( $form_data['settings']['disable_entries'] ) && ! empty( $form_data['settings']['store_spam_entries'] ) ? 'wpforms-hidden' : '';
}
/**
* Determine if the form is set to store spam entries detected by filtering.
*
* @since 1.9.2
*
* @param array $form_data Form data and settings.
*
* @return bool
*/
public static function is_store_filtering_spam( array $form_data ): bool {
return ! empty( $form_data['settings']['anti_spam']['filtering_store_spam'] );
}
}