# acymailing/11.1.0/WpInit/Cron.php

AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress, version 11.1.0. 51 lines.

- Page: https://pluginprobe.com/plugins/acymailing/11.1.0/code/WpInit/Cron.php
- Raw: https://pluginprobe.com/plugins/acymailing/11.1.0/raw/WpInit/Cron.php
- Modified: 2026-08-03T10:18:54+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/acymailing/11.1.0/code/WpInit/Cron.php#L10-L20`.

```php
<?php

namespace AcyMailing\WpInit;

defined('ABSPATH') || die('Restricted Access');

use AcyMailing\Controllers\ConfigurationController;
use AcyMailing\Helpers\CronHelper;

class Cron
{
    public function __construct()
    {
        add_filter('cron_schedules', [$this, 'addCronIntervals'], 100);
        add_action(ConfigurationController::CRON_TASK_NAME, [$this, 'triggerAutomatedTasks']);
    }

    public function addCronIntervals(array $schedules): array
    {
        $schedules['every_minute'] = [
            'interval' => 60,
            'display' => 'Every minute',
        ];

        return $schedules;
    }

    public function triggerAutomatedTasks()
    {

        // Starter versions shouldn't have access to the cron
        if (!acym_level(ACYM_ESSENTIAL)) {
            acym_deleteScheduledTask(['name' => ConfigurationController::CRON_TASK_NAME]);

            return;
        }

        //removeIf(development)
        $httpReferer = acym_getVar('string', 'HTTP_REFERER', '', 'SERVER');
        if (!acym_isLicenseValidWeekly() && (empty($httpReferer) || strpos($httpReferer, 'api.acymailing.com') === false)) {
            acym_deleteScheduledTask(['name' => ConfigurationController::CRON_TASK_NAME]);

            return;
        }
        //endRemoveIf(development)

        $cronHelper = new CronHelper();
        $cronHelper->cron();
    }
}

```
