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 | widgets/subscriptionform/elementor.php +0 -292 11.0.3 → 11.1.1 View file →
@@ -1,292 +1,0 @@
1 -<?php
2 -
3 -defined('ABSPATH') || die('Restricted Access');
4 -
5 -use AcyMailing\Classes\FieldClass;
6 -use AcyMailing\Classes\ListClass;
7 -use AcyMailing\Core\AcymParameter;
8 -
9 -// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Prefixed and unique class name.
10 -class acySubscriptionFormWidget extends \Elementor\Widget_Base
11 -{
12 - private array $displayMode;
13 - private array $lists;
14 - private array $listsPlacement;
15 - private array $fields = [];
16 - private array $displayTextMode;
17 - private array $subscriberInfo;
18 - private array $posts;
19 - private array $replaceMessage;
20 - private array $unsubButton;
21 - private array $alignment;
22 - private array $includeJavascript;
23 - private array $borderTypes;
24 -
25 - public function initParams()
26 - {
27 - $this->displayMode = [
28 - 'inline' => acym_translation('ACYM_MODE_HORIZONTAL'),
29 - 'vertical' => acym_translation('ACYM_MODE_VERTICAL'),
30 - 'tableless' => acym_translation('ACYM_MODE_TABLELESS'),
31 - ];
32 -
33 -
34 - $listClass = new ListClass();
35 - $this->lists = $listClass->getAllForSelect(false);
36 -
37 - $this->listsPlacement = [
38 - 'before' => acym_translation('ACYM_BEFORE_FIELDS'),
39 - 'after' => acym_translation('ACYM_AFTER_FIELDS'),
40 - ];
41 -
42 - $fieldClass = new FieldClass();
43 - $allFields = $fieldClass->getAll();
44 - foreach ($allFields as $field) {
45 - if ($field->id == 2 || intval($field->active) === 0) continue;
46 - $this->fields[$field->id] = acym_translation($field->name);
47 - }
48 -
49 - $this->displayTextMode = [
50 - 1 => acym_translation('ACYM_TEXT_INSIDE'),
51 - 0 => acym_translation('ACYM_TEXT_OUTSIDE'),
52 - ];
53 -
54 - $this->subscriberInfo = [
55 - 1 => acym_translation('ACYM_YES'),
56 - 0 => acym_translation('ACYM_NO'),
57 - ];
58 -
59 - $posts = acym_trigger('getPosts', [false, 0], 'plgAcymPost');
60 - foreach ($posts[0] as $post) {
61 - $this->posts[$post[0]] = $post[1];
62 - }
63 -
64 - $this->replaceMessage = [
65 - 'replace' => acym_translation('ACYM_SUCCESS_REPLACE'),
66 - 'replacetemp' => acym_translation('ACYM_SUCCESS_REPLACE_TEMP'),
67 - 'toptemp' => acym_translation('ACYM_SUCCESS_TOP_TEMP'),
68 - 'standard' => acym_translation('ACYM_SUCCESS_STANDARD'),
69 - ];
70 -
71 - $this->unsubButton = [
72 - '0' => acym_translation('ACYM_NO'),
73 - '1' => acym_translation('ACYM_CONNECTED_USER_SUBSCRIBED'),
74 - '2' => acym_translation('ACYM_ALWAYS'),
75 - ];
76 -
77 - $this->alignment = [
78 - 'none' => acym_translation('ACYM_DEFAULT'),
79 - 'left' => acym_translation('ACYM_LEFT'),
80 - 'center' => acym_translation('ACYM_CENTER'),
81 - 'right' => acym_translation('ACYM_RIGHT'),
82 - ];
83 -
84 - $this->includeJavascript = [
85 - 'header' => acym_translation('ACYM_IN_HEADER'),
86 - 'module' => acym_translation('ACYM_ON_THE_MODULE'),
87 - ];
88 -
89 - $this->borderTypes = [
90 - 'solid' => acym_translation('ACYM_SOLID'),
91 - 'dotted' => acym_translation('ACYM_DOTTED'),
92 - 'dashed' => acym_translation('ACYM_DASHED'),
93 - 'double' => acym_translation('ACYM_DOUBLE'),
94 - 'groove' => acym_translation('ACYM_GROOVE'),
95 - 'ridge' => acym_translation('ACYM_RIDGE'),
96 - 'inset' => acym_translation('ACYM_INSET'),
97 - 'outset' => acym_translation('ACYM_OUTSET'),
98 - ];
99 - }
100 -
101 - public function get_name()
102 - {
103 - return 'acy_sub_form';
104 - }
105 -
106 - public function get_title()
107 - {
108 - return acym_translation('ACYM_ACYMAILING_SUBSCRIPTION_FORM');
109 - }
110 -
111 - public function get_icon()
112 - {
113 - return 'fa fa-envelope';
114 - }
115 -
116 - public function get_categories()
117 - {
118 - return ['acymailing'];
119 - }
120 -
121 - protected function register_controls()
122 - {
123 - $this->initParams();
124 -
125 - //Main option
126 - $this->startControlsSection('main_options', acym_translation('ACYM_MAIN_OPTIONS'));
127 - $this->getText('title', acym_translation('ACYM_TITLE'), 'Receive our newsletters');
128 - $this->getSimpleSelect('mode', acym_translation('ACYM_DISPLAY_MODE'), $this->displayMode, 'inline');
129 - $this->getText('subtext', acym_translation('ACYM_SUBSCRIBE_TEXT'), 'Subscribe');
130 - $this->getText('subtextlogged', acym_translation('ACYM_SUBSCRIBE_TEXT_LOGGED_IN'), 'Subscribe');
131 - $this->end_controls_section();
132 -
133 - //Lists option
134 - $this->startControlsSection('lists_options', acym_translation('ACYM_LISTS_OPTIONS'));
135 - $this->getSelect('hiddenlists', acym_translation('ACYM_AUTO_SUBSCRIBE_TO'), $this->lists, '', true);
136 - $this->getSelect('displists', acym_translation('ACYM_DISPLAYED_LISTS'), $this->lists, '', true);
137 - $this->getSelect('listschecked', acym_translation('ACYM_LISTS_CHECKED_DEFAULT'), $this->lists, '', true);
138 - $this->getSelect('listposition', acym_translation('ACYM_DISPLAY_LISTS'), $this->listsPlacement, 'before');
139 - $this->end_controls_section();
140 -
141 - //Fields option
142 - $this->startControlsSection('fields_options', acym_translation('ACYM_FIELDS_OPTIONS'));
143 - $this->getSelect('fields', acym_translation('ACYM_FIELDS_TO_DISPLAY'), $this->fields, '', true);
144 - $this->getSimpleSelect('textmode', acym_translation('ACYM_TEXT_MODE'), $this->displayTextMode, '1');
145 - $this->getSimpleSelect('userinfo', acym_translation('ACYM_FORM_AUTOFILL_ID'), $this->subscriberInfo, '1');
146 - $this->end_controls_section();
147 -
148 - //Terms and policy option
149 - $this->startControlsSection('terms_condition_options', acym_translation('ACYM_TERMS_POLICY_OPTIONS'));
150 - $this->getSimpleSelect('termscontent', acym_translation('ACYM_TERMS_CONDITIONS'), $this->posts, '');
151 - $this->getSimpleSelect('privacypolicy', acym_translation('ACYM_PRIVACY_POLICY'), $this->posts, '');
152 - $this->getSimpleSelect('trackingconsent', acym_translation('ACYM_DISPLAY_TRACKING_CONSENT'), $this->subscriberInfo, '0');
153 - $this->end_controls_section();
154 -
155 - //Subscribe option
156 - $this->startControlsSection('subscribe_options', acym_translation('ACYM_SUBSCRIBE_OPTIONS'));
157 - $this->getSimpleSelect('successmode', acym_translation('ACYM_SUCCESS_MODE'), $this->replaceMessage, 'replace');
158 - $this->getText('confirmation_message', acym_translation('ACYM_CONFIRMATION_MESSAGE'));
159 - $this->getText('redirect', acym_translation('ACYM_REDIRECT_LINK'));
160 - $this->end_controls_section();
161 -
162 - //Unsubscribe option
163 - $this->startControlsSection('unsubscribe_options', acym_translation('ACYM_UNSUBSCRIBE_OPTIONS'));
164 - $this->getSimpleSelect('unsub', acym_translation('ACYM_DISPLAY_UNSUB_BUTTON'), $this->unsubButton, '0');
165 - $this->getText('unsubtext', acym_translation('ACYM_UNSUBSCRIBE_TEXT'), 'Unsubscribe');
166 - $this->getText('unsubredirect', acym_translation('ACYM_REDIRECT_LINK_UNSUB'));
167 - $this->end_controls_section();
168 -
169 - //Advanced option
170 - $this->startControlsSection('advanced_options', acym_translation('ACYM_ADVANCED_OPTIONS'));
171 - $this->getText('introtext', acym_translation('ACYM_INTRO_TEXT'));
172 - $this->getText('posttext', acym_translation('ACYM_POST_TEXT'));
173 - $this->getSimpleSelect('alignment', acym_translation('ACYM_ALIGNMENT'), $this->alignment, 'none');
174 - $this->getSimpleSelect('includejs', acym_translation('ACYM_MODULE_JS'), $this->includeJavascript, 'header');
175 - $this->getText('source', acym_translation('ACYM_SOURCE'), 'elementor_subscription_form');
176 - $this->end_controls_section();
177 -
178 - // Style zone
179 - $this->startControlsSection('global_options', acym_translation('ACYM_GLOBAL_OPTIONS'), \Elementor\Controls_Manager::TAB_STYLE);
180 - $this->getColor('background_color', acym_translation('ACYM_BACKGROUND_COLOR'));
181 - $this->getColor('text_color', acym_translation('ACYM_TEXT_COLOR'));
182 - $this->end_controls_section();
183 -
184 - $this->startControlsSection('button_options', acym_translation('ACYM_BUTTON'), \Elementor\Controls_Manager::TAB_STYLE);
185 - $this->getColor('button_background_color', acym_translation('ACYM_BACKGROUND_COLOR'));
186 - $this->getColor('button_text_color', acym_translation('ACYM_TEXT_COLOR'));
187 - $this->getColor('button_border_color', acym_translation('ACYM_BORDER_COLOR'));
188 - $this->getSimpleSelect('button_border_type', acym_translation('ACYM_BORDER_TYPE'), $this->borderTypes, 'solid');
189 - $this->getNumber('button_border_size', acym_translation('ACYM_BORDER_SIZE'));
190 - $this->getNumber('button_border_radius', acym_translation('ACYM_RADIUS'));
191 - $this->end_controls_section();
192 - }
193 -
194 - private function startControlsSection($option, $label, $type = null)
195 - {
196 - $this->start_controls_section(
197 - $option,
198 - [
199 - 'label' => $label,
200 - 'tab' => empty($type) ? \Elementor\Controls_Manager::TAB_CONTENT : $type,
201 - ]
202 - );
203 - }
204 -
205 - private function getSelect($option, $label, $values, $default, $multiple = false)
206 - {
207 - $this->add_control(
208 - $option,
209 - [
210 - 'label' => $label,
211 - 'type' => \Elementor\Controls_Manager::SELECT2,
212 - 'options' => $values,
213 - 'default' => $default,
214 - 'multiple' => $multiple,
215 - 'label_block' => true,
216 - ]
217 - );
218 - }
219 -
220 - private function getSimpleSelect($option, $label, $values, $default)
221 - {
222 - $this->add_control(
223 - $option,
224 - [
225 - 'label' => $label,
226 - 'type' => \Elementor\Controls_Manager::SELECT,
227 - 'options' => $values,
228 - 'default' => $default,
229 - 'label_block' => true,
230 - ]
231 - );
232 - }
233 -
234 - private function getText($option, $label, $default = '')
235 - {
236 - $data = [
237 - 'label' => $label,
238 - 'type' => \Elementor\Controls_Manager::TEXT,
239 - 'input_type' => 'text',
240 - 'label_block' => true,
241 - ];
242 -
243 - if (!empty($default)) $data['default'] = $default;
244 -
245 - $this->add_control(
246 - $option,
247 - $data
248 - );
249 - }
250 -
251 - private function getColor($option, $label, $default = '')
252 - {
253 - $data = [
254 - 'label' => $label,
255 - 'type' => \Elementor\Controls_Manager::COLOR,
256 - 'global' => [
257 - 'active' => false,
258 - ],
259 - ];
260 -
261 - if (!empty($default)) $data['default'] = $default;
262 -
263 - $this->add_control(
264 - $option,
265 - $data
266 - );
267 - }
268 -
269 - private function getNumber($option, $label, $default = '')
270 - {
271 - $data = [
272 - 'label' => $label,
273 - 'type' => \Elementor\Controls_Manager::NUMBER,
274 - 'label_block' => false,
275 - 'min' => 0,
276 - ];
277 -
278 - if (!empty($default)) $data['default'] = $default;
279 -
280 - $this->add_control(
281 - $option,
282 - $data
283 - );
284 - }
285 -
286 - protected function render()
287 - {
288 - $settings = $this->get_settings_for_display();
289 - $params = new AcymParameter($settings);
290 - acym_renderForm($params);
291 - }
292 -}