PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 10.11.1
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v10.11.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 10.11.1, at back/Types/FailActionType.php

75 lines 2.3 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 $return .= '<span id="bounce_action_lists_'.$num.'" style="display:none">';
56
57 $return .= acym_select(
58 $this->lists,
59 'config[bounce_action_lists_'.$num.']',
60 $this->config->get('bounce_action_lists_'.$num),
61 [
62 'class' => 'intext_select',
63 'style' => 'width: 200px;margin-left: 5px;',
64 ],
65 'value',
66 'text',
67 str_replace(['[', ']'], ['_', ''], 'config[bounce_action_lists_'.$num.']')
68 );
69
70 $return .= '</span>';
71
72 return $return;
73 }
74 }
75