__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace WPForms\Tasks\Actions;
use WPForms\Tasks\Task;
/**
* Class PurgeSpamTask.
*
* @since 1.9.1
*/
class PurgeSpamTask extends Task {
/**
* Action name for this task.
*
* @since 1.9.1
*/
const ACTION = 'wpforms_process_purge_spam';
/**
* Interval in seconds.
*
* @since 1.9.1
*
* @var int
*/
private $interval;
/**
* Tasks class instance.
*
* @since 1.9.1
*
* @var Tasks
*/
private $tasks;
/**
* Log title.
*
* @since 1.9.1
*
* @var string
*/
protected $log_title = 'Purge Spam';
/**
* Class constructor.
*
* @since 1.9.1
*/
public function __construct() {
parent::__construct( self::ACTION );
$this->init();
$this->hooks();
}
/**
* Init.
*
* @since 1.9.1
*/
public function init() {
/**
* Filter the interval for the purge spam task, in seconds.
*
* @since 1.9.1
*
* @param int $interval Interval in seconds.
*
* @return int
*/
$this->interval = (int) apply_filters( 'wpforms_tasks_actions_purge_spam_task_interval', DAY_IN_SECONDS );
$this->tasks = wpforms()->obj( 'tasks' );
// Do not add a new one if scheduled.
if ( $this->tasks->is_scheduled( self::ACTION ) !== false ) {
if ( $this->interval <= 0 ) {
$this->cancel();
}
return;
}
$this->add_scan_task();
}
/**
* Add hooks.
*
* @since 1.9.1
*/
public function hooks() {
add_action( self::ACTION, [ $this, 'process' ] );
}
/**
* Add a new task.
*
* @since 1.9.1
*/
private function add_scan_task() {
if ( $this->interval <= 0 ) {
return;
}
$this->tasks->create( self::ACTION )
->recurring( time(), $this->interval )
->params()
->register();
}
/**
* Purge spam action.
*
* @since 1.9.1
*/
public function process() {
$entry_obj = wpforms()->obj( 'entry' );
if ( ! $entry_obj ) {
return;
}
$entry_obj->purge_spam();
$this->log( 'Purge spam completed.' );
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| AsyncRequestTask.php | File | 1.09 KB | 0775 |
|
| DomainAutoRegistrationTask.php | File | 2.38 KB | 0775 |
|
| EntryEmailsMetaCleanupTask.php | File | 2.11 KB | 0775 |
|
| EntryEmailsTask.php | File | 1.34 KB | 0775 |
|
| FormsLocatorScanTask.php | File | 12.73 KB | 0775 |
|
| IconChoicesFontAwesomeUpgradeTask.php | File | 3.07 KB | 0775 |
|
| Migration173Task.php | File | 5.3 KB | 0775 |
|
| Migration175Task.php | File | 11.82 KB | 0775 |
|
| PurgeSpamTask.php | File | 1.9 KB | 0775 |
|
| SquareSubscriptionTransactionIDTask.php | File | 3.04 KB | 0775 |
|
| StripeLinkSubscriptionsTask.php | File | 6.81 KB | 0775 |
|
| WebhooksAutoConfigurationTask.php | File | 2.39 KB | 0775 |
|