PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / trunk
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress vtrunk
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 / widgets / subscriptionform / tmpl / default.php

default.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress trunk, at widgets/subscriptionform/tmpl/default.php

156 lines 6.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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__group" role="group" aria-label="<?php echo esc_attr(acym_translation('ACYM_NEWSLETTERS')); ?>">
19 <table class="acym_lists" role="presentation">
20 <?php foreach ($visibleLists as $myListId) { ?>
21 <tr>
22 <td>
23 <input type="checkbox"
24 class="acym_checkbox"
25 name="subscription[]"
26 id="acylist_<?php echo esc_attr($myListId.'_'.$formName); ?>"
27 <?php checked(in_array($myListId, $checkedLists)); ?>
28 value="<?php echo esc_attr($myListId); ?>" />
29 <label for="acylist_<?php echo esc_attr($myListId.'_'.$formName); ?>">
30 <?php echo esc_html(!empty($allLists[$myListId]->display_name) ? $allLists[$myListId]->display_name : $allLists[$myListId]->name); ?>
31 </label>
32 </td>
33 </tr>
34 <?php } ?>
35 </table>
36 </div>
37 <?php
38 }
39 }
40 if ($listPosition === 'before') {
41 acymailing_displayWidgetLists($allLists, $visibleLists, $checkedLists, $formName);
42 }
43 ?>
44
45 <table class="acym_form" role="presentation">
46 <tr>
47 <?php
48 foreach ($fields as $field) {
49 $field->option = !empty($field->option) ? json_decode($field->option) : new stdClass();
50 $fieldDB = empty($field->option->fieldDB) ? '' : json_decode($field->option->fieldDB);
51 $field->value = empty($field->value) ? '' : json_decode($field->value);
52 $valuesArray = [];
53 if (!empty($field->value)) {
54 foreach ($field->value as $value) {
55 $valueTmp = new stdClass();
56 $valueTmp->text = $value->title;
57 $valueTmp->value = $value->value;
58 if ($value->disabled == 'y') $valueTmp->disable = true;
59 $valuesArray[$value->value] = $valueTmp;
60 }
61 }
62 if (!empty($fieldDB) && !empty($fieldDB->value)) {
63 $fromDB = $fieldClass->getValueFromDB($fieldDB);
64 foreach ($fromDB as $value) {
65 $valuesArray[$value->value] = $value->title;
66 }
67 }
68
69 echo '<td class="onefield acyfield_'.esc_attr($field->id).' acyfield_'.esc_attr($field->type).'">';
70 $fieldClass->displayField($field, $field->default_value, $valuesArray, $displayOutside, true, $identifiedUser);
71 echo '</td>';
72 if (!$displayInline) {
73 echo '</tr><tr>';
74 }
75
76 if ($field->id == 2 && $config->get('email_confirmation')) {
77 $fieldClass->setEmailConfirmationField($displayOutside, $field, 'td', $displayInline);
78 }
79 }
80
81 if ($listPosition !== 'before') {
82 echo '<td>';
83 acymailing_displayWidgetLists($allLists, $visibleLists, $checkedLists, $formName);
84 echo '</td>';
85 if (!$displayInline) {
86 echo '</tr><tr>';
87 }
88 }
89
90 if (empty($identifiedUser->id) && $config->get('captcha', 'none') !== 'none' && acym_level(ACYM_ESSENTIAL)) {
91 echo '<td class="captchakeymodule" '.($displayOutside && !$displayInline ? 'colspan="2"' : '').'>';
92 $captcha = new CaptchaHelper();
93 $captcha->display($formName);
94 echo '</td>';
95 if (!$displayInline) {
96 echo '</tr><tr>';
97 }
98 }
99
100 if (!empty($termslink)) {
101 echo '<td class="acyterms" '.($displayOutside && !$displayInline ? 'colspan="2"' : '').'>';
102 echo '<label for="mailingdata_terms_'.esc_attr($formName).'">';
103 echo '<input id="mailingdata_terms_'.esc_attr($formName).'" class="checkbox" type="checkbox" name="terms" aria-required="true" title="'.esc_attr(
104 acym_translation('ACYM_TERMS_CONDITIONS')
105 ).'"/> ';
106 echo wp_kses(
107 $termslink,
108 SecurityHelper::ALLOWED_HTML_TERMS
109 );
110 echo '</label>';
111 echo '</td>';
112 if (!$displayInline) {
113 echo '</tr><tr>';
114 }
115 }
116
117 if (!empty($showTrackingConsent)) {
118 $trackingChecked = (int)($identifiedUser->tracking ?? 0) === 1;
119 echo '<td class="acytracking" '.($displayOutside && !$displayInline ? 'colspan="2"' : '').'>';
120 echo '<label for="mailingdata_tracking_'.esc_attr($formName).'">';
121 echo '<input type="hidden" name="user[tracking]" value="0"/>';
122 echo '<input id="mailingdata_tracking_'.esc_attr($formName).'" class="checkbox" type="checkbox" name="user[tracking]" value="1" '.checked($trackingChecked, true, false).'/> '.esc_html(
123 acym_translation('ACYM_TRACKING_CONSENT')
124 );
125 echo '</label>';
126 echo '</td>';
127 if (!$displayInline) {
128 echo '</tr><tr>';
129 }
130 }
131 ?>
132
133 <td <?php if ($displayOutside && !$displayInline) echo 'colspan="2"'; ?> class="acysubbuttons">
134 <noscript><?php echo esc_html(acym_translation('ACYM_NO_JAVASCRIPT')); ?></noscript>
135 <?php
136 $onclickSubscribe = 'try{ return submitAcymForm("subscribe","'.$formName.'"); }catch(err){alert("The form could not be submitted "+err);return false;}';
137 $onclickUnsubscribe = 'try{ return submitAcymForm("unsubscribe","'.$formName.'"); }catch(err){alert("The form could not be submitted "+err);return false;}';
138 if ($disableButtons) {
139 $onclickSubscribe = 'return false;';
140 $onclickUnsubscribe = 'return false;';
141 }
142 ?>
143 <button type="submit"
144 class="btn btn-primary button subbutton"
145 onclick="<?php echo esc_attr($onclickSubscribe); ?>"><?php echo esc_html(acym_translation($subscribeText)); ?>
146 </button>
147 <?php if ($unsubButton === '2' || ($unsubButton === '1' && !empty($countUnsub))) { ?>
148 <button type="submit"
149 class="btn button unsubbutton"
150 onclick="<?php echo esc_attr($onclickUnsubscribe); ?>"><?php echo esc_html(acym_translation($unsubscribeText)); ?>
151 </button>
152 <?php } ?>
153 </td>
154 </tr>
155 </table>
156