PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.1
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.1
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
← All changes | WpInit/Cron.php +0 -50 11.0.3 → 11.1.1 View file →
@@ -1,50 +1,0 @@
1 -<?php
2 -
3 -namespace AcyMailing\WpInit;
4 -
5 -defined('ABSPATH') || die('Restricted Access');
6 -
7 -use AcyMailing\Controllers\ConfigurationController;
8 -use AcyMailing\Helpers\CronHelper;
9 -
10 -class Cron
11 -{
12 - public function __construct()
13 - {
14 - add_filter('cron_schedules', [$this, 'addCronIntervals'], 100);
15 - add_action(ConfigurationController::CRON_TASK_NAME, [$this, 'triggerAutomatedTasks']);
16 - }
17 -
18 - public function addCronIntervals(array $schedules): array
19 - {
20 - $schedules['every_minute'] = [
21 - 'interval' => 60,
22 - 'display' => 'Every minute',
23 - ];
24 -
25 - return $schedules;
26 - }
27 -
28 - public function triggerAutomatedTasks()
29 - {
30 -
31 - // Starter versions shouldn't have access to the cron
32 - if (!acym_level(ACYM_ESSENTIAL)) {
33 - acym_deleteScheduledTask(['name' => ConfigurationController::CRON_TASK_NAME]);
34 -
35 - return;
36 - }
37 -
38 - //removeIf(development)
39 - $httpReferer = acym_getVar('string', 'HTTP_REFERER', '', 'SERVER');
40 - if (!acym_isLicenseValidWeekly() && (empty($httpReferer) || strpos($httpReferer, 'api.acymailing.com') === false)) {
41 - acym_deleteScheduledTask(['name' => ConfigurationController::CRON_TASK_NAME]);
42 -
43 - return;
44 - }
45 - //endRemoveIf(development)
46 -
47 - $cronHelper = new CronHelper();
48 - $cronHelper->cron();
49 - }
50 -}