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