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