PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.0
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.0
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/MailboxActions/Listing.php +25 -20 10.2.2 → 11.1.0 View file →
@@ -9,12 +9,14 @@
9 9 trait Listing
10 10 {
11 11 public function prepareMailboxesListing(array &$data): void
12 12 {
13 + // Prepare the pagination
13 14 $mailboxesPerPage = $data['pagination']->getListLimit();
14 15 $page = $this->getVarFiltersListing('int', 'mailboxes_pagination_page', 1);
15 16 $status = $data['status'];
16 17
18 + // Get the matching mailboxes
17 19 $matchingMailboxes = $this->getMatchingElementsFromData(
18 20 [
19 21 'ordering' => $data['ordering'],
20 22 'search' => $data['search'],
@@ -55,14 +57,34 @@
55 57 }
56 58
57 59 public function duplicateMailboxAction(): void
58 60 {
59 - $this->mailboxDoListingAction('duplicate');
61 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
62 +
63 + $mailboxActionSelected = acym_getVar('array', 'elements_checked', []);
64 + if (empty($mailboxActionSelected)) {
65 + return;
66 + }
67 +
68 + $mailboxClass = new MailboxClass();
69 + $mailboxClass->duplicate($mailboxActionSelected);
70 +
71 + $this->mailboxes();
60 72 }
61 73
62 74 public function deleteMailboxAction(): void
63 75 {
64 - $this->mailboxDoListingAction('delete');
76 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
77 +
78 + $mailboxActionSelected = acym_getVar('array', 'elements_checked');
79 + if (empty($mailboxActionSelected)) {
80 + return;
81 + }
82 +
83 + $mailboxClass = new MailboxClass();
84 + $mailboxClass->delete($mailboxActionSelected);
85 +
86 + $this->mailboxes();
65 87 }
66 88
67 89 private function prepareMailboxesActions(array &$data): void
68 90 {
@@ -77,8 +99,9 @@
77 99 if (empty($actions)) {
78 100 continue;
79 101 }
80 102
103 + // We build the actions to display in the listing
81 104 $actionsRendered = [];
82 105 foreach ($actions as $action) {
83 106 acym_trigger('onAcymMailboxActionSummaryListing', [&$action, &$actionsRendered]);
84 107 }
@@ -84,24 +107,6 @@
84 107 }
85 108
86 109 $data['allMailboxes'][$key]->actionsRendered = $actionsRendered;
87 110 }
88 - }
89 -
90 - private function mailboxDoListingAction(string $action): void
91 - {
92 - $mailboxClass = new MailboxClass();
93 - if (!method_exists($mailboxClass, $action)) {
94 - return;
95 - }
96 -
97 - $mailboxActionSelected = acym_getVar('int', 'elements_checked');
98 -
99 - if (empty($mailboxActionSelected)) {
100 - return;
101 - }
102 -
103 - $mailboxClass->$action($mailboxActionSelected);
104 -
105 - $this->mailboxes();
106 111 }
107 112 }