PluginProbe
Booking Calendar / 10.11.2
Booking Calendar v10.11.2
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 10.11.2 10.11.3 All 202 releases
booking / core / admin / page-email-trash.php

page-email-trash.php in Booking Calendar 10.11.2, at core/admin/page-email-trash.php

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