| @@ -1,45 +1,0 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -namespace AcyMailing\Controllers\Automations; | |
| 4 | - | |
| 5 | -use AcyMailing\Classes\AutomationClass; | |
| 6 | - | |
| 7 | -trait MassAction | |
| 8 | -{ | |
| 9 | - public function setFilterMassAction(): void | |
| 10 | - { | |
| 11 | - wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token'); | |
| 12 | - | |
| 13 | - $this->setSaveFilters(true); | |
| 14 | - $this->summary(); | |
| 15 | - } | |
| 16 | - | |
| 17 | - public function setActionMassAction(): void | |
| 18 | - { | |
| 19 | - wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token'); | |
| 20 | - | |
| 21 | - $this->getSaveActions(true); | |
| 22 | - $this->filter(); | |
| 23 | - } | |
| 24 | - | |
| 25 | - public function processMassAction(): void | |
| 26 | - { | |
| 27 | - wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token'); | |
| 28 | - | |
| 29 | - $automationClass = new AutomationClass(); | |
| 30 | - $massAction = acym_getVar('array', 'massAction', [], 'SESSION'); | |
| 31 | - if (!empty($massAction)) { | |
| 32 | - $automation = new \stdClass(); | |
| 33 | - $automation->filters = json_encode($massAction['filters']); | |
| 34 | - $automation->actions = json_encode($massAction['actions']); | |
| 35 | - $automationClass->execute($automation); | |
| 36 | - | |
| 37 | - if (!empty($automationClass->report)) { | |
| 38 | - foreach ($automationClass->report as $oneReport) { | |
| 39 | - acym_enqueueMessage($oneReport, 'info'); | |
| 40 | - } | |
| 41 | - } | |
| 42 | - } | |
| 43 | - $this->listing(); | |
| 44 | - } | |
| 45 | -} | |