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/archive/widget.php +58 -31 10.1.4 → 11.1.0 View file →
@@ -1,6 +1,8 @@
1 1 <?php
2 2
3 +defined('ABSPATH') || die('Restricted Access');
4 +
3 5 use AcyMailing\Classes\ListClass;
4 6 use AcyMailing\FrontControllers\ArchiveController;
5 7
6 8 class acym_archive_widget extends WP_Widget
@@ -15,8 +17,9 @@
15 17 ['description' => acym_translation('ACYM_MENU_ARCHIVE_DESC')]
16 18 );
17 19 }
18 20
21 + //Widget Configuration
19 22 public function form($instance)
20 23 {
21 24 $this->loadAcyMailing();
22 25
@@ -22,10 +25,10 @@
22 25
23 26 $params = [
24 27 'title' => 'See all newsletters',
25 28 'lists' => '',
26 - 'popup' => '1',
27 - 'displayUserListOnly' => '1',
29 + 'popup' => true,
30 + 'displayUserListOnly' => true,
28 31 'nbNewslettersPerPage' => '10',
29 32 ];
30 33
31 34 $listClass = new ListClass();
@@ -44,34 +47,52 @@
44 47 if (is_array($valueParam)) {
45 48 $valueParam = implode(',', $valueParam);
46 49 }
47 50
48 - $valueParam = esc_attr($valueParam);
51 + if (in_array($keyParam, ['popup', 'displayUserListOnly'])) {
52 + $valueParam = (bool)$valueParam;
53 + } else {
54 + $valueParam = esc_attr($valueParam);
55 + }
49 56 }
50 57
51 58 echo '<div class="acyblock">';
52 - echo '<p><label class="acyWPconfig" for="'.$this->get_field_id('title').'">'.acym_translation('ACYM_TITLE').'</label>
53 - <input type="text" class="widefat" id="'.$this->get_field_id('title').'" name="'.$this->get_field_name('title').'" value="'.$params['title'].'" /></p>';
54 - echo '<p><label class="acyWPconfig"> '.acym_translation('ACYM_WIDGET_CAMPAIGN_NUMBER_PER_PAGE').'</label>
55 - '.acym_translationSprintf(
56 - 'ACYM_X_NEWSLETTERS_PER_PAGE',
57 - acym_select(
58 - [
59 - '5' => '5',
60 - '10' => '10',
61 - '15' => '15',
62 - '20' => '20',
63 - '30' => '30',
64 - '50' => '50',
65 - '100' => '100',
66 - '200' => '200',
59 + echo '<p><label class="acyWPconfig" for="'.esc_attr($this->get_field_id('title')).'">'.esc_html(acym_translation('ACYM_TITLE')).'</label>
60 + <input type="text" class="widefat" id="'.esc_attr($this->get_field_id('title')).'" name="'.esc_attr($this->get_field_name('title')).'" value="'.esc_attr(
61 + $params['title']
62 + ).'" /></p>';
63 + echo '<p><label class="acyWPconfig"> '.esc_html(acym_translation('ACYM_WIDGET_CAMPAIGN_NUMBER_PER_PAGE')).'</label>
64 + '.wp_kses(
65 + acym_translationSprintf(
66 + 'ACYM_X_NEWSLETTERS_PER_PAGE',
67 + acym_select(
68 + [
69 + '5' => '5',
70 + '10' => '10',
71 + '15' => '15',
72 + '20' => '20',
73 + '30' => '30',
74 + '50' => '50',
75 + '100' => '100',
76 + '200' => '200',
77 + ],
78 + $this->get_field_name('nbNewslettersPerPage'),
79 + $params['nbNewslettersPerPage']
80 + )
81 + ),
82 + [
83 + 'select' => [
84 + 'name' => true,
85 + 'id' => true,
67 86 ],
68 - $this->get_field_name('nbNewslettersPerPage'),
69 - $params['nbNewslettersPerPage']
70 - )
87 + 'option' => [
88 + 'value' => true,
89 + 'selected' => true,
90 + ],
91 + ]
71 92 ).'</p>';
72 - echo '<p><label class="acyWPconfig" title="'.acym_translation('ACYM_LISTS_ARCHIVE').'">'.acym_translation('ACYM_LISTS').'</label>';
73 - echo acym_selectMultiple(
93 + echo '<p><label class="acyWPconfig" title="'.esc_attr(acym_translation('ACYM_LISTS_ARCHIVE')).'">'.esc_html(acym_translation('ACYM_LISTS')).'</label>';
94 + acym_selectMultiple(
74 95 $lists,
75 96 $this->get_field_name('lists'),
76 97 explode(',', $params['lists']),
77 98 [
@@ -78,20 +99,24 @@
78 99 'style' => 'width:100%;',
79 100 'id' => $this->get_field_id('lists'),
80 101 ],
81 102 'id',
82 - 'name'
103 + 'name',
104 + true
83 105 );
84 106
85 - echo '<p><label class="acyWPconfig" title="'.acym_translation('ACYM_ARCHIVE_POPUP_DESC').'">'.acym_translation('ACYM_ARCHIVE_POPUP').'</label>';
86 - echo acym_boolean($this->get_field_name('popup'), $params['popup'], $this->get_field_id('popup')).'</p>';
107 + echo '<p><label class="acyWPconfig" title="'.esc_attr(acym_translation('ACYM_ARCHIVE_POPUP_DESC')).'">'.esc_html(acym_translation('ACYM_ARCHIVE_POPUP')).'</label>';
108 + acym_boolean($this->get_field_name('popup'), $params['popup'], $this->get_field_id('popup')).'</p>';
87 109
88 - echo '<p><label class="acyWPconfig" title="'.acym_translation('ACYM_ARCHIVE_ONLY_USER_LIST_DESC').'">'.acym_translation('ACYM_ARCHIVE_ONLY_USER_LIST').'</label>';
89 - echo acym_boolean($this->get_field_name('displayUserListOnly'), $params['displayUserListOnly'], $this->get_field_id('displayUserListOnly')).'</p>';
110 + echo '<p><label class="acyWPconfig" title="'.esc_attr(acym_translation('ACYM_ARCHIVE_ONLY_USER_LIST_DESC')).'">'.esc_html(
111 + acym_translation('ACYM_ARCHIVE_ONLY_USER_LIST')
112 + ).'</label>';
113 + acym_boolean($this->get_field_name('displayUserListOnly'), $params['displayUserListOnly'], $this->get_field_id('displayUserListOnly')).'</p>';
90 114
91 115 echo '</div>';
92 116 }
93 117
118 + // Widget's output
94 119 public function widget($args, $instance)
95 120 {
96 121 $this->loadAcyMailing();
97 122
@@ -98,14 +123,16 @@
98 123 if (!acym_isElementorEdition()) {
99 124 acym_loadAssets('archive', 'listing');
100 125 }
101 126
102 - echo $args['before_widget'];
127 + echo wp_kses_post($args['before_widget']);
103 128
104 129 if (!isset($instance['title'])) $instance['title'] = '';
105 130 $title = apply_filters('widget_title', $instance['title'], $instance, $args['widget_id']);
106 131 if (!empty($title)) {
107 - echo $args['before_title'].$title.$args['after_title'];
132 + echo wp_kses_post($args['before_title']);
133 + echo esc_html($title);
134 + echo wp_kses_post($args['after_title']);
108 135 }
109 136
110 137 acym_setVar('page', 'front');
111 138 $searchs = acym_getVar('array', 'acym_search', []);
@@ -123,9 +150,9 @@
123 150
124 151 $archiveController = new ArchiveController();
125 152 $archiveController->showArchive($viewParams);
126 153
127 - echo $args['after_widget'];
154 + echo wp_kses_post($args['after_widget']);
128 155 }
129 156
130 157 private function loadAcyMailing(): void
131 158 {