PluginProbe ʕ •ᴥ•ʔ
Brevo – Email, SMS, Web Push, Chat, and more. / 3.1.87
Brevo – Email, SMS, Web Push, Chat, and more. v3.1.87
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-scenarios.php 3 years ago page-statistics.php 2 years ago
page-form.php
1193 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 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 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 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 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 </div>
348 </div>
349 <div class="small-content2" style="margin-top: 20px;"
350 id="sib_field_add_area">
351 <button type="button" id="sib_add_to_form_btn"
352 class="btn btn-success sib-add-to-form"><span
353 class="sib-large-icon"><</span> <?php esc_attr_e( 'Add to form', 'mailin' ); ?>
354 </button>&nbsp;&nbsp;
355 <div style="display:none">
356 <input id="getDomain" value="<?php
357 echo plugins_url('mailin/img/flags/') ?>"></input>
358 </div>
359 <?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' ) ); ?>
360 </div>
361 <div class="small-content2" style="margin-top: 20px;"
362 id="sib_field_html_area">
363 <span><?php esc_attr_e( 'Generated HTML', 'mailin' ); ?></span>
364 <textarea class="col-md-12" style="height: 140px;"
365 id="sib_field_html"></textarea>
366 </div>
367 </div>
368 </div>
369 <!---- multi list per interest ----->
370 <div id="sib-multi-lists" class="card form-field"
371 style="padding-bottom: 20px;">
372
373 <div class="small-content2"
374 style="margin-top: 15px">
375 <b><?php esc_attr_e( 'Add Multi-List Subscription', 'mailin' ); ?></b>&nbsp;
376 <?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' ) ); ?>
377 </div>
378 <div id="sib_sel_multi_list_area" class="small-content2"
379 style="margin-top: 20px;">
380 <input type="hidden" id="sib_selected_multi_list_id" value="">
381 <select data-placeholder="<?php esc_attr_e( 'Please select the lists', 'mailin' ); ?>" id="sib_select_multi_list"
382 class="col-md-12 chosen-select" name="multi_list_ids[]" multiple=""
383 tabindex="-1"></select>
384 </div>
385 <div id="sib_multi_list_field" style="display: none;">
386 <div style="margin-top: 30px;">
387 <div class="sib-attr-normal sib-attr-category small-content2"
388 style="margin-top: 10px;" id="sib_multi_field_label_area">
389 <?php esc_attr_e( 'Label', 'mailin' ); ?>
390 <small>(<?php esc_attr_e( 'Optional', 'mailin' ); ?>)</small>
391 <input type="text" class="col-md-12 sib_field_changes" id="sib_multi_field_label">
392 </div>
393 </div>
394 <div style="margin-top: 20px;">
395 <div class="sib-attr-normal sib-attr-category small-content2" style="margin-top: 5px;" id="sib_multi_field_required_area">
396 <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' ); ?>
397 </label>
398 </div>
399 </div>
400 <div class="small-content2" style="margin-top: 20px;"
401 id="sib_multi_field_add_area">
402 <button type="button" id="sib_multi_lists_add_form_btn"
403 class="btn btn-success sib-add-to-form"><span
404 class="sib-large-icon"><</span> <?php esc_attr_e( 'Add to form', 'mailin' ); ?>
405 </button>&nbsp;&nbsp;
406 <?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' ) ); ?>
407 </div>
408 <div class="small-content2" style="margin-top: 20px;"
409 id="sib_field_html_area">
410 <span><?php esc_attr_e( 'Generated HTML', 'mailin' ); ?></span>
411 <textarea class="col-md-12" style="height: 140px;"
412 id="sib_multi_field_html"></textarea>
413 </div>
414 </div>
415 </div>
416
417 <div id="sib-gdpr-block" class="card form-field" style="padding-bottom: 20px;">
418 <div class="small-content2"
419 style="margin-top: 15px;margin-bottom: 15px;">
420 <b><?php esc_attr_e( 'Compliance Note', 'mailin' ); ?></b>&nbsp;
421 <?php SIB_Page_Home::get_narration_script( __( 'Add compliance note', 'mailin' ), __( 'Create GDPR-compliant subscription forms for collecting email addresses.', 'mailin' ) ); ?>
422 </div>
423 <div class="small-content2" style="margin-top: 0px;">
424 <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>
425 <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>
426 </div>
427 <div class="small-content2 sib-gdpr-block-area" style="display: none;">
428 <textarea id="sib_gdpr_text" class="col-md-12" rows="5"><?php echo trim( $this->defaultComplianceNote ); ?></textarea>
429 <label id="set_gdpr_default"><?php esc_attr_e('Reset to Default', 'mailin');?>&nbsp;<i class="fa fa-refresh"></i></label>
430 </div>
431 <div class="small-content2 sib-gdpr-block-btn" style="display: none;">
432 <button type="button" id="sib_add_compliance_note"
433 class="btn btn-success sib-add-to-form"><span
434 class="sib-large-icon"><</span> <?php esc_attr_e( 'Add to form', 'mailin' ); ?>
435 </button>&nbsp;&nbsp;
436 <?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' ) ); ?>
437 </div>
438 </div>
439
440 <!---- end block ------>
441 <div id="sib_form_captcha" class="card form-field"
442 style="padding-bottom: 20px;">
443 <div class="alert alert-danger" style="margin:5px;display: none;"></div>
444 <div class="small-content2" style="margin-top: 15px;margin-bottom: 15px;">
445 <b><?php esc_attr_e( 'Add Captcha', 'mailin' ); ?></b>&nbsp;
446 <?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' ) ); ?>
447 </div>
448 <div class="small-content2" style="margin-top: 0px;">
449 <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>
450 <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>
451 </div>
452 <!-- Captcha Select Box-->
453 <div id="sib_sel_captcha_area" class="small-content2" style="margin-top: 15px;" >
454 <select class="col-md-12 sib-captcha-select" name="sib-select-captcha-type"<?php
455 if ( '0' == $gCaptcha) {
456 echo("style='display: none;'");}
457 ?>>
458 <option value="1" disabled="true" selected>Select the Captcha that you would like to use</option>
459 <option value="2" <?php echo ('2' == $selectCaptchaType) ? "selected" : ""; ?>>Google Captcha</option>
460 <option value="3" <?php echo ('3' == $selectCaptchaType) ? "selected" : ""; ?>>Cloudflare Captcha</option>
461 </select>
462 </div>
463 <!-- Google Captcha Start-->
464 <div class="small-content2 sib-captcha-key"
465 <?php
466 if ( '1' !== $gCaptcha || $selectCaptchaType == 3) {
467 echo("style='display: none;'");}
468 ?>
469 >
470 <i><?php esc_attr_e( 'Site Key', 'mailin' ); ?></i>&nbsp;
471 <input type="text" class="col-md-12" id="sib_captcha_site" name="sib_captcha_site" value="<?php
472 if ( isset( $formData['gCaptcha_site'] ) && ! empty( $formData['gCaptcha_site'] ) ) {
473 echo esc_attr( $formData['gCaptcha_site'] );
474 } else {
475 echo '';
476 }
477 ?>">
478 </div>
479 <div class="small-content2 sib-captcha-key"
480 <?php
481 if ( '1' !== $gCaptcha || $selectCaptchaType == 3 ) {
482 echo("style='display: none;'");}
483 ?>
484 >
485 <i><?php esc_attr_e( 'Secret Key', 'mailin' ); ?></i>&nbsp;
486 <input type="text" class="col-md-12" id="sib_captcha_secret" name="sib_captcha_secret" value="<?php
487 if ( isset( $formData['gCaptcha_secret'] ) && ! empty( $formData['gCaptcha_secret'] ) ) {
488 echo esc_attr( $formData['gCaptcha_secret'] );
489 } else {
490 echo '';
491 }
492 ?>">
493 </div>
494 <div class="small-content2 sib-captcha-key"
495 <?php
496 if ( '1' !== $gCaptcha || $selectCaptchaType == 3) {
497 echo("style='display: none;'");}
498
499 ?>
500 >
501 <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>
502 <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>
503 </div>
504 <div class="small-content2 sib-captcha-key"
505 <?php
506 if ( '1' !== $gCaptcha || $selectCaptchaType == 3) {
507 echo("style='display: none;'");}
508 ?>
509 >
510 <button type="button" id="sib_add_captcha_btn"
511 class="btn btn-success sib-add-to-form"><span
512 class="sib-large-icon"></span> <?php esc_attr_e( 'Add to form', 'mailin' ); ?>
513 </button>&nbsp;&nbsp;
514 <?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' ) ); ?>
515 </div>
516 <!-- Google Captcha End-->
517 <!-- Turnstile Start-->
518 <div class="sib-captcha-key-turnstile"
519 <?php
520 if ($selectCaptchaType != 3 || $gCaptcha == 0 ) {
521 echo("style='display: none;'");}
522 ?>
523 >
524 <div class="small-content2">
525 <i><?php esc_attr_e( 'Site Key', 'mailin' ); ?></i>&nbsp;
526 <input type="text" class="col-md-12" id="sib_captcha_site_turnstile" name="sib_captcha_site_turnstile" value="<?php
527 if ( isset( $formData['cCaptcha_site'] ) && ! empty( $formData['cCaptcha_site'] ) ) {
528 echo esc_attr( $formData['cCaptcha_site'] );
529 } else {
530 echo '';
531 }
532 ?>">
533 </div>
534 <div class="small-content2 sib-captcha-key-turnstile" style="margin-bottom: 15px !important;">
535 <i><?php esc_attr_e( 'Secret Key', 'mailin' ); ?></i>&nbsp;
536 <input type="text" class="col-md-12" id="sib_captcha_secret_turnstile" name="sib_captcha_secret_turnstile" value="<?php
537 if ( isset( $formData['cCaptcha_secret'] ) && ! empty( $formData['cCaptcha_secret'] ) ) {
538 echo esc_attr( $formData['cCaptcha_secret'] );
539 } else {
540 echo '';
541 }
542 ?>">
543 </div>
544 <div class="small-content2 sib-captcha-key-turnstile">
545 <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>
546 <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>
547 <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>
548 </div>
549 <div class="small-content2">
550 <button type="button" id="sib_add_captcha_btn_turnstile"
551 class="btn btn-success sib-add-to-form"><span
552 class="sib-large-icon"></span> <?php esc_attr_e( 'Add to form', 'mailin' ); ?>
553 </button>&nbsp;&nbsp;
554 <?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' ) ); ?>
555 </div>
556 </div>
557 <!-- Turnstile End -->
558 </div>
559 <div id="sib_form_terms" class="card form-field"
560 style="padding-bottom: 20px;">
561 <div class="alert alert-danger" style="margin:5px;display: none;"></div>
562 <!-- for terms -->
563 <div class="small-content2" style="margin-top: 15px;margin-bottom: 15px;">
564 <b><?php esc_attr_e( 'Add a Term acceptance checkbox', 'mailin' ); ?></b>&nbsp;
565 <?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' ) ); ?>
566 </div>
567 <div class="small-content2" style="margin-top: 0px;">
568 <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>
569 <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>
570 </div>
571 <div class="small-content2 sib-terms-url"
572 <?php
573 if ( '1' !== $formData['termAccept'] ) {
574 echo("style='display: none;'");}
575 ?>
576 >
577 <i><?php esc_attr_e( 'URL to terms and conditions', 'mailin' ); ?></i>&nbsp;
578 <input type="text" class="col-md-12" id="sib_terms_url" name="sib_terms_url" value="<?php
579 if ( isset( $formData['termsURL'] ) && ! empty( $formData['termsURL'] ) ) {
580 echo esc_attr( $formData['termsURL'] );
581 } else {
582 echo '';
583 }
584 ?>">
585 </div>
586 <div class="small-content2 sib-terms-url"
587 <?php
588 if ( '1' !== $formData['termAccept'] ) {
589 echo("style='display: none;'");}
590 ?>
591 >
592 <button type="button" id="sib_add_termsUrl_btn"
593 class="btn btn-success sib-add-to-form"><span
594 class="sib-large-icon"><</span> <?php esc_attr_e( 'Add to form', 'mailin' ); ?>
595 </button>&nbsp;&nbsp;
596 <?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' ) ); ?>
597 </div>
598
599 </div>
600 <!-- use css of custom or theme -->
601 <div class="card form-field">
602 <div class="small-content2" style="margin-top: 15px;margin-bottom: 10px;">
603 <b><?php esc_attr_e( 'Form Style', 'mailin' ); ?>&nbsp;</b>
604 <?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' ) ); ?>
605 </div>
606 <div id="sib_form_css_area" class="small-content2" style="margin-bottom: 15px;">
607 <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' ); ?>
608 </label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
609 <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' ); ?>
610 </label>
611 <textarea class="widefat" cols="60" rows="10" id="sibcssmarkup" style="margin-top: 10px; font-size: 13px; display: <?php echo '0' == $formData['dependTheme'] ? 'block' : 'none'; ?>;"
612 name="sib_form_css"><?php echo esc_textarea( $formData['css'] ); ?></textarea>
613
614 </div>
615
616 </div>
617 </div>
618 <div class="col-md-6">
619 <!-- hidden fields for attributes -->
620 <input type="hidden" id="sib_hidden_email" data-type="email" data-name="email"
621 data-text="<?php esc_attr_e( 'Email Address', 'mailin' ); ?>">
622 <input type="hidden" id="sib_hidden_submit" data-type="submit"
623 data-name="submit" data-text="<?php esc_attr_e( 'Subscribe', 'mailin' ); ?>">
624 <input type="hidden" id="sib_hidden_message_1"
625 value="<?php esc_attr_e( 'Select Brevo Attribute', 'mailin' ); ?>">
626 <input type="hidden" id="sib_hidden_message_2"
627 value="<?php esc_attr_e( 'Brevo merge fields : Normal', 'mailin' ); ?>">
628 <input type="hidden" id="sib_hidden_message_3"
629 value="<?php esc_attr_e( 'Brevo merge fields : Category', 'mailin' ); ?>">
630 <input type="hidden" id="sib_hidden_message_4"
631 value="<?php esc_attr_e( 'Other', 'mailin' ); ?>">
632 <input type="hidden" id="sib_hidden_message_5"
633 value="<?php esc_attr_e( 'Submit Button', 'mailin' ); ?>">
634
635 <!-- preview field -->
636
637 <div class="card form-field">
638 <div class="small-content2" style="margin-top: 15px;margin-bottom: 15px;">
639 <b><?php esc_attr_e( 'Preview', 'mailin' ); ?>&nbsp;
640 <i id="sib-preview-form-refresh" class="fa fa-refresh" style="cursor:pointer;font-weight: bold;" aria-hidden="true"></i>
641 </b>
642 </div>
643 <iframe id="sib-preview-form"
644 src="<?php echo esc_url( site_url() . '/?sib_form=' . esc_attr( $this->formID ) ); ?>"
645 width="300px" height="428" title="SIB Preview Form"></iframe>
646 </div>
647 </div>
648 </div>
649 <div class="sib-small-content" style="margin-top: 30px;">
650 <div class="col-md-3">
651 <button class="btn btn-success"><?php esc_attr_e( 'Save', 'mailin' ); ?></button>
652 </div>
653 </div>
654 </div>
655 </div> <!-- End Subscription form-->
656
657 <!-- Sign up Process -->
658
659 <div class="card sib-small-content">
660
661 <!-- Adding security through hidden referrer field -->
662 <div class="card-header">
663 <strong><?php esc_attr_e( 'Sign up process', 'mailin' ); ?></strong>&nbsp;<i
664 id="sib_setting_signup_spin" class="fa fa-spinner fa-spin fa-fw fa-lg fa-2x"></i>
665 </div>
666 <div id="sib_setting_signup_body" class="card-body">
667 <div id="sib_form_alert_message" class="alert alert-danger alert-dismissable fade in"
668 role="alert" style="display: none;">
669 <span id="sib_disclaim_smtp"
670 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>
671 <span id="sib_disclaim_do_template"
672 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>
673 <span id="sib_disclaim_confirm_template"
674 style="display: none;"><?php _e( 'You cannot select a template with the tag {{DOUBLEOPTIN}}', 'mailin' ); ?></span>
675 </div>
676
677 <!-- Linked List -->
678 <div class="row sib-small-content">
679 <span class="col-md-3">
680 <?php esc_attr_e( 'Linked List', 'mailin' ); ?>&nbsp;
681 <?php SIB_Page_Home::get_narration_script( __( 'Linked List', 'mailin' ), __( 'Select the list where you want to add your new subscribers', 'mailin' ) ); ?>
682 </span>
683 <div id="sib_select_list_area" class="col-md-4">
684
685 <input type="hidden" id="sib_selected_list_id" value="">
686 <select data-placeholder="Please select the list" id="sib_select_list"
687 class="col-md-12 chosen-select" name="list_id[]" multiple=""
688 tabindex="-1"></select>
689 </div>
690 <div class="col-md-5">
691 <small
692 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>
693 </div>
694
695 </div>
696 <!-- confirmation email -->
697 <div class="row small-content">
698 <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>
699
700 <div class="col-md-4">
701 <label class="col-md-6" style="font-weight: normal;"><input type="radio"
702 id="is_confirm_email_yes"
703 name="is_confirm_email"
704 value="1" <?php checked( $formData['isOpt'], '1' ); ?>>&nbsp;<?php esc_attr_e( 'Yes', 'mailin' ); ?>
705 </label>
706 <label class="col-md-5" style="font-weight: normal;"><input type="radio"
707 id="is_confirm_email_no"
708 name="is_confirm_email"
709 value="0" <?php checked( $formData['isOpt'], '0' ); ?>>&nbsp;<?php esc_attr_e( 'No', 'mailin' ); ?>
710 </label>
711 </div>
712 <div class="col-md-5">
713 <small
714 style="font-style: italic;"><?php esc_attr_e( 'Select "Yes" if you want your subscribers to receive a confirmation email', 'mailin' ); ?></small>
715 </div>
716 </div>
717 <!-- select template id for confirmation email -->
718 <div class="row" id="sib_confirm_template_area">
719 <input type="hidden" id="sib_selected_template_id"
720 value="<?php echo esc_attr( $formData['templateID'] ); ?>">
721 <input type="hidden" id="sib_default_template_name"
722 value="<?php esc_attr_e( 'Default', 'mailin' ); ?>">
723
724 <div class="col-md-3" id="sib_template_id_area">
725 </div>
726 <div class="col-md-4">
727 <a href="https://my.brevo.com/camp/lists/template" class="col-md-12"
728 target="_blank" rel="noopener"><i
729 class="fa fa-angle-right"></i> <?php esc_attr_e( 'Set up my templates', 'mailin' ); ?>
730 </a>
731 </div>
732 </div>
733 <!-- double optin confirmation email -->
734 <div class="row sib-small-content mt-3">
735 <span
736 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>
737
738 <div class="col-md-4">
739 <label class="col-md-6" style="font-weight: normal;"><input type="radio"
740 id="is_double_optin_yes"
741 name="is_double_optin"
742 value="1" <?php checked( $formData['isDopt'], '1' ); ?>>&nbsp;<?php esc_attr_e( 'Yes', 'mailin' ); ?>
743 </label>
744 <label class="col-md-5" style="font-weight: normal;"><input type="radio"
745 id="is_double_optin_no"
746 name="is_double_optin"
747 value="0" <?php checked( $formData['isDopt'], '0' ); ?>>&nbsp;<?php esc_attr_e( 'No', 'mailin' ); ?>
748 </label>
749 </div>
750 <div class="col-md-5">
751 <small
752 style="font-style: italic;"><?php esc_attr_e( 'Select "Yes" if you want your subscribers to confirm their email address', 'mailin' ); ?></small>
753 </div>
754 </div>
755 <!-- select template id for double optin confirmation email -->
756 <div class="row" id="sib_doubleoptin_template_area">
757 <input type="hidden" id="sib_selected_do_template_id" value="<?php echo esc_attr( $formData['templateID'] ); ?>">
758 <div class="col-md-3" id="sib_doubleoptin_template_id_area">
759 </div>
760 <div class="col-md-4">
761 <a href="https://my.brevo.com/camp/lists/template"
762 class="col-md-12" target="_blank" rel="noopener"><i
763 class="fa fa-angle-right"></i> <?php esc_attr_e( 'Set up my templates', 'mailin' ); ?>
764 </a>
765 </div>
766 </div>
767 <div class="row sib-small-content mt-3" id="sib_double_redirect_area">
768 <span class="col-md-3"><?php esc_attr_e( 'Redirect to this URL after clicking in the email', 'mailin' ); ?></span>
769
770 <div class="col-md-8">
771 <input type="url" class="col-md-11" name="redirect_url" value="<?php echo esc_attr( $formData['redirectInEmail'] ); ?>">
772 </div>
773 </div>
774 <div class="row sib-small-content mt-3" id="sib_final_confirm_template_area">
775 <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\'.
776 For your information, you cannot select a template with the tag {{DOUBLEOPTIN}}.', 'mailin' ) ) ); ?></span>
777 <div class="row col-md-8">
778 <input type="hidden" id="sib_selected_confirm_template_id" value="<?php echo esc_attr( $formData['confirmID'] );?>">
779 <div class="col-md-5" id="sib_final_confirm_template_id_area">
780 </div>
781 <div class="col-md-4">
782 <a href="https://my.brevo.com/camp/lists/template"
783 class="col-md-12" target="_blank" rel="noopener"><i
784 class="fa fa-angle-right"></i> <?php esc_attr_e( 'Set up my templates', 'mailin' ); ?>
785 </a>
786 </div>
787 </div>
788 </div>
789
790 <div class="row sib-small-content mt-3">
791 <span
792 class="col-md-3"><?php esc_attr_e( 'Redirect to this URL after subscription', 'mailin' ); ?></span>
793
794 <div class="col-md-4">
795 <label class="col-md-6" style="font-weight: normal;"><input type="radio"
796 id="is_redirect_url_click_yes"
797 name="is_redirect_url_click"
798 value="1" checked>&nbsp;<?php esc_attr_e( 'Yes', 'mailin' ); ?>
799 </label>
800 <label class="col-md-5" style="font-weight: normal;"><input type="radio"
801 id="is_redirect_url_click_no"
802 name="is_redirect_url_click"
803 value="0" <?php checked( $formData['redirectInForm'], '' ); ?>>&nbsp;<?php esc_attr_e( 'No', 'mailin' ); ?>
804 </label>
805
806 </div>
807 <div class="col-md-5">
808 <small
809 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>
810 </div>
811 </div>
812 <div class="row" style="margin-top: 10px;
813 <?php
814 if ( '' == $formData['redirectInForm'] ) {
815 echo 'display:none;';
816 }
817 ?>
818 " id="sib_subscrition_redirect_area">
819 <span class="col-md-3"></span>
820
821 <div class="col-md-8">
822 <input type="url" class="col-md-11" name="redirect_url_click"
823 value="<?php echo esc_attr( $formData['redirectInForm'] ); ?>">
824 </div>
825 </div>
826
827 <div class="row sib-small-content" style="margin-top: 30px;">
828 <div class="col-md-3">
829 <button class="btn btn-success"><?php esc_attr_e( 'Save', 'mailin' ); ?></button>
830 </div>
831 </div>
832
833 </div>
834 </div><!-- End Sign up process form-->
835
836 <!-- Confirmation message form -->
837 <div class="card sib-small-content">
838 <div class="card-header">
839 <strong><?php esc_attr_e( 'Confirmation message', 'mailin' ); ?></strong>
840 </div>
841 <div class="card-body">
842 <div class="row sib-small-content mt-3">
843 <!-- <span class="col-md-3"></span> -->
844 <label for="inputEmail3" class="col-md-3"><?php esc_attr_e( 'Success message', 'mailin' ); ?></label>
845 <div class="col-md-8">
846 <input type="text" class="col-md-11" name="alert_success_message"
847 value="<?php echo esc_attr( $formData['successMsg'] ); ?>" required>&nbsp;
848 <?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' ) ) ); ?>
849 </div>
850 </div>
851 <div class="row sib-small-content mt-3">
852 <span class="col-md-3"><?php esc_attr_e( 'General error message', 'mailin' ); ?></span>
853
854 <div class="col-md-8">
855 <input type="text" class="col-md-11" name="alert_error_message"
856 value="<?php echo esc_attr( $formData['errorMsg'] ); ?>" required>&nbsp;
857 <?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' ) ) ); ?>
858 </div>
859 </div>
860 <!--
861 <div class="row sib-small-content mt-3">
862 <span class="col-md-3"><?php esc_attr_e( 'Existing subscribers', 'mailin' ); ?></span>
863
864 <div class="col-md-8">
865 <input type="text" class="col-md-11" name="alert_exist_subscriber"
866 value="<?php echo esc_attr( $formData['existMsg'] ); ?>" required>&nbsp;
867 <?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' ) ) ); ?>
868 </div>
869 </div>
870 -->
871 <div class="row sib-small-content mt-3">
872 <span class="col-md-3"><?php esc_attr_e( 'Invalid email address', 'mailin' ); ?></span>
873
874 <div class="col-md-8">
875 <input type="text" class="col-md-11" name="alert_invalid_email"
876 value="<?php echo esc_attr( $formData['invalidMsg'] ); ?>" required>&nbsp;
877 <?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' ) ) ); ?>
878 </div>
879 </div>
880 <div class="row sib-small-content mt-3">
881 <span class="col-md-3"><?php esc_attr_e( 'Required Field', 'mailin' ); ?></span>
882
883 <div class="col-md-8">
884 <input type="text" class="col-md-11" name="alert_required_message"
885 value="<?php echo esc_attr( $formData['requiredMsg'] ); ?>" required>&nbsp;
886 <?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' ) ) ); ?>
887 </div>
888 </div>
889 <div class="row sib-small-content" style="margin-top: 30px;">
890 <div class="col-md-3">
891 <button class="btn btn-success"><?php esc_attr_e( 'Save', 'mailin' ); ?></button>
892 </div>
893 </div>
894 </div>
895 </div> <!-- End Confirmation message form-->
896 </form>
897 </div>
898 <script>
899 jQuery(document).ready(function () {
900 jQuery('#sib_add_to_form_btn').click(function () {
901 //var field_html = jQuery('#sib_field_html').html();
902
903 // tinyMCE.activeEditor.selection.setContent(field_html);
904
905 return false;
906 });
907 });
908 </script>
909 <?php
910 } else {
911 // If empty?
912 ?>
913 <div id="main-content" class="sib-content">
914 <div class="card sib-small-content">
915 <div class="card-header">
916 <strong><?php esc_attr_e( 'Subscription form', 'mailin' ); ?></strong>
917 </div>
918 <div style="padding: 24px 32px; margin-bottom: 12px;">
919 <?php esc_attr_e( 'Sorry, you selected invalid form ID. Please check again if the ID is right', 'mailin' ); ?>
920 </div>
921 </div>
922 </div>
923 <?php
924 }
925 }
926
927 /** Generate welcome page */
928 function generate_welcome_page() {
929 ?>
930 <div id="main-content" class="row">
931 <img class="small-content" src="<?php echo esc_url( SIB_Manager::$plugin_url . '/img/background/setting.png' ); ?>" alt="Settings Image" style="width: 100%;">
932 </div>
933 <?php
934 SIB_Page_Home::print_disable_popup();
935 }
936
937 /** Save subscription form setting */
938 public static function save_setting_subscription() {
939 // Check user role.
940 if ( ! current_user_can( 'manage_options' ) ) {
941 wp_die( 'Not allowed' );
942 }
943
944 // Check secret through hidden referrer field.
945 check_admin_referer( 'sib_setting_subscription' );
946
947 //Handling of backslash added by WP because magic quotes are enabled by default
948 array_walk_recursive( $_POST, function(&$value) {
949 $value = stripslashes($value);
950 });
951
952 // Subscription form.
953 $formID = isset( $_POST['sib_form_id'] ) ? sanitize_text_field( $_POST['sib_form_id'] ) : '';
954 $form_name = isset( $_POST['sib_form_name'] ) ? sanitize_text_field( $_POST['sib_form_name'] ) : '';
955 // phpcs:disable
956 $form_html = isset( $_POST['sib_form_html'] ) ? wp_kses($_POST['sib_form_html'], SIB_Manager::wordpress_allowed_attributes()) : '';
957 $list_ids = '';
958
959 if (!empty($_POST['list_id']) && is_array($_POST['list_id'])) {
960 $list_ids = array_filter($_POST['list_id'], 'intval');
961 $list_ids = maybe_serialize($list_ids);
962 }
963 // phpcs:enable
964 $dependTheme = isset( $_POST['sib_css_type'] ) ? sanitize_text_field( $_POST['sib_css_type'] ) : '';
965 $customCss = isset( $_POST['sib_form_css'] ) ? sanitize_text_field( $_POST['sib_form_css'] ) : '';
966 $gCaptcha = isset( $_POST['sib_add_captcha'] ) ? sanitize_text_field( $_POST['sib_add_captcha'] ) : '0';
967 $gCaptchaSecret = isset( $_POST['sib_captcha_secret'] ) ? sanitize_text_field( $_POST['sib_captcha_secret'] ) : '';
968 $gCaptchaSite = isset( $_POST['sib_captcha_site'] ) ? sanitize_text_field( $_POST['sib_captcha_site'] ) : '';
969 $termAccept = isset( $_POST['sib_add_terms'] ) ? sanitize_text_field( $_POST['sib_add_terms'] ) : '0';
970 $termURL = isset( $_POST['sib_terms_url'] ) ? sanitize_text_field( $_POST['sib_terms_url'] ) : '';
971 $gCaptchaType = isset( $_POST['sib_recaptcha_type'] ) ? sanitize_text_field( $_POST['sib_recaptcha_type'] ) : '0';
972 $selectCaptchaType = isset( $_POST['sib-select-captcha-type'] ) ? sanitize_text_field( $_POST['sib-select-captcha-type'] ) : '1';
973 $cCaptchaSecret = isset( $_POST['sib_captcha_secret_turnstile'] ) ? sanitize_text_field( $_POST['sib_captcha_secret_turnstile'] ) : '';
974 $cCaptchaSite = isset( $_POST['sib_captcha_site_turnstile'] ) ? sanitize_text_field( $_POST['sib_captcha_site_turnstile'] ) : '';
975 $cCaptchaType = isset( $_POST['sib_recaptcha_type_turnstile'] ) ? sanitize_text_field( $_POST['sib_recaptcha_type_turnstile'] ) : '';
976 $cCaptchaStyle = isset( $_POST['turnstile_captcha_theme'] ) ? sanitize_text_field( $_POST['turnstile_captcha_theme'] ) : '';
977
978 if ( $gCaptcha != '0' ) {
979 if ( $gCaptchaType == '0' ) {
980 $gCaptcha = '3'; // google recaptcha.
981 }
982 elseif ( $gCaptchaType == '1' ) {
983 $gCaptcha = '2'; // google invisible recaptcha.
984 }
985 }
986 // for wpml plugins.
987 $pid = isset( $_POST['pid'] ) ? sanitize_text_field( $_POST['pid'] ) : '';
988 $lang = isset( $_POST['lang'] ) ? sanitize_text_field( $_POST['lang'] ) : '';
989 // sign up process.
990 $templateID = '-1';
991 $confirmID = '-1';
992 $redirectInForm = '';
993
994 $isOpt = isset( $_POST['is_confirm_email'] ) ? sanitize_text_field( $_POST['is_confirm_email'] ) : false;
995 if ( $isOpt ) {
996 $templateID = isset( $_POST['template_id'] ) ? sanitize_text_field( $_POST['template_id'] ) : '-1';
997 }
998 $isDopt = isset( $_POST['is_double_optin'] ) ? sanitize_text_field( $_POST['is_double_optin'] ) : false;
999 if ( $isDopt ) {
1000 $templateID = isset( $_POST['doubleoptin_template_id'] ) ? sanitize_text_field( $_POST['doubleoptin_template_id'] ) : '-1';
1001 $confirmID = isset( $_POST['confirm_template_id'] ) ? sanitize_text_field( $_POST['confirm_template_id'] ) : '-1';
1002 }
1003 $redirectInEmail = isset( $_POST['redirect_url'] ) ? sanitize_text_field( $_POST['redirect_url'] ) : '';
1004 $isRedirectInForm = isset( $_POST['is_redirect_url_click'] ) ? sanitize_text_field( $_POST['is_redirect_url_click'] ) : false;
1005 if ( $isRedirectInForm ) {
1006 $redirectInForm = isset( $_POST['redirect_url_click'] ) ? sanitize_text_field( $_POST['redirect_url_click'] ) : '';
1007 }
1008
1009 // get available attributes list.
1010 $attributes = SIB_API_Manager::get_attributes();
1011 $attributes = array_merge( $attributes['attributes']['normal_attributes'],$attributes['attributes']['category_attributes'] );
1012 $available_attrs = array( 'email' );
1013 if ( isset( $attributes ) && is_array( $attributes ) ) {
1014 foreach ( $attributes as $attribute ) {
1015 $pos = strpos( $form_html, 'sib-' . $attribute['name'] . '-area' );
1016 if ( false !== $pos ) {
1017 $available_attrs[] = $attribute['name'];
1018 }
1019 }
1020 }
1021 $successMsg = isset( $_POST['alert_success_message'] ) ? sanitize_text_field( esc_attr ($_POST['alert_success_message'] ) ) : '';
1022 $errorMsg = isset( $_POST['alert_error_message'] ) ? sanitize_text_field( esc_attr( $_POST['alert_error_message'] ) ) : '';
1023 $existMsg = isset( $_POST['alert_exist_subscriber'] ) ? sanitize_text_field( esc_attr( $_POST['alert_exist_subscriber'] ) ) : '';
1024 $invalidMsg = isset( $_POST['alert_invalid_email'] ) ? sanitize_text_field( esc_attr( $_POST['alert_invalid_email'] ) ) : '';
1025 $requiredMsg = isset( $_POST['alert_required_message']) ? sanitize_text_field( esc_attr($_POST['alert_required_message'])) : '';
1026 $formData = array(
1027 'title' => $form_name,
1028 'html' => $form_html,
1029 'css' => $customCss,
1030 'listID' => $list_ids,
1031 'dependTheme' => $dependTheme,
1032 'isOpt' => $isOpt,
1033 'isDopt' => $isDopt,
1034 'templateID' => $templateID,
1035 'confirmID' => $confirmID,
1036 'redirectInEmail' => $redirectInEmail,
1037 'redirectInForm' => $redirectInForm,
1038 'successMsg' => $successMsg,
1039 'errorMsg' => $errorMsg,
1040 'existMsg' => $existMsg,
1041 'invalidMsg' => $invalidMsg,
1042 'requiredMsg' => $requiredMsg,
1043 'attributes' => implode( ',', $available_attrs ),
1044 'gcaptcha' => $gCaptcha,
1045 'gcaptcha_secret' => $gCaptchaSecret,
1046 'gcaptcha_site' => $gCaptchaSite,
1047 'selectCaptchaType' => $selectCaptchaType,
1048 'cCaptchaType' => $cCaptchaType,
1049 'ccaptcha_secret' => $cCaptchaSecret,
1050 'ccaptcha_site' => $cCaptchaSite,
1051 'cCaptchaStyle' => $cCaptchaStyle,
1052 'termAccept' => $termAccept,
1053 'termsURL' => $termURL,
1054 );
1055
1056 if ( 'new' === $formID ) {
1057 $formID = SIB_Forms::addForm( $formData );
1058 if ( '' !== $pid ) {
1059 $transID = SIB_Forms_Lang::add_form_ID( $formID, $pid, $lang );
1060 }
1061 } else {
1062 SIB_Forms::updateForm( $formID, $formData );
1063 }
1064 if ( '' !== $pid ) {
1065 wp_safe_redirect(
1066 add_query_arg(
1067 array(
1068 'page' => self::PAGE_ID,
1069 'action' => 'edit',
1070 'id' => $formID,
1071 'pid' => $pid,
1072 'lang' => $lang,
1073 ), admin_url( 'admin.php' )
1074 )
1075 );
1076 exit();
1077 } else {
1078 wp_safe_redirect(
1079 add_query_arg(
1080 array(
1081 'page' => self::PAGE_ID,
1082 'action' => 'edit',
1083 'id' => $formID,
1084 ), admin_url( 'admin.php' )
1085 )
1086 );
1087 exit();
1088 }
1089 }
1090
1091 /** Ajax process when change template id */
1092 public static function ajax_change_template() {
1093 check_ajax_referer( 'ajax_sib_admin_nonce', 'security' );
1094 $template_id = isset( $_POST['template_id'] ) ? sanitize_text_field( $_POST['template_id'] ) : '';
1095 $mailin = new SendinblueApiClient( );
1096 $data = array(
1097 'id' => $template_id,
1098 );
1099 $response = $mailin->getEmailTemplate( $data["id"] );
1100
1101 $ret_email = '-1';
1102 if ( $mailin->getLastResponseCode() === SendinblueApiClient::RESPONSE_CODE_OK) {
1103 $from_email = $response[0]['sender']['email'];
1104 if ( '[DEFAULT_FROM_EMAIL]' == $from_email ) {
1105 $ret_email = '-1';
1106 } else {
1107 $ret_email = $from_email;
1108 }
1109 }
1110 wp_send_json( $ret_email );
1111 }
1112
1113 /**
1114 * Ajax module to get all lists.
1115 */
1116 public static function ajax_get_lists() {
1117 check_ajax_referer( 'ajax_sib_admin_nonce', 'security' );
1118 $lists = SIB_API_Manager::get_lists();
1119 $frmID = isset( $_POST['frmid'] ) ? sanitize_text_field( $_POST['frmid'] ) : '';
1120 $formData = SIB_Forms::getForm( $frmID );
1121 $result = array(
1122 'lists' => $lists,
1123 'selected' => $formData['listID'],
1124 );
1125 wp_send_json( $result );
1126 }
1127
1128 /**
1129 * Ajax module to get all templates.
1130 */
1131 public static function ajax_get_templates() {
1132 check_ajax_referer( 'ajax_sib_admin_nonce', 'security' );
1133 $templates = SIB_API_Manager::get_templates();
1134 $result = array(
1135 'templates' => $templates,
1136 );
1137 wp_send_json( $result );
1138 }
1139
1140 /**
1141 * Ajax module to get all attributes.
1142 */
1143 public static function ajax_get_attributes() {
1144 check_ajax_referer( 'ajax_sib_admin_nonce', 'security' );
1145 $attrs = SIB_API_Manager::get_attributes();
1146 $result = array(
1147 'attrs' => $attrs,
1148 );
1149 wp_send_json( $result );
1150 }
1151
1152 /**
1153 * Ajax module to update form html for preview
1154 */
1155 public static function ajax_update_html() {
1156 check_ajax_referer( 'ajax_sib_admin_nonce', 'security' );
1157 $gCaptchaType = isset( $_POST['gCaptchaType']) ? sanitize_text_field($_POST['gCaptchaType']) : '1';
1158 $gCaptcha = isset( $_POST['gCaptcha'] ) ? sanitize_text_field($_POST['gCaptcha']) : '0';
1159 if ( $gCaptcha != '0' ) {
1160 if( $gCaptchaType == '1' ) {
1161 $gCaptcha = '2';
1162 }
1163 elseif ( $gCaptchaType == '0' ) {
1164 $gCaptcha = '3';
1165 }
1166 }
1167 $formData = array(
1168 'html' => isset( $_POST['frmData'] ) ? wp_kses($_POST['frmData'], SIB_Manager::wordpress_allowed_attributes()) : '',// phpcs:ignore
1169 'css' => isset( $_POST['frmCss'] ) ? sanitize_text_field($_POST['frmCss']) : '',
1170 'dependTheme' => isset( $_POST['isDepend'] ) ? sanitize_text_field($_POST['isDepend']) : '',
1171 'gCaptcha' => $gCaptcha,
1172 'gCaptcha_site' => isset( $_POST['gCaptchaSite'] ) ? sanitize_text_field($_POST['gCaptchaSite']) : '',
1173 'selectCaptchaType' => isset( $_POST['selectCaptchaType'] ) ? sanitize_text_field($_POST['selectCaptchaType']) : '',
1174 );
1175
1176 update_option( SIB_Manager::PREVIEW_OPTION_NAME, $formData );
1177 die;
1178 }
1179
1180 /**
1181 * Ajax module to copy content from origin form for translation
1182 */
1183 public static function ajax_copy_origin_form() {
1184 check_ajax_referer( 'ajax_sib_admin_nonce', 'security' );
1185 $pID = isset( $_POST['pid'] ) ? sanitize_text_field( $_POST['pid'] ) : 1;
1186 $formData = SIB_Forms::getForm( $pID );
1187 // phpcs:ignore
1188 $html = $formData['html'];
1189
1190 wp_send_json( $html );
1191 }
1192 }
1193 }