PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.0.4
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.0.4
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
acymailing / back / Controllers / Mails / Automation.php

Automation.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 11.0.4, at back/Controllers/Mails/Automation.php

48 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace AcyMailing\Controllers\Mails;
4
5 use AcyMailing\Classes\MailClass;
6
7 trait Automation
8 {
9 public function deleteMailAutomation(): void
10 {
11 wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
12
13 $mailClass = new MailClass();
14 $mailId = acym_getVar('int', 'id', 0);
15
16 if (!empty($mailId)) {
17 $mailClass->delete([$mailId]);
18 }
19
20 exit;
21 }
22
23 public function duplicateMailAutomation(): void
24 {
25 wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
26
27 $mailClass = new MailClass();
28 $mailId = acym_getVar('int', 'id', 0);
29 $prevMail = acym_getVar('int', 'previousId');
30
31 if (!empty($prevMail)) {
32 $mailClass->delete([$prevMail]);
33 }
34
35 if (empty($mailId)) {
36 acym_sendAjaxResponse(acym_translationSprintf('ACYM_NOT_FOUND', acym_translation('ACYM_ID')), [], false);
37 }
38
39 $newMail = $mailClass->duplicateMail($mailId, MailClass::TYPE_AUTOMATION);
40
41 if (empty($newMail)) {
42 acym_sendAjaxResponse(acym_translation('ACYM_COULD_NOT_DUPLICATE_EMAIL'), [], false);
43 }
44
45 acym_sendAjaxResponse('', ['newMail' => $newMail]);
46 }
47 }
48