PluginProbe ʕ •ᴥ•ʔ
Brevo – Email, SMS, Web Push, Chat, and more. / 3.2.0
Brevo – Email, SMS, Web Push, Chat, and more. v3.2.0
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 / page / page-form.php
mailin / page Last commit date
index.php 11 years ago page-form.php 1 year ago page-home.php 1 year ago page-push.php 1 year ago
page-form.php
1202 lines
1 <?php
2 /**
3 * Admin page : dashboard
4 *
5 * @package SIB_Page_Form
6 */
7
8 if ( ! class_exists( 'SIB_Page_Form' ) ) {
9 /**
10 * Page class that handles backend page <i>dashboard ( for admin )</i> with form generation and processing
11 *
12 * @package SIB_Page_Form
13 */
14 class SIB_Page_Form {
15 /** Page slug */
16 const PAGE_ID = 'sib_page_form';
17
18 /**
19 * Page hook
20 *
21 * @var false|string
22 */
23 protected $page_hook;
24
25 /**
26 * Page tabs
27 *
28 * @var mixed
29 */
30 protected $tabs;
31
32 /**
33 * Form ID
34 *
35 * @var string
36 */
37 public $formID;
38
39 /**
40 * Default compliant Note
41 *
42 * @var string
43 */
44 public $defaultComplianceNote;
45
46 /**
47 * Constructs new page object and adds entry to WordPress admin menu
48 */
49 function __construct() {
50 global $wp_roles;
51 $wp_roles->add_cap( 'administrator', 'view_custom_menu' );
52 $wp_roles->add_cap( 'editor', 'view_custom_menu' );
53
54 $title = get_bloginfo('name');
55 $this->defaultComplianceNote = sprintf( esc_attr('Your e-mail address is only used to send you our newsletter and information about the activities of %s. You can always use the unsubscribe link included in the newsletter.', 'mailin'), $title);
56 $this->page_hook = add_submenu_page( SIB_Page_Home::PAGE_ID, __( 'Forms', 'mailin' ), __( 'Forms', 'mailin' ), 'view_custom_menu', self::PAGE_ID, array( &$this, 'generate' ) );
57 add_action( 'admin_print_scripts-' . $this->page_hook, array( $this, 'enqueue_scripts' ) );
58 add_action( 'admin_print_styles-' . $this->page_hook, array( $this, 'enqueue_styles' ) );
59 add_action( 'load-' . $this->page_hook, array( &$this, 'init' ) );
60 }
61
62 /**
63 * Init Process
64 */
65 function Init() {
66 SIB_Manager::is_done_validation();
67 $this->forms = new SIB_Forms_List();
68 $this->forms->prepare_items();
69 }
70
71 /**
72 * Enqueue scripts of plugin
73 */
74 function enqueue_scripts() {
75 wp_enqueue_script( 'sib-admin-js' );
76 wp_enqueue_script( 'sib-bootstrap-js' );
77 wp_enqueue_script( 'sib-chosen-js' );
78
79 wp_localize_script(
80 'sib-admin-js', 'ajax_sib_object',
81 array(
82 'ajax_url' => admin_url( 'admin-ajax.php' ),
83 'ajax_nonce' => wp_create_nonce( 'ajax_sib_admin_nonce' ),
84 'compliance_note' => $this->defaultComplianceNote
85 )
86 );
87 wp_localize_script( 'sib-admin-js', 'sib_img_url', array(SIB_Manager::$plugin_url.'/img/flags/') );
88 }
89
90 /**
91 * Enqueue style sheets of plugin
92 */
93 function enqueue_styles() {
94 wp_enqueue_style( 'sib-admin-css' );
95 wp_enqueue_style( 'sib-bootstrap-css' );
96 wp_enqueue_style( 'sib-chosen-css' );
97 wp_enqueue_style( 'sib-fontawesome-css' );
98 wp_enqueue_style( 'thickbox' );
99 }
100
101 /** Generate page script */
102 function generate() {
103 ?>
104 <div id="wrap" class="wrap box-border-box container-fluid">
105 <svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" fill="currentColor" viewBox="0 0 32 32">
106 <circle cx="16" cy="16" r="16" fill="#0B996E"/>
107 <path fill="#fff" d="M21.002 14.54c.99-.97 1.453-2.089 1.453-3.45 0-2.814-2.07-4.69-5.19-4.69H9.6v20h6.18c4.698 0 8.22-2.874 8.22-6.686 0-2.089-1.081-3.964-2.998-5.174Zm-8.62-5.538h4.573c1.545 0 2.565.877 2.565 2.208 0 1.513-1.329 2.663-4.048 3.54-1.854.574-2.688 1.059-2.997 1.634l-.094.001V9.002Zm3.151 14.796h-3.152v-3.085c0-1.362 1.175-2.693 2.813-3.208 1.453-.484 2.657-.969 3.677-1.482 1.36.787 2.194 2.148 2.194 3.57 0 2.42-2.35 4.205-5.532 4.205Z"/>
108 </svg>
109 <svg xmlns="http://www.w3.org/2000/svg" width="80" height="25" fill="currentColor" viewBox="0 0 90 31">
110 <path fill="#0B996E" d="M73.825 19.012c0-4.037 2.55-6.877 6.175-6.877 3.626 0 6.216 2.838 6.216 6.877s-2.59 6.715-6.216 6.715c-3.626 0-6.175-2.799-6.175-6.715Zm-3.785 0c0 5.957 4.144 10.155 9.96 10.155 5.816 0 10-4.198 10-10.155 0-5.957-4.143-10.314-10-10.314s-9.96 4.278-9.96 10.314ZM50.717 8.937l7.81 19.989h3.665l7.81-19.989h-3.945L60.399 24.37h-.08L54.662 8.937h-3.945Zm-15.18 9.354c.239-3.678 2.67-6.156 5.977-6.156 2.867 0 5.02 1.84 5.338 4.598h-6.614c-2.35 0-3.626.28-4.58 1.56h-.12v-.002Zm-3.784.6c0 5.957 4.183 10.274 9.96 10.274 3.904 0 7.33-1.998 8.804-5.158l-3.187-1.6c-1.115 2.08-3.267 3.319-5.618 3.319-2.83 0-5.379-2.16-5.379-4.238 0-1.08.718-1.56 1.753-1.56h12.63v-1.079c0-5.997-3.825-10.155-9.323-10.155-5.497 0-9.641 4.279-9.641 10.195M20.916 28.924h3.586V16.653c0-2.639 1.632-4.518 3.905-4.518.956 0 1.951.32 2.43.758.36-.96.917-1.918 1.753-2.878-.957-.799-2.59-1.32-4.184-1.32-4.382 0-7.49 3.279-7.49 7.956v12.274-.001Zm-17.33-13.23V5.937h5.896c1.992 0 3.307 1.16 3.307 2.919 0 1.998-1.713 3.518-5.218 4.677-2.39.759-3.466 1.399-3.865 2.16h-.12Zm0 9.794v-4.077c0-1.799 1.514-3.558 3.626-4.238 1.873-.64 3.425-1.28 4.74-1.958 1.754 1.04 2.829 2.837 2.829 4.717 0 3.198-3.028 5.556-7.132 5.556H3.586ZM0 28.926h7.968c6.057 0 10.597-3.798 10.597-8.835 0-2.759-1.393-5.237-3.864-6.836 1.275-1.28 1.873-2.76 1.873-4.559 0-3.717-2.67-6.196-6.693-6.196H0v26.426Z"/>
111 </svg>
112 <div class="row">
113 <div id="wrap-left" class="box-border-box col-md-9 ">
114 <input type="hidden" class="sib-dateformat" value="<?php echo esc_attr( 'yyyy-mm-dd' ); ?>">
115 <?php
116 if ( SIB_Manager::is_api_key_set() ) {
117 if ( ( isset( $_GET['action'] ) && 'edit' === sanitize_text_field($_GET['action'] )) || ( isset( $_GET['action'] ) && 'duplicate' === sanitize_text_field($_GET['action'] )) ) {
118 $this->formID = isset( $_GET['id'] ) ? sanitize_text_field( $_GET['id'] ) : 'new';
119 $this->generate_form_edit();
120 } else {
121 $this->generate_forms_page();
122 }
123 } else {
124 $this->generate_welcome_page();
125 }
126 ?>
127 </div>
128 <div id="wrap-right-side" class="box-border-box col-md-3">
129 <?php
130
131 SIB_Page_Home::generate_side_bar();
132 ?>
133 </div>
134 </div>
135 </div>
136 <div id="sib_modal" class="modal fade" role="dialog">
137 <div class="modal-dialog">
138 <div class="modal-content">
139 <div class="modal-header">
140 <button type="button" class="close" data-dismiss="modal">&times;</button>
141 <h4><?php esc_attr_e( 'You are about to change the language', 'mailin' ); ?></h4>
142 </div>
143 <div class="modal-body">
144 <p><?php esc_attr_e( "Please make sure that you've saved all the changes. We will have to reload the page.", 'mailin' ); ?></p>
145 <p><?php esc_attr_e( 'Do you want to continue?', 'mailin' ); ?></p>
146 </div>
147 <div class="modal-footer">
148 <button type="button" class="btn btn-default" id="sib_modal_ok"><?php esc_attr_e( 'Ok', 'mailin' ); ?></button>
149 <button type="button" class="btn btn-default" id="sib_modal_cancel"><?php esc_attr_e( 'Cancel', 'mailin' ); ?></button>
150 </div>
151 </div>
152 </div>
153 </div>
154 <?php
155 }
156 /** Generate forms page */
157 function generate_forms_page() {
158 ?>
159 <div id="main-content" class="sib-content">
160 <div class="card sib-small-content">
161 <div class="card-header"><strong><?php esc_attr_e( 'Forms', 'mailin' ); ?></strong></div>
162
163 <form method="post" class="sib-forms-wrapper" style="padding:20px;min-height: 500px;">
164 <i style="font-size: 13px;"><?php esc_attr_e( "Note: Forms created in Brevo plugin for WordPress won't be displayed in Forms section in Brevo application", 'mailin' ); ?></i>
165 <?php
166 $this->forms->display();
167 ?>
168 </form>
169 </div>
170 </div>
171 <?php
172 }
173 /** Generate form edit page */
174 function generate_form_edit() {
175 $is_activated_smtp = SIB_API_Manager::get_smtp_status() == 'disabled' ? 0 : 1;
176 $formData = SIB_Forms::getForm( $this->formID );
177 $invisibleCaptcha = '1';
178 if ( ! empty( $formData ) ) {
179 if ( isset( $_GET['action'] ) && 'duplicate' === sanitize_text_field($_GET['action']) ) {
180 $this->formID = 'new';
181 $formData['title'] = '';
182 }
183 if ( 'new' === $this->formID && isset( $_GET['pid'] ) ) {
184 $parent_formData = SIB_Forms::getForm( sanitize_text_field( $_GET['pid'] ) );
185 $formData['title'] = $parent_formData['title'];
186 }
187 if ( ! isset( $formData['gCaptcha'] ) ) {
188 $gCaptcha = '0';
189 }
190 else {
191 if( '0' == $formData['gCaptcha'] ) {
192 $gCaptcha = '0';
193 }
194 else {
195 $gCaptcha = '1';
196 }
197 if ( '3' == $formData['gCaptcha'] ) {
198 $invisibleCaptcha = '0';
199 }
200 else {
201 $invisibleCaptcha = '1';
202 }
203 }
204 if ( ! isset( $formData['termAccept'] ) ) {
205 $formData['termAccept'] = '0';
206 }
207
208 $selectCaptchaType = isset($formData['selectCaptchaType']) ? $formData['selectCaptchaType'] : "";
209 if (!$selectCaptchaType) {
210 $gCaptchaVal = isset($formData['gCaptcha']) ? $formData['gCaptcha'] : 0;
211 if ($gCaptchaVal == 0) {
212 $selectCaptchaType = 1;
213 } else if ($gCaptchaVal == 2 || $gCaptchaVal == 3) {
214 $selectCaptchaType = 2;
215 }
216 }
217 $cCaptchaType = isset($formData['cCaptchaType']) ?? $formData['cCaptchaType'];
218 $cCaptchaStyle = isset($formData['cCaptchaStyle']) ? $formData['cCaptchaStyle'] : "auto";
219
220 ?>
221 <div id="main-content" class="sib-content">
222 <form action="admin.php" class="" method="post" role="form">
223 <input type="hidden" name="action" value="sib_setting_subscription">
224 <input type="hidden" name="sib_form_id" value="<?php echo esc_attr( $this->formID ) ; ?>">
225 <input type="hidden" id="is_smtp_activated" value="<?php echo esc_attr( $is_activated_smtp ) ; ?>">
226 <?php
227 if ( isset( $_GET['pid'] ) ) {
228 ?>
229 <input type="hidden" name="pid" value="<?php echo esc_attr( $_GET['pid'] ); ?>">
230 <?php
231 $lang = isset( $_GET['lang'] ) ? sanitize_text_field( $_GET['lang'] ) : '';
232 if ( $lang ) { ?>
233 <input type="hidden" name="lang" value="<?php echo esc_attr( $lang ); ?>">
234 <?php
235 }
236 }
237 ?>
238 <?php wp_nonce_field( 'sib_setting_subscription' ); ?>
239 <!-- Subscription form -->
240 <div class="card sib-small-content">
241 <div class="card-header">
242 <strong><?php esc_attr_e( 'Subscription form', 'mailin' ); ?></strong>&nbsp;<i
243 id="sib_setting_form_spin" class="fa fa-spinner fa-spin fa-fw fa-lg fa-2x"></i>
244 </div>
245 <div id="sib_setting_form_body" class="card-body">
246 <div class="row <!--small-content-->">
247 <div style="margin: 12px 0 34px 0px;">
248 <b><?php esc_attr_e( 'Form Name : ', 'mailin' ); ?></b>&nbsp; <input type="text"
249 name="sib_form_name"
250 value="<?php echo esc_attr( $formData['title'] ); ?>"
251 style="width: 60%;"
252 required="required"/>
253 </div>
254 <div class="col-md-6">
255
256 <?php
257 if ( function_exists( 'wp_editor' ) ) {
258 // phpcs:ignore
259 wp_editor(
260 esc_html(stripcslashes($formData['html'])), 'sibformmarkup', array(
261 'tinymce' => false,
262 'media_buttons' => true,
263 'textarea_name' => 'sib_form_html',
264 'textarea_rows' => 15,
265 )
266 );
267 } else {
268 ?>
269 <textarea class="widefat" cols="160" rows="20" id="sibformmarkup"
270 name="sib_form_html"><?php
271 // phpcs:ignore
272 echo esc_html( $formData['html'] ); ?></textarea>
273 <?php
274 }
275 ?>
276 <br>
277
278 <p>
279 <?php
280 esc_attr_e( 'Use the shortcode', 'mailin' );
281 if ( isset( $_GET['pid'] ) ) {
282 $id = sanitize_text_field( $_GET['pid'] );
283 } else {
284 $id = 'new' !== $this->formID ? $this->formID : '';
285 }
286 ?>
287 <i style="background-color: #eee;padding: 3px;">[sibwp_form
288 id=<?php echo esc_attr( $id ); ?>]</i>
289 <?php
290 esc_attr_e( 'inside a post, page or text widget to display your sign-up form.', 'mailin' );
291 ?>
292 <b><?php esc_attr_e( 'Do not copy and paste the above form mark up, that will not work', 'mailin' ); ?></b>
293 </p>
294 <div id="sib-field-form" class="card form-field"
295 style="padding-bottom: 20px;">
296
297 <div class="small-content2"
298 style="margin-top: 15px;">
299 <b><?php esc_attr_e( 'Add a new Field', 'mailin' ); ?></b>&nbsp;
300 <?php SIB_Page_Home::get_narration_script( __( 'Add a New Field', 'mailin' ), __( 'Choose an attribute and add it to the subscription form of your Website', 'mailin' ) ); ?>
301 </div>
302 <div id="sib_sel_attribute_area" class="small-content2"
303 style="margin-top: 20px;">
304 </div>
305 <div id="sib-field-content">
306 <div style="margin-top: 30px;">
307 <div class="sib-attr-normal sib-attr-category sib-attr-multiple-choice small-content2"
308 style="margin-top: 10px;" id="sib_field_label_area">
309 <?php esc_attr_e( 'Label', 'mailin' ); ?>
310 <small>(<?php esc_attr_e( 'Optional', 'mailin' ); ?>)</small>
311 <input type="text" class="col-md-12 sib_field_changes" id="sib_field_label">
312 </div>
313 <div class="sib-attr-normal small-content2"
314 style="margin-top: 10px;" id="sib_field_placeholder_area">
315 <span><?php esc_attr_e( 'Place holder', 'mailin' ); ?>
316 <small>(<?php esc_attr_e( 'Optional', 'mailin' ); ?>)
317 </small> </span>
318 <input type="text" class="col-md-12 sib_field_changes" id="sib_field_placeholder">
319 </div>
320 <div class="sib-attr-normal small-content2"
321 style="margin-top: 10px;" id="sib_field_initial_area">
322 <span><?php esc_attr_e( 'Initial value', 'mailin' ); ?>
323 <small>(<?php esc_attr_e( 'Optional', 'mailin' ); ?>)
324 </small> </span>
325 <input type="text" class="col-md-12 sib_field_changes" id="sib_field_initial">
326 </div>
327 <div class="sib-attr-other small-content2"
328 style="margin-top: 10px;" id="sib_field_button_text_area">
329 <span><?php esc_attr_e( 'Button Text', 'mailin' ); ?></span>
330 <input type="text" class="col-md-12 sib_field_changes" id="sib_field_button_text">
331 </div>
332 </div>
333 <div style="margin-top: 20px;">
334
335 <div class="sib-attr-normal sib-attr-category sib-attr-multiple-choice small-content2" style="margin-top: 5px;" id="sib_field_required_area">
336 <label style="font-weight: normal;"><input type="checkbox" class="sib_field_changes" id="sib_field_required">&nbsp;&nbsp;<?php esc_attr_e( 'Required field ?', 'mailin' ); ?>
337 </label>
338 </div>
339 <div class="sib-attr-category sib-attr-multiple-choice small-content2"
340 style="margin-top: 5px;" id="sib_field_type_area">
341 <label style="font-weight: normal;"><input type="radio" class="sib_field_changes" name="sib_field_type" value="select"
342 checked>&nbsp;<?php esc_attr_e( 'Drop-down List', 'mailin' ); ?>
343 </label>&nbsp;&nbsp;
344 <label class="sib-attr-category" style="font-weight: normal;"><input type="radio" class="sib_field_changes" name="sib_field_type"
345 value="radio">&nbsp;<?php esc_attr_e( 'Radio List', 'mailin' ); ?>
346 </label>
347 <label class="sib-attr-multiple-choice" style="font-weight: normal;"><input type="radio" class="sib_field_changes" name="sib_field_type"
348 value="radio">&nbsp;<?php esc_attr_e( 'Checkboxes List', 'mailin' ); ?>
349 </label>
350 </div>
351 </div>
352 <div class="small-content2" style="margin-top: 20px;"
353 id="sib_field_add_area">
354 <button type="button" id="sib_add_to_form_btn"
355 class="btn btn-success sib-add-to-form"><span
356 class="sib-large-icon"><</span> <?php esc_attr_e( 'Add to form', 'mailin' ); ?>
357 </button>&nbsp;&nbsp;
358 <div style="display:none">
359 <input id="getDomain" value="<?php
360 echo plugins_url('mailin/img/flags/') ?>"></input>
361 </div>
362 <?php SIB_Page_Home::get_narration_script( __( 'Add to form', 'mailin' ), __( 'Please click where you want to insert the field and click on this button. By default, the new field will be added at top.', 'mailin' ) ); ?>
363 </div>
364 <div class="small-content2" style="margin-top: 20px;"
365 id="sib_field_html_area">
366 <span><?php esc_attr_e( 'Generated HTML', 'mailin' ); ?></span>
367 <textarea class="col-md-12" style="height: 140px;"
368 id="sib_field_html"></textarea>
369 </div>
370 </div>
371 </div>
372 <!---- multi list per interest ----->
373 <div id="sib-multi-lists" class="card form-field"
374 style="padding-bottom: 20px;">
375
376 <div class="small-content2"
377 style="margin-top: 15px">
378 <b><?php esc_attr_e( 'Add Multi-List Subscription', 'mailin' ); ?></b>&nbsp;
379 <?php SIB_Page_Home::get_narration_script( __( 'Add Multi-List Subscription', 'mailin' ), __( 'Enable your contacts to subscribe to content based on specific interests or preferences. Create a contact list for each interest and allow them to subscribe using this field', 'mailin' ) ); ?>
380 </div>
381 <div id="sib_sel_multi_list_area" class="small-content2"
382 style="margin-top: 20px;">
383 <input type="hidden" id="sib_selected_multi_list_id" value="">
384 <select data-placeholder="<?php esc_attr_e( 'Please select the lists', 'mailin' ); ?>" id="sib_select_multi_list"
385 class="col-md-12 chosen-select" name="multi_list_ids[]" multiple=""
386 tabindex="-1"></select>
387 </div>
388 <div id="sib_multi_list_field" style="display: none;">
389 <div style="margin-top: 30px;">
390 <div class="sib-attr-normal sib-attr-category sib-attr-multiple-choice small-content2"
391 style="margin-top: 10px;" id="sib_multi_field_label_area">
392 <?php esc_attr_e( 'Label', 'mailin' ); ?>
393 <small>(<?php esc_attr_e( 'Optional', 'mailin' ); ?>)</small>
394 <input type="text" class="col-md-12 sib_field_changes" id="sib_multi_field_label">
395 </div>
396 </div>
397 <div style="margin-top: 20px;">
398 <div class="sib-attr-normal sib-attr-category sib-attr-multiple-choice small-content2" style="margin-top: 5px;" id="sib_multi_field_required_area">
399 <label style="font-weight: normal;"><input type="checkbox" class="sib_field_changes" id="sib_multi_field_required">&nbsp;&nbsp;<?php esc_attr_e( 'Required field ?', 'mailin' ); ?>
400 </label>
401 </div>
402 </div>
403 <div class="small-content2" style="margin-top: 20px;"
404 id="sib_multi_field_add_area">
405 <button type="button" id="sib_multi_lists_add_form_btn"
406 class="btn btn-success sib-add-to-form"><span
407 class="sib-large-icon"><</span> <?php esc_attr_e( 'Add to form', 'mailin' ); ?>
408 </button>&nbsp;&nbsp;
409 <?php SIB_Page_Home::get_narration_script( __( 'Add to form', 'mailin' ), __( 'Please click where you want to insert the field and click on this button. By default, the new field will be added at top.', 'mailin' ) ); ?>
410 </div>
411 <div class="small-content2" style="margin-top: 20px;"
412 id="sib_field_html_area">
413 <span><?php esc_attr_e( 'Generated HTML', 'mailin' ); ?></span>
414 <textarea class="col-md-12" style="height: 140px;"
415 id="sib_multi_field_html"></textarea>
416 </div>
417 </div>
418 </div>
419
420 <div id="sib-gdpr-block" class="card form-field" style="padding-bottom: 20px;">
421 <div class="small-content2"
422 style="margin-top: 15px;margin-bottom: 15px;">
423 <b><?php esc_attr_e( 'Compliance Note', 'mailin' ); ?></b>&nbsp;
424 <?php SIB_Page_Home::get_narration_script( __( 'Add compliance note', 'mailin' ), __( 'Create GDPR-compliant subscription forms for collecting email addresses.', 'mailin' ) ); ?>
425 </div>
426 <div class="small-content2" style="margin-top: 0px;">
427 <input type="radio" name="sib_add_compliant_note" class="sib-add-compliant-note" value="1" ><label class="sib-radio-label">&nbsp;<?php esc_attr_e( 'Yes', 'mailin');?></label>
428 <input type="radio" name="sib_add_compliant_note" class="sib-add-compliant-note" value="0" checked><label class="sib-radio-label">&nbsp;<?php esc_attr_e( 'No', 'mailin');?></label>
429 </div>
430 <div class="small-content2 sib-gdpr-block-area" style="display: none;">
431 <textarea id="sib_gdpr_text" class="col-md-12" rows="5"><?php echo trim( $this->defaultComplianceNote ); ?></textarea>
432 <label id="set_gdpr_default"><?php esc_attr_e('Reset to Default', 'mailin');?>&nbsp;<i class="fa fa-refresh"></i></label>
433 </div>
434 <div class="small-content2 sib-gdpr-block-btn" style="display: none;">
435 <button type="button" id="sib_add_compliance_note"
436 class="btn btn-success sib-add-to-form"><span
437 class="sib-large-icon"><</span> <?php esc_attr_e( 'Add to form', 'mailin' ); ?>
438 </button>&nbsp;&nbsp;
439 <?php SIB_Page_Home::get_narration_script( __( 'Add to form', 'mailin' ), __( 'Please click where you want to insert the field and click on this button. By default, the new field will be added at top.', 'mailin' ) ); ?>
440 </div>
441 </div>
442
443 <!---- end block ------>
444 <div id="sib_form_captcha" class="card form-field"
445 style="padding-bottom: 20px;">
446 <div class="alert alert-danger" style="margin:5px;display: none;"></div>
447 <div class="small-content2" style="margin-top: 15px;margin-bottom: 15px;">
448 <b><?php esc_attr_e( 'Add Captcha', 'mailin' ); ?></b>&nbsp;
449 <?php SIB_Page_Home::get_narration_script( __( 'Add Captcha', 'mailin' ), __( 'We are using Google reCaptcha for this form. To use Google reCaptcha on this form, you should input site key and secret key.' , 'mailin' ) ); ?>
450 </div>
451 <div class="small-content2" style="margin-top: 0px;">
452 <input type="radio" name="sib_add_captcha" class="sib-add-captcha" value="1" <?php checked( $gCaptcha, '1' ); ?>><label class="sib-radio-label">&nbsp;<?php esc_attr_e( 'Yes', 'mailin' ); ?></label>
453 <input type="radio" name="sib_add_captcha" class="sib-add-captcha" value="0" <?php checked( $gCaptcha, '0' ); ?>><label class="sib-radio-label">&nbsp;<?php esc_attr_e( 'No', 'mailin' ); ?></label>
454 </div>
455 <!-- Captcha Select Box-->
456 <div id="sib_sel_captcha_area" class="small-content2" style="margin-top: 15px;" >
457 <select class="col-md-12 sib-captcha-select" name="sib-select-captcha-type"<?php
458 if ( '0' == $gCaptcha) {
459 echo("style='display: none;'");}
460 ?>>
461 <option value="1" disabled="true" selected>Select the Captcha that you would like to use</option>
462 <option value="2" <?php echo ('2' == $selectCaptchaType) ? "selected" : ""; ?>>Google Captcha</option>
463 <option value="3" <?php echo ('3' == $selectCaptchaType) ? "selected" : ""; ?>>Cloudflare Captcha</option>
464 </select>
465 </div>
466 <!-- Google Captcha Start-->
467 <div class="small-content2 sib-captcha-key"
468 <?php
469 if ( '1' !== $gCaptcha || $selectCaptchaType == 3) {
470 echo("style='display: none;'");}
471 ?>
472 >
473 <i><?php esc_attr_e( 'Site Key', 'mailin' ); ?></i>&nbsp;
474 <input type="text" class="col-md-12" id="sib_captcha_site" name="sib_captcha_site" value="<?php
475 if ( isset( $formData['gCaptcha_site'] ) && ! empty( $formData['gCaptcha_site'] ) ) {
476 echo esc_attr( $formData['gCaptcha_site'] );
477 } else {
478 echo '';
479 }
480 ?>">
481 </div>
482 <div class="small-content2 sib-captcha-key"
483 <?php
484 if ( '1' !== $gCaptcha || $selectCaptchaType == 3 ) {
485 echo("style='display: none;'");}
486 ?>
487 >
488 <i><?php esc_attr_e( 'Secret Key', 'mailin' ); ?></i>&nbsp;
489 <input type="text" class="col-md-12" id="sib_captcha_secret" name="sib_captcha_secret" value="<?php
490 if ( isset( $formData['gCaptcha_secret'] ) && ! empty( $formData['gCaptcha_secret'] ) ) {
491 echo esc_attr( $formData['gCaptcha_secret'] );
492 } else {
493 echo '';
494 }
495 ?>">
496 </div>
497 <div class="small-content2 sib-captcha-key"
498 <?php
499 if ( '1' !== $gCaptcha || $selectCaptchaType == 3) {
500 echo("style='display: none;'");}
501
502 ?>
503 >
504 <input type="radio" name="sib_recaptcha_type" class="sib-captcha-type" value="0" <?php checked( $invisibleCaptcha, '0' ); ?>><label class="sib-radio-label">&nbsp;<?php esc_attr_e( 'Google Captcha', 'mailin');?></label>
505 <input type="radio" name="sib_recaptcha_type" class="sib-captcha-type" value="1" <?php checked( $invisibleCaptcha, '1' ); ?>><label class="sib-radio-label">&nbsp;<?php esc_attr_e( 'Google Invisible Captcha', 'mailin');?></label>
506 </div>
507 <div class="small-content2 sib-captcha-key"
508 <?php
509 if ( '1' !== $gCaptcha || $selectCaptchaType == 3) {
510 echo("style='display: none;'");}
511 ?>
512 >
513 <button type="button" id="sib_add_captcha_btn"
514 class="btn btn-success sib-add-to-form"><span
515 class="sib-large-icon"></span> <?php esc_attr_e( 'Add to form', 'mailin' ); ?>
516 </button>&nbsp;&nbsp;
517 <?php SIB_Page_Home::get_narration_script( __( 'Add Captcha', 'mailin' ), __( 'Please click where you want to insert the field and click on this button. By default, the new field will be added at top.', 'mailin' ) ); ?>
518 </div>
519 <!-- Google Captcha End-->
520 <!-- Turnstile Start-->
521 <div class="sib-captcha-key-turnstile"
522 <?php
523 if ($selectCaptchaType != 3 || $gCaptcha == 0 ) {
524 echo("style='display: none;'");}
525 ?>
526 >
527 <div class="small-content2">
528 <i><?php esc_attr_e( 'Site Key', 'mailin' ); ?></i>&nbsp;
529 <input type="text" class="col-md-12" id="sib_captcha_site_turnstile" name="sib_captcha_site_turnstile" value="<?php
530 if ( isset( $formData['cCaptcha_site'] ) && ! empty( $formData['cCaptcha_site'] ) ) {
531 echo esc_attr( $formData['cCaptcha_site'] );
532 } else {
533 echo '';
534 }
535 ?>">
536 </div>
537 <div class="small-content2 sib-captcha-key-turnstile" style="margin-bottom: 15px !important;">
538 <i><?php esc_attr_e( 'Secret Key', 'mailin' ); ?></i>&nbsp;
539 <input type="text" class="col-md-12" id="sib_captcha_secret_turnstile" name="sib_captcha_secret_turnstile" value="<?php
540 if ( isset( $formData['cCaptcha_secret'] ) && ! empty( $formData['cCaptcha_secret'] ) ) {
541 echo esc_attr( $formData['cCaptcha_secret'] );
542 } else {
543 echo '';
544 }
545 ?>">
546 </div>
547 <div class="small-content2 sib-captcha-key-turnstile">
548 <input type="radio" name="turnstile_captcha_theme" class="sib-captcha-type" value="auto" <?php checked( $cCaptchaStyle, 'auto' ); ?>><label class="sib-radio-label">&nbsp;<?php esc_attr_e( 'Auto', 'mailin');?></label>
549 <input type="radio" name="turnstile_captcha_theme" class="sib-captcha-type" value="dark" <?php checked( $cCaptchaStyle, 'dark' ); ?>><label class="sib-radio-label">&nbsp;<?php esc_attr_e( 'Dark Theme', 'mailin');?></label>
550 <input type="radio" name="turnstile_captcha_theme" class="sib-captcha-type" value="light" <?php checked( $cCaptchaStyle, 'light' ); ?>><label class="sib-radio-label">&nbsp;<?php esc_attr_e( 'Light Theme', 'mailin');?></label>
551 </div>
552 <div class="small-content2">
553 <button type="button" id="sib_add_captcha_btn_turnstile"
554 class="btn btn-success sib-add-to-form"><span
555 class="sib-large-icon"></span> <?php esc_attr_e( 'Add to form', 'mailin' ); ?>
556 </button>&nbsp;&nbsp;
557 <?php SIB_Page_Home::get_narration_script( __( 'Add Captcha', 'mailin' ), __( 'Please click where you want to insert the field and click on this button. By default, the new field will be added at top.', 'mailin' ) ); ?>
558 </div>
559 </div>
560 <!-- Turnstile End -->
561 </div>
562 <div id="sib_form_terms" class="card form-field"
563 style="padding-bottom: 20px;">
564 <div class="alert alert-danger" style="margin:5px;display: none;"></div>
565 <!-- for terms -->
566 <div class="small-content2" style="margin-top: 15px;margin-bottom: 15px;">
567 <b><?php esc_attr_e( 'Add a Term acceptance checkbox', 'mailin' ); ?></b>&nbsp;
568 <?php SIB_Page_Home::get_narration_script( __( 'Add a Term acceptance checkbox', 'mailin' ), __( 'If the terms and condition checkbox is added to the form, the field will be mandatory for subscription.' , 'mailin' ) ); ?>
569 </div>
570 <div class="small-content2" style="margin-top: 0px;">
571 <input type="radio" name="sib_add_terms" class="sib-add-terms" value="1" <?php checked( $formData['termAccept'], '1' ); ?>><label class="sib-radio-label">&nbsp;<?php esc_attr_e( 'Yes', 'mailin');?></label>
572 <input type="radio" name="sib_add_terms" class="sib-add-terms" value="0" <?php checked( $formData['termAccept'], '0' ); ?>><label class="sib-radio-label">&nbsp;<?php esc_attr_e( 'No', 'mailin');?></label>
573 </div>
574 <div class="small-content2 sib-terms-url"
575 <?php
576 if ( '1' !== $formData['termAccept'] ) {
577 echo("style='display: none;'");}
578 ?>
579 >
580 <i><?php esc_attr_e( 'URL to terms and conditions', 'mailin' ); ?></i>&nbsp;
581 <input type="text" class="col-md-12" id="sib_terms_url" name="sib_terms_url" value="<?php
582 if ( isset( $formData['termsURL'] ) && ! empty( $formData['termsURL'] ) ) {
583 echo esc_attr( $formData['termsURL'] );
584 } else {
585 echo '';
586 }
587 ?>">
588 </div>
589 <div class="small-content2 sib-terms-url"
590 <?php
591 if ( '1' !== $formData['termAccept'] ) {
592 echo("style='display: none;'");}
593 ?>
594 >
595 <button type="button" id="sib_add_termsUrl_btn"
596 class="btn btn-success sib-add-to-form"><span
597 class="sib-large-icon"><</span> <?php esc_attr_e( 'Add to form', 'mailin' ); ?>
598 </button>&nbsp;&nbsp;
599 <?php SIB_Page_Home::get_narration_script( __( 'Add Terms URL', 'mailin' ), __( 'Please click where you want to insert the field and click on this button. By default, the new field will be added at top.', 'mailin' ) ); ?>
600 </div>
601
602 </div>
603 <!-- use css of custom or theme -->
604 <div class="card form-field">
605 <div class="small-content2" style="margin-top: 15px;margin-bottom: 10px;">
606 <b><?php esc_attr_e( 'Form Style', 'mailin' ); ?>&nbsp;</b>
607 <?php SIB_Page_Home::get_narration_script( __( 'Form Style', 'mailin' ), __( 'Select the style you favorite. Your custom css will be applied to form only.', 'mailin' ) ); ?>
608 </div>
609 <div id="sib_form_css_area" class="small-content2" style="margin-bottom: 15px;">
610 <label style="font-weight: normal;"><input type="radio" name="sib_css_type" value="1" <?php checked( $formData['dependTheme'], '1' ); ?>>&nbsp;<?php esc_attr_e( 'Current Theme', 'mailin' ); ?>
611 </label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
612 <label style="font-weight: normal;"><input type="radio" name="sib_css_type" value="0" <?php checked( $formData['dependTheme'], '0' ); ?>>&nbsp;<?php esc_attr_e( 'Custom style', 'mailin' ); ?>
613 </label>
614 <textarea class="widefat" cols="60" rows="10" id="sibcssmarkup" style="margin-top: 10px; font-size: 13px; display: <?php echo '0' == $formData['dependTheme'] ? 'block' : 'none'; ?>;"
615 name="sib_form_css"><?php echo esc_textarea( $formData['css'] ); ?></textarea>
616
617 </div>
618
619 </div>
620 </div>
621 <div class="col-md-6">
622 <!-- hidden fields for attributes -->
623 <input type="hidden" id="sib_hidden_email" data-type="email" data-name="email"
624 data-text="<?php esc_attr_e( 'Email Address', 'mailin' ); ?>">
625 <input type="hidden" id="sib_hidden_submit" data-type="submit"
626 data-name="submit" data-text="<?php esc_attr_e( 'Subscribe', 'mailin' ); ?>">
627 <input type="hidden" id="sib_hidden_message_1"
628 value="<?php esc_attr_e( 'Select Brevo Attribute', 'mailin' ); ?>">
629 <input type="hidden" id="sib_hidden_message_2"
630 value="<?php esc_attr_e( 'Brevo merge fields : Normal', 'mailin' ); ?>">
631 <input type="hidden" id="sib_hidden_message_3"
632 value="<?php esc_attr_e( 'Brevo merge fields : Category', 'mailin' ); ?>">
633 <input type="hidden" id="sib_hidden_message_multichoice"
634 value="<?php esc_attr_e( 'Brevo merge fields : Multiple Choice', 'mailin' ); ?>">
635 <input type="hidden" id="sib_hidden_message_4"
636 value="<?php esc_attr_e( 'Other', 'mailin' ); ?>">
637 <input type="hidden" id="sib_hidden_message_5"
638 value="<?php esc_attr_e( 'Submit Button', 'mailin' ); ?>">
639
640 <!-- preview field -->
641
642 <div class="card form-field">
643 <div class="small-content2" style="margin-top: 15px;margin-bottom: 15px;">
644 <b><?php esc_attr_e( 'Preview', 'mailin' ); ?>&nbsp;
645 <i id="sib-preview-form-refresh" class="fa fa-refresh" style="cursor:pointer;font-weight: bold;" aria-hidden="true"></i>
646 </b>
647 </div>
648 <iframe id="sib-preview-form"
649 src="<?php echo esc_url( site_url() . '/?sib_form=' . esc_attr( $this->formID ) ); ?>"
650 width="300px" height="428" title="SIB Preview Form"></iframe>
651 </div>
652 </div>
653 </div>
654 <div class="sib-small-content" style="margin-top: 30px;">
655 <div class="col-md-3">
656 <button class="btn btn-success"><?php esc_attr_e( 'Save', 'mailin' ); ?></button>
657 </div>
658 </div>
659 </div>
660 </div> <!-- End Subscription form-->
661
662 <!-- Sign up Process -->
663
664 <div class="card sib-small-content">
665
666 <!-- Adding security through hidden referrer field -->
667 <div class="card-header">
668 <strong><?php esc_attr_e( 'Sign up process', 'mailin' ); ?></strong>&nbsp;<i
669 id="sib_setting_signup_spin" class="fa fa-spinner fa-spin fa-fw fa-lg fa-2x"></i>
670 </div>
671 <div id="sib_setting_signup_body" class="card-body">
672 <div id="sib_form_alert_message" class="alert alert-danger alert-dismissable fade in"
673 role="alert" style="display: none;">
674 <span id="sib_disclaim_smtp"
675 style="display: none;"><?php _e( 'Confirmation emails will be sent through your own email server, but you have no guarantees on their deliverability. <br/> <a href="https://app-smtp.brevo.com/" target="_blank" rel="noopener">Click here</a> to send your emails through Brevo in order to improve your deliverability and get statistics', 'mailin' ); ?></span>
676 <span id="sib_disclaim_do_template"
677 style="display: none;"><?php _e( 'The template you selected does not include a link {{DOUBLEOPTIN}} to allow subscribers to confirm their subscription. <br/> Please edit the template to include a link with {{DOUBLEOPTIN}} as URL.', 'mailin' ); ?></span>
678 <span id="sib_disclaim_confirm_template"
679 style="display: none;"><?php _e( 'You cannot select a template with the tag {{DOUBLEOPTIN}}', 'mailin' ); ?></span>
680 </div>
681
682 <!-- Linked List -->
683 <div class="row sib-small-content">
684 <span class="col-md-3">
685 <?php esc_attr_e( 'Linked List', 'mailin' ); ?>&nbsp;
686 <?php SIB_Page_Home::get_narration_script( __( 'Linked List', 'mailin' ), __( 'Select the list where you want to add your new subscribers', 'mailin' ) ); ?>
687 </span>
688 <div id="sib_select_list_area" class="col-md-4">
689
690 <input type="hidden" id="sib_selected_list_id" value="">
691 <select data-placeholder="Please select the list" id="sib_select_list"
692 class="col-md-12 chosen-select" name="list_id[]" multiple=""
693 tabindex="-1"></select>
694 </div>
695 <div class="col-md-5">
696 <small
697 style="font-style: italic;"><?php esc_attr_e( 'You can use Marketing Automation to create specific workflow when a user is added to the list.', 'mailin' ); ?></small>
698 </div>
699
700 </div>
701 <!-- confirmation email -->
702 <div class="row small-content">
703 <span class="col-md-3"><?php esc_attr_e( 'Send a confirmation email', 'mailin' ); ?><?php echo esc_html( SIB_Page_Home::get_narration_script( __( 'Confirmation message', 'mailin' ), __( 'You can choose to send a confirmation email. You will be able to set up the template that will be sent to your new suscribers', 'mailin' ) ) ); ?></span>
704
705 <div class="col-md-4">
706 <label class="col-md-6" style="font-weight: normal;"><input type="radio"
707 id="is_confirm_email_yes"
708 name="is_confirm_email"
709 value="1" <?php checked( $formData['isOpt'], '1' ); ?>>&nbsp;<?php esc_attr_e( 'Yes', 'mailin' ); ?>
710 </label>
711 <label class="col-md-5" style="font-weight: normal;"><input type="radio"
712 id="is_confirm_email_no"
713 name="is_confirm_email"
714 value="0" <?php checked( $formData['isOpt'], '0' ); ?>>&nbsp;<?php esc_attr_e( 'No', 'mailin' ); ?>
715 </label>
716 </div>
717 <div class="col-md-5">
718 <small
719 style="font-style: italic;"><?php esc_attr_e( 'Select "Yes" if you want your subscribers to receive a confirmation email', 'mailin' ); ?></small>
720 </div>
721 </div>
722 <!-- select template id for confirmation email -->
723 <div class="row" id="sib_confirm_template_area">
724 <input type="hidden" id="sib_selected_template_id"
725 value="<?php echo esc_attr( $formData['templateID'] ); ?>">
726 <input type="hidden" id="sib_default_template_name"
727 value="<?php esc_attr_e( 'Default', 'mailin' ); ?>">
728
729 <div class="col-md-3" id="sib_template_id_area">
730 </div>
731 <div class="col-md-4">
732 <a href="https://my.brevo.com/camp/lists/template" class="col-md-12"
733 target="_blank" rel="noopener"><i
734 class="fa fa-angle-right"></i> <?php esc_attr_e( 'Set up my templates', 'mailin' ); ?>
735 </a>
736 </div>
737 </div>
738 <!-- double optin confirmation email -->
739 <div class="row sib-small-content mt-3">
740 <span
741 class="col-md-3"><?php esc_attr_e( 'Double Opt-In', 'mailin' ); ?><?php echo esc_html( SIB_Page_Home::get_narration_script( __( 'Double Opt-In', 'mailin' ), __( 'Your subscribers will receive an email inviting them to confirm their subscription. Be careful, your subscribers are not saved in your list before confirming their subscription.', 'mailin' ) ) ); ?></span>
742
743 <div class="col-md-4">
744 <label class="col-md-6" style="font-weight: normal;"><input type="radio"
745 id="is_double_optin_yes"
746 name="is_double_optin"
747 value="1" <?php checked( $formData['isDopt'], '1' ); ?>>&nbsp;<?php esc_attr_e( 'Yes', 'mailin' ); ?>
748 </label>
749 <label class="col-md-5" style="font-weight: normal;"><input type="radio"
750 id="is_double_optin_no"
751 name="is_double_optin"
752 value="0" <?php checked( $formData['isDopt'], '0' ); ?>>&nbsp;<?php esc_attr_e( 'No', 'mailin' ); ?>
753 </label>
754 </div>
755 <div class="col-md-5">
756 <small
757 style="font-style: italic;"><?php esc_attr_e( 'Select "Yes" if you want your subscribers to confirm their email address', 'mailin' ); ?></small>
758 </div>
759 </div>
760 <!-- select template id for double optin confirmation email -->
761 <div class="row" id="sib_doubleoptin_template_area">
762 <input type="hidden" id="sib_selected_do_template_id" value="<?php echo esc_attr( $formData['templateID'] ); ?>">
763 <div class="col-md-3" id="sib_doubleoptin_template_id_area">
764 </div>
765 <div class="col-md-4">
766 <a href="https://my.brevo.com/camp/lists/template"
767 class="col-md-12" target="_blank" rel="noopener"><i
768 class="fa fa-angle-right"></i> <?php esc_attr_e( 'Set up my templates', 'mailin' ); ?>
769 </a>
770 </div>
771 </div>
772 <div class="row sib-small-content mt-3" id="sib_double_redirect_area">
773 <span class="col-md-3"><?php esc_attr_e( 'Redirect to this URL after clicking in the email', 'mailin' ); ?></span>
774
775 <div class="col-md-8">
776 <input type="url" class="col-md-11" name="redirect_url" value="<?php echo esc_attr( $formData['redirectInEmail'] ); ?>">
777 </div>
778 </div>
779 <div class="row sib-small-content mt-3" id="sib_final_confirm_template_area">
780 <span class="col-md-3"><?php esc_attr_e( 'Select final confirmation email template', 'mailin' ); ?><?php echo esc_html( SIB_Page_Home::get_narration_script( __( 'Final confirmation', 'mailin' ), __( 'This is the final confirmation email your contacts will receive once they click on the double opt-in confirmation link. You can select one of the default templates we have created for you, e.g. \'Default template - Final confirmation\'.
781 For your information, you cannot select a template with the tag {{DOUBLEOPTIN}}.', 'mailin' ) ) ); ?></span>
782 <div class="row col-md-8">
783 <input type="hidden" id="sib_selected_confirm_template_id" value="<?php echo esc_attr( $formData['confirmID'] );?>">
784 <div class="col-md-5" id="sib_final_confirm_template_id_area">
785 </div>
786 <div class="col-md-4">
787 <a href="https://my.brevo.com/camp/lists/template"
788 class="col-md-12" target="_blank" rel="noopener"><i
789 class="fa fa-angle-right"></i> <?php esc_attr_e( 'Set up my templates', 'mailin' ); ?>
790 </a>
791 </div>
792 </div>
793 </div>
794
795 <div class="row sib-small-content mt-3">
796 <span
797 class="col-md-3"><?php esc_attr_e( 'Redirect to this URL after subscription', 'mailin' ); ?></span>
798
799 <div class="col-md-4">
800 <label class="col-md-6" style="font-weight: normal;"><input type="radio"
801 id="is_redirect_url_click_yes"
802 name="is_redirect_url_click"
803 value="1" checked>&nbsp;<?php esc_attr_e( 'Yes', 'mailin' ); ?>
804 </label>
805 <label class="col-md-5" style="font-weight: normal;"><input type="radio"
806 id="is_redirect_url_click_no"
807 name="is_redirect_url_click"
808 value="0" <?php checked( $formData['redirectInForm'], '' ); ?>>&nbsp;<?php esc_attr_e( 'No', 'mailin' ); ?>
809 </label>
810
811 </div>
812 <div class="col-md-5">
813 <small
814 style="font-style: italic;"><?php esc_attr_e( 'Select "Yes" if you want to redirect your subscribers to a specific page after they fullfill the form', 'mailin' ); ?></small>
815 </div>
816 </div>
817 <div class="row" style="margin-top: 10px;
818 <?php
819 if ( '' == $formData['redirectInForm'] ) {
820 echo 'display:none;';
821 }
822 ?>
823 " id="sib_subscrition_redirect_area">
824 <span class="col-md-3"></span>
825
826 <div class="col-md-8">
827 <input type="url" class="col-md-11" name="redirect_url_click"
828 value="<?php echo esc_attr( $formData['redirectInForm'] ); ?>">
829 </div>
830 </div>
831
832 <div class="row sib-small-content" style="margin-top: 30px;">
833 <div class="col-md-3">
834 <button class="btn btn-success"><?php esc_attr_e( 'Save', 'mailin' ); ?></button>
835 </div>
836 </div>
837
838 </div>
839 </div><!-- End Sign up process form-->
840
841 <!-- Confirmation message form -->
842 <div class="card sib-small-content">
843 <div class="card-header">
844 <strong><?php esc_attr_e( 'Confirmation message', 'mailin' ); ?></strong>
845 </div>
846 <div class="card-body">
847 <div class="row sib-small-content mt-3">
848 <!-- <span class="col-md-3"></span> -->
849 <label for="inputEmail3" class="col-md-3"><?php esc_attr_e( 'Success message', 'mailin' ); ?></label>
850 <div class="col-md-8">
851 <input type="text" class="col-md-11" name="alert_success_message"
852 value="<?php echo esc_attr( $formData['successMsg'] ); ?>" required>&nbsp;
853 <?php echo esc_html( SIB_Page_Home::get_narration_script( __( 'Success message', 'mailin' ), __( 'Set up the success message that will appear when one of your visitors surccessfully signs up', 'mailin' ) ) ); ?>
854 </div>
855 </div>
856 <div class="row sib-small-content mt-3">
857 <span class="col-md-3"><?php esc_attr_e( 'General error message', 'mailin' ); ?></span>
858
859 <div class="col-md-8">
860 <input type="text" class="col-md-11" name="alert_error_message"
861 value="<?php echo esc_attr( $formData['errorMsg'] ); ?>" required>&nbsp;
862 <?php echo esc_html( SIB_Page_Home::get_narration_script( __( 'General message error', 'mailin' ), __( 'Set up the message that will appear when an error occurs during the subscritpion process', 'mailin' ) ) ); ?>
863 </div>
864 </div>
865 <!--
866 <div class="row sib-small-content mt-3">
867 <span class="col-md-3"><?php esc_attr_e( 'Existing subscribers', 'mailin' ); ?></span>
868
869 <div class="col-md-8">
870 <input type="text" class="col-md-11" name="alert_exist_subscriber"
871 value="<?php echo esc_attr( $formData['existMsg'] ); ?>" required>&nbsp;
872 <?php echo esc_html( SIB_Page_Home::get_narration_script( __( 'Existing Suscribers', 'mailin' ), __( 'Set up the message that will appear when a suscriber is already in your database', 'mailin' ) ) ); ?>
873 </div>
874 </div>
875 -->
876 <div class="row sib-small-content mt-3">
877 <span class="col-md-3"><?php esc_attr_e( 'Invalid email address', 'mailin' ); ?></span>
878
879 <div class="col-md-8">
880 <input type="text" class="col-md-11" name="alert_invalid_email"
881 value="<?php echo esc_attr( $formData['invalidMsg'] ); ?>" required>&nbsp;
882 <?php echo esc_html( SIB_Page_Home::get_narration_script( __( 'Invalid email address', 'mailin' ), __( 'Set up the message that will appear when the email address used to sign up is not valid', 'mailin' ) ) ); ?>
883 </div>
884 </div>
885 <div class="row sib-small-content mt-3">
886 <span class="col-md-3"><?php esc_attr_e( 'Required Field', 'mailin' ); ?></span>
887
888 <div class="col-md-8">
889 <input type="text" class="col-md-11" name="alert_required_message"
890 value="<?php echo esc_attr( $formData['requiredMsg'] ); ?>" required>&nbsp;
891 <?php echo esc_html( SIB_Page_Home::get_narration_script( __( 'Required Field', 'mailin' ), __( 'Set up the message that will appear when the required field is empty', 'mailin' ) ) ); ?>
892 </div>
893 </div>
894 <div class="row sib-small-content" style="margin-top: 30px;">
895 <div class="col-md-3">
896 <button class="btn btn-success"><?php esc_attr_e( 'Save', 'mailin' ); ?></button>
897 </div>
898 </div>
899 </div>
900 </div> <!-- End Confirmation message form-->
901 </form>
902 </div>
903 <script>
904 jQuery(document).ready(function () {
905 jQuery('#sib_add_to_form_btn').click(function () {
906 //var field_html = jQuery('#sib_field_html').html();
907
908 // tinyMCE.activeEditor.selection.setContent(field_html);
909
910 return false;
911 });
912 });
913 </script>
914 <?php
915 } else {
916 // If empty?
917 ?>
918 <div id="main-content" class="sib-content">
919 <div class="card sib-small-content">
920 <div class="card-header">
921 <strong><?php esc_attr_e( 'Subscription form', 'mailin' ); ?></strong>
922 </div>
923 <div style="padding: 24px 32px; margin-bottom: 12px;">
924 <?php esc_attr_e( 'Sorry, you selected invalid form ID. Please check again if the ID is right', 'mailin' ); ?>
925 </div>
926 </div>
927 </div>
928 <?php
929 }
930 }
931
932 /** Generate welcome page */
933 function generate_welcome_page() {
934 ?>
935 <div id="main-content" class="row">
936 <img class="small-content" src="<?php echo esc_url( SIB_Manager::$plugin_url . '/img/background/setting.png' ); ?>" alt="Settings Image" style="width: 100%;">
937 </div>
938 <?php
939 SIB_Page_Home::print_disable_popup();
940 }
941
942 /** Save subscription form setting */
943 public static function save_setting_subscription() {
944 // Check user role.
945 if ( ! current_user_can( 'manage_options' ) ) {
946 wp_die( 'Not allowed' );
947 }
948
949 // Check secret through hidden referrer field.
950 check_admin_referer( 'sib_setting_subscription' );
951
952 //Handling of backslash added by WP because magic quotes are enabled by default
953 array_walk_recursive( $_POST, function(&$value) {
954 $value = stripslashes($value);
955 });
956
957 // Subscription form.
958 $formID = isset( $_POST['sib_form_id'] ) ? sanitize_text_field( $_POST['sib_form_id'] ) : '';
959 $form_name = isset( $_POST['sib_form_name'] ) ? sanitize_text_field( $_POST['sib_form_name'] ) : '';
960 // phpcs:disable
961 $form_html = isset( $_POST['sib_form_html'] ) ? wp_kses($_POST['sib_form_html'], SIB_Manager::wordpress_allowed_attributes()) : '';
962 $list_ids = '';
963
964 if (!empty($_POST['list_id']) && is_array($_POST['list_id'])) {
965 $list_ids = array_filter($_POST['list_id'], 'intval');
966 $list_ids = maybe_serialize($list_ids);
967 }
968 // phpcs:enable
969 $dependTheme = isset( $_POST['sib_css_type'] ) ? sanitize_text_field( $_POST['sib_css_type'] ) : '';
970 $customCss = isset( $_POST['sib_form_css'] ) ? sanitize_text_field( $_POST['sib_form_css'] ) : '';
971 $gCaptcha = isset( $_POST['sib_add_captcha'] ) ? sanitize_text_field( $_POST['sib_add_captcha'] ) : '0';
972 $gCaptchaSecret = isset( $_POST['sib_captcha_secret'] ) ? sanitize_text_field( $_POST['sib_captcha_secret'] ) : '';
973 $gCaptchaSite = isset( $_POST['sib_captcha_site'] ) ? sanitize_text_field( $_POST['sib_captcha_site'] ) : '';
974 $termAccept = isset( $_POST['sib_add_terms'] ) ? sanitize_text_field( $_POST['sib_add_terms'] ) : '0';
975 $termURL = isset( $_POST['sib_terms_url'] ) ? sanitize_text_field( $_POST['sib_terms_url'] ) : '';
976 $gCaptchaType = isset( $_POST['sib_recaptcha_type'] ) ? sanitize_text_field( $_POST['sib_recaptcha_type'] ) : '0';
977 $selectCaptchaType = isset( $_POST['sib-select-captcha-type'] ) ? sanitize_text_field( $_POST['sib-select-captcha-type'] ) : '1';
978 $cCaptchaSecret = isset( $_POST['sib_captcha_secret_turnstile'] ) ? sanitize_text_field( $_POST['sib_captcha_secret_turnstile'] ) : '';
979 $cCaptchaSite = isset( $_POST['sib_captcha_site_turnstile'] ) ? sanitize_text_field( $_POST['sib_captcha_site_turnstile'] ) : '';
980 $cCaptchaType = isset( $_POST['sib_recaptcha_type_turnstile'] ) ? sanitize_text_field( $_POST['sib_recaptcha_type_turnstile'] ) : '';
981 $cCaptchaStyle = isset( $_POST['turnstile_captcha_theme'] ) ? sanitize_text_field( $_POST['turnstile_captcha_theme'] ) : '';
982
983 if ( $gCaptcha != '0' ) {
984 if ( $gCaptchaType == '0' ) {
985 $gCaptcha = '3'; // google recaptcha.
986 }
987 elseif ( $gCaptchaType == '1' ) {
988 $gCaptcha = '2'; // google invisible recaptcha.
989 }
990 }
991 // for wpml plugins.
992 $pid = isset( $_POST['pid'] ) ? sanitize_text_field( $_POST['pid'] ) : '';
993 $lang = isset( $_POST['lang'] ) ? sanitize_text_field( $_POST['lang'] ) : '';
994 // sign up process.
995 $templateID = '-1';
996 $confirmID = '-1';
997 $redirectInForm = '';
998
999 $isOpt = isset( $_POST['is_confirm_email'] ) ? sanitize_text_field( $_POST['is_confirm_email'] ) : false;
1000 if ( $isOpt ) {
1001 $templateID = isset( $_POST['template_id'] ) ? sanitize_text_field( $_POST['template_id'] ) : '-1';
1002 }
1003 $isDopt = isset( $_POST['is_double_optin'] ) ? sanitize_text_field( $_POST['is_double_optin'] ) : false;
1004 if ( $isDopt ) {
1005 $templateID = isset( $_POST['doubleoptin_template_id'] ) ? sanitize_text_field( $_POST['doubleoptin_template_id'] ) : '-1';
1006 $confirmID = isset( $_POST['confirm_template_id'] ) ? sanitize_text_field( $_POST['confirm_template_id'] ) : '-1';
1007 }
1008 $redirectInEmail = isset( $_POST['redirect_url'] ) ? sanitize_text_field( $_POST['redirect_url'] ) : '';
1009 $isRedirectInForm = isset( $_POST['is_redirect_url_click'] ) ? sanitize_text_field( $_POST['is_redirect_url_click'] ) : false;
1010 if ( $isRedirectInForm ) {
1011 $redirectInForm = isset( $_POST['redirect_url_click'] ) ? sanitize_text_field( $_POST['redirect_url_click'] ) : '';
1012 }
1013
1014 // get available attributes list.
1015 $attributes = SIB_API_Manager::get_attributes();
1016 $attributes = array_merge(
1017 $attributes['attributes']['normal_attributes'],
1018 $attributes['attributes']['category_attributes'],
1019 $attributes['attributes']['multiple_choice_attributes']
1020 );
1021 $available_attrs = array( 'email' );
1022 if ( isset( $attributes ) && is_array( $attributes ) ) {
1023 foreach ( $attributes as $attribute ) {
1024 $pos = strpos( $form_html, 'sib-' . $attribute['name'] . '-area' );
1025 if ( false !== $pos ) {
1026 $available_attrs[] = $attribute['name'];
1027 }
1028 }
1029 }
1030 $successMsg = isset( $_POST['alert_success_message'] ) ? sanitize_text_field( esc_attr ($_POST['alert_success_message'] ) ) : '';
1031 $errorMsg = isset( $_POST['alert_error_message'] ) ? sanitize_text_field( esc_attr( $_POST['alert_error_message'] ) ) : '';
1032 $existMsg = isset( $_POST['alert_exist_subscriber'] ) ? sanitize_text_field( esc_attr( $_POST['alert_exist_subscriber'] ) ) : '';
1033 $invalidMsg = isset( $_POST['alert_invalid_email'] ) ? sanitize_text_field( esc_attr( $_POST['alert_invalid_email'] ) ) : '';
1034 $requiredMsg = isset( $_POST['alert_required_message']) ? sanitize_text_field( esc_attr($_POST['alert_required_message'])) : '';
1035 $formData = array(
1036 'title' => $form_name,
1037 'html' => $form_html,
1038 'css' => $customCss,
1039 'listID' => $list_ids,
1040 'dependTheme' => $dependTheme,
1041 'isOpt' => $isOpt,
1042 'isDopt' => $isDopt,
1043 'templateID' => $templateID,
1044 'confirmID' => $confirmID,
1045 'redirectInEmail' => $redirectInEmail,
1046 'redirectInForm' => $redirectInForm,
1047 'successMsg' => $successMsg,
1048 'errorMsg' => $errorMsg,
1049 'existMsg' => $existMsg,
1050 'invalidMsg' => $invalidMsg,
1051 'requiredMsg' => $requiredMsg,
1052 'attributes' => implode( ',', $available_attrs ),
1053 'gcaptcha' => $gCaptcha,
1054 'gcaptcha_secret' => $gCaptchaSecret,
1055 'gcaptcha_site' => $gCaptchaSite,
1056 'selectCaptchaType' => $selectCaptchaType,
1057 'cCaptchaType' => $cCaptchaType,
1058 'ccaptcha_secret' => $cCaptchaSecret,
1059 'ccaptcha_site' => $cCaptchaSite,
1060 'cCaptchaStyle' => $cCaptchaStyle,
1061 'termAccept' => $termAccept,
1062 'termsURL' => $termURL,
1063 );
1064
1065 if ( 'new' === $formID ) {
1066 $formID = SIB_Forms::addForm( $formData );
1067 if ( '' !== $pid ) {
1068 $transID = SIB_Forms_Lang::add_form_ID( $formID, $pid, $lang );
1069 }
1070 } else {
1071 SIB_Forms::updateForm( $formID, $formData );
1072 }
1073 if ( '' !== $pid ) {
1074 wp_safe_redirect(
1075 add_query_arg(
1076 array(
1077 'page' => self::PAGE_ID,
1078 'action' => 'edit',
1079 'id' => $formID,
1080 'pid' => $pid,
1081 'lang' => $lang,
1082 ), admin_url( 'admin.php' )
1083 )
1084 );
1085 exit();
1086 } else {
1087 wp_safe_redirect(
1088 add_query_arg(
1089 array(
1090 'page' => self::PAGE_ID,
1091 'action' => 'edit',
1092 'id' => $formID,
1093 ), admin_url( 'admin.php' )
1094 )
1095 );
1096 exit();
1097 }
1098 }
1099
1100 /** Ajax process when change template id */
1101 public static function ajax_change_template() {
1102 check_ajax_referer( 'ajax_sib_admin_nonce', 'security' );
1103 $template_id = isset( $_POST['template_id'] ) ? sanitize_text_field( $_POST['template_id'] ) : '';
1104 $mailin = new SendinblueApiClient( );
1105 $data = array(
1106 'id' => $template_id,
1107 );
1108 $response = $mailin->getEmailTemplate( $data["id"] );
1109
1110 $ret_email = '-1';
1111 if ( $mailin->getLastResponseCode() === SendinblueApiClient::RESPONSE_CODE_OK) {
1112 $from_email = $response[0]['sender']['email'];
1113 if ( '[DEFAULT_FROM_EMAIL]' == $from_email ) {
1114 $ret_email = '-1';
1115 } else {
1116 $ret_email = $from_email;
1117 }
1118 }
1119 wp_send_json( $ret_email );
1120 }
1121
1122 /**
1123 * Ajax module to get all lists.
1124 */
1125 public static function ajax_get_lists() {
1126 check_ajax_referer( 'ajax_sib_admin_nonce', 'security' );
1127 $lists = SIB_API_Manager::get_lists();
1128 $frmID = isset( $_POST['frmid'] ) ? sanitize_text_field( $_POST['frmid'] ) : '';
1129 $formData = SIB_Forms::getForm( $frmID );
1130 $result = array(
1131 'lists' => $lists,
1132 'selected' => $formData['listID'],
1133 );
1134 wp_send_json( $result );
1135 }
1136
1137 /**
1138 * Ajax module to get all templates.
1139 */
1140 public static function ajax_get_templates() {
1141 check_ajax_referer( 'ajax_sib_admin_nonce', 'security' );
1142 $templates = SIB_API_Manager::get_templates();
1143 $result = array(
1144 'templates' => $templates,
1145 );
1146 wp_send_json( $result );
1147 }
1148
1149 /**
1150 * Ajax module to get all attributes.
1151 */
1152 public static function ajax_get_attributes() {
1153 check_ajax_referer( 'ajax_sib_admin_nonce', 'security' );
1154 $attrs = SIB_API_Manager::get_attributes();
1155 $result = array(
1156 'attrs' => $attrs,
1157 );
1158 wp_send_json( $result );
1159 }
1160
1161 /**
1162 * Ajax module to update form html for preview
1163 */
1164 public static function ajax_update_html() {
1165 check_ajax_referer( 'ajax_sib_admin_nonce', 'security' );
1166 $gCaptchaType = isset( $_POST['gCaptchaType']) ? sanitize_text_field($_POST['gCaptchaType']) : '1';
1167 $gCaptcha = isset( $_POST['gCaptcha'] ) ? sanitize_text_field($_POST['gCaptcha']) : '0';
1168 if ( $gCaptcha != '0' ) {
1169 if( $gCaptchaType == '1' ) {
1170 $gCaptcha = '2';
1171 }
1172 elseif ( $gCaptchaType == '0' ) {
1173 $gCaptcha = '3';
1174 }
1175 }
1176 $formData = array(
1177 'html' => isset( $_POST['frmData'] ) ? wp_kses($_POST['frmData'], SIB_Manager::wordpress_allowed_attributes()) : '',// phpcs:ignore
1178 'css' => isset( $_POST['frmCss'] ) ? sanitize_text_field($_POST['frmCss']) : '',
1179 'dependTheme' => isset( $_POST['isDepend'] ) ? sanitize_text_field($_POST['isDepend']) : '',
1180 'gCaptcha' => $gCaptcha,
1181 'gCaptcha_site' => isset( $_POST['gCaptchaSite'] ) ? sanitize_text_field($_POST['gCaptchaSite']) : '',
1182 'selectCaptchaType' => isset( $_POST['selectCaptchaType'] ) ? sanitize_text_field($_POST['selectCaptchaType']) : '',
1183 );
1184
1185 update_option( SIB_Manager::PREVIEW_OPTION_NAME, $formData );
1186 die;
1187 }
1188
1189 /**
1190 * Ajax module to copy content from origin form for translation
1191 */
1192 public static function ajax_copy_origin_form() {
1193 check_ajax_referer( 'ajax_sib_admin_nonce', 'security' );
1194 $pID = isset( $_POST['pid'] ) ? sanitize_text_field( $_POST['pid'] ) : 1;
1195 $formData = SIB_Forms::getForm( $pID );
1196 // phpcs:ignore
1197 $html = $formData['html'];
1198
1199 wp_send_json( $html );
1200 }
1201 }
1202 }