PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.0.1
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.0.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
acymailing / back / Types / FailActionType.php

FailActionType.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 11.0.1, at back/Types/FailActionType.php

76 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace AcyMailing\Types;
4
5 use AcyMailing\Classes\ListClass;
6 use AcyMailing\Core\AcymObject;
7
8 class FailActionType extends AcymObject
9 {
10 private array $values = [];
11 private array $lists = [];
12
13 public function __construct()
14 {
15 parent::__construct();
16
17 $this->values[] = acym_selectOption('noaction', 'ACYM_DO_NOTHING');
18 $this->values[] = acym_selectOption('remove', 'ACYM_REMOVE_SUB');
19 $this->values[] = acym_selectOption('unsub', 'ACYM_UNSUB_USER');
20 $this->values[] = acym_selectOption('sub', 'ACYM_SUBSCRIBE_USER');
21 $this->values[] = acym_selectOption('block', 'ACYM_BLOCK_USER');
22 $this->values[] = acym_selectOption('delete', 'ACYM_DELETE_USER');
23
24 $listClass = new ListClass();
25 $lists = $listClass->getAll('name');
26 foreach ($lists as $oneList) {
27 $this->lists[] = acym_selectOption($oneList->id, $oneList->name);
28 }
29
30 $js = 'function updateSubAction(num){
31 window.document.getElementById("bounce_action_lists_"+num).style.display = window.document.getElementById("bounce_action_"+num).value == "sub" ? "" : "none";
32 }';
33 acym_addScript(true, $js);
34 }
35
36 public function display(string $num, string $value): string
37 {
38 $js = 'jQuery(document).ready(function($){ updateSubAction("'.$num.'"); });';
39 acym_addScript(true, $js);
40
41 $return = acym_select(
42 $this->values,
43 'config[bounce_action_'.$num.']',
44 $value,
45 [
46 'class' => 'intext_select',
47 'style' => 'width: 200px;',
48 'onchange' => "updateSubAction('".$num."');",
49 ],
50 'value',
51 'text',
52 'bounce_action_'.$num
53 );
54
55 //We add a span with an ID around the dropdown as we can't hide/display the dropdown itself any more due to bootstrap integration
56 $return .= '<span id="bounce_action_lists_'.$num.'" style="display:none">';
57
58 $return .= acym_select(
59 $this->lists,
60 'config[bounce_action_lists_'.$num.']',
61 $this->config->get('bounce_action_lists_'.$num),
62 [
63 'class' => 'intext_select',
64 'style' => 'width: 200px;margin-left: 5px;',
65 ],
66 'value',
67 'text',
68 str_replace(['[', ']'], ['_', ''], 'config[bounce_action_lists_'.$num.']')
69 );
70
71 $return .= '</span>';
72
73 return $return;
74 }
75 }
76