PluginProbe ʕ •ᴥ•ʔ
Brevo – Email, SMS, Web Push, Chat, and more. / 3.3.4
Brevo – Email, SMS, Web Push, Chat, and more. v3.3.4
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 2 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 3 months ago push-httpclient.php 1 year ago push-public.php 1 year ago push-settings.php 3 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
302 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 (!function_exists('curl_exec')) return false; // No curl, force use WP_Http
50 if ($storedValue === null) return true; // Bypass by default
51 return $storedValue ? true : false;
52 }
53
54 public function setBypassWordPressHttpClient($value) {
55 return $this->set('bypassWordPressHttpClient', (bool)$value);
56 }
57
58 public function getDefaultTargetSegmentId() {
59 return $this->get('defaultTargetSegmentId');
60 }
61 public function setDefaultTargetSegmentId($value) {
62 return $this->set('defaultTargetSegmentId', $value ?: null); // Prevent 0
63 }
64 public function getDefaultTargetListId() {
65 return $this->get('defaultTargetListId');
66 }
67 public function setDefaultTargetListId($value) {
68 return $this->set('defaultTargetListId', $value ?: null); // Prevent 0
69 }
70 public function getAdditionalCustomPostTypes() {
71 return $this->get('additionalCustomPostTypes');
72 }
73 public function setAdditionalCustomPostTypes($value) {
74 return $this->set('additionalCustomPostTypes', $value);
75 }
76
77 public function getDisableSendOnPublish() {
78 return $this->get('disableSendOnPublish') ? true : false;
79 }
80
81 public function setDisableSendOnPublish($value) {
82 return $this->set('disableSendOnPublish', $value ? true : false);
83 }
84
85 public function getDisableSendByDefaultOnPublish() {
86 return $this->get('disableSendByDefaultOnPublish') ? true : false;
87 }
88
89 public function getSendOnThirdPartyPublish() {
90 return $this->get('sendOnThirdPartyPublish') ? true : false;
91 }
92
93 public function setDisableSendByDefaultOnPublish($value) {
94 return $this->set('disableSendByDefaultOnPublish', $value ? true : false);
95 }
96
97 public function setSendOnThirdPartyPublish($value) {
98 return $this->set('sendOnThirdPartyPublish', $value ? true : false);
99 }
100
101 public function getDisableFeedbackOnPublish() {
102 return $this->get('disableFeedbackOnPublish') ? true : false;
103 }
104
105 public function setDisableFeedbackOnPublish($value) {
106 return $this->set('disableFeedbackOnPublish', $value ? true : false);
107 }
108
109 public function getDisableUsePostImageForNotification() {
110 return $this->get('disableUsePostImageForNotification') ? true : false;
111 }
112
113 public function setDisableUsePostImageForNotification($value) {
114 return $this->set('disableUsePostImageForNotification', $value ? true : false);
115 }
116
117 public function getPreferLargeImageForNotification() {
118 return $this->get('preferLargeImageForNotification') ? true : false;
119 }
120
121 public function setPreferLargeImageForNotification($value) {
122 return $this->set('preferLargeImageForNotification', $value ? true : false);
123 }
124
125 public function getNotificationTitle() {
126 return $this->get('notificationTitle');
127 }
128
129 public function setNotificationTitle($value) {
130 return $this->set('notificationTitle', $value);
131 }
132
133 public function getEnableOrderCompleteNotifications() {
134 return $this->get('enableOrderCompleteNotifications') ? true : false;
135 }
136
137 public function setEnableOrderCompleteNotifications($value) {
138 return $this->set('enableOrderCompleteNotifications', $value ? true : false);
139 }
140
141 public function getOrderCompleteNotificationsMessage() {
142 return $this->get('orderCompleteNotificationsMessage');
143 }
144
145 public function setOrderCompleteNotificationsMessage($value) {
146 $this->set('orderCompleteNotificationsMessage', $value);
147 return $this;
148 }
149
150 public function getEnableOrderProcessingNotifications() {
151 return $this->get('enableOrderProcessingNotifications') ? true : false;
152 }
153
154 public function setEnableOrderProcessingNotifications($value) {
155 return $this->set('enableOrderProcessingNotifications', $value ? true : false);
156 }
157
158 public function getOrderProcessingNotificationsMessage() {
159 return $this->get('orderProcessingNotificationsMessage');
160 }
161
162 public function setOrderProcessingNotificationsMessage($value) {
163 $this->set('orderProcessingNotificationsMessage', $value);
164 return $this;
165 }
166
167 public function getCartReminderCampaignId() {
168 return $this->get('cartReminderCampaignId');
169 }
170
171 public function setCartReminderCampaignId($value) {
172 return $this->set('cartReminderCampaignId', $value);
173 }
174
175 public function getDisableThankYouEvent() {
176 return $this->get('disableThankYouEvent') ? true : false;
177 }
178
179 public function setDisableThankYouEvent($value) {
180 return $this->set('disableThankYouEvent', $value ? true : false);
181 }
182
183 public function getThankYouEventName() {
184 return $this->get('thankYouEventName');
185 }
186
187 public function setThankYouEventName($value) {
188 return $this->set('thankYouEventName', $value);
189 }
190
191 public function getDisableAmpUnsubscribe() {
192 return $this->get('disableAmpUnsubscribe') ? true : false;
193 }
194
195 public function setDisableAmpUnsubscribe($value) {
196 return $this->set('disableAmpUnsubscribe', $value ? true : false);
197 }
198
199 public function getAmpSubscribeButtonLabel() {
200 return $this->get('ampSubscribeButtonLabel');
201 }
202
203 public function setAmpSubscribeButtonLabel($value) {
204 return $this->set('ampSubscribeButtonLabel', $value ? $value : null);
205 }
206
207 public function getAmpUnsubscribeButtonLabel() {
208 return $this->get('ampUnsubscribeButtonLabel');
209 }
210
211 public function setAmpUnsubscribeButtonLabel($value) {
212 return $this->set('ampUnsubscribeButtonLabel', $value ? $value : null);
213 }
214
215 public function getDisableAmpTopSubscribeButton() {
216 return $this->get('disableAmpTopSubscribeButton') ? true : false;
217 }
218
219 public function setDisableAmpTopSubscribeButton($value) {
220 return $this->set('disableAmpTopSubscribeButton', $value ? true : false);
221 }
222
223 public function getDisableAmpBottomSubscribeButton() {
224 return $this->get('disableAmpBottomSubscribeButton') ? true : false;
225 }
226
227 public function setDisableAmpBottomSubscribeButton($value) {
228 return $this->set('disableAmpBottomSubscribeButton', $value ? true : false);
229 }
230
231 public function getAmpButtonWidth() {
232 return $this->get('ampButtonWidth');
233 }
234
235 public function setAmpButtonWidth($value) {
236 return $this->set('ampButtonWidth', is_int($value) ? $value : null);
237 }
238
239 public function getAmpButtonHeight() {
240 return $this->get('ampButtonHeight');
241 }
242
243 public function setAmpButtonHeight($value) {
244 return $this->set('ampButtonHeight', is_int($value) ? $value : null);
245 }
246
247 public function getAdditionalInitOptionsJson() {
248 return $this->get('additionalInitOptionsJson');
249 }
250
251 public function setAdditionalInitOptionsJson($value) {
252 $this->set('additionalInitOptionsJson', $value);
253 return $this;
254 }
255
256 public function getShowPush() {
257 return $this->get('showPush') ? true : false;
258 }
259
260 public function setShowPush($value) {
261 return $this->set('showPush', $value ? true : false);
262 }
263
264 public function getHideAdminBarShortcut() {
265 return $this->get('hideAdminBarShortcut') ? true : false;
266 }
267
268 public function setHideAdminBarShortcut($value) {
269 return $this->set('hideAdminBarShortcut', $value ? true : false);
270 }
271
272 public function getSendOnlyToThisDomain() {
273 $storedValue = $this->get('sendOnlyToThisDomain');
274 if ($storedValue === null) return true; // Default to true
275 return $storedValue ? true : false;
276 }
277
278 public function setSendOnlyToThisDomain($value) {
279 return $this->set('sendOnlyToThisDomain', $value ? true : false);
280 }
281
282 public function save() {
283 update_option(SIB_Manager::PUSH_SETTINGS_OPTION_NAME, $this->settings);
284 }
285
286 /**
287 * @return SIB_Push_Settings
288 */
289 public static function getSettings() {
290 if (!self::$instance) self::$instance = new SIB_Push_Settings(get_option(SIB_Manager::PUSH_SETTINGS_OPTION_NAME));
291 return self::$instance;
292 }
293
294 /** Deletes all push related settings */
295 public static function clearAllSettings() {
296 delete_option(SIB_Manager::PUSH_SETTINGS_OPTION_NAME);
297 }
298
299 }
300
301 }
302