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/Configuration/Subscription.php +0 -83 10.0.1 → 11.1.1 View file →
@@ -1,83 +1,0 @@
1 -<?php
2 -
3 -namespace AcyMailing\Controllers\Configuration;
4 -
5 -use AcyMailing\Helpers\HeaderHelper;
6 -
7 -trait Subscription
8 -{
9 - public function removeNotification()
10 - {
11 - $whichNotification = acym_getVar('string', 'id');
12 -
13 - if ($whichNotification != 0 && empty($whichNotification)) {
14 - acym_sendAjaxResponse(acym_translation('ACYM_NOTIFICATION_NOT_FOUND'), [], false);
15 - }
16 -
17 - if ('all' === $whichNotification) {
18 - $this->config->save(['notifications' => '[]']);
19 - $notifications = [];
20 - } else {
21 - $notifications = json_decode($this->config->get('notifications', '[]'), true);
22 - unset($notifications[$whichNotification]);
23 - $this->config->save(['notifications' => json_encode($notifications)]);
24 - }
25 - $helperHeader = new HeaderHelper();
26 -
27 - acym_sendAjaxResponse('', ['html' => $helperHeader->getNotificationCenterInner($notifications)]);
28 - }
29 -
30 - public function markNotificationRead()
31 - {
32 - $which = acym_getVar('string', 'id');
33 -
34 - $notifications = json_decode($this->config->get('notifications', '[]'), true);
35 - if (empty($notifications)) {
36 - acym_sendAjaxResponse('', []);
37 - }
38 -
39 - if (empty($which)) {
40 - foreach ($notifications as $key => $notification) {
41 - $notifications[$key]['read'] = true;
42 - }
43 - } else {
44 - foreach ($notifications as $key => $notification) {
45 - if ($notification['id'] != $which) continue;
46 - $notifications[$key]['read'] = true;
47 - }
48 - }
49 -
50 -
51 - $this->config->save(['notifications' => json_encode($notifications)]);
52 -
53 - acym_sendAjaxResponse('', []);
54 - }
55 -
56 - public function addNotification()
57 - {
58 - $message = acym_getVar('string', 'message');
59 - $level = acym_getVar('string', 'level');
60 -
61 - if (empty($message) || empty($level)) {
62 - acym_sendAjaxResponse(acym_translation('ACYM_ERROR'), [], false);
63 - }
64 -
65 - $helperHeader = new HeaderHelper();
66 -
67 - $newNotification = new \stdClass();
68 - $newNotification->message = $message;
69 - $newNotification->level = $level;
70 - $newNotification->read = false;
71 - $newNotification->date = time();
72 -
73 - $helperHeader->addNotification($newNotification);
74 -
75 - acym_sendAjaxResponse('', ['notificationCenter' => $helperHeader->getNotificationCenter()]);
76 - }
77 -
78 - private function loadSurveyAnswers(&$data)
79 - {
80 - $surveyTexts = $this->config->get('unsub_survey', '{}');
81 - $data['surveyAnswers'] = json_decode($surveyTexts, true);
82 - }
83 -}