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 | back/Views/Users/tmpl/export.php +108 -44 10.0.1 → 11.1.0 View file →
@@ -1,47 +1,84 @@
1 -<form id="acym_form" action="<?php echo acym_prepareAjaxURL(acym_getVar('cmd', 'ctrl')); ?>" method="post" name="acyForm">
1 +<?php
2 +// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- View file, its variables are local to the include scope, not true globals.
3 +defined('ABSPATH') || die('Restricted Access');
4 +use AcyMailing\Helpers\EntitySelectHelper;
5 +
6 +?>
7 +<form id="acym_form" action="<?php echo esc_url(acym_prepareAjaxURL(acym_getVar('cmd', 'ctrl'))); ?>" method="post" name="acyForm">
2 8 <div class="grid-x acym__content" id="acym__users__export">
3 9 <div class="cell grid-x grid-margin-x">
4 10 <div class="cell acym_area medium-6 acym__content">
5 - <div class="acym__title"><?php echo acym_translation('ACYM_FIELDS_TO_EXPORT'); ?></div>
6 - <p><span id="acym__users__export__check_all_field"><?php echo acym_strtolower(acym_translation('ACYM_ALL')); ?></span> |
7 - <span id="acym__users__export__check_default_field"><?php echo acym_strtolower(acym_translation('ACYM_DEFAULT')); ?></span></p>
11 + <div class="acym__title"><?php echo esc_html(acym_translation('ACYM_FIELDS_TO_EXPORT')); ?></div>
12 + <p><span id="acym__users__export__check_all_field"><?php echo esc_html(acym_strtolower(acym_translation('ACYM_ALL'))); ?></span> |
13 + <span id="acym__users__export__check_default_field"><?php echo esc_html(acym_strtolower(acym_translation('ACYM_DEFAULT'))); ?></span></p>
8 14 <div class="margin-bottom-1">
9 15 <?php
10 16 $defaultFields = explode(',', $this->config->get('export_fields', 'name,email'));
11 17 foreach ($data['fields'] as $fieldName) {
12 - if (in_array($fieldName, ['id', 'automation'])) continue;
13 -
14 - $checked = in_array($fieldName, $defaultFields) ? 'checked="checked"' : '';
15 - echo '<input '.$checked.' id="checkbox_'.$fieldName.'" class="acym__users__export__export_fields" type="checkbox" name="export_fields[]" value="'.$fieldName.'">
16 - <label for="checkbox_'.$fieldName.'">'.$fieldName.'</label><br/>';
18 + if (in_array($fieldName, ['id', 'automation'])) {
19 + continue;
20 + }
21 + ?>
22 + <input <?php checked(in_array($fieldName, $defaultFields)); ?>
23 + id="checkbox_<?php echo esc_attr($fieldName); ?>"
24 + class="acym__users__export__export_fields"
25 + type="checkbox"
26 + name="export_fields[]"
27 + value="<?php echo esc_attr($fieldName); ?>">
28 + <label for="checkbox_<?php echo esc_attr($fieldName); ?>"><?php echo esc_html($fieldName); ?></label>
29 + <br />
30 + <?php
17 31 }
18 32
19 33 foreach ($data['customfields'] as $field) {
20 - if ($field->type == 'file' || in_array($field->id, $data['coreFields'])) continue;
34 + if ($field->type === 'file' || in_array($field->id, $data['coreFields'])) {
35 + continue;
36 + }
21 37
22 - $checked = in_array($field->id, $defaultFields) ? 'checked="checked"' : '';
23 38 $fieldName = $field->name;
24 -
25 - echo '<input '.$checked.' id="checkbox_'.$fieldName.'" class="acym__users__export__export_fields" type="checkbox" name="export_fields[]" value="'.$field->id.'">
26 - <label for="checkbox_'.$fieldName.'">'.acym_translation($fieldName).'</label><br/>';
39 + ?>
40 + <input <?php checked(in_array($field->id, $defaultFields)); ?>
41 + id="checkbox_<?php echo esc_attr($fieldName); ?>"
42 + class="acym__users__export__export_fields"
43 + type="checkbox"
44 + name="export_fields[]"
45 + value="<?php echo esc_attr($field->id); ?>">
46 + <label for="checkbox_<?php echo esc_attr($fieldName); ?>">
47 + <?php echo esc_html(acym_translation($fieldName)); ?>
48 + </label>
49 + <br />
50 + <?php
27 51 }
52 + ?>
53 + <input <?php checked(in_array('subscribe_date', $defaultFields)); ?>
54 + id="checkbox_subscribe_date"
55 + class="acym__users__export__export_fields"
56 + type="checkbox"
57 + name="export_fields[]"
58 + value="subscribe_date">
59 + <label for="checkbox_subscribe_date">
60 + <?php echo esc_html(acym_translation('ACYM_SUBSCRIPTION_DATE')); ?>
61 + </label>
62 + <br />
28 63
29 - $checked = in_array('subscribe_date', $defaultFields) ? 'checked="checked"' : '';
30 - echo '<input '.$checked.' id="checkbox_subscribe_date" class="acym__users__export__export_fields" type="checkbox" name="export_fields[]" value="subscribe_date">
31 - <label for="checkbox_subscribe_date">'.acym_translation('ACYM_SUBSCRIPTION_DATE').'</label><br/>';
32 -
33 - $checked = in_array('unsubscribe_date', $defaultFields) ? 'checked="checked"' : '';
34 - echo '<input '.$checked.' id="checkbox_unsubscribe_date" class="acym__users__export__export_fields" type="checkbox" name="export_fields[]" value="unsubscribe_date">
35 - <label for="checkbox_unsubscribe_date">'.acym_translation('ACYM_UNSUBSCRIPTION_DATE').'</label><br/>';
36 - ?>
64 + <input <?php checked(in_array('unsubscribe_date', $defaultFields)); ?>
65 + id="checkbox_unsubscribe_date"
66 + class="acym__users__export__export_fields"
67 + type="checkbox"
68 + name="export_fields[]"
69 + value="unsubscribe_date">
70 + <label for="checkbox_unsubscribe_date">
71 + <?php echo esc_html(acym_translation('ACYM_UNSUBSCRIPTION_DATE')); ?>
72 + </label>
73 + <br />
37 74 </div>
38 75 <div class="grid-x margin-bottom-1" id="userField_separator">
39 - <label class="cell"><?php echo acym_translation('ACYM_SEPARATOR'); ?></label>
76 + <label class="cell"><?php echo esc_html(acym_translation('ACYM_SEPARATOR')); ?></label>
40 77 <?php
41 - echo acym_radio(
78 + acym_radio(
42 79 ['semicol' => acym_translation('ACYM_SEMICOLON'), 'comma' => acym_translation('ACYM_COMMA')],
43 - "export_separator",
80 + 'export_separator',
44 81 $this->config->get('export_separator', 'comma')
45 82 );
46 83 ?>
47 84 <div class="cell medium-auto"></div>
@@ -46,14 +83,15 @@
46 83 ?>
47 84 <div class="cell medium-auto"></div>
48 85 </div>
49 86 <div class="grid-x margin-bottom-1">
50 - <label class="cell medium-6 xxlarge-3"><?php echo acym_translation('ACYM_ENCODING'); ?>
87 + <label class="cell medium-6 xxlarge-3"><?php echo esc_html(acym_translation('ACYM_ENCODING')); ?>
51 88 <?php
52 - echo $data['encodingHelper']->charsetField(
89 + $data['encodingHelper']->charsetField(
53 90 'export_charset',
54 91 $this->config->get('export_charset', 'UTF-8'),
55 - 'class="acym__select"'
92 + ['class' => 'acym__select'],
93 + true
56 94 );
57 95 ?>
58 96 </label>
59 97 <div class="cell medium-auto"></div>
@@ -58,13 +96,14 @@
58 96 </label>
59 97 <div class="cell medium-auto"></div>
60 98 </div>
61 99 <div class="grid-x" id="userField_excel">
62 - <label class="cell"><?php echo acym_translation('ACYM_EXCEL_SECURITY').acym_info('ACYM_EXCEL_SECURITY_DESC'); ?></label>
100 + <label class="cell"><?php echo esc_html(acym_translation('ACYM_EXCEL_SECURITY'));
101 + acym_info(['textShownInTooltip' => 'ACYM_EXCEL_SECURITY_DESC']); ?></label>
63 102 <?php
64 - echo acym_boolean(
103 + acym_boolean(
65 104 'export_excelsecurity',
66 - $this->config->get('export_excelsecurity', 0)
105 + (bool)$this->config->get('export_excelsecurity', 0)
67 106 );
68 107 ?>
69 108 <div class="cell medium-auto"></div>
70 109 </div>
@@ -69,14 +108,14 @@
69 108 <div class="cell medium-auto"></div>
70 109 </div>
71 110 </div>
72 111 <div class="cell acym_area medium-6 acym__content">
73 - <div class="acym__title"><?php echo acym_translation('ACYM_SUBSCRIBERS_TO_EXPORT'); ?></div>
74 - <p class="cell margin-bottom-1"><?php echo acym_translation('ACYM_WARNING_FILTERS_APPLIED_EXPORT'); ?></p>
112 + <div class="acym__title"><?php echo esc_html(acym_translation('ACYM_SUBSCRIBERS_TO_EXPORT')); ?></div>
113 + <p class="cell margin-bottom-1"><?php echo esc_html(acym_translation('ACYM_WARNING_FILTERS_APPLIED_EXPORT')); ?></p>
75 114 <?php if (empty($data['checkedElements']) || $data['isPreselectedList']) { ?>
76 115 <fieldset id="acym__users__export__users-to-export">
77 116 <?php
78 - echo acym_radio(
117 + acym_radio(
79 118 [
80 119 'all' => acym_translation('ACYM_ALL_SUBSCRIBERS'),
81 120 'list' => acym_translation('ACYM_SUBSCRIBERS_FROM_LISTS'),
82 121 ],
@@ -85,12 +124,32 @@
85 124 );
86 125 ?>
87 126 </fieldset>
88 127 <div id="acym__users__export__select_lists" class="margin-bottom-1" style="display: <?php echo $data['isPreselectedList'] ? 'block' : 'none'; ?>">
89 - <?php echo $data['entitySelect']; ?>
128 + <?php
129 + $entityHelper = new EntitySelectHelper();
130 + if ($data['isPreselectedList']) {
131 + $entityHelper->entitySelect(
132 + [
133 + 'display' => true,
134 + 'entity' => 'list',
135 + 'entityParams' => ['join' => 'join_lists-'.implode(',', $data['checkedElements'])],
136 + 'columnsToDisplay' => $entityHelper->getColumnsForList('lists.list_id', true),
137 + ]
138 + );
139 + } else {
140 + $entityHelper->entitySelect(
141 + [
142 + 'display' => true,
143 + 'entity' => 'list',
144 + 'columnsToDisplay' => $entityHelper->getColumnsForList('', true),
145 + ]
146 + );
147 + }
148 + ?>
90 149 <div class="margin-top-1">
91 150 <?php
92 - echo acym_radio(
151 + acym_radio(
93 152 [
94 153 'sub' => acym_translation('ACYM_SUBSCRIBED_USER'),
95 154 'unsub' => acym_translation('ACYM_UNSUBSCRIBED_USER'),
96 155 'all' => acym_translation('ACYM_EXPORT_BOTH'),
@@ -102,14 +161,14 @@
102 161 ?>
103 162 </div>
104 163 </div>
105 164 <div id="acym__users__export__segments" class="padding-top-1">
106 - <?php echo acym_translation('ACYM_FILTER_EXPORTED_SUBSCRIBERS_SEGMENT'); ?>
165 + <?php echo esc_html(acym_translation('ACYM_FILTER_EXPORTED_SUBSCRIBERS_SEGMENT')); ?>
107 166 </div>
108 167 <div id="acym__users__export__select_segments" class="margin-bottom-1">
109 168 <div class="margin-bottom-1 margin-top-1">
110 169 <?php
111 - echo acym_select(
170 + acym_select(
112 171 $data['segments'],
113 172 'export_segment',
114 173 $data['preselectedSegment'],
115 174 [
@@ -114,15 +173,20 @@
114 173 $data['preselectedSegment'],
115 174 [
116 175 'class' => 'acym__select',
117 176 'acym-data-infinite' => '',
118 - ]
177 + ],
178 + 'value',
179 + 'text',
180 + null,
181 + false,
182 + true
119 183 );
120 184 ?>
121 185 </div>
122 186 </div>
123 187 <?php } else { ?>
124 - <input type="hidden" name="selected_users" value="<?php echo implode(',', $data['checkedElements']); ?>" />
188 + <input type="hidden" name="selected_users" value="<?php echo esc_attr(implode(',', $data['checkedElements'])); ?>" />
125 189 <div class="grid-x">
126 190 <?php
127 191 if (!$data['isPreselectedList']) {
128 192 foreach ($data['checkedElements'] as $id) {
@@ -127,10 +191,10 @@
127 191 if (!$data['isPreselectedList']) {
128 192 foreach ($data['checkedElements'] as $id) {
129 193 $user = $data['userClass']->getOneById($id);
130 194 echo '<div class="cell grid-x acym__listing__row">';
131 - echo ' <div class="cell small-6">'.$user->name.'</div>
132 - <div class="cell small-6">'.$user->email.'</div>';
195 + echo ' <div class="cell small-6">'.esc_html($user->name ?? '').'</div>
196 + <div class="cell small-6">'.esc_html($user->email).'</div>';
133 197 echo '</div>';
134 198 }
135 199 }
136 200 ?>
@@ -140,13 +204,13 @@
140 204 </div>
141 205 <div class="cell grid-x grid-margin-x margin-top-1">
142 206 <div class="cell hide-for-small-only medium-auto"></div>
143 207 <?php
144 - echo acym_cancelButton();
208 + acym_cancelButton();
145 209 $exportButton = '<button type="button" data-task="doexport" class="cell button acy_button_submit" id="acym__export__button">';
146 210 $exportButton .= acym_translation('ACYM_EXPORT_SUBSCRIBERS');
147 211 $exportButton .= '</button>';
148 - echo acym_tooltip(
212 + acym_tooltip(
149 213 [
150 214 'hoveredText' => $exportButton,
151 215 'textShownInTooltip' => acym_translation('ACYM_DATA_WILL_EXPORT_CSV_FORMAT'),
152 216 ]