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/default.php +84 -38 10.10.2 → 11.1.0 View file →
@@ -1,32 +1,49 @@
1 1 <?php
2 +// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- View file, its variables are local to the include scope, not true globals.
2 3
4 +defined('ABSPATH') || die('Restricted Access');
5 +
6 +// Prepare list display
3 7 use AcyMailing\Helpers\CaptchaHelper;
8 +use AcyMailing\Helpers\SecurityHelper;
4 9
5 -$listsContent = '';
6 -if (!empty($visibleLists)) {
7 - $listsContent .= '<table class="acym_lists">';
8 - foreach ($visibleLists as $myListId) {
9 - $check = '';
10 - if (in_array($myListId, $checkedLists)) {
11 - $check = 'checked="checked"';
10 +if (!function_exists('acymailing_displayWidgetLists')) {
11 + function acymailing_displayWidgetLists($allLists, $visibleLists, $checkedLists, $formName)
12 + {
13 + if (empty($visibleLists)) {
14 + return;
12 15 }
16 + ?>
13 17
14 - $listsContent .= '
15 - <tr>
16 - <td>
17 - <input type="checkbox" class="acym_checkbox" name="subscription[]" id="acylist_'.$myListId.'_'.$formName.'" '.$check.' value="'.$myListId.'"/>
18 - <label for="acylist_'.$myListId.'_'.$formName.'">'.(!empty($allLists[$myListId]->display_name) ? $allLists[$myListId]->display_name
19 - : $allLists[$myListId]->name).'</label>
20 - </td>
21 - </tr>';
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
22 38 }
23 - $listsContent .= '</table>';
24 39 }
25 -if ($listPosition == 'before') echo $listsContent;
40 +if ($listPosition === 'before') {
41 + acymailing_displayWidgetLists($allLists, $visibleLists, $checkedLists, $formName);
42 +}
26 43 ?>
27 44
28 -<table class="acym_form">
45 +<table class="acym_form" role="presentation">
29 46 <tr>
30 47 <?php
31 48 foreach ($fields as $field) {
32 49 $field->option = !empty($field->option) ? json_decode($field->option) : new stdClass();
@@ -48,43 +65,74 @@
48 65 $valuesArray[$value->value] = $value->title;
49 66 }
50 67 }
51 68
52 - echo '<td class="onefield acyfield_'.$field->id.' acyfield_'.$field->type.'">';
53 - echo $fieldClass->displayField($field, $field->default_value, $valuesArray, $displayOutside, true, $identifiedUser);
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);
54 71 echo '</td>';
55 - if (!$displayInline) echo '</tr><tr>';
72 + if (!$displayInline) {
73 + echo '</tr><tr>';
74 + }
56 75
57 76 if ($field->id == 2 && $config->get('email_confirmation')) {
58 - echo $fieldClass->setEmailConfirmationField($displayOutside, $field, 'td', $displayInline);
77 + $fieldClass->setEmailConfirmationField($displayOutside, $field, 'td', $displayInline);
59 78 }
60 79 }
61 80
62 - if ($listPosition != 'before') {
63 - echo '<td>'.$listsContent.'</td>';
64 - if (!$displayInline) echo '</tr><tr>';
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 + }
65 88 }
66 89
67 90 if (empty($identifiedUser->id) && $config->get('captcha', 'none') !== 'none' && acym_level(ACYM_ESSENTIAL)) {
68 91 echo '<td class="captchakeymodule" '.($displayOutside && !$displayInline ? 'colspan="2"' : '').'>';
69 92 $captcha = new CaptchaHelper();
70 - echo $captcha->display($formName);
93 + $captcha->display($formName);
71 94 echo '</td>';
72 - if (!$displayInline) echo '</tr><tr>';
95 + if (!$displayInline) {
96 + echo '</tr><tr>';
97 + }
73 98 }
74 99
75 100 if (!empty($termslink)) {
76 101 echo '<td class="acyterms" '.($displayOutside && !$displayInline ? 'colspan="2"' : '').'>';
77 - echo '<input id="mailingdata_terms_'.$formName.'" class="checkbox" type="checkbox" name="terms" title="'.acym_translation('ACYM_TERMS_CONDITIONS').'"/> '.$termslink;
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>';
78 111 echo '</td>';
79 - if (!$displayInline) echo '</tr><tr>';
112 + if (!$displayInline) {
113 + echo '</tr><tr>';
114 + }
80 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 + }
81 131 ?>
82 132
83 133 <td <?php if ($displayOutside && !$displayInline) echo 'colspan="2"'; ?> class="acysubbuttons">
84 - <noscript>
85 - <?php echo acym_translation('ACYM_NO_JAVASCRIPT'); ?>
86 - </noscript>
134 + <noscript><?php echo esc_html(acym_translation('ACYM_NO_JAVASCRIPT')); ?></noscript>
87 135 <?php
88 136 $onclickSubscribe = 'try{ return submitAcymForm("subscribe","'.$formName.'"); }catch(err){alert("The form could not be submitted "+err);return false;}';
89 137 $onclickUnsubscribe = 'try{ return submitAcymForm("unsubscribe","'.$formName.'"); }catch(err){alert("The form could not be submitted "+err);return false;}';
90 138 if ($disableButtons) {
@@ -92,17 +140,15 @@
92 140 $onclickUnsubscribe = 'return false;';
93 141 }
94 142 ?>
95 143 <button type="submit"
96 - class="btn btn-primary button subbutton"
97 - onclick="<?php echo acym_escape($onclickSubscribe); ?>">
98 - <?php echo acym_escape(acym_translation($subscribeText)); ?>
144 + class="btn btn-primary button subbutton"
145 + onclick="<?php echo esc_attr($onclickSubscribe); ?>"><?php echo esc_html(acym_translation($subscribeText)); ?>
99 146 </button>
100 147 <?php if ($unsubButton === '2' || ($unsubButton === '1' && !empty($countUnsub))) { ?>
101 148 <button type="submit"
102 - class="btn button unsubbutton"
103 - onclick="<?php echo acym_escape($onclickUnsubscribe); ?>">
104 - <?php echo acym_escape(acym_translation($unsubscribeText)); ?>
149 + class="btn button unsubbutton"
150 + onclick="<?php echo esc_attr($onclickUnsubscribe); ?>"><?php echo esc_html(acym_translation($unsubscribeText)); ?>
105 151 </button>
106 152 <?php } ?>
107 153 </td>
108 154 </tr>