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 | back/Controllers/Automations/Action.php +0 -119 10.2.2 → 11.1.1 View file →
@@ -1,119 +1,0 @@
1 -<?php
2 -
3 -namespace AcyMailing\Controllers\Automations;
4 -
5 -use AcyMailing\Classes\ActionClass;
6 -use AcyMailing\Classes\AutomationClass;
7 -use AcyMailing\Classes\ConditionClass;
8 -use AcyMailing\Classes\MailClass;
9 -use AcyMailing\Classes\StepClass;
10 -use AcyMailing\Classes\TagClass;
11 -use AcyMailing\Helpers\WorkflowHelper;
12 -
13 -trait Action
14 -{
15 - public function action(): void
16 - {
17 -
18 - if (!acym_level(ACYM_ENTERPRISE)) {
19 - acym_redirect(acym_completeLink('dashboard&task=upgrade&version=enterprise', false, true));
20 - }
21 - }
22 -
23 - private function _saveActions(bool $isMassAction = false): array
24 - {
25 - if ($isMassAction) {
26 - acym_session();
27 - }
28 -
29 - $automationID = acym_getVar('int', 'id');
30 - $actionId = acym_getVar('int', 'actionId');
31 - $action = acym_getVar('array', 'acym_action');
32 - $actionClass = new ActionClass();
33 - $stepAutomationId = acym_getVar('int', 'stepAutomationId');
34 - $conditionId = acym_getVar('int', 'conditionId');
35 -
36 - if ((!empty($conditionId))) {
37 - $action['condition_id'] = $conditionId;
38 - }
39 -
40 - if (!empty($actionId)) {
41 - $action['id'] = $actionId;
42 - }
43 -
44 - if (empty($action['actions'])) {
45 - $action['actions'] = [];
46 - }
47 -
48 - if ($isMassAction) {
49 - $_SESSION['massAction']['actions'] = $action['actions'];
50 -
51 - return [];
52 - }
53 -
54 - $action['actions'] = json_encode($action['actions']);
55 -
56 - foreach ($action as $column => $value) {
57 - acym_secureDBColumn($column);
58 - }
59 -
60 - $action = (object)$action;
61 -
62 - $action->id = $actionClass->save($action);
63 -
64 - return [
65 - 'automationId' => $automationID,
66 - 'stepId' => $stepAutomationId,
67 - 'actionId' => $action->id,
68 - ];
69 - }
70 -
71 - public function saveExitActions(): void
72 - {
73 - $this->_saveActions();
74 -
75 - acym_enqueueMessage(acym_translation('ACYM_SUCCESSFULLY_SAVED'));
76 -
77 - $this->listing();
78 - }
79 -
80 - public function saveActions(): void
81 - {
82 - $ids = $this->_saveActions();
83 -
84 - acym_setVar('id', $ids['automationId']);
85 - acym_setVar('stepId', $ids['stepId']);
86 - acym_setVar('actionId', $ids['actionId']);
87 - $this->filter();
88 - }
89 -
90 - public function createMail(): void
91 - {
92 - $id = acym_getVar('int', 'id');
93 - $idAdmin = acym_getVar('boolean', 'automation_admin');
94 - $type = MailClass::TYPE_AUTOMATION;
95 - if ($idAdmin) {
96 - $type = 'automation_admin';
97 - }
98 -
99 - $and = acym_getVar('string', 'and_action');
100 - $this->_saveActions(empty($id));
101 -
102 - $actions = acym_getVar('array', 'acym_action');
103 - $mailId = $actions['actions'][$and]['acy_add_queue']['mail_id'];
104 - $mailId = empty($mailId) ? '' : '&id='.$mailId;
105 -
106 - $favoriteTemplate = $this->config->get('favorite_template', 0);
107 - $startFrom = empty($favoriteTemplate) || !empty($mailId) ? '' : '&from='.$favoriteTemplate;
108 -
109 - acym_redirect(
110 - acym_completeLink(
111 - 'mails&task=edit&step=editEmail&type='.$type.$mailId.'&return='.urlencode(
112 - acym_completeLink('automation&task=edit&step=action&id='.$id.'&fromMailEditor=1&mailid={mailid}&and='.$and)
113 - ).$startFrom,
114 - false,
115 - true
116 - )
117 - );
118 - }
119 -}