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/Segments/Listing.php +0 -53 11.0.2 → 11.1.1 View file →
@@ -1,53 +1,0 @@
1 -<?php
2 -
3 -namespace AcyMailing\Controllers\Segments;
4 -
5 -use AcyMailing\Classes\SegmentClass;
6 -use AcyMailing\Helpers\PaginationHelper;
7 -use AcyMailing\Helpers\ToolbarHelper;
8 -
9 -trait Listing
10 -{
11 - public function listing(): void
12 - {
13 - if (!acym_level(ACYM_ENTERPRISE)) {
14 - acym_redirect(acym_completeLink('dashboard&task=upgrade&version=enterprise', false, true));
15 - }
16 -
17 - }
18 -
19 - private function prepareToolbar(array &$data): void
20 - {
21 - $toolbarHelper = new ToolbarHelper();
22 - $toolbarHelper->addSearchBar($data['search'], 'segments_search');
23 - $toolbarHelper->addButton(acym_translation('ACYM_CREATE'), ['data-task' => 'edit'], 'add', true);
24 -
25 - $data['toolbar'] = $toolbarHelper;
26 - }
27 -
28 - public function duplicate(): void
29 - {
30 - wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
31 -
32 - $ids = acym_getVar('array', 'elements_checked', []);
33 -
34 - $segmentClass = new SegmentClass();
35 -
36 - foreach ($ids as $id) {
37 - $segment = $segmentClass->getOneById($id);
38 -
39 - if (empty($segment)) {
40 - continue;
41 - }
42 -
43 - unset($segment->id);
44 - $segment->name .= ' - '.acym_translation('ACYM_COPY');
45 - $segment->creation_date = acym_date('now', 'Y-m-d H:i:s');
46 - $segment->filters = json_encode($segment->filters);
47 -
48 - $segmentClass->save($segment);
49 - }
50 -
51 - $this->listing();
52 - }
53 -}