PluginProbe ʕ •ᴥ•ʔ
Brevo – Email, SMS, Web Push, Chat, and more. / 3.3.2
Brevo – Email, SMS, Web Push, Chat, and more. v3.3.2
2.9.13 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8 2.9.9 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.9 3.1.0 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.2 3.1.20 3.1.21 3.1.22 3.1.23 3.1.24 3.1.25 3.1.26 3.1.27 3.1.28 3.1.29 3.1.3 3.1.30 3.1.31 3.1.32 3.1.33 3.1.34 3.1.35 3.1.36 3.1.37 3.1.38 3.1.39 3.1.4 3.1.40 3.1.41 3.1.42 3.1.43 3.1.44 3.1.45 3.1.46 3.1.47 3.1.48 3.1.49 3.1.5 3.1.50 3.1.51 3.1.52 3.1.53 3.1.54 3.1.55 3.1.56 3.1.57 3.1.58 3.1.59 3.1.6 3.1.60 3.1.61 3.1.62 3.1.63 3.1.64 3.1.65 3.1.66 3.1.67 3.1.68 3.1.69 3.1.7 3.1.70 3.1.71 3.1.72 3.1.73 3.1.74 3.1.75 3.1.76 3.1.77 3.1.78 3.1.79 3.1.8 3.1.80 3.1.81 3.1.82 3.1.83 3.1.84 3.1.85 3.1.86 3.1.87 3.1.88 3.1.89 3.1.9 3.1.90 3.1.91 3.1.92 3.1.93 3.1.94 3.1.95 3.1.96 3.1.97 3.1.98 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 trunk 1.0 1.5 2.0.8 2.9.10 2.9.11 2.9.12
mailin / inc / push-settings.php
mailin / inc Last commit date
templates 1 year ago SendinblueAccount.php 1 year ago SendinblueApiClient.php 4 months ago function.wp_mail.php 8 years ago http-build-url.php 1 year ago index.php 8 years ago mailin.php 3 years ago push-admin.php 5 months ago push-amp.php 1 year ago push-api.php 5 months ago push-httpclient.php 1 year ago push-public.php 1 year ago push-settings.php 5 months ago push-utils.php 5 months ago push-woocommerce.php 11 months ago sendinblue.php 3 years ago sib-api-manager.php 1 year ago sib-form-preview.php 2 years ago sib-sms-code.php 5 months ago table-forms.php 1 year ago
push-settings.php
301 lines
1 <?php
2 if (!defined( 'ABSPATH' )) { http_response_code(403); exit(); }
3
4 if ( ! class_exists( 'SIB_Push_Settings' ) ) {
5 class SIB_Push_Settings {
6 /** @var SIB_Push_Settings */
7 static $instance;
8 static $defaults = array(
9 );
10 /** @var array */
11 private $settings;
12
13 private function __construct($settings) {
14 if (is_array($settings)) $this->settings = $settings;
15 else $this->settings = array();
16 }
17
18 private function get($name) {
19 if (isset($this->settings[$name])) return $this->settings[$name];
20 return array_key_exists($name, self::$defaults) ? self::$defaults[$name] : null;
21 }
22
23 private function has($name) {
24 return isset($this->settings[$name]);
25 }
26
27 private function set($name, $value) {
28 if ($value === null) unset($this->settings[$name]);
29 else $this->settings[$name] = $value;
30 return $this;
31 }
32
33 public function getWonderPushCredentials() {
34 $apiKey = get_option( SIB_Manager::API_KEY_V3_OPTION_NAME );
35 if (!$apiKey) return null;
36 return new WonderPush\BrevoAPIKeyV3Credentials($apiKey);
37 }
38
39 public function getDeliveryTimeSeconds() {
40 return $this->get('deliveryTimeSeconds') ?: 0;
41 }
42
43 public function setDeliveryTimeSeconds($value) {
44 return $this->set('deliveryTimeSeconds', is_int($value) ? $value : 0);
45 }
46
47 public function getBypassWordPressHttpClient() {
48 $storedValue = $this->get('bypassWordPressHttpClient');
49 if ($storedValue === null) return true; // Bypass by default
50 return $storedValue ? true : false;
51 }
52
53 public function setBypassWordPressHttpClient($value) {
54 return $this->set('bypassWordPressHttpClient', (bool)$value);
55 }
56
57 public function getDefaultTargetSegmentId() {
58 return $this->get('defaultTargetSegmentId');
59 }
60 public function setDefaultTargetSegmentId($value) {
61 return $this->set('defaultTargetSegmentId', $value ?: null); // Prevent 0
62 }
63 public function getDefaultTargetListId() {
64 return $this->get('defaultTargetListId');
65 }
66 public function setDefaultTargetListId($value) {
67 return $this->set('defaultTargetListId', $value ?: null); // Prevent 0
68 }
69 public function getAdditionalCustomPostTypes() {
70 return $this->get('additionalCustomPostTypes');
71 }
72 public function setAdditionalCustomPostTypes($value) {
73 return $this->set('additionalCustomPostTypes', $value);
74 }
75
76 public function getDisableSendOnPublish() {
77 return $this->get('disableSendOnPublish') ? true : false;
78 }
79
80 public function setDisableSendOnPublish($value) {
81 return $this->set('disableSendOnPublish', $value ? true : false);
82 }
83
84 public function getDisableSendByDefaultOnPublish() {
85 return $this->get('disableSendByDefaultOnPublish') ? true : false;
86 }
87
88 public function getSendOnThirdPartyPublish() {
89 return $this->get('sendOnThirdPartyPublish') ? true : false;
90 }
91
92 public function setDisableSendByDefaultOnPublish($value) {
93 return $this->set('disableSendByDefaultOnPublish', $value ? true : false);
94 }
95
96 public function setSendOnThirdPartyPublish($value) {
97 return $this->set('sendOnThirdPartyPublish', $value ? true : false);
98 }
99
100 public function getDisableFeedbackOnPublish() {
101 return $this->get('disableFeedbackOnPublish') ? true : false;
102 }
103
104 public function setDisableFeedbackOnPublish($value) {
105 return $this->set('disableFeedbackOnPublish', $value ? true : false);
106 }
107
108 public function getDisableUsePostImageForNotification() {
109 return $this->get('disableUsePostImageForNotification') ? true : false;
110 }
111
112 public function setDisableUsePostImageForNotification($value) {
113 return $this->set('disableUsePostImageForNotification', $value ? true : false);
114 }
115
116 public function getPreferLargeImageForNotification() {
117 return $this->get('preferLargeImageForNotification') ? true : false;
118 }
119
120 public function setPreferLargeImageForNotification($value) {
121 return $this->set('preferLargeImageForNotification', $value ? true : false);
122 }
123
124 public function getNotificationTitle() {
125 return $this->get('notificationTitle');
126 }
127
128 public function setNotificationTitle($value) {
129 return $this->set('notificationTitle', $value);
130 }
131
132 public function getEnableOrderCompleteNotifications() {
133 return $this->get('enableOrderCompleteNotifications') ? true : false;
134 }
135
136 public function setEnableOrderCompleteNotifications($value) {
137 return $this->set('enableOrderCompleteNotifications', $value ? true : false);
138 }
139
140 public function getOrderCompleteNotificationsMessage() {
141 return $this->get('orderCompleteNotificationsMessage');
142 }
143
144 public function setOrderCompleteNotificationsMessage($value) {
145 $this->set('orderCompleteNotificationsMessage', $value);
146 return $this;
147 }
148
149 public function getEnableOrderProcessingNotifications() {
150 return $this->get('enableOrderProcessingNotifications') ? true : false;
151 }
152
153 public function setEnableOrderProcessingNotifications($value) {
154 return $this->set('enableOrderProcessingNotifications', $value ? true : false);
155 }
156
157 public function getOrderProcessingNotificationsMessage() {
158 return $this->get('orderProcessingNotificationsMessage');
159 }
160
161 public function setOrderProcessingNotificationsMessage($value) {
162 $this->set('orderProcessingNotificationsMessage', $value);
163 return $this;
164 }
165
166 public function getCartReminderCampaignId() {
167 return $this->get('cartReminderCampaignId');
168 }
169
170 public function setCartReminderCampaignId($value) {
171 return $this->set('cartReminderCampaignId', $value);
172 }
173
174 public function getDisableThankYouEvent() {
175 return $this->get('disableThankYouEvent') ? true : false;
176 }
177
178 public function setDisableThankYouEvent($value) {
179 return $this->set('disableThankYouEvent', $value ? true : false);
180 }
181
182 public function getThankYouEventName() {
183 return $this->get('thankYouEventName');
184 }
185
186 public function setThankYouEventName($value) {
187 return $this->set('thankYouEventName', $value);
188 }
189
190 public function getDisableAmpUnsubscribe() {
191 return $this->get('disableAmpUnsubscribe') ? true : false;
192 }
193
194 public function setDisableAmpUnsubscribe($value) {
195 return $this->set('disableAmpUnsubscribe', $value ? true : false);
196 }
197
198 public function getAmpSubscribeButtonLabel() {
199 return $this->get('ampSubscribeButtonLabel');
200 }
201
202 public function setAmpSubscribeButtonLabel($value) {
203 return $this->set('ampSubscribeButtonLabel', $value ? $value : null);
204 }
205
206 public function getAmpUnsubscribeButtonLabel() {
207 return $this->get('ampUnsubscribeButtonLabel');
208 }
209
210 public function setAmpUnsubscribeButtonLabel($value) {
211 return $this->set('ampUnsubscribeButtonLabel', $value ? $value : null);
212 }
213
214 public function getDisableAmpTopSubscribeButton() {
215 return $this->get('disableAmpTopSubscribeButton') ? true : false;
216 }
217
218 public function setDisableAmpTopSubscribeButton($value) {
219 return $this->set('disableAmpTopSubscribeButton', $value ? true : false);
220 }
221
222 public function getDisableAmpBottomSubscribeButton() {
223 return $this->get('disableAmpBottomSubscribeButton') ? true : false;
224 }
225
226 public function setDisableAmpBottomSubscribeButton($value) {
227 return $this->set('disableAmpBottomSubscribeButton', $value ? true : false);
228 }
229
230 public function getAmpButtonWidth() {
231 return $this->get('ampButtonWidth');
232 }
233
234 public function setAmpButtonWidth($value) {
235 return $this->set('ampButtonWidth', is_int($value) ? $value : null);
236 }
237
238 public function getAmpButtonHeight() {
239 return $this->get('ampButtonHeight');
240 }
241
242 public function setAmpButtonHeight($value) {
243 return $this->set('ampButtonHeight', is_int($value) ? $value : null);
244 }
245
246 public function getAdditionalInitOptionsJson() {
247 return $this->get('additionalInitOptionsJson');
248 }
249
250 public function setAdditionalInitOptionsJson($value) {
251 $this->set('additionalInitOptionsJson', $value);
252 return $this;
253 }
254
255 public function getShowPush() {
256 return $this->get('showPush') ? true : false;
257 }
258
259 public function setShowPush($value) {
260 return $this->set('showPush', $value ? true : false);
261 }
262
263 public function getHideAdminBarShortcut() {
264 return $this->get('hideAdminBarShortcut') ? true : false;
265 }
266
267 public function setHideAdminBarShortcut($value) {
268 return $this->set('hideAdminBarShortcut', $value ? true : false);
269 }
270
271 public function getSendOnlyToThisDomain() {
272 $storedValue = $this->get('sendOnlyToThisDomain');
273 if ($storedValue === null) return true; // Default to true
274 return $storedValue ? true : false;
275 }
276
277 public function setSendOnlyToThisDomain($value) {
278 return $this->set('sendOnlyToThisDomain', $value ? true : false);
279 }
280
281 public function save() {
282 update_option(SIB_Manager::PUSH_SETTINGS_OPTION_NAME, $this->settings);
283 }
284
285 /**
286 * @return SIB_Push_Settings
287 */
288 public static function getSettings() {
289 if (!self::$instance) self::$instance = new SIB_Push_Settings(get_option(SIB_Manager::PUSH_SETTINGS_OPTION_NAME));
290 return self::$instance;
291 }
292
293 /** Deletes all push related settings */
294 public static function clearAllSettings() {
295 delete_option(SIB_Manager::PUSH_SETTINGS_OPTION_NAME);
296 }
297
298 }
299
300 }
301