PluginProbe
Booking Calendar / 10.10
Booking Calendar v10.10
11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 All 204 releases
booking / core / admin / page-email-new-visitor.php

page-email-new-visitor.php in Booking Calendar 10.10, at core/admin/page-email-new-visitor.php

1,045 lines 61.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @version 1.0
4 * @package Content
5 * @category Menu
6 * @author wpdevelop
7 *
8 * @web-site https://wpbookingcalendar.com/
9 * @email [email protected]
10 *
11 * @modified 2015-04-09
12 */
13
14 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
15
16
17 if ( ! defined( 'WPBC_EMAIL_NEW_VISITOR_PREFIX' ) ) define( 'WPBC_EMAIL_NEW_VISITOR_PREFIX', 'booking_email_' ); // Its defined in api-emails.php file & its same for all emails, here its used only for easy coding...
18
19 if ( ! defined( 'WPBC_EMAIL_NEW_VISITOR_ID' ) ) define( 'WPBC_EMAIL_NEW_VISITOR_ID', 'new_visitor' ); /* Define Name of Email Template.
20 Note. Prefix "booking_email_" defined in api-emails.php file.
21 Full name of option is - "booking_email_new_visitor"
22 Other email templates names:
23 - 'new_admin'
24 - 'new_visitor'
25 - 'approved'
26 - 'deny' -- pending, trash, deleted
27 - 'payment_request'
28 - 'modification'
29 */
30
31
32 require_once( WPBC_PLUGIN_DIR . '/core/any/api-emails.php' ); // API
33
34
35
36 // <editor-fold defaultstate="collapsed" desc=" Import Old Data " >
37
38 function wpbc_import6_is_old_email_new_visitor_exist() {
39
40 $is_old_data_exist = get_bk_option( 'booking_email_newbookingbyperson_content' );
41
42 if ( ! empty( $is_old_data_exist ) ) // Check if Old data exist
43 return true;
44 else
45 return false;
46 }
47
48 function wpbc_import6_get_old_email_new_visitor_data() {
49
50 $default_values = array();
51 if ( wpbc_import6_is_old_email_new_visitor_exist() ) {
52 $default_values['enabled'] = get_bk_option( 'booking_is_email_newbookingbyperson_adress' );
53 //$default_values['to'] = get_bk_option( 'booking_email_reservation_adress' ); //Parse it to Name and Email
54 $default_values['from'] = get_bk_option( 'booking_email_newbookingbyperson_adress' ); //Parse it to Name and Email, relpace [visitoremail]
55 $default_values['subject'] = get_bk_option( 'booking_email_newbookingbyperson_subject' );
56 $default_values['content'] = get_bk_option( 'booking_email_newbookingbyperson_content' );
57 }
58 return $default_values;
59 }
60
61
62 function wpbc_import6_is_new_email_new_visitor_exist() {
63
64 $is_data_exist = get_bk_option( WPBC_EMAIL_NEW_VISITOR_PREFIX . WPBC_EMAIL_NEW_VISITOR_ID ); // ''booking_email_' - defined in api-emails.php file.
65
66 if ( ! empty( $is_data_exist ) ) // Check if data exist
67 return true;
68 else
69 return false;
70 }
71
72
73 function wpbc_import6_email__new_visitor__get_fields_array_for_activation() {
74
75
76 if ( ! wpbc_import6_is_new_email_new_visitor_exist() ) { // New Email Template NOT exist
77
78 // Import
79 $old_data = wpbc_import6_get_old_email_new_visitor_data();
80 if ( ! empty( $old_data ) ) { // Get Old data
81
82 /*
83 $old_data = [
84 [enabled] => On
85 [to] => "Booking system" <[email protected]>
86 [from] => [visitoremail]
87 [subject] => New booking
88 [content] => You need to approve a new booking [bookingtype] for: [dates]<br/><br/> Person detail information:<br/> [content]<br/><br/> Currently a new booking is waiting for approval. Please visit the moderation panel [moderatelink]<br/><br/>Thank you, Beta<br/>[siteurl]
89 ]
90 wpbc_get_email_parts() >>> return [
91 [email] => [email protected]
92 [title] => Booking system
93 [original] => "Booking system"
94 [original_to_show] => "Booking system" <[email protected]>
95 ]
96 */
97
98 // Make transform - emails
99 // $email_to = wpbc_get_email_parts( $old_data['to'] );
100 $email_from = wpbc_get_email_parts( $old_data['from'] );
101
102 // $old_data['to'] = $email_to['email']; // '[email protected]' // booking_email_reservation_adress
103 // $old_data['to_name'] = $email_to['title']; // 'Booking system' // booking_email_reservation_adress
104 /* Description of Code.
105 * Here we replacing any shortcodes, like [visitoremail] to get_option( 'admin_email' )
106 * because we are setting in header "Reply-To" visitor emil from the booking form - its exist by hook for this email template at the wpbc-emails.php file
107 *
108 * Here we need to use for field "From" email with DNS same as DNS in the website. In most cases its have to be the get_option( 'admin_email' )
109 *
110 * After parsing with wpbc_get_email_parts, if we was have [visitoremail] in this field, then $email_from['email'] will be empty. So we check it and set admin email.
111 *
112 */
113 $old_data['from'] = ( empty( $email_from['email'] ) ? get_option( 'admin_email' ) /*$email_from['original']*/ : $email_from['email'] ); // [visitoremail] | [email protected] // booking_email_reservation_from_adress
114 $old_data['from_name'] = $email_from['title']; // [visitoremail] | 'Booking System' | '' // booking_email_reservation_from_adress
115
116 // $old_data['subject'] = html_entity_decode( $old_data['subject'] );
117 // $old_data['content'] = html_entity_decode( $old_data['content'] );
118 }
119
120 // Default
121 $init_fields_values = $old_data;
122 $mail_api = new WPBC_Emails_API_NewVisitor( WPBC_EMAIL_NEW_VISITOR_ID , $init_fields_values );
123
124 $default_fields_in_settings = $mail_api->get_default_values() ; // Get default fields values, from settings - defined in function init_settings_fields {class WPBC_Emails_API_NewVisitor}
125
126 $fields_values = wp_parse_args( $old_data, $default_fields_in_settings );
127
128 return array( WPBC_EMAIL_NEW_VISITOR_PREFIX . WPBC_EMAIL_NEW_VISITOR_ID => $fields_values );
129
130 /*
131 Array (
132 [booking_email_new_visitor] => Array
133 (
134 [enabled] => On
135 [to] => [email protected]
136 [to_name] => Booking system
137 [from] => [email protected]
138 [from_name] =>
139 [subject] => New booking
140 [content] => You need to approve a new booking [bookingtype] for: [dates]...
141 [header_content] =>
142 [footer_content] =>
143 [template_file] => plain
144 [base_color] => #557da1
145 [background_color] => #f5f5f5
146 [body_color] => #fdfdfd
147 [text_color] => #505050
148 [email_content_type] => html
149 )
150 )
151
152 // $mail_api->save_to_db( $fields_values );
153
154 */
155
156 } else { // New Email Template is Exist - return empty array(), its will make loading of data from DB, during activation Mail API class.
157 return array( WPBC_EMAIL_NEW_VISITOR_PREFIX . WPBC_EMAIL_NEW_VISITOR_ID => array() );
158 }
159 }
160 // </editor-fold>
161
162
163
164 /** Email F i e l d s */
165 class WPBC_Emails_API_NewVisitor extends WPBC_Emails_API { // O v e r r i d i n g "WPBC_Emails_API" ClASS
166
167
168 /** Overrided functions - define Email Fields & Values */
169 public function init_settings_fields() {
170
171 $this->fields = array();
172
173 $this->fields['enabled'] = array(
174 'type' => 'checkbox'
175 , 'default' => 'On'
176 , 'title' => __('Enable / Disable', 'booking')
177 , 'label' => __('Enable this email notification', 'booking')
178 , 'description' => ''
179 , 'group' => 'general'
180
181 );
182
183
184 /*
185 $this->fields['to_html_prefix'] = array(
186 'type' => 'pure_html'
187 , 'group' => 'general'
188 , 'html' => '<tr valign="top">
189 <th scope="row">
190 <label class="wpbc-form-email" for="'
191 . esc_attr( 'new_visitor_to' )
192 . '">' . wp_kses_post( __('To' ,'booking') )
193 . '</label>
194 </th>
195 <td><fieldset style="float:left;width:50%;margin-right:5%;">'
196 );
197 $this->fields['to'] = array(
198 'type' => 'text' // We are using here 'text' and not 'email', for ability to save several comma seperated emails.
199 , 'default' => get_option( 'admin_email' )
200 //, 'placeholder' => ''
201 , 'title' => ''
202 , 'description' => __('Email Address', 'booking') . '. ' . __('Required', 'booking') . '.'
203 , 'description_tag' => ''
204 , 'css' => 'width:100%'
205 , 'group' => 'general'
206 , 'tr_class' => ''
207 , 'only_field' => true
208 , 'validate_as' => array( 'required' )
209 );
210 $this->fields['to_html_middle'] = array(
211 'type' => 'pure_html'
212 , 'group' => 'general'
213 , 'html' => '</fieldset><fieldset style="float:left;width:45%;">'
214 );
215 $this->fields['to_name'] = array(
216 'type' => 'text'
217 , 'default' => 'Booking system'
218 //, 'placeholder' => ''
219 , 'title' => ''
220 , 'description' => __('Title', 'booking') . ' (' . __('optional', 'booking') . ').' //. ' ' . __('If empty then title defined as WordPress', 'booking')
221 , 'description_tag' => ''
222 , 'css' => 'width:100%'
223 , 'group' => 'general'
224 , 'tr_class' => ''
225 , 'only_field' => true
226 );
227 $this->fields['to_html_sufix'] = array(
228 'type' => 'pure_html'
229 , 'group' => 'general'
230 , 'html' => ' </fieldset>
231 </td>
232 </tr>'
233 );
234 */
235
236
237 $this->fields['from_html_prefix'] = array(
238 'type' => 'pure_html'
239 , 'group' => 'general'
240 , 'html' => '<tr valign="top">
241 <th scope="row">
242 <label class="wpbc-form-email" for="'
243 . esc_attr( 'new_visitor_from' )
244 . '">' . wp_kses_post( __('From' ,'booking') )
245 . '</label>
246 </th>
247 <td><fieldset style="float:left;width:50%;margin-right:5%;">'
248 );
249 $this->fields['from'] = array(
250 'type' => 'email' // Its can be only 1 email, so check it as Email field.
251 , 'default' => get_option( 'admin_email' )
252 //, 'placeholder' => ''
253 , 'title' => ''
254 , 'description' => __('Email Address', 'booking') . '. ' . __('Required', 'booking') . '.'
255 , 'description_tag' => ''
256 , 'css' => 'width:100%'
257 , 'group' => 'general'
258 , 'tr_class' => ''
259 , 'only_field' => true
260 , 'validate_as' => array( 'required' )
261 );
262 $this->fields['from_html_middle'] = array(
263 'type' => 'pure_html'
264 , 'group' => 'general'
265 , 'html' => '</fieldset><fieldset style="float:left;width:45%;">'
266 );
267 $this->fields['from_name'] = array(
268 'type' => 'text'
269 , 'default' => 'Booking system'
270 //, 'placeholder' => ''
271 , 'title' => ''
272 , 'description' => __('Title', 'booking') . ' (' . __('optional', 'booking') . ').' //. ' ' . __('If empty then title defined as WordPress', 'booking')
273 , 'description_tag' => ''
274 , 'css' => 'width:100%'
275 , 'group' => 'general'
276 , 'tr_class' => ''
277 , 'only_field' => true
278 );
279 $this->fields['from_html_sufix'] = array(
280 'type' => 'pure_html'
281 , 'group' => 'general'
282 , 'html' => ' </fieldset>
283 </td>
284 </tr>'
285 );
286
287
288
289
290 $this->fields['subject_before'] = array(
291 'type' => 'pure_html'
292 , 'group' => 'general_content'
293 , 'html' => '<tr><td colspan="2">'
294 .'<div style="margin: 0 0 15px;font-weight: 600;">'
295 .'<label class="wpbc-form-email-subject" for="' . WPBC_EMAIL_NEW_VISITOR_ID . '_subject">' .
296 __( 'Subject', 'booking' )
297 . '</label></div>'
298 );
299 $this->fields['subject'] = array(
300 'type' => 'text'
301 , 'default' => __( 'New booking', 'booking' )
302 //, 'placeholder' => ''
303 , 'title' => __('Subject', 'booking')
304 , 'description' => ''
305 , 'description_tag' => ''
306 , 'css' => 'width:100%;font-size:16px;line-height:34px;font-weight:600;'
307 , 'group' => 'general_content'
308 , 'tr_class' => ''
309 , 'validate_as' => array( 'required' )
310 , 'only_field' => true
311 );
312 $this->fields['subject_after'] = array( 'type' => 'pure_html', 'group' => 'general_content',
313 'html' => '<p style="text-align: right;font-size:12px;">'
314 /* translators: 1: ... */
315 . sprintf( __( 'Type your email %1$ssubject%2$s for the booking confirmation message.', 'booking' ),'<b>','</b>') . ' ' . __('Required', 'booking')
316 . '.</p>' . '</td></tr>' );
317
318 $blg_title = get_option( 'blogname' );
319 $blg_title = str_replace( array( '"', "'" ), '', $blg_title );
320
321 if ( class_exists( 'wpdev_bk_personal' ) ) {
322 /* translators: 1: ... */
323 $email_content = sprintf( __( 'Your reservation %1$s for: %2$s is processing now! We will send confirmation by email. %3$sYou can edit this booking at this page: %4$s Thank you, %5$s', 'booking' ), '[bookingtype]', '[dates]', '<br/><br/>[content]<br/><br/>', '[visitorbookingediturl]<br/><br/>', $blg_title . '<br/>[siteurl]' );
324 } else {
325 /* translators: 1: ... */
326 $email_content = sprintf( __( 'Your reservation %1$s for: %2$s is processing now! We will send confirmation by email. %3$s Thank you, %4$s', 'booking' ), '[bookingtype]', '[dates]', '<br/><br/>[content]<br/><br/>', $blg_title . '<br/>[siteurl]' );
327 }
328 $this->fields['content_before'] = array(
329 'type' => 'pure_html',
330 'group' => 'general_content',
331 'html' => '<tr><td colspan="2" style="padding-bottom:0;">'
332 . '<div style="margin: 0;font-weight: 600;">'
333 . '<label class="wpbc-form-email-content" for="' . WPBC_EMAIL_NEW_VISITOR_ID . '_content">' .
334 __( 'Content', 'booking' )
335 . '</label></div>'
336 );
337 $this->fields['content'] = array(
338 'type' => 'wp_textarea'
339 , 'default' => $email_content
340 //, 'placeholder' => ''
341 , 'title' => __('Content', 'booking')
342 , 'description' => ''//__('Type your email message content. ', 'booking')
343 , 'description_tag' => ''
344 , 'css' => ''
345 , 'group' => 'general_content'
346 , 'tr_class' => ''
347 , 'rows' => 17
348 , 'show_in_2_cols' => true
349 , 'only_field' => true
350 );
351 $this->fields['content_after'] = array( 'type' => 'pure_html', 'group' => 'general_content', 'html' => '</td></tr>' );
352 // $this->fields['content'] = htmlspecialchars( $this->fields['content'] );// Convert > to &gt;
353 // $this->fields['content'] = html_entity_decode( $this->fields['content'] );// Convert &gt; to >
354
355
356
357 ////////////////////////////////////////////////////////////////////
358 // Style
359 ////////////////////////////////////////////////////////////////////
360
361
362 $this->fields['header_content'] = array(
363 'type' => 'textarea'
364 , 'default' => ''
365 , 'title' => __('Email Heading', 'booking')
366 , 'description' => __('Enter main heading contained within the email notification.', 'booking')
367 //, 'placeholder' => ''
368 , 'rows' => 2
369 , 'css' => "width:100%;"
370 , 'group' => 'parts'
371 );
372 $this->fields['footer_content'] = array(
373 'type' => 'textarea'
374 , 'default' => ''
375 , 'title' => __('Email Footer Text', 'booking')
376 , 'description' => __('Enter text contained within footer of the email notification', 'booking')
377 //, 'placeholder' => ''
378 , 'rows' => 2
379 , 'css' => 'width:100%;'
380 , 'group' => 'parts'
381 );
382
383 $this->fields['template_file'] = array(
384 'type' => 'select'
385 , 'default' => 'plain'
386 , 'title' => __('Email template', 'booking')
387 , 'description' => __('Choose email template.', 'booking')
388 , 'description_tag' => 'span'
389 , 'css' => ''
390 , 'options' => array(
391 'plain' => __('Plain (without styles)', 'booking')
392 , 'standard' => __('Standard 1 column', 'booking')
393 )
394 , 'group' => 'style'
395 );
396
397 $this->fields['template_file_help'] = array(
398 'type' => 'help'
399 /* translators: 1: ... */
400 , 'value' => array( sprintf( __( 'You can override this email template in this folder %s', 'booking')
401 , '<code>' . realpath( dirname(__FILE__) . '/../any/emails_tpl/' ) . '</code>' )
402 )
403 , 'cols' => 2
404 , 'group' => 'style'
405 );
406
407 $this->fields['base_color'] = array(
408 'type' => 'color'
409 , 'default' => '#557da1'
410 , 'title' => __('Base Color', 'booking')
411 , 'description' => __('The base color for email templates.', 'booking')
412 . ' ' . __('Default color', 'booking') .': <code>#557da1</code>.'
413 , 'group' => 'style'
414 , 'tr_class' => 'template_colors'
415 );
416 $this->fields['background_color'] = array(
417 'type' => 'color'
418 , 'default' => '#f5f5f5'
419 , 'title' => __('Background Color', 'booking')
420 , 'description' => __('The background color for email templates.', 'booking')
421 . ' ' . __('Default color', 'booking') .': <code>#f5f5f5</code>.'
422 , 'group' => 'style'
423 , 'tr_class' => 'template_colors'
424 );
425 $this->fields['body_color'] = array(
426 'type' => 'color'
427 , 'default' => '#fdfdfd'
428 , 'title' => __('Email Body Background Color', 'booking')
429 , 'description' => __('The main body background color for email templates.', 'booking')
430 . ' ' . __('Default color', 'booking') .': <code>#fdfdfd</code>.'
431 , 'group' => 'style'
432 , 'tr_class' => 'template_colors'
433 );
434 $this->fields['text_color'] = array(
435 'type' => 'color'
436 , 'default' => '#505050'
437 , 'title' => __('Email Body Text Colour', 'booking')
438 , 'description' => __('The main body text color for email templates.', 'booking')
439 . ' ' . __('Default color', 'booking') .': <code>#505050</code>.'
440 , 'group' => 'style'
441 , 'tr_class' => 'template_colors'
442 );
443
444
445 ////////////////////////////////////////////////////////////////////
446 // Email format: Plain, HTML, MultiPart
447 ////////////////////////////////////////////////////////////////////
448
449
450 $this->fields['email_content_type'] = array(
451 'type' => 'select'
452 , 'default' => 'plain'
453 , 'title' => __('Email format', 'booking')
454 , 'description' => __('Choose which format of email to send.', 'booking')
455 , 'description_tag' => 'p'
456 , 'css' => 'width:100%;'
457 , 'options' => array(
458 'plain' => __('Plain text', 'booking')
459 // , 'html' => __('HTML', 'booking')
460 // , 'multipart' => __('Multipart', 'booking')
461 )
462 , 'group' => 'email_content_type'
463 );
464 if ( class_exists( 'DOMDocument' ) ) {
465 $this->fields['email_content_type']['options']['html'] = __('HTML', 'booking');
466 $this->fields['email_content_type']['options']['multipart'] = __('Multipart', 'booking');
467
468 $this->fields['email_content_type']['default'] = 'html';
469 }
470
471
472
473 ////////////////////////////////////////////////////////////////////
474 // Help
475 ////////////////////////////////////////////////////////////////////
476
477 $this->fields['content_help'] = array(
478 'type' => 'help'
479 , 'value' => array()
480 , 'cols' => 2
481 , 'group' => 'help'
482 , 'css' => 'padding-right: 10px !important;max-height: 598px;overflow: auto;'
483 , 'only_field' => true
484 );
485
486 $skip_shortcodes = array(
487 'denyreason'
488 , 'moderatelink'
489 , 'paymentreason'
490 //, 'visitorbookingediturl'
491 //, 'visitorbookingcancelurl'
492 //, 'visitorbookingslisting' //FixIn: 8.1.3.5.1
493 , 'visitorbookingpayurl'
494 );
495 /* translators: 1: ... */
496 $email_example = sprintf( __( 'For example: "You have a new reservation %1$s on the following date(s): %2$s Contact information: %3$s You can approve or cancel this booking at: %4$s Thank you, Reservation service."', 'booking' ),'','[dates]&lt;br/&gt;&lt;br/&gt;','&lt;br/&gt; [content]&lt;br/&gt;&lt;br/&gt;', htmlentities( ' <a href="[moderatelink]">'.__('here' ,'booking').'</a> ') . '&lt;br/&gt;&lt;br/&gt; ');
497
498 $help_fields = wpbc_get_email_help_shortcodes( $skip_shortcodes, $email_example );
499
500 foreach ( $help_fields as $help_fields_key => $help_fields_value ) {
501 $this->fields['content_help']['value'][] = $help_fields_value;
502 }
503
504 }
505
506 }
507
508
509
510 /** Settings Emails P a g e */
511 class WPBC_Settings_Page_Email_NewVisitor extends WPBC_Page_Structure {
512
513 public $email_settings_api = false;
514
515
516 /**
517 * Define interface for Email API
518 *
519 * @param string $selected_email_name - name of Email template
520 * @param array $init_fields_values - array of init form fields data
521 * @return object Email API
522 */
523 public function mail_api( $selected_email_name ='', $init_fields_values = array() ){
524
525 if ( $this->email_settings_api === false ) {
526 $this->email_settings_api = new WPBC_Emails_API_NewVisitor( $selected_email_name , $init_fields_values );
527 }
528
529 return $this->email_settings_api;
530 }
531
532
533 public function in_page() { // P a g e t a g
534 return 'wpbc-settings';
535 }
536
537
538 public function tabs() { // T a b s A r r a y
539
540 $tabs = array();
541
542 // $tabs[ 'email' ] = array(
543 // 'title' => __( 'Emails', 'booking') // Title of TAB
544 // , 'page_title'=> __( 'Emails Settings', 'booking') // Title of Page
545 // , 'hint' => __( 'Emails Settings', 'booking') // Hint
546 // //, 'link' => '' // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link
547 // //, 'position' => '' // 'left' || 'right' || ''
548 // //, 'css_classes'=> '' // CSS class(es)
549 // //, 'icon' => '' // Icon - link to the real PNG img
550 // , 'font_icon' => 'wpbc_icn_mail_outline' // CSS definition of forn Icon
551 // //, 'default' => false // Is this tab activated by default or not: true || false.
552 // //, 'disabled' => false // Is this tab disbaled: true || false.
553 // //, 'hided' => false // Is this tab hided: true || false.
554 // , 'subtabs' => array()
555 // );
556
557 $subtabs = array();
558
559 $is_data_exist = get_bk_option( WPBC_EMAIL_NEW_ADMIN_PREFIX . WPBC_EMAIL_NEW_VISITOR_ID );
560
561 $subtabs['new-visitor'] = array(
562 'type' => 'subtab' // Required| Possible values: 'subtab' | 'separator' | 'button' | 'goto-link' | 'html'
563 , 'title' => __('New Booking' ,'booking') . ' (' . __('visitor' ,'booking') . ')' // Title of TAB //__('New for Visitor' ,'booking') // Title of TAB
564 , 'page_title' => __('Emails Settings', 'booking') // Title of Page
565 , 'hint' => __('Customization of email template, which is sending to Visitor after new booking' ,'booking') // Hint
566 , 'link' => '' // link
567 , 'position' => '' // 'left' || 'right' || ''
568 , 'css_classes' => '' // CSS class(es)
569 //, 'icon' => 'http://.../icon.png' // Icon - link to the real PNG img
570 //, 'font_icon' => 'wpbc_icn_mail_outline' // CSS definition of Font Icon
571 , 'header_font_icon' => 'wpbc_icn_mail_outline' // CSS definition of Font Icon // FixIn: 9.5.5.3.
572 , 'default' => false // Is this sub tab activated by default or not: true || false.
573 , 'disabled' => false // Is this sub tab deactivated: true || false.
574 , 'checkbox' => false // or definition array for specific checkbox: array( 'checked' => true, 'name' => 'feature1_active_status' ) //, 'checkbox' => array( 'checked' => $is_checked, 'name' => 'enabled_active_status' )
575 , 'content' => 'content' // Function to load as conten of this TAB
576 , 'is_use_left_navigation' => true
577 , 'show_checked_icon' => true
578 , 'checked_data' => WPBC_EMAIL_NEW_ADMIN_PREFIX . WPBC_EMAIL_NEW_VISITOR_ID // This is where we get content
579 );
580
581 $tabs[ 'email' ]['subtabs'] = $subtabs;
582
583 return $tabs;
584 }
585
586
587 /** Show Content of Settings page */
588 public function content() {
589 $this->css();
590
591 // -------------------------------------------------------------------------------------------------------------
592 // Checking
593 // -------------------------------------------------------------------------------------------------------------
594 do_action( 'wpbc_hook_settings_page_header', 'emails_settings'); // Define Notices Section and show some static messages, if needed
595
596 if ( ! wpbc_is_mu_user_can_be_here('activated_user') ) return false; // Check if MU user activated, otherwise show Warning message.
597 // if ( ! wpbc_is_mu_user_can_be_here('only_super_admin') ) return false; // User is not Super admin, so exit. Basically its was already checked at the bottom of the PHP file, just in case.
598
599
600 // -------------------------------------------------------------------------------------------------------------
601 // S u b m i t Main Form
602 // -------------------------------------------------------------------------------------------------------------
603 $submit_form_name = 'wpbc_emails_template'; // Define form name
604 //$this->maybe_update(); // It is run from parent CLASS before showing this content on Actual Selected by user Page
605
606
607 ////////////////////////////////////////////////////////////////////////
608 // JavaScript: Tooltips, Popover, Datepick (js & css)
609 ////////////////////////////////////////////////////////////////////////
610
611 echo '<span class="wpdevelop">';
612
613 wpbc_js_for_bookings_page();
614
615 echo '</span>';
616
617
618 ////////////////////////////////////////////////////////////////////////
619 // Content
620 ////////////////////////////////////////////////////////////////////////
621 ?>
622 <div class="clear"></div>
623
624 <span class="metabox-holder">
625
626 <form name="<?php echo esc_attr( $submit_form_name ); ?>" id="<?php echo esc_attr( $submit_form_name ); ?>" action="" method="post" autocomplete="off">
627 <?php
628 // N o n c e field, and key for checking S u b m i t
629 wp_nonce_field( 'wpbc_settings_page_' . $submit_form_name );
630 ?><input type="hidden" name="is_form_sbmitted_<?php echo esc_attr( $submit_form_name ); ?>" id="is_form_sbmitted_<?php echo esc_attr( $submit_form_name ); ?>" value="1" /><?php
631
632 ?><div class="clear"></div><?php
633
634 wpbc_email_troubleshooting_help_notice();
635
636 ?>
637 <div class="metabox-holder">
638 <?php
639 wpbc_open_meta_box_section( $submit_form_name . 'general', __('Email is sending to Visitor after creation of booking.', 'booking') ); //FixIn: 8.1.2.17.1
640
641 $this->mail_api()->show( 'general' );
642
643 wpbc_close_meta_box_section();
644 ?>
645 <div class="wpbc_settings_row wpbc_settings_row_left" >
646 <?php
647 wpbc_open_meta_box_section( $submit_form_name . 'general_content', __('Email Content', 'booking') ); //FixIn: 8.1.2.17.1
648
649 $this->mail_api()->show( 'general_content' );
650
651 wpbc_close_meta_box_section();
652 ?>
653 </div>
654
655 <div class="wpbc_settings_row wpbc_settings_row_right">
656 <?php
657 wpbc_open_meta_box_section( $submit_form_name . 'help', __('Help', 'booking') );
658
659 $this->mail_api()->show( 'help' );
660
661 wpbc_close_meta_box_section();
662 ?>
663 </div>
664 <div class="clear"></div>
665 <?php
666 wpbc_open_meta_box_section( $submit_form_name . 'email_content_type', __('Email Type', 'booking') . ' / ' . __('Email Styles', 'booking') );
667
668 $this->mail_api()->show( 'email_content_type' );
669
670 $this->mail_api()->show( 'style' );
671
672 wpbc_close_meta_box_section();
673
674 wpbc_open_meta_box_section( $submit_form_name . 'parts' , __('Header / Footer', 'booking') );
675
676 $this->mail_api()->show( 'parts' );
677
678 wpbc_close_meta_box_section();
679 ?>
680 </div>
681 <input type="submit" value="<?php echo esc_attr( __( 'Save Changes', 'booking' ) ); ?>" class="button button-primary" />
682 </form>
683 </span>
684 <?php
685
686 $this->enqueue_js();
687 }
688
689
690 /**
691 * This function called from PARENT CLASS for actual selected tab. Firstly it load data and then Maybe Save changes.
692 * @return void
693 */
694 public function maybe_update() {
695
696 // -------------------------------------------------------------------------------------------------------------
697 // Load Data
698 // -------------------------------------------------------------------------------------------------------------
699
700 /* Check if New Email Template Exist or NOT
701 * Exist - return empty array in format: array( OPTION_NAME => array() )
702 * It will load DATA from DB, during creation mail_api CLASS
703 * during initial activation of the API its try to get option from DB
704 * We need to define this API before checking POST, to know all available fields
705 * Define Email Name & define field values from DB, if not exist, then default values.
706 * Not Exist - import Old Data from DB
707 * or get "default" data from settings and return array with this data
708 * This data its initial parameters for definition fields in mail_api CLASS
709 *
710 */
711
712 $init_fields_values = wpbc_import6_email__new_visitor__get_fields_array_for_activation();
713
714 // Get Value of first element - array of default or imported OLD data, because need only array of values without key - name of options for wp_options table
715 $init_fields_values_temp = array_values( $init_fields_values ); // FixIn: 7.0.1.32.
716 $init_fields_values = array_shift( $init_fields_values_temp );
717
718
719 $this->mail_api( WPBC_EMAIL_NEW_VISITOR_ID, $init_fields_values ); // FixIn: 9.8.2.1.
720
721
722 // -------------------------------------------------------------------------------------------------------------
723 // Maybe Update Data
724 // -------------------------------------------------------------------------------------------------------------
725
726 $submit_form_name = 'wpbc_emails_template'; // Define form name
727
728 $this->mail_api()->validated_form_id = $submit_form_name; // Define ID of Form for ability to validate fields before submit.
729
730 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
731 if ( isset( $_POST['is_form_sbmitted_'. $submit_form_name ] ) ) {
732
733 // Nonce checking {Return false if invalid, 1 if generated between, 0-12 hours ago, 2 if generated between 12-24 hours ago. }
734 $nonce_gen_time = check_admin_referer( 'wpbc_settings_page_' . $submit_form_name ); // Its stop show anything on submiting, if its not refear to the original page
735
736 // Save Changes
737 $this->update();
738 }
739 }
740
741
742 /** Update Email template to DB */
743 public function update() {
744
745 // Get Validated Email fields
746 $validated_fields = $this->mail_api()->validate_post();
747
748 $this->mail_api()->save_to_db( $validated_fields );
749
750 wpbc_show_message ( __('Settings saved.', 'booking'), 5 ); // Show Save message
751 }
752
753 // <editor-fold defaultstate="collapsed" desc=" CSS & JS " >
754
755 /** CSS for this page */
756 private function css() {
757 ?>
758 <style type="text/css">
759 .wpbc-help-message {
760 border:none;
761 margin:0 !important;
762 padding:0 !important;
763 }
764
765 @media (max-width: 399px) {
766 }
767 </style>
768 <?php
769 }
770
771
772 /**
773 * Add Custon JavaScript - for some specific settings options
774 * Executed After post content, after initial definition of settings, and possible definition after POST request.
775 *
776 * @param type $menu_slug
777 *
778 */
779 private function enqueue_js(){
780 $js_script = '';
781 //Show or hide colors section in settings page depend form selected email template.
782 $js_script .= " jQuery('select[name=\"new_visitor_template_file\"]').on( 'change', function(){
783 if ( jQuery('select[name=\"new_visitor_template_file\"] option:selected').val() == 'plain' ) {
784 jQuery('.template_colors').hide();
785 } else {
786 jQuery('.template_colors').show();
787 }
788 } ); ";
789 $js_script .= "\n"; //New Line
790 $js_script .= " if ( jQuery('select[name=\"new_visitor_template_file\"] option:selected').val() == 'plain' ) {
791 jQuery('.template_colors').hide();
792 } ";
793
794 // Show Warning messages if Title (optional) is empty - title of email will be "WordPress
795 $js_script .= " jQuery(document).ready(function(){ ";
796 $js_script .= " if ( jQuery('#new_visitor_to_name').val() == '' ) {";
797 $js_script .= " jQuery('#new_visitor_to_name').parent().append('<div class=\'updated\' style=\'border-left-color:#ffb900;padding:5px 10px;\'>". esc_js(__('If empty then title defined as WordPress', 'booking' ))."</div>')";
798 $js_script .= " }";
799 $js_script .= " if ( jQuery('#new_visitor_from_name').val() == '' ) {";
800 $js_script .= " jQuery('#new_visitor_from_name').parent().append('<div class=\'updated\' style=\'border-left-color:#ffb900;padding:5px 10px;\'>". esc_js(__('If empty then title defined as WordPress', 'booking' ))."</div>')";
801 $js_script .= " }";
802 $js_script .= " }); ";
803
804 // Eneque JS to the footer of the page
805 wpbc_enqueue_js( $js_script );
806 }
807
808 // </editor-fold>
809 }
810 add_action('wpbc_menu_created', array( new WPBC_Settings_Page_Email_NewVisitor() , '__construct') ); // Executed after creation of Menu
811
812
813
814 // <editor-fold defaultstate="collapsed" desc=" Emails Sending After New Booking " >
815
816 /**
817 * Get ShortCodes to Replace
818 *
819 * @param int $booking_id - ID of booking
820 * @param int $bktype - booking resource type
821 * @param string $formdata - booking form data content
822 */
823 function wpbc__get_replace_shortcodes__email_new_visitor( $booking_id, $bktype, $formdata ) {
824
825 $replace = array();
826
827 // Resources ///////////////////////////////////////////////////////////////
828 $bk_title = wpbc_get_resource_title( $bktype );
829 $parent_resource_title = wpbc_get_parent_resource_title( $bktype ); // FixIn: 10.9.2.4.
830
831 // FixIn: 9.6.3.10.
832 if ( class_exists( 'wpdev_bk_biz_l' ) ) {
833 $booking_data_arr = wpbc_api_get_booking_by_id( $booking_id );
834
835 $child_resource_id = (int) $booking_data_arr['booking_type'];
836
837 $bk_title = wpbc_get_resource_title( $child_resource_id );
838 }
839
840 // Dates ///////////////////////////////////////////////////////////////////
841 $my_dates4emeil = wpbc_db__get_sql_dates__in_booking__as_str( $booking_id );
842
843 $my_dates_4_send = ( 'short' === get_bk_option( 'booking_date_view_type' ) )
844 ? wpbc_get_dates_short_format( $my_dates4emeil )
845 : wpbc_get_dates_comma_string_localized( $my_dates4emeil );
846 $my_dates4emeil_check_in_out = explode( ',', $my_dates4emeil );
847
848 $my_check_in_date = wpbc_get_dates_comma_string_localized( $my_dates4emeil_check_in_out[0] );
849 $my_check_out_date = wpbc_get_dates_comma_string_localized( $my_dates4emeil_check_in_out[ count( $my_dates4emeil_check_in_out ) - 1 ] );
850 $my_check_in_onlydate = wpbc_get_dates_comma_string_localized( wpbc_datetime_localized( gmdate( 'Y-m-d 00:00:00', strtotime( $my_dates4emeil_check_in_out[0] ) ), 'Y-m-d 00:00:00' ) ); // FixIn: 8.7.2.5.
851 $my_check_out_onlydate = wpbc_get_dates_comma_string_localized( wpbc_datetime_localized( gmdate( 'Y-m-d 00:00:00', strtotime( $my_dates4emeil_check_in_out[ count( $my_dates4emeil_check_in_out ) - 1 ] ) ), 'Y-m-d 00:00:00' ) );
852 $my_check_out_plus1day = wpbc_get_dates_comma_string_localized( wpbc_datetime_localized( gmdate( 'Y-m-d H:i:s', strtotime( $my_dates4emeil_check_in_out[ count( $my_dates4emeil_check_in_out ) - 1 ] . " +1 day" ) ), 'Y-m-d H:i:s' ) ); // FixIn: 6.0.1.11.
853 $my_check_out_minus1day = wpbc_get_dates_comma_string_localized( wpbc_datetime_localized( gmdate( 'Y-m-d H:i:s', strtotime( $my_dates4emeil_check_in_out[ count( $my_dates4emeil_check_in_out ) - 1 ] . " -1 day" ) ), 'Y-m-d H:i:s' ) ); // FixIn: 7.2.1.6.
854
855 // FixIn: 10.1.5.6.
856 $dates_only_arr = wpbc_get_only_dates__from_dates_ymd_his_csv__as_arr( $my_dates4emeil ); // -> '2023-10-09, 2023-10-09'
857 $dates_only_str = implode( ',', $dates_only_arr );
858 $dates_only_str_formatted = ( 'short' === get_bk_option( 'booking_date_view_type' ) )
859 ? wpbc_get_dates_short_format( $dates_only_str )
860 : wpbc_get_dates_comma_string_localized( $dates_only_str );
861
862 // Cost ////////////////////////////////////////////////////////////////////
863 $booking_cost_digits_only = apply_bk_filter( 'get_booking_cost_from_db', '', $booking_id ); // FixIn: 9.2.3.1.
864 $booking_cost = wpbc_get_cost_with_currency_for_user( $booking_cost_digits_only );
865
866 // Other ///////////////////////////////////////////////////////////////////
867 $replace[ 'booking_id' ] = $booking_id;
868 $replace[ 'id' ] = $replace[ 'booking_id' ];
869 $replace[ 'dates' ] = $my_dates_4_send;
870 $replace[ 'only_dates' ] = $dates_only_str_formatted;
871 $replace[ 'dates_only' ] = $dates_only_str_formatted;
872 $replace[ 'check_in_date' ] = $my_check_in_date;
873 $replace[ 'check_out_date' ] = $my_check_out_date;
874 // FixIn: 8.7.2.5.
875 $replace[ 'check_in_only_date' ] = $my_check_in_onlydate;
876 $replace[ 'check_out_only_date' ] = $my_check_out_onlydate;
877
878 $replace[ 'check_out_plus1day'] = $my_check_out_plus1day; // FixIn: 6.0.1.11.
879
880 $replace[ 'check_out_minus1day'] = $my_check_out_minus1day; // FixIn: 7.2.1.6.
881 $replace[ 'dates_count' ] = count( $my_dates4emeil_check_in_out );
882 $replace['cost'] = $booking_cost;
883 $replace['cost_digits_only'] = $booking_cost_digits_only;
884 $replace[ 'siteurl' ] = htmlspecialchars_decode( '<a href="' . esc_url( home_url() ) . '">' . home_url() . '</a>' );
885 $replace[ 'resource_title'] = wpbc_lang( $bk_title );
886 $replace[ 'parent_resource_title'] = wpbc_lang( $parent_resource_title ); // FixIn: 10.9.2.4.
887 $replace[ 'bookingtype' ] = $replace[ 'resource_title'];
888 $replace[ 'remote_ip' ] = wpbc_get_user_ip(); //FixIn:7.1.2.4 // The IP address from which the user is viewing the current page.
889 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
890 $replace[ 'user_agent' ] = ( ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? sanitize_text_field( $_SERVER['HTTP_USER_AGENT'] ) : '' ); // Contents of the User-Agent: header from the current request, if there is one.
891 $server_http_referer_uri = ( ( isset( $_SERVER['HTTP_REFERER'] ) ) ? sanitize_text_field( $_SERVER['HTTP_REFERER'] ) : '' ); /* phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.MissingUnslash */ /* FixIn: sanitize_unslash */
892 $replace['request_url'] = $server_http_referer_uri; // The address of the page (if any) where action was occured. Because we are sending it in Ajax request, we need to use the REFERER HTTP
893 $replace[ 'current_date' ] = date_i18n( get_bk_option( 'booking_date_format' ) );
894 $replace[ 'current_time' ] = date_i18n( get_bk_option( 'booking_time_format' ) );
895
896 // Form Fields /////////////////////////////////////////////////////////////
897 $booking_form_show_array = wpbc__legacy__get_form_content_arr( $formdata, $bktype, '', $replace ); // We use here $replace array, becaise in "Content of booking filds data" form can be shortcodes from above definition
898
899 foreach ( $booking_form_show_array['_all_fields_'] as $shortcode_name => $shortcode_value ) {
900
901 if ( ! isset( $replace[ $shortcode_name ] ) )
902 $replace[ $shortcode_name ] = $shortcode_value;
903 }
904 $replace[ 'content' ] = $booking_form_show_array['content'];
905
906 // Links ///////////////////////////////////////////////////////////////////
907 $replace[ 'moderatelink' ] = htmlspecialchars_decode(
908 // '<a href="' .
909 esc_url( wpbc_get_bookings_url() . '&view_mode=vm_listing&tab=actions&wh_booking_id=' . $booking_id )
910 // . '">' . esc_html__('here', 'booking') . '</a>'
911 );
912 $replace[ 'visitorbookingediturl' ] = apply_bk_filter( 'wpdev_booking_set_booking_edit_link_at_email', '[visitorbookingediturl]', $booking_id );
913 $replace[ 'visitorbookingslisting' ] = apply_bk_filter( 'wpdev_booking_set_booking_edit_link_at_email', '[visitorbookingslisting]', $booking_id ); //FixIn: 8.1.3.5.1
914 $replace[ 'visitorbookingcancelurl' ] = apply_bk_filter( 'wpdev_booking_set_booking_edit_link_at_email', '[visitorbookingcancelurl]', $booking_id );
915 $replace[ 'visitorbookingpayurl' ] = apply_bk_filter( 'wpdev_booking_set_booking_edit_link_at_email', '[visitorbookingpayurl]', $booking_id );
916 $replace[ 'bookinghash' ] = apply_bk_filter( 'wpdev_booking_set_booking_edit_link_at_email', '[bookinghash]', $booking_id );
917
918 // FixIn: 8.8.2.4.
919 $booking_data = array( 'form_data' => $booking_form_show_array );
920 // $replace[ 'add_to_google_cal_url' ] = htmlspecialchars_decode( esc_url( wpbc_btn_add_booking_to_google_calendar( $booking_data , array( 'is_only_url' => true ), false ) ) );
921 // FixIn: 9.6.3.8.
922 $google_calendar_link = wpbc_booking_do_action__get_google_calendar_link( array(
923 'form_data' => $booking_form_show_array['_all_fields_'],
924 'form_show' => $booking_form_show_array['content'], //wp_strip_all_tags( $parsed_form_show ),
925 'dates_short' => array(
926 $my_dates4emeil_check_in_out[0]
927 , '-'
928 , $my_dates4emeil_check_in_out[ count( $my_dates4emeil_check_in_out ) - 1 ]
929 )
930 ) );
931 $replace['add_to_google_cal_url'] = htmlspecialchars_decode( esc_url( $google_calendar_link ) );
932 $replace['add_to_google_cal_button'] = '<a href="' . esc_attr( $replace['add_to_google_cal_url'] ) . '" target="_blank" rel="nofollow">' . esc_attr__( 'Add to Google Calendar', 'booking' ) . '</a>';
933
934
935 // -----------------------------------------------------------------------------------------------------------------
936 // Get additional replace paramaters to the email shortcodes
937 $replace = apply_filters( 'wpbc_replace_params_for_booking', $replace, $booking_id, $bktype, $formdata ); // FixIn: 8.0.1.7.
938
939
940 return $replace;
941
942
943 }
944
945
946 /**
947 * Send email about New Booking to Visitor
948 *
949 * @param type $booking_id - ID of booking
950 * @param type $bktype - type
951 * @param type $formdata - booking form data
952 */
953 function wpbc_send_email_new_visitor( $booking_id, $bktype, $formdata ) { // function wpbc_send_email_new() - Old
954
955 $previous_active_user = apply_bk_filter( 'wpbc_mu_set_environment_for_owner_of_resource', -1, $bktype ); // MU
956
957 ////////////////////////////////////////////////////////////////////////
958 // Load Data
959 ////////////////////////////////////////////////////////////////////////
960
961 /* Check if New Email Template Exist or NOT
962 * Exist - return empty array in format: array( OPTION_NAME => array() )
963 * Its will load DATA from DB, during creattion mail_api CLASS
964 * during initial activation of the API its try to get option from DB
965 * We need to define this API before checking POST, to know all available fields
966 * Define Email Name & define field values from DB, if not exist, then default values.
967 * Not Exist - import Old Data from DB
968 * or get "default" data from settings and return array with this data
969 * This data its initial parameters for definition fields in mail_api CLASS
970 *
971 */
972
973 $init_fields_values = wpbc_import6_email__new_visitor__get_fields_array_for_activation();
974
975 // Get Value of first element - array of default or imported OLD data, because need only array of values without key - name of options for wp_options table
976 $init_fields_values_temp = array_values( $init_fields_values ); // FixIn: 7.0.1.32.
977 $init_fields_values = array_shift( $init_fields_values_temp );
978
979 $mail_api = new WPBC_Emails_API_NewVisitor( WPBC_EMAIL_NEW_VISITOR_ID, $init_fields_values );
980
981 // -----------------------------------------------------------------------------------------------------------------
982 if ( $mail_api->fields_values['enabled'] == 'Off' ) return false; // Email template deactivated - exit.
983
984
985 $replace = wpbc__get_replace_shortcodes__email_new_visitor( $booking_id, $bktype, $formdata );
986
987 // Replace shortcodes with custom URL parameter, like: 'visitorbookingediturl', 'visitorbookingcancelurl', 'visitorbookingpayurl'
988 foreach ( array( 'visitorbookingediturl', 'visitorbookingcancelurl', 'visitorbookingpayurl', 'visitorbookingslisting' ) as $url_shortcode ) { //FixIn: 7.0.1.8 //FixIn: 8.1.3.5.1
989
990 // Loop to search if we are having several such shortcodes in our $mail_api->fields_values['content'] (For example, if we have several languges ).
991 $pos = 0; //FixIn: 7.0.1.52
992 do {
993 $shortcode_params = wpbc_get_params_of_shortcode_in_string( $url_shortcode, $mail_api->fields_values['content'] , $pos );
994
995 if ( ( ! empty( $shortcode_params ) ) && ( isset( $shortcode_params['url'] ) ) ){
996
997 $pos = $shortcode_params['end'];
998
999 $exist_replace = substr( $mail_api->fields_values['content'], $shortcode_params['start'], ( $shortcode_params['end'] - $shortcode_params['start'] ) );
1000
1001 $new_replace = $url_shortcode . wp_rand(1000,9000);
1002
1003 $pos = $shortcode_params['start'] + strlen( $new_replace ); //FixIn: 9.7.3.5.1
1004 $mail_api->fields_values['content'] = str_replace( $exist_replace, $new_replace ,$mail_api->fields_values['content'] );
1005
1006 $replace[ $new_replace ] = apply_bk_filter( 'wpdev_booking_set_booking_edit_link_at_email', '['.$exist_replace.']', $booking_id );
1007 } else if ( // FixIn: 8.1.1.8.
1008 ( ! empty( $shortcode_params ) )
1009 && ( isset( $shortcode_params['end'] ) )
1010 && ( $shortcode_params['end'] < strlen( $mail_api->fields_values['content'] ) )
1011 ) {
1012 $pos = $shortcode_params['end'];
1013 } else {
1014
1015 $shortcode_params = false; //FixIn: 7.0.1.58
1016 }
1017 } while ( ! empty( $shortcode_params ) ); // FixIn: 7.0.1.52.
1018 }
1019
1020 $mail_api->set_replace( $replace );
1021 $mail_api->fields_values['from_name'] = $mail_api->replace_shortcodes( $mail_api->fields_values['from_name'] ); // FixIn: 7.0.1.29.
1022
1023
1024 $to = ( isset( $replace['email'] ) ) ? $replace['email'] : ''; // Get To field
1025
1026 if ( ! empty( $replace['email'] ) ) {
1027 $to = wpbc_email_prepand_person_name( $replace['email'], $replace );
1028 }
1029
1030 $to = wpbc_check_for_several_emails_in_form( $to, $formdata, $bktype ); // FixIn: 6.0.1.9.
1031
1032 $to = str_replace( ';', ',', $to );
1033
1034 if ( wpbc_is_not_blank_email( $to, $replace['content'] ) ) {
1035 $email_result = $mail_api->send( $to, $replace );
1036 }
1037
1038 make_bk_action( 'wpbc_mu_set_environment_for_user', $previous_active_user ); // MU
1039
1040 $email_result = ( isset( $email_result ) ) ? $email_result : false;
1041 return $email_result;
1042 }
1043
1044 // </editor-fold>
1045