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/DynamicsController.php +0 -93 10.0.1 → 11.1.1 View file →
@@ -1,93 +1,0 @@
1 -<?php
2 -
3 -namespace AcyMailing\Controllers;
4 -
5 -use AcyMailing\Classes\MailClass;
6 -use AcyMailing\Classes\UserClass;
7 -use AcyMailing\Helpers\PluginHelper;
8 -use AcyMailing\Core\AcymController;
9 -
10 -class DynamicsController extends AcymController
11 -{
12 - public function replaceDummy()
13 - {
14 - $mailId = acym_getVar('int', 'mailId', 0);
15 - $code = acym_getVar('string', 'code', '', '', ACYM_ALLOWRAW);
16 - $previewBody = acym_getVar('string', 'previewBody', '', '', ACYM_ALLOWRAW);
17 -
18 - $pluginHelper = new PluginHelper();
19 - $email = $pluginHelper->createDummyEmailObject($mailId, $code, $previewBody);
20 -
21 - @acym_trigger('replaceContent', [&$email, false]);
22 -
23 - $userClass = new UserClass();
24 - $userEmail = acym_currentUserEmail();
25 - $user = $userClass->getOneByEmail($userEmail);
26 -
27 - if (empty($user)) {
28 - $user = new \stdClass();
29 - $user->email = $userEmail;
30 - $user->name = acym_currentUserName();
31 - $user->cms_id = acym_currentUserId();
32 - $user->confirmed = 0;
33 - $user->source = acym_isAdmin() ? 'Back-end' : 'Front-end';
34 -
35 - $userClass->checkVisitor = false;
36 - $user->id = $userClass->save($user);
37 - }
38 -
39 - @acym_trigger('replaceUserInformation', [&$email, &$user, false]);
40 -
41 - acym_sendAjaxResponse(
42 - '',
43 - [
44 - 'content' => $email->body,
45 - 'custom_view' => !empty($email->custom_view),
46 - ]
47 - );
48 - }
49 -
50 - public function trigger()
51 - {
52 - $plugin = acym_getVar('cmd', 'plugin', '');
53 - $trigger = acym_getVar('cmd', 'trigger', '');
54 - if (empty($plugin) || empty($trigger)) exit;
55 -
56 - $triggerParams = $this->getTriggerParams($plugin, $trigger);
57 - acym_trigger($trigger, $triggerParams, $plugin);
58 - exit;
59 - }
60 -
61 - private function getTriggerParams(string $plugin, string $trigger): array
62 - {
63 - $shortcode = acym_getVar('string', 'shortcode', '');
64 - $shortcode = trim($shortcode, '{}');
65 -
66 - $separatorPosition = strpos($shortcode, ':');
67 - if (false !== $separatorPosition) {
68 - $pluginSubType = substr($shortcode, 0, $separatorPosition);
69 - $shortcode = substr($shortcode, $separatorPosition + 1);
70 - $pluginHelper = new PluginHelper();
71 - $defaultValues = $pluginHelper->extractTag($shortcode);
72 - $defaultValues->defaultPluginTab = $pluginSubType;
73 -
74 - return [$defaultValues];
75 - }
76 -
77 - if ($trigger === 'insertionOptions') {
78 - $rawDefaultValues = $this->config->get('dcontent_default_'.$plugin);
79 -
80 - if (!empty($rawDefaultValues)) {
81 - $defaultValues = json_decode($rawDefaultValues, true);
82 - unset($defaultValues['id']);
83 - unset($defaultValues['from']);
84 - unset($defaultValues['to']);
85 - $defaultValues = (object)$defaultValues;
86 -
87 - return [$defaultValues];
88 - }
89 - }
90 -
91 - return [];
92 - }
93 -}