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

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