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/dynamics/subscription/SubscriptionInsertion.php +0 -607 10.0.1 → 11.1.1 View file →
@@ -1,607 +1,0 @@
1 -<?php
2 -
3 -use AcyMailing\Classes\CampaignClass;
4 -use AcyMailing\Classes\MailClass;
5 -use AcyMailing\Classes\UserClass;
6 -use AcyMailing\Classes\ListClass;
7 -
8 -trait SubscriptionInsertion
9 -{
10 - private $addedListUnsubscribe = [];
11 - private $lists = [];
12 - private $listsowner = [];
13 - private $listsinfo = [];
14 - private $unsubscribeLink = [];
15 - private $mailLists = [];
16 - private $userClass = null;
17 -
18 - public function dynamicText($mailId)
19 - {
20 - return $this->pluginDescription;
21 - }
22 -
23 - public function textPopup()
24 - {
25 - $others = [];
26 - $others['unsubscribe'] = ['name' => acym_translation('ACYM_UNSUBSCRIBE_LINK'), 'default' => 'ACYM_UNSUBSCRIBE'];
27 - $others['unsubscribeall'] = ['name' => acym_translation('ACYM_UNSUBSCRIBE_ALL_LISTS_LINK'), 'default' => 'ACYM_UNSUBSCRIBE_ALL_LISTS'];
28 - $others['confirm'] = ['name' => acym_translation('ACYM_CONFIRM_SUBSCRIPTION_LINK'), 'default' => 'ACYM_CONFIRM_SUBSCRIPTION'];
29 - $others['subscribe'] = ['name' => acym_translation('ACYM_SUBSCRIBE_LINK'), 'default' => 'ACYM_SUBSCRIBE'];
30 -
31 - ?>
32 - <script type="text/javascript">
33 - var openedLists = false;
34 - var selectedSubscriptionDText = '';
35 -
36 - function changeSubscriptionTag(tagName) {
37 - selectedSubscriptionDText = tagName;
38 - let defaultText = [];
39 - <?php
40 - foreach ($others as $tagname => $tag) {
41 - echo 'defaultText["'.$tagname.'"] = "'.acym_translation($tag['default'], true).'";';
42 - }
43 - ?>
44 - jQuery('.selected_row').removeClass('selected_row');
45 - jQuery('#tr_' + tagName).addClass('selected_row');
46 - jQuery('#acym__popup__subscription__tagtext').val(defaultText[tagName]);
47 - setSubscriptionTag();
48 - }
49 -
50 - function setSubscriptionTag() {
51 - var tag = '{' + selectedSubscriptionDText;
52 - var lists = jQuery('#acym__popup__subscription__listids');
53 -
54 - if ('subscribe' === selectedSubscriptionDText) {
55 - tag += '|lists:' + lists.html();
56 - } else if (openedLists) {
57 - jQuery('#acym__popup__plugin__subscription__lists__modal').slideUp();
58 - jQuery('#select_lists_zone').hide();
59 - openedLists = false;
60 - }
61 -
62 - tag += '}' + jQuery('#acym__popup__subscription__tagtext').val() + '{/' + selectedSubscriptionDText + '}';
63 - setTag(tag, jQuery('#tr_' + selectedSubscriptionDText));
64 - }
65 -
66 - function displayLists() {
67 - if (openedLists) return;
68 - openedLists = true;
69 -
70 - jQuery.acymModal();
71 - jQuery('#acym__popup__plugin__subscription__lists__modal').slideDown();
72 - jQuery('#select_lists_zone').toggle();
73 - jQuery('#acym__popup__subscription__change').on('change', function () {
74 - var lists = JSON.parse(jQuery('#acym__modal__lists-selected').val());
75 - jQuery('#acym__popup__subscription__listids').html(lists.join());
76 - changeSubscriptionTag('subscribe');
77 - });
78 - }
79 - </script>
80 - <?php
81 -
82 - $text = '<div class="acym__popup__listing text-center grid-x">
83 - <h1 class="acym__title acym__title__secondary text-center cell">'.acym_translation('ACYM_SUBSCRIPTION').'</h1>
84 - <div class="grid-x medium-12 cell acym__row__no-listing text-left acym_vcenter">
85 - <div class="grid-x cell medium-5 small-12 acym__listing__title acym__listing__title__dynamics acym__subscription__subscription acym_vcenter">
86 - <label class="small-3 margin-bottom-0" for="acym__popup__subscription__tagtext">'.acym_translation('ACYM_TEXT').': </label>
87 - <input class="small-9" type="text" name="tagtext" id="acym__popup__subscription__tagtext" onchange="setSubscriptionTag();">
88 - </div>
89 - <div class="medium-1"></div>
90 - <div style="display: none;" id="select_lists_zone" class="grid-x cell medium-6 small-12 acym__listing__title acym__listing__title__dynamics">
91 - <p class="shrink" id="acym__popup__subscription__text__list">'.acym_translation('ACYM_LISTS_SELECTED').'</p>
92 - <p class="shrink" id="acym__popup__subscription__listids"></p>
93 - </div>
94 - </div>';
95 - $text .= '
96 - <div class="cell grid-x">';
97 -
98 - foreach ($others as $tagname => $tag) {
99 - $onclick = "changeSubscriptionTag('".$tagname."');";
100 - if ($tagname == 'subscribe') {
101 - $onclick .= 'displayLists();return false;';
102 - }
103 - $text .= '<div class="grid-x small-12 cell acym__row__no-listing acym__listing__row__popup text-left" onclick="'.$onclick.'" id="tr_'.$tagname.'" >';
104 - $text .= '<div class="cell small-12 acym__listing__title acym__listing__title__dynamics">'.$tag['name'].'</div>';
105 - $text .= '</div>';
106 - }
107 - $text .= '</div>
108 - <div class="medium-1"></div>
109 - <div class="medium-10 text-left">';
110 - $text .= acym_modalPaginationLists(
111 - 'acym__popup__subscription__change',
112 - '',
113 - false,
114 - 'style="display: none;" id="acym__popup__plugin__subscription__lists__modal"'
115 - );
116 - $text .= ' </div>
117 - <div class="medium-1"></div>
118 - </div>';
119 -
120 - $others = [];
121 - $others['name'] = acym_translation('ACYM_LIST_NAME');
122 - $others['description'] = acym_translation('ACYM_LIST_DESCRIPTION');
123 - $others['names'] = acym_translation('ACYM_LIST_NAMES');
124 - $others['descriptions'] = acym_translation('ACYM_LIST_DESCRIPTIONS');
125 - $others['id'] = acym_translation('ACYM_LIST_ID', true);
126 -
127 - $text .= '<div class="acym__popup__listing text-center grid-x">
128 - <h1 class="acym__title acym__title__secondary text-center cell">'.acym_translation('ACYM_LIST').'</h1>
129 - <div class="cell grid-x">';
130 -
131 - foreach ($others as $tagname => $tag) {
132 - $text .= '<div class="grid-x medium-12 cell acym__row__no-listing acym__listing__row__popup text-left" onclick="changeSubscriptionTag(\'list\');setTag(\'{list:'.$tagname.'}\', jQuery(this));" id="tr_'.$tagname.'">
133 - <div class="cell medium-12 small-12 acym__listing__title acym__listing__title__dynamics">'.$tag.'</div>
134 - </div>';
135 - }
136 -
137 - $text .= '</div></div>';
138 -
139 - $text .= '<div class="acym__popup__listing text-center grid-x">
140 - <span class="acym__title acym__title__secondary text-center cell">'.acym_translation('ACYM_CAMPAIGN').'</span>
141 - <div class="cell grid-x">';
142 - $othersMail = ['campaignid', 'subject'];
143 -
144 - foreach ($othersMail as $tag) {
145 - $text .= '<div class="grid-x medium-12 cell acym__row__no-listing acym__listing__row__popup text-left" onclick="changeSubscriptionTag(\'mail\');setTag(\'{mail:'.$tag.'}\', jQuery(this));" id="tr_'.$tag.'">
146 - <div class="cell medium-12 small-12 acym__listing__title acym__listing__title__dynamics">'.$tag.'</div>
147 - </div>';
148 - }
149 - $text .= '</div></div>';
150 -
151 - $text .= '<div class="acym__popup__listing text-center grid-x">
152 - <span class="acym__title acym__title__secondary text-center cell">'.acym_translation('ACYM_AUTO').' '.acym_translation('ACYM_CAMPAIGNS').'</span>
153 - <div class="cell grid-x">';
154 - $autoMail = ['number_generated' => ['name' => acym_translation('ACYM_ISSUE_NB'), 'default' => '#1']];
155 -
156 - foreach ($autoMail as $tag => $oneTag) {
157 - $tagInserted = $tag;
158 - if (!empty($oneTag['default'])) $tagInserted = $tag.'|default:'.$oneTag['default'];
159 - $text .= '<div class="grid-x medium-12 cell acym__row__no-listing acym__listing__row__popup text-left" onclick="changeSubscriptionTag(\'automail\');setTag(\'{automail:'.$tagInserted.'}\', jQuery(this));" id="tr_'.$tag.'">
160 - <div class="cell medium-12 small-12 acym__listing__title acym__listing__title__dynamics">'.$oneTag['name'].'</div>
161 - </div>';
162 - }
163 - $text .= '</div></div>';
164 -
165 - echo $text;
166 - }
167 -
168 - public function replaceUserInformation(&$email, &$user, $send = true)
169 - {
170 - $this->_replacelisttags($email, $user, $send);
171 -
172 - if ($this->config->get('unsubscribe_header', 1) == 0) return;
173 - if (empty($user->id) || !empty($this->addedListUnsubscribe[$email->id][$user->id])) return;
174 - if (empty($this->unsubscribeLink[$email->id]) || !method_exists($email, 'addCustomHeader')) return;
175 -
176 -
177 - $this->addedListUnsubscribe[$email->id][$user->id] = true;
178 -
179 - $mailto = '';
180 - if ($this->config->get('auto_bounce', 0)) {
181 - $mailto = $this->config->get('bounce_email');
182 - }
183 - if (empty($mailto)) {
184 - $mailto = empty($email->replyemail) ? $this->config->get('replyto_email') : $email->replyemail;
185 - }
186 -
187 - if (empty($mailto)) {
188 - return;
189 - }
190 -
191 - $body = 'Please%20unsubscribe%20user%20ID%20'.$user->id;
192 -
193 - if (!isset($this->mailLists[$email->id])) {
194 - $mailClass = new MailClass();
195 - $lists = $mailClass->getAllListsByMailId($email->id);
196 - $this->mailLists[$email->id] = empty($lists) ? null : array_keys($lists);
197 - }
198 -
199 - if (!empty($this->mailLists[$email->id])) {
200 - $userClass = $this->getUserClass();
201 - $userLists = $userClass->getSubscriptionStatus($user->id, [], 1);
202 - if (!empty($userLists)) {
203 - $commonLists = array_intersect($this->mailLists[$email->id], array_keys($userLists));
204 -
205 - if (!empty($commonLists)) {
206 - $body .= '%20from%20list(s)%20'.implode(',', $commonLists).'.';
207 - }
208 - }
209 - }
210 -
211 - $unsubscribeLink = str_replace(
212 - ['{subscriber:id}', '{subscriber:key|urlencode}'],
213 - [$user->id, urlencode($user->key)],
214 - $this->unsubscribeLink[$email->id]
215 - );
216 - $email->addCustomHeader('List-Unsubscribe', '<'.$unsubscribeLink.'&ajax=1>, <mailto:'.$mailto.'?subject=unsubscribe_user_'.$user->id.'&body='.$body.'>');
217 - $email->addCustomHeader('List-Unsubscribe-Post', 'List-Unsubscribe=One-Click');
218 - }
219 -
220 - public function replaceContent(&$email, $send = true)
221 - {
222 - $this->_replaceSubscriptionTags($email);
223 - $this->_replacemailtags($email);
224 - $this->replaceAutomailTags($email);
225 - }
226 -
227 - private function _replacemailtags(&$email)
228 - {
229 - $result = $this->pluginHelper->extractTags($email, 'mail');
230 - $tags = [];
231 -
232 - foreach ($result as $key => $oneTag) {
233 - if (isset($tags[$key])) {
234 - continue;
235 - }
236 -
237 - $field = $oneTag->id;
238 - if (!empty($email) && !empty($email->$field)) {
239 - $text = $email->$field;
240 - $this->pluginHelper->formatString($text, $oneTag);
241 - $tags[$key] = $text;
242 - } elseif (substr($field, 0, 8) == 'campaign') {
243 - $this->getCampaignTags($email, $tags, $oneTag, $key);
244 - } else {
245 - $tags[$key] = $oneTag->default;
246 - }
247 - }
248 -
249 - $this->pluginHelper->replaceTags($email, $tags);
250 - }
251 -
252 - private function getCampaignTags(&$email, &$tags, $oneTag, $key)
253 - {
254 - $campaignClass = new CampaignClass();
255 - $campaignFromMail = $campaignClass->getOneCampaignByMailId($email->id);
256 - $campaignField = substr($oneTag->id, 8);
257 - if (!empty($campaignFromMail) && !empty($campaignFromMail->$campaignField)) {
258 - $text = $campaignFromMail->$campaignField;
259 - $this->pluginHelper->formatString($text, $oneTag);
260 - $tags[$key] = $text;
261 - } else {
262 - $tags[$key] = $oneTag->default;
263 - }
264 - }
265 -
266 - private function replaceAutomailTags(&$email)
267 - {
268 - $result = $this->pluginHelper->extractTags($email, 'automail');
269 - $tags = [];
270 -
271 - foreach ($result as $key => $oneTag) {
272 - if (isset($tags[$key])) {
273 - continue;
274 - }
275 -
276 - $field = $oneTag->id;
277 -
278 - $campaignClass = new CampaignClass();
279 - $autoCampaignFromMail = $campaignClass->getAutoCampaignFromGeneratedMailId($email->id);
280 -
281 - if (!empty($autoCampaignFromMail) && !empty($autoCampaignFromMail->sending_params[$field])) {
282 - $text = $autoCampaignFromMail->sending_params[$field];
283 - $this->pluginHelper->formatString($text, $oneTag);
284 - $tags[$key] = $text;
285 - } else {
286 - $tags[$key] = $oneTag->default;
287 - }
288 - }
289 -
290 - $this->pluginHelper->replaceTags($email, $tags);
291 - }
292 -
293 - private function _replacelisttags(&$email, &$user, $send)
294 - {
295 - $tags = $this->pluginHelper->extractTags($email, 'list');
296 - if (empty($tags)) {
297 - return;
298 - }
299 -
300 - $replaceTags = [];
301 - foreach ($tags as $oneTag => $parameter) {
302 - $method = 'list'.trim(strtolower($parameter->id));
303 -
304 - if (method_exists($this, $method)) {
305 - $replaceTags[$oneTag] = $this->$method($email, $user, $parameter);
306 - } else {
307 - $replaceTags[$oneTag] = 'Method not found: '.$method;
308 - }
309 - }
310 -
311 - $this->pluginHelper->replaceTags($email, $replaceTags, true);
312 - }
313 -
314 - private function _getAttachedListid($email, $subid)
315 - {
316 - $mailid = $email->id;
317 -
318 - if (isset($this->lists[$mailid][$subid])) {
319 - return $this->lists[$mailid][$subid];
320 - }
321 -
322 - $mailClass = new MailClass();
323 - $mailLists = array_keys($mailClass->getAllListsByMailId($mailid));
324 - $userLists = [];
325 -
326 - if (!empty($subid)) {
327 - $userClass = $this->getUserClass();
328 - $userLists = $userClass->getUserSubscriptionById($subid, 'id', false, false, false, true);
329 -
330 - $listid = null;
331 - foreach ($userLists as $id => $oneList) {
332 - if ($oneList->status == 1 && in_array($id, $mailLists)) {
333 - $this->lists[$mailid][$subid] = $id;
334 -
335 - return $this->lists[$mailid][$subid];
336 - }
337 - }
338 -
339 - if (!empty($listid)) {
340 - $this->lists[$mailid][$subid] = $listid;
341 -
342 - return $listid;
343 - }
344 - }
345 -
346 - if (!empty($mailLists)) {
347 - $this->lists[$mailid][$subid] = array_shift($mailLists);
348 -
349 - return $this->lists[$mailid][$subid];
350 - }
351 -
352 - if (!empty($subid) && !empty($email->type) && $email->type === MailClass::TYPE_WELCOME) {
353 - $listid = acym_loadResult(
354 - 'SELECT list.id
355 - FROM #__acym_list AS list
356 - JOIN #__acym_user_has_list AS userlist ON list.id = userlist.list_id
357 - WHERE list.welcome_id = '.intval($mailid).' AND userlist.user_id = '.intval($subid).'
358 - ORDER BY userlist.subscription_date DESC'
359 - );
360 - if (!empty($listid)) {
361 - $this->lists[$mailid][$subid] = $listid;
362 -
363 - return $listid;
364 - }
365 - }
366 -
367 - if (!empty($subid) && !empty($email->type) && $email->type === MailClass::TYPE_UNSUBSCRIBE) {
368 - $listid = acym_loadResult(
369 - 'SELECT list.id
370 - FROM #__acym_list AS list
371 - JOIN #__acym_user_has_list AS userlist ON list.id = userlist.list_id
372 - WHERE list.unsubscribe_id = '.intval($mailid).' AND userlist.user_id = '.intval($subid).'
373 - ORDER BY userlist.unsubscribe_date DESC'
374 - );
375 - if (!empty($listid)) {
376 - $this->lists[$mailid][$subid] = $listid;
377 -
378 - return $listid;
379 - }
380 - }
381 -
382 - if (!empty($userLists)) {
383 - $listIds = array_keys($userLists);
384 - $this->lists[$mailid][$subid] = array_shift($listIds);
385 -
386 - return $this->lists[$mailid][$subid];
387 - }
388 -
389 - return 0;
390 - }
391 -
392 - private function listnames(&$email, &$user, &$parameter)
393 - {
394 - if (empty($user->id)) return '';
395 -
396 - $userClass = $this->getUserClass();
397 - $usersubscription = $userClass->getUserSubscriptionById($user->id, 'id', false, true);
398 - $lists = [];
399 - if (!empty($usersubscription)) {
400 - foreach ($usersubscription as $onesub) {
401 - if ($onesub->status < 1 || empty($onesub->active)) {
402 - continue;
403 - }
404 - $lists[] = (!empty($onesub->display_name) ? $onesub->display_name : $onesub->name);
405 - }
406 - }
407 -
408 - return implode(isset($parameter->separator) ? $parameter->separator : ', ', $lists);
409 - }
410 -
411 - private function listowner(&$email, &$user, &$parameter)
412 - {
413 - if (empty($user->id)) {
414 - return '';
415 - }
416 - $listid = $this->_getAttachedListid($email, $user->id);
417 - if (empty($listid)) {
418 - return "";
419 - }
420 -
421 - global $acymCmsUserVars;
422 - if (!isset($this->listsowner[$listid])) {
423 - $this->listsowner[$listid] = acym_loadObject(
424 - 'SELECT user.* FROM #__acym_list AS list JOIN '.$acymCmsUserVars->table.' AS user ON user.'.$acymCmsUserVars->id.' = list.cms_user_id WHERE list.id = '.intval(
425 - $listid
426 - )
427 - );
428 - }
429 -
430 - if (!in_array($parameter->field, [$acymCmsUserVars->username, $acymCmsUserVars->name, $acymCmsUserVars->email])) {
431 - return 'Field not found : '.$parameter->field;
432 - }
433 -
434 - return @$this->listsowner[$listid]->{$acymCmsUserVars->{$parameter->field}};
435 - }
436 -
437 - private function listname(&$email, &$user, &$parameter)
438 - {
439 - if (empty($user->id)) {
440 - return '';
441 - }
442 - $listid = $this->_getAttachedListid($email, $user->id);
443 - if (empty($listid)) {
444 - return '';
445 - }
446 -
447 - $this->_loadlist($listid);
448 -
449 - return !empty($this->listsinfo[$listid]->display_name) ? $this->listsinfo[$listid]->display_name : @$this->listsinfo[$listid]->name;
450 - }
451 -
452 - private function listdescription(&$email, &$user, &$parameter)
453 - {
454 - if (empty($user->id)) {
455 - return '';
456 - }
457 - if (!empty($parameter->listid)) $listid = $parameter->listid;
458 - if (empty($listid)) $listid = $this->_getAttachedListid($email, $user->id);
459 - if (empty($listid)) {
460 - return '';
461 - }
462 -
463 - $this->_loadlist($listid);
464 -
465 - return @$this->listsinfo[$listid]->description;
466 - }
467 -
468 - private function _loadlist($listid)
469 - {
470 - if (isset($this->listsinfo[$listid])) {
471 - return;
472 - }
473 -
474 - $listClass = new ListClass();
475 - $this->listsinfo[$listid] = $listClass->getOneById(intval($listid));
476 - }
477 -
478 - private function listdescriptions(&$email, &$user, &$parameter)
479 - {
480 - if (empty($user->id)) return '';
481 -
482 - $userClass = $this->getUserClass();
483 - $usersubscription = $userClass->getUserSubscriptionById($user->id);
484 - $listids = [];
485 - if (!empty($parameter->listids)) $listids = explode(',', $parameter->listids);
486 - $lists = [];
487 - if (!empty($usersubscription)) {
488 - foreach ($usersubscription as $onesub) {
489 - if (empty($onesub->description) || $onesub->status < 1 || empty($onesub->active) || (!empty($listids) && !in_array($onesub->id, $listids))) {
490 - continue;
491 - }
492 - $lists[] = $onesub->description;
493 - }
494 - }
495 -
496 - return implode(isset($parameter->separator) ? $parameter->separator : ', ', $lists);
497 - }
498 -
499 - private function listid(&$email, &$user, &$parameter)
500 - {
501 - if (empty($user->id)) {
502 - return '';
503 - }
504 - $listid = $this->_getAttachedListid($email, $user->id);
505 - if (empty($listid)) {
506 - return '';
507 - }
508 -
509 - return $listid;
510 - }
511 -
512 - private function _replaceSubscriptionTags(&$email)
513 - {
514 - $match = '#(?:{|%7B)(confirm|unsubscribe(?:\|[^}]+)*|unsubscribeall|subscribe(?:\|[^}]+)*)(?:}|%7D)(.*)(?:{|%7B)/(confirm|unsubscribe|unsubscribeall|subscribe)(?:}|%7D)#Uis';
515 - $variables = ['subject', 'body'];
516 - $found = false;
517 - $results = [];
518 - foreach ($variables as $var) {
519 - if (empty($email->$var)) continue;
520 -
521 - $found = preg_match_all($match, $email->$var, $results[$var]) || $found;
522 - if (empty($results[$var][0])) unset($results[$var]);
523 - }
524 -
525 - if (!$found) return;
526 -
527 - $tags = [];
528 - $this->addedListUnsubscribe[$email->id] = [];
529 - foreach ($results as $var => $allresults) {
530 - foreach ($allresults[0] as $i => $oneTag) {
531 - if (isset($tags[$oneTag])) continue;
532 -
533 - $tags[$oneTag] = $this->_replaceSubscriptionTag($allresults, $i, $email);
534 - }
535 - }
536 -
537 - $this->pluginHelper->replaceTags($email, $tags);
538 - }
539 -
540 - private function _replaceSubscriptionTag(&$allresults, $i, &$email)
541 - {
542 - $parameters = $this->pluginHelper->extractTag($allresults[1][$i]);
543 -
544 - $lang = $this->getLanguage($email->links_language);
545 -
546 - if ($parameters->id === 'confirm') {
547 - $myLink = acym_frontendLink('frontusers&task=confirm&userId={subscriber:id}&userKey={subscriber:key|urlencode}'.$lang);
548 - if (empty($allresults[2][$i])) {
549 - return $myLink;
550 - }
551 -
552 - return '<a target="_blank" href="'.$myLink.'"><span class="acym_confirm acym_link">'.$allresults[2][$i].'</span></a>';
553 - } elseif ($parameters->id === 'subscribe') {
554 - if (empty($parameters->lists)) {
555 - return acym_translation('ACYM_EXPORT_SELECT_LIST');
556 - }
557 - $lists = explode(',', $parameters->lists);
558 - acym_arrayToInteger($lists);
559 - $captchaKey = $this->config->get('captcha', 'none') !== 'none' ? '&seckey='.$this->config->get('security_key', '') : '';
560 - $myLink = acym_frontendLink(
561 - 'frontusers&task=subscribe&hiddenlists='.implode(',', $lists).'&userId={subscriber:id}&userKey={subscriber:key|urlencode}'.$lang.$captchaKey
562 - );
563 - if (empty($allresults[2][$i])) {
564 - return $myLink;
565 - }
566 -
567 - return '<a style="text-decoration:none;" target="_blank" href="'.$myLink.'"><span class="acym_subscribe acym_link">'.$allresults[2][$i].'</span></a>';
568 - } else {
569 - $baseLink = 'frontusers'.$lang.'&mail_id='.$email->id;
570 - if ($parameters->id === 'unsubscribe') {
571 - $unsubscribeLink = $baseLink.'&task=unsubscribe&userId={subscriber:id}&userKey={subscriber:key|urlencode}';
572 - if ($this->config->get('unsubpage_header') != 1) {
573 - $unsubscribeLink .= '&'.acym_noTemplate();
574 - }
575 - $unsubClass = 'acym_unsubscribe';
576 - } else {
577 - $unsubscribeLink = $baseLink.'&task=unsubscribeAll&user_id={subscriber:id}&user_key={subscriber:key|urlencode}';
578 - $unsubClass = 'acym_unsubscribe_all_lists';
579 - }
580 -
581 - $needToCompleteLink = true;
582 - if (!empty($parameters->baseUrl)) {
583 - $unsubscribeLink = $parameters->baseUrl.$unsubscribeLink;
584 - $needToCompleteLink = false;
585 - }
586 -
587 - $unsubscribeLink = acym_frontendLink($unsubscribeLink, $needToCompleteLink);
588 -
589 - $this->unsubscribeLink[$email->id] = $unsubscribeLink;
590 -
591 - if (empty($allresults[2][$i])) {
592 - return $unsubscribeLink;
593 - }
594 -
595 - return '<a style="text-decoration:none;" target="_blank" href="'.$unsubscribeLink.'"><span class="'.$unsubClass.' acym_link">'.$allresults[2][$i].'</span></a>';
596 - }
597 - }
598 -
599 - private function getUserClass()
600 - {
601 - if ($this->userClass === null) {
602 - $this->userClass = new UserClass();
603 - }
604 -
605 - return $this->userClass;
606 - }
607 -}