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 -606 10.2.2 → 11.1.1 View file →
@@ -1,606 +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 (empty($user->id) || !empty($this->addedListUnsubscribe[$email->id][$user->id])) return;
173 - if (empty($this->unsubscribeLink[$email->id]) || !method_exists($email, 'addCustomHeader')) return;
174 -
175 -
176 - $this->addedListUnsubscribe[$email->id][$user->id] = true;
177 -
178 - $mailto = '';
179 - if ($this->config->get('auto_bounce', 0)) {
180 - $mailto = $this->config->get('bounce_email');
181 - }
182 - if (empty($mailto)) {
183 - $mailto = empty($email->replyemail) ? $this->config->get('replyto_email') : $email->replyemail;
184 - }
185 -
186 - if (empty($mailto)) {
187 - return;
188 - }
189 -
190 - $body = 'Please%20unsubscribe%20user%20ID%20'.$user->id;
191 -
192 - if (!isset($this->mailLists[$email->id])) {
193 - $mailClass = new MailClass();
194 - $lists = $mailClass->getAllListsByMailId($email->id);
195 - $this->mailLists[$email->id] = empty($lists) ? null : array_keys($lists);
196 - }
197 -
198 - if (!empty($this->mailLists[$email->id])) {
199 - $userClass = $this->getUserClass();
200 - $userLists = $userClass->getSubscriptionStatus($user->id, [], 1);
201 - if (!empty($userLists)) {
202 - $commonLists = array_intersect($this->mailLists[$email->id], array_keys($userLists));
203 -
204 - if (!empty($commonLists)) {
205 - $body .= '%20from%20list(s)%20'.implode(',', $commonLists).'.';
206 - }
207 - }
208 - }
209 -
210 - $unsubscribeLink = str_replace(
211 - ['{subscriber:id}', '{subscriber:key|urlencode}'],
212 - [$user->id, urlencode($user->key)],
213 - $this->unsubscribeLink[$email->id]
214 - );
215 - $email->addCustomHeader('List-Unsubscribe', '<'.$unsubscribeLink.'&ajax=1>, <mailto:'.$mailto.'?subject=unsubscribe_user_'.$user->id.'&body='.$body.'>');
216 - $email->addCustomHeader('List-Unsubscribe-Post', 'List-Unsubscribe=One-Click');
217 - }
218 -
219 - public function replaceContent(&$email, $send = true)
220 - {
221 - $this->_replaceSubscriptionTags($email);
222 - $this->_replacemailtags($email);
223 - $this->replaceAutomailTags($email);
224 - }
225 -
226 - private function _replacemailtags(&$email)
227 - {
228 - $result = $this->pluginHelper->extractTags($email, 'mail');
229 - $tags = [];
230 -
231 - foreach ($result as $key => $oneTag) {
232 - if (isset($tags[$key])) {
233 - continue;
234 - }
235 -
236 - $field = $oneTag->id;
237 - if (!empty($email) && !empty($email->$field)) {
238 - $text = $email->$field;
239 - $this->pluginHelper->formatString($text, $oneTag);
240 - $tags[$key] = $text;
241 - } elseif (substr($field, 0, 8) == 'campaign') {
242 - $this->getCampaignTags($email, $tags, $oneTag, $key);
243 - } else {
244 - $tags[$key] = $oneTag->default;
245 - }
246 - }
247 -
248 - $this->pluginHelper->replaceTags($email, $tags);
249 - }
250 -
251 - private function getCampaignTags(&$email, &$tags, $oneTag, $key)
252 - {
253 - $campaignClass = new CampaignClass();
254 - $campaignFromMail = $campaignClass->getOneCampaignByMailId($email->id);
255 - $campaignField = substr($oneTag->id, 8);
256 - if (!empty($campaignFromMail) && !empty($campaignFromMail->$campaignField)) {
257 - $text = $campaignFromMail->$campaignField;
258 - $this->pluginHelper->formatString($text, $oneTag);
259 - $tags[$key] = $text;
260 - } else {
261 - $tags[$key] = $oneTag->default;
262 - }
263 - }
264 -
265 - private function replaceAutomailTags(&$email)
266 - {
267 - $result = $this->pluginHelper->extractTags($email, 'automail');
268 - $tags = [];
269 -
270 - foreach ($result as $key => $oneTag) {
271 - if (isset($tags[$key])) {
272 - continue;
273 - }
274 -
275 - $field = $oneTag->id;
276 -
277 - $campaignClass = new CampaignClass();
278 - $autoCampaignFromMail = $campaignClass->getAutoCampaignFromGeneratedMailId($email->id);
279 -
280 - if (!empty($autoCampaignFromMail) && !empty($autoCampaignFromMail->sending_params[$field])) {
281 - $text = $autoCampaignFromMail->sending_params[$field];
282 - $this->pluginHelper->formatString($text, $oneTag);
283 - $tags[$key] = $text;
284 - } else {
285 - $tags[$key] = $oneTag->default;
286 - }
287 - }
288 -
289 - $this->pluginHelper->replaceTags($email, $tags);
290 - }
291 -
292 - private function _replacelisttags(&$email, &$user, $send)
293 - {
294 - $tags = $this->pluginHelper->extractTags($email, 'list');
295 - if (empty($tags)) {
296 - return;
297 - }
298 -
299 - $replaceTags = [];
300 - foreach ($tags as $oneTag => $parameter) {
301 - $method = 'list'.trim(strtolower($parameter->id));
302 -
303 - if (method_exists($this, $method)) {
304 - $replaceTags[$oneTag] = $this->$method($email, $user, $parameter);
305 - } else {
306 - $replaceTags[$oneTag] = 'Method not found: '.$method;
307 - }
308 - }
309 -
310 - $this->pluginHelper->replaceTags($email, $replaceTags, true);
311 - }
312 -
313 - private function _getAttachedListid($email, $subid)
314 - {
315 - $mailid = $email->id;
316 -
317 - if (isset($this->lists[$mailid][$subid])) {
318 - return $this->lists[$mailid][$subid];
319 - }
320 -
321 - $mailClass = new MailClass();
322 - $mailLists = array_keys($mailClass->getAllListsByMailId($mailid));
323 - $userLists = [];
324 -
325 - if (!empty($subid)) {
326 - $userClass = $this->getUserClass();
327 - $userLists = $userClass->getUserSubscriptionById($subid, 'id', false, false, false, true);
328 -
329 - $listid = null;
330 - foreach ($userLists as $id => $oneList) {
331 - if ($oneList->status == 1 && in_array($id, $mailLists)) {
332 - $this->lists[$mailid][$subid] = $id;
333 -
334 - return $this->lists[$mailid][$subid];
335 - }
336 - }
337 -
338 - if (!empty($listid)) {
339 - $this->lists[$mailid][$subid] = $listid;
340 -
341 - return $listid;
342 - }
343 - }
344 -
345 - if (!empty($mailLists)) {
346 - $this->lists[$mailid][$subid] = array_shift($mailLists);
347 -
348 - return $this->lists[$mailid][$subid];
349 - }
350 -
351 - if (!empty($subid) && !empty($email->type) && $email->type === MailClass::TYPE_WELCOME) {
352 - $listid = acym_loadResult(
353 - 'SELECT list.id
354 - FROM #__acym_list AS list
355 - JOIN #__acym_user_has_list AS userlist ON list.id = userlist.list_id
356 - WHERE list.welcome_id = '.intval($mailid).' AND userlist.user_id = '.intval($subid).'
357 - ORDER BY userlist.subscription_date DESC'
358 - );
359 - if (!empty($listid)) {
360 - $this->lists[$mailid][$subid] = $listid;
361 -
362 - return $listid;
363 - }
364 - }
365 -
366 - if (!empty($subid) && !empty($email->type) && $email->type === MailClass::TYPE_UNSUBSCRIBE) {
367 - $listid = acym_loadResult(
368 - 'SELECT list.id
369 - FROM #__acym_list AS list
370 - JOIN #__acym_user_has_list AS userlist ON list.id = userlist.list_id
371 - WHERE list.unsubscribe_id = '.intval($mailid).' AND userlist.user_id = '.intval($subid).'
372 - ORDER BY userlist.unsubscribe_date DESC'
373 - );
374 - if (!empty($listid)) {
375 - $this->lists[$mailid][$subid] = $listid;
376 -
377 - return $listid;
378 - }
379 - }
380 -
381 - if (!empty($userLists)) {
382 - $listIds = array_keys($userLists);
383 - $this->lists[$mailid][$subid] = array_shift($listIds);
384 -
385 - return $this->lists[$mailid][$subid];
386 - }
387 -
388 - return 0;
389 - }
390 -
391 - private function listnames(&$email, &$user, &$parameter)
392 - {
393 - if (empty($user->id)) return '';
394 -
395 - $userClass = $this->getUserClass();
396 - $usersubscription = $userClass->getUserSubscriptionById($user->id, 'id', false, true);
397 - $lists = [];
398 - if (!empty($usersubscription)) {
399 - foreach ($usersubscription as $onesub) {
400 - if ($onesub->status < 1 || empty($onesub->active)) {
401 - continue;
402 - }
403 - $lists[] = (!empty($onesub->display_name) ? $onesub->display_name : $onesub->name);
404 - }
405 - }
406 -
407 - return implode(isset($parameter->separator) ? $parameter->separator : ', ', $lists);
408 - }
409 -
410 - private function listowner(&$email, &$user, &$parameter)
411 - {
412 - if (empty($user->id)) {
413 - return '';
414 - }
415 -
416 - if (!in_array($parameter->field, ['username', 'name', 'email'])) {
417 - return 'Field not found : '.$parameter->field;
418 - }
419 -
420 - $listid = $this->_getAttachedListid($email, $user->id);
421 - if (empty($listid)) {
422 - return '';
423 - }
424 -
425 - global $acymCmsUserVars;
426 - if (!isset($this->listsowner[$listid])) {
427 - $this->listsowner[$listid] = acym_loadObject(
428 - 'SELECT `user`.* FROM #__acym_list AS `list`
429 - JOIN '.$acymCmsUserVars->table.' AS `user`
430 - ON `user`.'.$acymCmsUserVars->id.' = `list`.cms_user_id
431 - WHERE `list`.id = '.intval($listid)
432 - );
433 - }
434 -
435 - return @$this->listsowner[$listid]->{$acymCmsUserVars->{$parameter->field}};
436 - }
437 -
438 - private function listname(&$email, &$user, &$parameter)
439 - {
440 - if (empty($user->id)) {
441 - return '';
442 - }
443 - $listid = $this->_getAttachedListid($email, $user->id);
444 - if (empty($listid)) {
445 - return '';
446 - }
447 -
448 - $this->_loadlist($listid);
449 -
450 - return !empty($this->listsinfo[$listid]->display_name) ? $this->listsinfo[$listid]->display_name : @$this->listsinfo[$listid]->name;
451 - }
452 -
453 - private function listdescription(&$email, &$user, &$parameter)
454 - {
455 - if (empty($user->id)) {
456 - return '';
457 - }
458 - if (!empty($parameter->listid)) $listid = $parameter->listid;
459 - if (empty($listid)) $listid = $this->_getAttachedListid($email, $user->id);
460 - if (empty($listid)) {
461 - return '';
462 - }
463 -
464 - $this->_loadlist($listid);
465 -
466 - return @$this->listsinfo[$listid]->description;
467 - }
468 -
469 - private function _loadlist($listid)
470 - {
471 - if (isset($this->listsinfo[$listid])) {
472 - return;
473 - }
474 -
475 - $listClass = new ListClass();
476 - $this->listsinfo[$listid] = $listClass->getOneById(intval($listid));
477 - }
478 -
479 - private function listdescriptions(&$email, &$user, &$parameter)
480 - {
481 - if (empty($user->id)) return '';
482 -
483 - $userClass = $this->getUserClass();
484 - $usersubscription = $userClass->getUserSubscriptionById($user->id);
485 - $listids = [];
486 - if (!empty($parameter->listids)) $listids = explode(',', $parameter->listids);
487 - $lists = [];
488 - if (!empty($usersubscription)) {
489 - foreach ($usersubscription as $onesub) {
490 - if (empty($onesub->description) || $onesub->status < 1 || empty($onesub->active) || (!empty($listids) && !in_array($onesub->id, $listids))) {
491 - continue;
492 - }
493 - $lists[] = $onesub->description;
494 - }
495 - }
496 -
497 - return implode(isset($parameter->separator) ? $parameter->separator : ', ', $lists);
498 - }
499 -
500 - private function listid(&$email, &$user, &$parameter)
501 - {
502 - if (empty($user->id)) {
503 - return '';
504 - }
505 - $listid = $this->_getAttachedListid($email, $user->id);
506 - if (empty($listid)) {
507 - return '';
508 - }
509 -
510 - return $listid;
511 - }
512 -
513 - private function _replaceSubscriptionTags(&$email)
514 - {
515 - $match = '#(?:{|%7B)(confirm|unsubscribe(?:\|[^}]+)*|unsubscribeall|subscribe(?:\|[^}]+)*)(?:}|%7D)(.*)(?:{|%7B)/(confirm|unsubscribe|unsubscribeall|subscribe)(?:}|%7D)#Uis';
516 - $variables = ['subject', 'body'];
517 - $found = false;
518 - $results = [];
519 - foreach ($variables as $var) {
520 - if (empty($email->$var)) continue;
521 -
522 - $found = preg_match_all($match, $email->$var, $results[$var]) || $found;
523 - if (empty($results[$var][0])) unset($results[$var]);
524 - }
525 -
526 - if (!$found) return;
527 -
528 - $tags = [];
529 - $this->addedListUnsubscribe[$email->id] = [];
530 - foreach ($results as $var => $allresults) {
531 - foreach ($allresults[0] as $i => $oneTag) {
532 - if (isset($tags[$oneTag])) continue;
533 -
534 - $tags[$oneTag] = $this->_replaceSubscriptionTag($allresults, $i, $email);
535 - }
536 - }
537 -
538 - $this->pluginHelper->replaceTags($email, $tags);
539 - }
540 -
541 - private function _replaceSubscriptionTag(&$allresults, $i, &$email)
542 - {
543 - $parameters = $this->pluginHelper->extractTag($allresults[1][$i]);
544 -
545 - $lang = $this->getLanguage($email->links_language);
546 -
547 - if ($parameters->id === 'confirm') {
548 - $myLink = acym_frontendLink('frontusers&task=confirm&userId={subscriber:id}&userKey={subscriber:key|urlencode}'.$lang);
549 - if (empty($allresults[2][$i])) {
550 - return $myLink;
551 - }
552 -
553 - return '<a target="_blank" href="'.$myLink.'"><span class="acym_confirm acym_link">'.$allresults[2][$i].'</span></a>';
554 - } elseif ($parameters->id === 'subscribe') {
555 - if (empty($parameters->lists)) {
556 - return acym_translation('ACYM_EXPORT_SELECT_LIST');
557 - }
558 - $lists = explode(',', $parameters->lists);
559 - acym_arrayToInteger($lists);
560 - $captchaKey = $this->config->get('captcha', 'none') !== 'none' ? '&seckey='.$this->config->get('security_key', '') : '';
561 - $myLink = acym_frontendLink(
562 - 'frontusers&task=subscribe&hiddenlists='.implode(',', $lists).'&userId={subscriber:id}&userKey={subscriber:key|urlencode}'.$lang.$captchaKey
563 - );
564 - if (empty($allresults[2][$i])) {
565 - return $myLink;
566 - }
567 -
568 - return '<a style="text-decoration:none;" target="_blank" href="'.$myLink.'"><span class="acym_subscribe acym_link">'.$allresults[2][$i].'</span></a>';
569 - } else {
570 - $baseLink = 'frontusers'.$lang.'&mail_id='.$email->id;
571 - if ($parameters->id === 'unsubscribe') {
572 - $unsubscribeLink = $baseLink.'&task=unsubscribe&userId={subscriber:id}&userKey={subscriber:key|urlencode}';
573 - $unsubscribeLink .= '&'.acym_noTemplate();
574 - $unsubClass = 'acym_unsubscribe';
575 - } else {
576 - $unsubscribeLink = $baseLink.'&task=unsubscribeAll&user_id={subscriber:id}&user_key={subscriber:key|urlencode}';
577 - $unsubClass = 'acym_unsubscribe_all_lists';
578 - }
579 -
580 - $needToCompleteLink = true;
581 - if (!empty($parameters->baseUrl)) {
582 - $unsubscribeLink = $parameters->baseUrl.$unsubscribeLink;
583 - $needToCompleteLink = false;
584 - }
585 -
586 - $unsubscribeLink = acym_frontendLink($unsubscribeLink, $needToCompleteLink);
587 -
588 - $this->unsubscribeLink[$email->id] = $unsubscribeLink;
589 -
590 - if (empty($allresults[2][$i])) {
591 - return $unsubscribeLink;
592 - }
593 -
594 - return '<a style="text-decoration:none;" target="_blank" href="'.$unsubscribeLink.'"><span class="'.$unsubClass.' acym_link">'.$allresults[2][$i].'</span></a>';
595 - }
596 - }
597 -
598 - private function getUserClass()
599 - {
600 - if ($this->userClass === null) {
601 - $this->userClass = new UserClass();
602 - }
603 -
604 - return $this->userClass;
605 - }
606 -}