Uname: Linux premium294.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
Software: LiteSpeed
PHP version: 8.1.32 [ PHP INFO ] PHP os: Linux
Server Ip: 104.21.48.1
Your Ip: 216.73.216.223
User: mjbynoyq (1574) | Group: mjbynoyq (1570)
Safe Mode: OFF
Disable Function:
NONE

name : Helpers.php
<?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'] );
	}
}
© 2025 XylotrechusZ