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 | WpInit/UserSync.php +42 -15 10.0.1 → 11.1.0 View file →
@@ -1,8 +1,10 @@
1 1 <?php
2 2
3 3 namespace AcyMailing\WpInit;
4 4
5 +defined('ABSPATH') || die('Restricted Access');
6 +
5 7 use AcyMailing\Classes\UserClass;
6 8 use AcyMailing\Helpers\RegacyHelper;
7 9
8 10 class UserSync
@@ -8,12 +10,14 @@
8 10 class UserSync
9 11 {
10 12 public function __construct()
11 13 {
14 + // Let the users opt in to the AcyMailing lists
12 15 add_action('register_form', [$this, 'addRegistrationFields']);
13 16 add_action('edit_user_profile', [$this, 'addProfileFields'], 10, 1);
14 17 add_action('show_user_profile', [$this, 'addProfileFields'], 10, 1);
15 18
19 + // Hooks to create/update an Acy user when a WP user is created/updated
16 20 add_action('user_register', [$this, 'synchSaveUsers'], 10, 1);
17 21 add_action('profile_update', [$this, 'synchSaveUsers'], 10, 2);
18 22 add_action('delete_user', [$this, 'synchDeleteUsers']);
19 23 }
@@ -31,10 +35,30 @@
31 35 if (!$regacyHelper->prepareLists(['formatted' => true])) return;
32 36
33 37 ?>
34 38 <div class="acym__regacy">
35 - <label class="acym__regacy__label"><?php echo $regacyHelper->label; ?></label>
36 - <div class="acym__regacy__values"><?php echo $regacyHelper->lists; ?></div>
39 + <label class="acym__regacy__label"><?php echo esc_html($regacyHelper->label); ?></label>
40 + <div class="acym__regacy__values">
41 + <?php
42 + echo wp_kses(
43 + $regacyHelper->listsHtml,
44 + [
45 + 'table' => ['class' => [], 'style' => []],
46 + 'tr' => ['style' => []],
47 + 'td' => ['style' => []],
48 + 'input' => [
49 + 'type' => [],
50 + 'name' => [],
51 + 'id' => [],
52 + 'value' => [],
53 + 'class' => [],
54 + 'checked' => [],
55 + ],
56 + 'label' => ['for' => [], 'class' => []],
57 + ]
58 + );
59 + ?>
60 + </div>
37 61 </div>
38 62 <?php
39 63 }
40 64
@@ -39,32 +63,35 @@
39 63 }
40 64
41 65 public function addProfileFields()
42 66 {
43 -
44 67 $config = acym_config();
45 - if (!$config->get('regacy', 0)) return;
68 + if (!$config->get('regacy', 0)) {
69 + return;
70 + }
46 71
47 72 $regacyHelper = new RegacyHelper();
48 - if (!$regacyHelper->prepareLists([])) return;
49 -
73 + if (!$regacyHelper->prepareLists([])) {
74 + return;
75 + }
50 76 ?>
51 - <h2><?php echo acym_translation('ACYM_SUBSCRIPTION'); ?></h2>
77 + <h2><?php echo esc_html(acym_translation('ACYM_SUBSCRIPTION')); ?></h2>
52 78 <table class="form-table">
53 79 <tbody>
54 80 <?php
55 81 foreach ($regacyHelper->lists as $listId => $oneList) {
56 - $checked = $oneList['checked'] ? 'checked="checked"' : '';
57 82 ?>
58 83 <tr>
59 - <th scope="row"><label class="acym__regacy__lists__label" for="acym__regacy__lists-<?php echo intval($listId); ?>"><?php echo acym_escape(
60 - $oneList['name']
61 - ); ?></label></th>
84 + <th scope="row">
85 + <label class="acym__regacy__lists__label" for="acym__regacy__lists-<?php echo intval($listId); ?>">
86 + <?php echo esc_html($oneList['name']); ?>
87 + </label>
88 + </th>
62 89 <td>
63 90 <input name="regacy_visible_lists_checked[]"
64 - type="checkbox"
65 - id="acym__regacy__lists-<?php echo intval($listId); ?>"
66 - value="<?php echo intval($listId); ?>" <?php echo $checked; ?>>
91 + type="checkbox"
92 + id="acym__regacy__lists-<?php echo intval($listId); ?>"
93 + value="<?php echo intval($listId); ?>" <?php checked($oneList['checked']); ?>>
67 94 </td>
68 95 </tr>
69 96 <?php
70 97 }
@@ -70,9 +97,9 @@
70 97 }
71 98 ?>
72 99 </tbody>
73 100 </table>
74 - <input type="hidden" value="<?php echo implode(',', array_keys($regacyHelper->lists)); ?>" name="regacy_visible_lists" />
101 + <input type="hidden" value="<?php echo esc_attr(implode(',', array_keys($regacyHelper->lists))); ?>" name="regacy_visible_lists" />
75 102 <input type="hidden" value="WordPress user profile" name="acy_source" />
76 103 <?php
77 104 }
78 105