PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.0
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.0
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/tmpl/tableless.php +134 -0 10.1.2 → 11.1.0 View file →
@@ -1,0 +1,134 @@
1 +<?php
2 +// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- View file, its variables are local to the include scope, not true globals.
3 +
4 +defined('ABSPATH') || die('Restricted Access');
5 +
6 +// Prepare list display
7 +use AcyMailing\Helpers\CaptchaHelper;
8 +use AcyMailing\Helpers\SecurityHelper;
9 +
10 +if (!function_exists('acymailing_displayWidgetLists')) {
11 + function acymailing_displayWidgetLists($allLists, $visibleLists, $checkedLists, $formName)
12 + {
13 + if (empty($visibleLists)) {
14 + return;
15 + }
16 + ?>
17 +
18 + <div class="acym_lists" role="group" aria-label="<?php echo esc_attr(acym_translation('ACYM_NEWSLETTERS')); ?>">
19 + <?php foreach ($visibleLists as $myListId) { ?>
20 + <div class="onelist">
21 + <input type="checkbox"
22 + class="acym_checkbox"
23 + name="subscription[]"
24 + id="acylist_<?php echo esc_attr($myListId.'_'.$formName); ?>"
25 + <?php checked(in_array($myListId, $checkedLists)); ?>
26 + value="<?php echo esc_attr($myListId); ?>" />
27 + <label for="acylist_<?php echo esc_attr($myListId.'_'.$formName); ?>">
28 + <?php echo esc_html(!empty($allLists[$myListId]->display_name) ? $allLists[$myListId]->display_name : $allLists[$myListId]->name); ?>
29 + </label>
30 + </div>
31 + <?php } ?>
32 + </div>
33 + <?php
34 + }
35 +}
36 +if ($listPosition === 'before') {
37 + acymailing_displayWidgetLists($allLists, $visibleLists, $checkedLists, $formName);
38 +}
39 +?>
40 +
41 +<div class="acym_form">
42 + <?php
43 + foreach ($fields as $field) {
44 + $field->option = !empty($field->option) ? json_decode($field->option) : new stdClass();
45 + $fieldDB = empty($field->option->fieldDB) ? '' : json_decode($field->option->fieldDB);
46 + $field->value = empty($field->value) ? '' : json_decode($field->value);
47 + $valuesArray = [];
48 + if (!empty($field->value)) {
49 + foreach ($field->value as $value) {
50 + $valueTmp = new stdClass();
51 + $valueTmp->text = $value->title;
52 + $valueTmp->value = $value->value;
53 + if ($value->disabled == 'y') $valueTmp->disable = true;
54 + $valuesArray[$value->value] = $valueTmp;
55 + }
56 + }
57 + if (!empty($fieldDB) && !empty($fieldDB->value)) {
58 + $fromDB = $fieldClass->getValueFromDB($fieldDB);
59 + foreach ($fromDB as $value) {
60 + $valuesArray[$value->value] = $value->title;
61 + }
62 + }
63 + echo '<div class="onefield fieldacy'.esc_attr($field->id).' acyfield_'.esc_attr($field->type).'" id="field_'.esc_attr($field->id).'">';
64 + $fieldClass->displayField($field, $field->default_value, $valuesArray, $displayOutside, true, $identifiedUser);
65 + echo '</div>';
66 +
67 + if ($field->id == 2 && $config->get('email_confirmation')) {
68 + $fieldClass->setEmailConfirmationField($displayOutside, $field);
69 + }
70 + }
71 +
72 + if ($listPosition !== 'before') {
73 + acymailing_displayWidgetLists($allLists, $visibleLists, $checkedLists, $formName);
74 + }
75 +
76 + if (empty($identifiedUser->id) && $config->get('captcha', 'none') !== 'none' && acym_level(ACYM_ESSENTIAL)) {
77 + echo '<div class="onefield fieldacycaptcha" id="field_captcha_'.esc_attr($formName).'">';
78 + $captcha = new CaptchaHelper();
79 + $captcha->display($formName);
80 + echo '</div>';
81 + }
82 +
83 + if (!empty($termslink)) {
84 + echo '<div class="onefield fieldacyterms" id="field_terms_'.esc_attr($formName).'">';
85 + echo '<label for="mailingdata_terms_'.esc_attr($formName).'">';
86 + echo '<input id="mailingdata_terms_'.esc_attr($formName).'" class="checkbox" type="checkbox" name="terms" aria-required="true" title="'.esc_attr(
87 + acym_translation(
88 + 'ACYM_TERMS_CONDITIONS'
89 + )
90 + ).'"/> ';
91 + echo wp_kses(
92 + $termslink,
93 + SecurityHelper::ALLOWED_HTML_TERMS
94 + );
95 + echo '</label>';
96 + echo '</div>';
97 + }
98 +
99 + if (!empty($showTrackingConsent)) {
100 + $trackingChecked = (int)($identifiedUser->tracking ?? 0) === 1;
101 + echo '<div class="onefield fieldacytracking" id="field_tracking_'.esc_attr($formName).'">';
102 + echo '<label for="mailingdata_tracking_'.esc_attr($formName).'">';
103 + echo '<input type="hidden" name="user[tracking]" value="0"/>';
104 + echo '<input id="mailingdata_tracking_'.esc_attr($formName).'" class="acym_checkbox" type="checkbox" name="user[tracking]" value="1" '.checked($trackingChecked, true, false).'/> '.esc_html(
105 + acym_translation('ACYM_TRACKING_CONSENT')
106 + );
107 + echo '</label>';
108 + echo '</div>';
109 + }
110 + ?>
111 +</div>
112 +
113 +<p class="acysubbuttons">
114 + <noscript><?php echo esc_html(acym_translation('ACYM_NO_JAVASCRIPT')); ?></noscript>
115 + <?php
116 + $onclickSubscribe = 'try{ return submitAcymForm("subscribe","'.$formName.'", "acymSubmitSubForm"); }catch(err){alert("The form could not be submitted "+err);return false;}';
117 + $onclickUnsubscribe = 'try{ return submitAcymForm("unsubscribe","'.$formName.'", "acymSubmitSubForm"); }catch(err){alert("The form could not be submitted "+err);return false;}';
118 +
119 + if ($disableButtons) {
120 + $onclickSubscribe = 'return false;';
121 + $onclickUnsubscribe = 'return false;';
122 + }
123 + ?>
124 + <button type="submit"
125 + class="btn btn-primary button subbutton"
126 + onclick="<?php echo esc_attr($onclickSubscribe); ?>"><?php echo esc_html(acym_translation($subscribeText)); ?>
127 + </button>
128 + <?php if ($unsubButton === '2' || ($unsubButton === '1' && !empty($countUnsub))) { ?>
129 + <button type="submit"
130 + class="btn button unsubbutton"
131 + onclick="<?php echo esc_attr($onclickUnsubscribe); ?>"><?php echo esc_html(acym_translation($unsubscribeText)); ?>
132 + </button>
133 + <?php } ?>
134 +</p>