PluginProbe
Booking Calendar / 10.1.3
Booking Calendar v10.1.3
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 10.11.2 All 203 releases
booking / core / admin / page-email-new-admin.php

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

1,065 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 info@wpbookingcalendar.com
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_ADMIN_PREFIX' ) ) define( 'WPBC_EMAIL_NEW_ADMIN_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_ADMIN_ID' ) ) define( 'WPBC_EMAIL_NEW_ADMIN_ID', 'new_admin' ); /* 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_admin"
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_admin_exist() {
39
40 $is_old_data_exist = get_bk_option( 'booking_email_reservation_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_admin_data() {
49
50 $default_values = array();
51 if ( wpbc_import6_is_old_email_new_admin_exist() ) {
52 $default_values['enabled'] = get_bk_option( 'booking_is_email_reservation_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_reservation_from_adress' ); //Parse it to Name and Email, relpace [visitoremail]
55 $default_values['subject'] = get_bk_option( 'booking_email_reservation_subject' );
56 $default_values['content'] = get_bk_option( 'booking_email_reservation_content' );
57 }
58 return $default_values;
59 }
60
61
62 function wpbc_import6_is_new_email_new_admin_exist() {
63
64 $is_data_exist = get_bk_option( WPBC_EMAIL_NEW_ADMIN_PREFIX . WPBC_EMAIL_NEW_ADMIN_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_admin__get_fields_array_for_activation() {
74
75
76 if ( ! wpbc_import6_is_new_email_new_admin_exist() ) { // New Email Template NOT exist
77
78 // Import
79 $old_data = wpbc_import6_get_old_email_new_admin_data();
80
81 if ( ! empty( $old_data ) ) { // Get Old data
82
83 /*
84 $old_data = [
85 [enabled] => On
86 [to] => "Booking system" <beta@wpbookingcalendar.com>
87 [from] => [visitoremail]
88 [subject] => New booking
89 [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]
90 ]
91 wpbc_get_email_parts() >>> return [
92 [email] => beta@wpbookingcalendar.com
93 [title] => Booking system
94 [original] => "Booking system"
95 [original_to_show] => "Booking system" <beta@wpbookingcalendar.com>
96 ]
97 */
98
99 // Make transform - emails
100 $email_to = wpbc_get_email_parts( $old_data['to'] );
101 $email_from = wpbc_get_email_parts( $old_data['from'] );
102
103 $old_data['to'] = $email_to['email']; // 'beta@wpbookingcalendar.com' // booking_email_reservation_adress
104 $old_data['to_name'] = $email_to['title']; // 'Booking system' // booking_email_reservation_adress
105 /* Description of Code.
106 * Here we replacing any shortcodes, like [visitoremail] to get_option( 'admin_email' )
107 * 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
108 *
109 * 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' )
110 *
111 * 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.
112 *
113 */
114 $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
115 $old_data['from_name'] = $email_from['title']; // [visitoremail] | 'Booking System' | '' // booking_email_reservation_from_adress
116
117 // $old_data['subject'] = html_entity_decode( $old_data['subject'] );
118 // $old_data['content'] = html_entity_decode( $old_data['content'] );
119 }
120
121 // Default
122 $init_fields_values = $old_data;
123 $mail_api = new WPBC_Emails_API_NewAdmin( WPBC_EMAIL_NEW_ADMIN_ID , $init_fields_values );
124
125 $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_NewAdmin}
126
127 $fields_values = wp_parse_args( $old_data, $default_fields_in_settings );
128
129 return array( WPBC_EMAIL_NEW_ADMIN_PREFIX . WPBC_EMAIL_NEW_ADMIN_ID => $fields_values );
130
131 /*
132 Array (
133 [booking_email_new_admin] => Array
134 (
135 [enabled] => On
136 [to] => beta@wpbookingcalendar.com
137 [to_name] => Booking system
138 [from] => admin@wpbookingcalendar.com
139 [from_name] =>
140 [subject] => New booking
141 [content] => You need to approve a new booking [bookingtype] for: [dates]...
142 [header_content] =>
143 [footer_content] =>
144 [template_file] => plain
145 [base_color] => #557da1
146 [background_color] => #f5f5f5
147 [body_color] => #fdfdfd
148 [text_color] => #505050
149 [email_content_type] => html
150 )
151 )
152
153 // $mail_api->save_to_db( $fields_values );
154
155 */
156
157 } else { // New Email Template is Exist - return empty array(), its will make loading of data from DB, during activation Mail API class.
158 return array( WPBC_EMAIL_NEW_ADMIN_PREFIX . WPBC_EMAIL_NEW_ADMIN_ID => array() );
159 }
160 }
161 // </editor-fold>
162
163
164
165 /** Email F i e l d s */
166 class WPBC_Emails_API_NewAdmin extends WPBC_Emails_API { // O v e r r i d i n g "WPBC_Emails_API" ClASS
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 $this->fields['to_html_prefix'] = array(
184 'type' => 'pure_html'
185 , 'group' => 'general'
186 , 'html' => '<tr valign="top">
187 <th scope="row">
188 <label class="wpbc-form-email" for="'
189 . esc_attr( 'new_admin_to' )
190 . '">' . wp_kses_post( __('To' ,'booking') )
191 . '</label>
192 </th>
193 <td><fieldset style="float:left;width:50%;margin-right:5%;">'
194 );
195 $this->fields['to'] = array(
196 'type' => 'text' // We are using here 'text' and not 'email', for ability to save several comma seperated emails.
197 , 'default' => get_option( 'admin_email' )
198 //, 'placeholder' => ''
199 , 'title' => ''
200 , 'description' => __('Email Address', 'booking') . '. ' . __('Required', 'booking') . '.'
201 , 'description_tag' => ''
202 , 'css' => 'width:100%'
203 , 'group' => 'general'
204 , 'tr_class' => ''
205 , 'only_field' => true
206 , 'validate_as' => array( 'required' )
207 );
208 $this->fields['to_html_middle'] = array(
209 'type' => 'pure_html'
210 , 'group' => 'general'
211 , 'html' => '</fieldset><fieldset style="float:left;width:45%;">'
212 );
213 $this->fields['to_name'] = array(
214 'type' => 'text'
215 , 'default' => 'Booking system'
216 //, 'placeholder' => ''
217 , 'title' => ''
218 , 'description' => __('Title', 'booking') . ' (' . __('optional', 'booking') . ').' //. ' ' . __('If empty then title defined as WordPress', 'booking')
219 , 'description_tag' => ''
220 , 'css' => 'width:100%'
221 , 'group' => 'general'
222 , 'tr_class' => ''
223 , 'only_field' => true
224 );
225 $this->fields['to_html_sufix'] = array(
226 'type' => 'pure_html'
227 , 'group' => 'general'
228 , 'html' => ' </fieldset>
229 </td>
230 </tr>'
231 );
232
233
234
235 $this->fields['from_html_prefix'] = array(
236 'type' => 'pure_html'
237 , 'group' => 'general'
238 , 'html' => '<tr valign="top">
239 <th scope="row">
240 <label class="wpbc-form-email" for="'
241 . esc_attr( 'new_admin_from' )
242 . '">' . wp_kses_post( __('From' ,'booking') )
243 . '</label>
244 </th>
245 <td><fieldset style="float:left;width:50%;margin-right:5%;">'
246 );
247 $this->fields['from'] = array(
248 'type' => 'email' // Its can be only 1 email, so check it as Email field.
249 , 'default' => get_option( 'admin_email' )
250 //, 'placeholder' => ''
251 , 'title' => ''
252 , 'description' => __('Email Address', 'booking') . '. ' . __('Required', 'booking') . '.'
253 , 'description_tag' => ''
254 , 'css' => 'width:100%'
255 , 'group' => 'general'
256 , 'tr_class' => ''
257 , 'only_field' => true
258 , 'validate_as' => array( 'required' )
259 );
260 $this->fields['from_html_middle'] = array(
261 'type' => 'pure_html'
262 , 'group' => 'general'
263 , 'html' => '</fieldset><fieldset style="float:left;width:45%;">'
264 );
265 $this->fields['from_name'] = array(
266 'type' => 'text'
267 , 'default' => 'Booking system'
268 //, 'placeholder' => ''
269 , 'title' => ''
270 , 'description' => __('Title', 'booking') . ' (' . __('optional', 'booking') . ').' //. ' ' . __('If empty then title defined as WordPress', 'booking')
271 , 'description_tag' => ''
272 , 'css' => 'width:100%'
273 , 'group' => 'general'
274 , 'tr_class' => ''
275 , 'only_field' => true
276 );
277 $this->fields['from_html_sufix'] = array(
278 'type' => 'pure_html'
279 , 'group' => 'general'
280 , 'html' => ' </fieldset>
281 </td>
282 </tr>'
283 );
284 //FixIn: 9.7.3.17
285 $this->fields['enable_replyto'] = array(
286 'type' => 'checkbox'
287 , 'default' => 'Off'
288 , 'title' => __( 'Enable Reply-To', 'booking' )
289 , 'label' => __( 'Enable Reply-To visitor email', 'booking' )
290 , 'description' => ''
291 , 'group' => 'general'
292
293 );
294 $this->fields['subject_before'] = array(
295 'type' => 'pure_html'
296 , 'group' => 'general_content'
297 , 'html' => '<tr><td colspan="2">'
298 .'<div style="margin: 0 0 15px;font-weight: 600;">'
299 .'<label class="wpbc-form-email-subject" for="' . WPBC_EMAIL_NEW_ADMIN_ID . '_subject">' .
300 __( 'Subject', 'booking' )
301 . '</label></div>'
302 );
303 $this->fields['subject'] = array(
304 'type' => 'text'
305 , 'default' => __( 'New booking', 'booking' )
306 //, 'placeholder' => ''
307 , 'title' => __('Subject', 'booking')
308 , 'description' => ''
309 , 'description_tag' => ''
310 , 'css' => 'width:100%;font-size:16px;line-height:34px;font-weight:600;'
311 , 'group' => 'general_content'
312 , 'tr_class' => ''
313 , 'validate_as' => array( 'required' )
314 , 'only_field' => true
315 );
316 $this->fields['subject_after'] = array( 'type' => 'pure_html', 'group' => 'general_content',
317 'html' => '<p style="text-align: right;font-size:12px;">'
318 . sprintf( __( 'Type your email %ssubject%s for the booking confirmation message.', 'booking' ), '<b>', '</b>' ) . ' ' . __( 'Required', 'booking' )
319 . '.</p>' . '</td></tr>' );
320
321 $this->fields['content_before'] = array(
322 'type' => 'pure_html',
323 'group' => 'general_content',
324 'html' => '<tr><td colspan="2" style="padding-bottom:0;">'
325 . '<div style="margin: 0;font-weight: 600;">'
326 . '<label class="wpbc-form-email-content" for="' . WPBC_EMAIL_NEW_ADMIN_ID . '_content">' .
327 __( 'Content', 'booking' )
328 . '</label></div>'
329 );
330 $blg_title = get_option( 'blogname' );
331 $blg_title = str_replace( array( '"', "'" ), '', $blg_title );
332 $this->fields['content'] = array(
333 'type' => 'wp_textarea'
334 , 'default' => sprintf( __( 'You need to approve a new booking %s for: %s Person detail information:%s Currently a new booking is waiting for approval. Please visit the moderation panel%sThank you, %s', 'booking' ), '[bookingtype]', '[dates]<br/><br/>', '<br/> [content]<br/><br/>', ' [moderatelink]<br/><br/>', $blg_title . '<br/>[siteurl]' )
335 //, 'placeholder' => ''
336 , 'title' => __('Content', 'booking')
337 , 'description' => ''//__('Type your email message content. ', 'booking')
338 , 'description_tag' => ''
339 , 'css' => ''
340 , 'group' => 'general_content'
341 , 'tr_class' => ''
342 , 'rows' => 17
343 , 'show_in_2_cols' => true
344 , 'only_field' => true
345 );
346 $this->fields['content_after'] = array( 'type' => 'pure_html', 'group' => 'general_content', 'html' => '</td></tr>' );
347
348 // $this->fields['content'] = htmlspecialchars( $this->fields['content'] );// Convert > to &gt;
349 // $this->fields['content'] = html_entity_decode( $this->fields['content'] );// Convert &gt; to >
350
351
352
353 ////////////////////////////////////////////////////////////////////
354 // Style
355 ////////////////////////////////////////////////////////////////////
356
357
358 $this->fields['header_content'] = array(
359 'type' => 'textarea'
360 , 'default' => ''
361 , 'title' => __('Email Heading', 'booking')
362 , 'description' => __('Enter main heading contained within the email notification.', 'booking')
363 //, 'placeholder' => ''
364 , 'rows' => 2
365 , 'css' => "width:100%;"
366 , 'group' => 'parts'
367 );
368 $this->fields['footer_content'] = array(
369 'type' => 'textarea'
370 , 'default' => ''
371 , 'title' => __('Email Footer Text', 'booking')
372 , 'description' => __('Enter text contained within footer of the email notification', 'booking')
373 //, 'placeholder' => ''
374 , 'rows' => 2
375 , 'css' => 'width:100%;'
376 , 'group' => 'parts'
377 );
378
379 $this->fields['template_file'] = array(
380 'type' => 'select'
381 , 'default' => 'plain'
382 , 'title' => __('Email template', 'booking')
383 , 'description' => __('Choose email template.', 'booking')
384 , 'description_tag' => 'span'
385 , 'css' => ''
386 , 'options' => array(
387 'plain' => __('Plain (without styles)', 'booking')
388 , 'standard' => __('Standard 1 column', 'booking')
389 )
390 , 'group' => 'style'
391 );
392
393 $this->fields['template_file_help'] = array(
394 'type' => 'help'
395 , 'value' => array( sprintf( __('You can override this email template in this folder %s', 'booking')
396 , '<code>' . realpath( dirname(__FILE__) . '/../any/emails_tpl/' ) . '</code>' )
397 )
398 , 'cols' => 2
399 , 'group' => 'style'
400 );
401
402 $this->fields['base_color'] = array(
403 'type' => 'color'
404 , 'default' => '#557da1'
405 , 'title' => __('Base Color', 'booking')
406 , 'description' => __('The base color for email templates.', 'booking')
407 . ' ' . __('Default color', 'booking') .': <code>#557da1</code>.'
408 , 'group' => 'style'
409 , 'tr_class' => 'template_colors'
410 );
411 $this->fields['background_color'] = array(
412 'type' => 'color'
413 , 'default' => '#f5f5f5'
414 , 'title' => __('Background Color', 'booking')
415 , 'description' => __('The background color for email templates.', 'booking')
416 . ' ' . __('Default color', 'booking') .': <code>#f5f5f5</code>.'
417 , 'group' => 'style'
418 , 'tr_class' => 'template_colors'
419 );
420 $this->fields['body_color'] = array(
421 'type' => 'color'
422 , 'default' => '#fdfdfd'
423 , 'title' => __('Email Body Background Color', 'booking')
424 , 'description' => __('The main body background color for email templates.', 'booking')
425 . ' ' . __('Default color', 'booking') .': <code>#fdfdfd</code>.'
426 , 'group' => 'style'
427 , 'tr_class' => 'template_colors'
428 );
429 $this->fields['text_color'] = array(
430 'type' => 'color'
431 , 'default' => '#505050'
432 , 'title' => __('Email Body Text Colour', 'booking')
433 , 'description' => __('The main body text color for email templates.', 'booking')
434 . ' ' . __('Default color', 'booking') .': <code>#505050</code>.'
435 , 'group' => 'style'
436 , 'tr_class' => 'template_colors'
437 );
438
439
440 ////////////////////////////////////////////////////////////////////
441 // Email format: Plain, HTML, MultiPart
442 ////////////////////////////////////////////////////////////////////
443
444
445 $this->fields['email_content_type'] = array(
446 'type' => 'select'
447 , 'default' => 'plain'
448 , 'title' => __('Email format', 'booking')
449 , 'description' => __('Choose which format of email to send.', 'booking')
450 , 'description_tag' => 'p'
451 , 'css' => 'width:100%;'
452 , 'options' => array(
453 'plain' => __('Plain text', 'booking')
454 // , 'html' => __('HTML', 'booking')
455 // , 'multipart' => __('Multipart', 'booking')
456 )
457 , 'group' => 'email_content_type'
458 );
459 if ( class_exists( 'DOMDocument' ) ) {
460 $this->fields['email_content_type']['options']['html'] = __('HTML', 'booking');
461 $this->fields['email_content_type']['options']['multipart'] = __('Multipart', 'booking');
462
463 $this->fields['email_content_type']['default'] = 'html';
464 }
465
466
467
468 ////////////////////////////////////////////////////////////////////
469 // Help
470 ////////////////////////////////////////////////////////////////////
471
472 $this->fields['content_help'] = array(
473 'type' => 'help'
474 , 'value' => array()
475 , 'cols' => 2
476 , 'group' => 'help'
477 , 'css' => 'padding-right: 10px !important;max-height: 598px;overflow: auto;'
478 , 'only_field' => true
479 );
480
481 $skip_shortcodes = array(
482 'denyreason'
483 , 'paymentreason'
484 , 'visitorbookingediturl'
485 , 'visitorbookingslisting' //FixIn: 8.1.3.5.1
486 , 'visitorbookingcancelurl'
487 , 'visitorbookingpayurl'
488 );
489 $email_example = sprintf(__('For example: "You have a new reservation %s on the following date(s): %s Contact information: %s You can approve or cancel this booking at: %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; ');
490
491 $help_fields = wpbc_get_email_help_shortcodes( $skip_shortcodes, $email_example );
492
493 foreach ( $help_fields as $help_fields_key => $help_fields_value ) {
494 $this->fields['content_help']['value'][] = $help_fields_value;
495 }
496
497 }
498
499 }
500
501
502
503 /** Settings Emails P a g e */
504 class WPBC_Settings_Page_Email_NewAdmin extends WPBC_Page_Structure {
505
506 public $email_settings_api = false;
507
508
509 /**
510 * Define interface for Email API
511 *
512 * @param string $selected_email_name - name of Email template
513 * @param array $init_fields_values - array of init form fields data
514 * @return object Email API
515 */
516 public function mail_api( $selected_email_name ='', $init_fields_values = array() ){
517
518 if ( $this->email_settings_api === false ) {
519 $this->email_settings_api = new WPBC_Emails_API_NewAdmin( $selected_email_name , $init_fields_values );
520 }
521
522 return $this->email_settings_api;
523 }
524
525
526 public function in_page() { // P a g e t a g
527 // if (
528 // ( ! wpbc_is_mu_user_can_be_here( 'only_super_admin' ) )
529 // && ( ! wpbc_is_current_user_have_this_role('contributor') )
530 // ){ // If this User not "super admin", then do not load this page at all
531 // return (string) rand(100000, 1000000);
532 // }
533
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
560 $is_data_exist = get_bk_option( WPBC_EMAIL_NEW_ADMIN_PREFIX . WPBC_EMAIL_NEW_ADMIN_ID ); // ''booking_email_' - defined in api-emails.php file.
561
562 $subtabs['new-admin'] = array(
563 'type' => 'subtab' // Required| Possible values: 'subtab' | 'separator' | 'button' | 'goto-link' | 'html'
564 , 'title' => __('New Booking' ,'booking') . ' (' . __('admin' ,'booking') . ')' // Title of TAB
565 , 'page_title' => __('Emails Settings', 'booking') // Title of Page
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.6.1.4
572 , 'default' => true // 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_ADMIN_ID // This is where we get content
579 //, 'hint' => array( 'title' => __('Customization of email template, which is sending to Admin after new booking' ,'booking') , 'position' => 'right' )
580 );
581
582 $tabs[ 'email' ]['subtabs'] = $subtabs;
583
584 return $tabs;
585 }
586
587
588 /** Show Content of Settings page */
589 public function content() {
590 $this->css();
591
592 // -------------------------------------------------------------------------------------------------------------
593 // Checking
594 // -------------------------------------------------------------------------------------------------------------
595 do_action( 'wpbc_hook_settings_page_header', 'emails_settings'); // Define Notices Section and show some static messages, if needed
596
597 if ( ! wpbc_is_mu_user_can_be_here('activated_user') ) return false; // Check if MU user activated, otherwise show Warning message.
598 // 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.
599
600
601 // -------------------------------------------------------------------------------------------------------------
602 // S u b m i t Main Form
603 // -------------------------------------------------------------------------------------------------------------
604 $submit_form_name = 'wpbc_emails_template'; // Define form name
605 // $this->maybe_update(); // It is run from parent CLASS before showing this content on Actual Selected by user Page
606
607
608 ////////////////////////////////////////////////////////////////////////
609 // JavaScript: Tooltips, Popover, Datepick (js & css)
610 ////////////////////////////////////////////////////////////////////////
611
612 echo '<span class="wpdevelop">';
613
614 wpbc_js_for_bookings_page();
615
616 echo '</span>';
617
618
619 ////////////////////////////////////////////////////////////////////////
620 // Content
621 ////////////////////////////////////////////////////////////////////////
622 ?>
623 <div class="clear"></div>
624
625 <span class="metabox-holder">
626
627 <form name="<?php echo $submit_form_name; ?>" id="<?php echo $submit_form_name; ?>" action="" method="post" autocomplete="off">
628 <?php
629 // N o n c e field, and key for checking S u b m i t
630 wp_nonce_field( 'wpbc_settings_page_' . $submit_form_name );
631 ?><input type="hidden" name="is_form_sbmitted_<?php echo $submit_form_name; ?>" id="is_form_sbmitted_<?php echo $submit_form_name; ?>" value="1" />
632
633 <div class="clear"></div>
634 <?php
635
636 wpbc_email_troubleshooting_help_notice();
637
638 ?>
639 <div class="metabox-holder">
640 <?php
641 wpbc_open_meta_box_section( $submit_form_name . 'general', __('Email is sending to Admin after creation of booking.', 'booking') ); //FixIn: 8.1.2.17.1
642
643 $this->mail_api()->show( 'general' );
644
645 wpbc_close_meta_box_section();
646 ?>
647 <div class="wpbc_settings_row wpbc_settings_row_left" >
648 <?php
649 wpbc_open_meta_box_section( $submit_form_name . 'general_content', __('Email Content', 'booking') ); //FixIn: 8.1.2.17.1
650
651 $this->mail_api()->show( 'general_content' );
652
653 wpbc_close_meta_box_section();
654 ?>
655 </div>
656
657 <div class="wpbc_settings_row wpbc_settings_row_right">
658 <?php
659 wpbc_open_meta_box_section( $submit_form_name . 'help', __('Help', 'booking') );
660
661 $this->mail_api()->show( 'help' );
662
663 wpbc_close_meta_box_section();
664 ?>
665 </div>
666 <div class="clear"></div>
667 <?php
668 wpbc_open_meta_box_section( $submit_form_name . 'email_content_type', __('Email Type', 'booking') . ' / ' . __('Email Styles', 'booking') );
669
670 $this->mail_api()->show( 'email_content_type' );
671
672 $this->mail_api()->show( 'style' );
673
674 wpbc_close_meta_box_section();
675
676 wpbc_open_meta_box_section( $submit_form_name . 'parts' , __('Header / Footer', 'booking') );
677
678 $this->mail_api()->show( 'parts' );
679
680 wpbc_close_meta_box_section();
681 ?>
682 </div>
683 <input type="submit" value="<?php echo esc_attr( __( 'Save Changes', 'booking' ) ); ?>" class="button button-primary" />
684 </form>
685 </span>
686 <?php
687
688 $this->enqueue_js();
689 }
690
691
692 /**
693 * This function called from PARENT CLASS for actual selected tab. Firstly it load data and then Maybe Save changes.
694 * @return void
695 */
696 public function maybe_update() {
697
698 // -------------------------------------------------------------------------------------------------------------
699 // Load Data
700 // -------------------------------------------------------------------------------------------------------------
701
702 /* Check if New Email Template Exist or NOT
703 * Exist - return empty array in format: array( OPTION_NAME => array() )
704 * It will load DATA from DB, during creation mail_api CLASS
705 * during initial activation of the API its try to get option from DB
706 * We need to define this API before checking POST, to know all available fields
707 * Define Email Name & define field values from DB, if not exist, then default values.
708 * Not Exist - import Old Data from DB
709 * or get "default" data from settings and return array with this data
710 * This data its initial parameters for definition fields in mail_api CLASS
711 *
712 */
713
714 $init_fields_values = wpbc_import6_email__new_admin__get_fields_array_for_activation();
715
716 // 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
717 $init_fields_values_temp = array_values( $init_fields_values ); //FixIn: 7.0.1.32
718 $init_fields_values = array_shift( $init_fields_values_temp );
719
720
721 $this->mail_api( WPBC_EMAIL_NEW_ADMIN_ID, $init_fields_values );
722
723 // -------------------------------------------------------------------------------------------------------------
724 // Maybe Update Data
725 // -------------------------------------------------------------------------------------------------------------
726
727 $submit_form_name = 'wpbc_emails_template'; // Define form name
728
729 $this->mail_api()->validated_form_id = $submit_form_name; // Define ID of Form for ability to validate fields before submit.
730
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(){ // $page_tag, $active_page_tab, $active_page_subtab ) {
780 $js_script = '';
781 //Show or hide colors section in settings page depend form selected email template.
782 $js_script .= " jQuery('select[name=\"new_admin_template_file\"]').on( 'change', function(){
783 if ( jQuery('select[name=\"new_admin_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_admin_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_admin_to_name').val() == '' ) {";
797 $js_script .= " jQuery('#new_admin_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_admin_from_name').val() == '' ) {";
800 $js_script .= " jQuery('#new_admin_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_NewAdmin() , '__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_admin( $booking_id, $bktype, $formdata ) {
824
825 $replace = array();
826
827 // Resources ///////////////////////////////////////////////////////////////
828 $bk_title = wpbc_get_resource_title( $bktype );
829
830 //FixIn: 9.6.3.10
831 if ( class_exists( 'wpdev_bk_biz_l' ) ) {
832 $booking_data_arr = wpbc_api_get_booking_by_id( $booking_id );
833
834 $child_resource_id = (int) $booking_data_arr['booking_type'];
835
836 $bk_title = wpbc_get_resource_title( $child_resource_id );
837 }
838
839 // Dates ///////////////////////////////////////////////////////////////////
840 $my_dates4emeil = wpbc_db__get_sql_dates__in_booking__as_str( $booking_id );
841 if ( get_bk_option( 'booking_date_view_type' ) == 'short' )
842 $my_dates_4_send = wpbc_get_dates_short_format( $my_dates4emeil );
843 else
844 $my_dates_4_send = wpbc_get_dates_comma_string_localized( $my_dates4emeil );
845
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 //FixIn: 8.7.2.5
851 $my_check_in_onlydate = wpbc_date_localized( date( 'Y-m-d 00:00:00', strtotime( $my_dates4emeil_check_in_out[0] ) ), 'Y-m-d' );
852 $my_check_out_onlydate = wpbc_date_localized( date( 'Y-m-d 00:00:00', strtotime( $my_dates4emeil_check_in_out[ count( $my_dates4emeil_check_in_out ) - 1 ] ) ), 'Y-m-d' );
853
854 $my_check_out_plus1day = wpbc_get_dates_comma_string_localized( wpbc_datetime_localized( date( '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' ) );
855
856 // Cost ////////////////////////////////////////////////////////////////////
857 $booking_cost_digits_only = apply_bk_filter( 'get_booking_cost_from_db', '', $booking_id ); //FixIn: 9.2.3.1
858 $booking_cost = wpbc_get_cost_with_currency_for_user( $booking_cost_digits_only );
859 // Other ///////////////////////////////////////////////////////////////////
860 $replace[ 'booking_id' ] = $booking_id;
861 $replace[ 'id' ] = $replace[ 'booking_id' ];
862 $replace[ 'dates' ] = $my_dates_4_send;
863 $replace[ 'check_in_date' ] = $my_check_in_date;
864 $replace[ 'check_out_date' ] = $my_check_out_date;
865 //FixIn: 8.7.2.5
866 $replace[ 'check_in_only_date' ] = $my_check_in_onlydate;
867 $replace[ 'check_out_only_date' ] = $my_check_out_onlydate;
868 $replace[ 'check_out_plus1day'] = $my_check_out_plus1day; //FixIn: 6.0.1.11
869 $replace[ 'dates_count' ] = count( $my_dates4emeil_check_in_out );
870 $replace['cost'] = $booking_cost;
871 $replace['cost_digits_only'] = $booking_cost_digits_only;
872 $replace[ 'siteurl' ] = htmlspecialchars_decode( '<a href="' . home_url() . '">' . home_url() . '</a>' );
873 $replace[ 'resource_title'] = wpbc_lang( $bk_title );
874 $replace[ 'bookingtype' ] = $replace[ 'resource_title'];
875 $replace[ 'remote_ip' ] = wpbc_get_user_ip(); //FixIn:7.1.2.4 // The IP address from which the user is viewing the current page.
876 $replace[ 'user_agent' ] = $_SERVER['HTTP_USER_AGENT']; // Contents of the User-Agent: header from the current request, if there is one.
877 $replace[ 'request_url' ] = ( isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : '' ); // 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
878 $replace[ 'current_date' ] = date_i18n( get_bk_option( 'booking_date_format' ) );
879 $replace[ 'current_time' ] = date_i18n( get_bk_option( 'booking_time_format' ) );
880
881 // Form Fields /////////////////////////////////////////////////////////////
882 $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
883
884 foreach ( $booking_form_show_array['_all_fields_'] as $shortcode_name => $shortcode_value ) {
885
886 if ( ! isset( $replace[ $shortcode_name ] ) )
887 $replace[ $shortcode_name ] = $shortcode_value;
888 }
889 $replace[ 'content' ] = $booking_form_show_array['content'];
890
891 // Links ///////////////////////////////////////////////////////////////////
892 $replace[ 'moderatelink' ] = htmlspecialchars_decode(
893 // '<a href="' .
894 esc_url( wpbc_get_bookings_url() . '&view_mode=vm_listing&tab=actions&wh_booking_id=' . $booking_id )
895 // . '">' . __('here', 'booking') . '</a>'
896 );
897
898 if ( function_exists( 'wpbc_get_url_click2approve' ) ) {
899 $replace['click2approve'] = wpbc_get_url_click2approve( $booking_id ); //FixIn: 8.4.7.25
900 $replace['click2decline'] = wpbc_get_url_click2decline( $booking_id ); //FixIn: 8.4.7.25
901 $replace['click2trash'] = wpbc_get_url_click2trash( $booking_id ); //FixIn: 8.4.7.25
902 }
903
904 $replace[ 'visitorbookingediturl' ] = apply_bk_filter( 'wpdev_booking_set_booking_edit_link_at_email', '[visitorbookingediturl]', $booking_id );
905 $replace[ 'visitorbookingslisting' ] = apply_bk_filter( 'wpdev_booking_set_booking_edit_link_at_email', '[visitorbookingslisting]', $booking_id ); //FixIn: 8.1.3.5.1
906 $replace[ 'visitorbookingcancelurl' ] = apply_bk_filter( 'wpdev_booking_set_booking_edit_link_at_email', '[visitorbookingcancelurl]', $booking_id );
907 $replace[ 'visitorbookingpayurl' ] = apply_bk_filter( 'wpdev_booking_set_booking_edit_link_at_email', '[visitorbookingpayurl]', $booking_id );
908 $replace[ 'bookinghash' ] = apply_bk_filter( 'wpdev_booking_set_booking_edit_link_at_email', '[bookinghash]', $booking_id );
909
910
911 //FixIn: 7.1.2.5
912 // $booking_data = array( 'form_data' => $booking_form_show_array );
913 // $booking_data[ 'dates_short' ] = array( $my_dates4emeil_check_in_out[ 0 ], '-', $my_dates4emeil_check_in_out[ count( $my_dates4emeil_check_in_out ) - 1 ] );
914 // $replace[ 'add_to_google_cal_url' ] = htmlspecialchars_decode( esc_url(
915 // wpbc_btn_add_booking_to_google_calendar( $booking_data , array( 'is_only_url' => true ), false )
916 // ) );
917 //FixIn: 9.6.3.8
918 $google_calendar_link = wpbc_booking_do_action__get_google_calendar_link( array(
919 'form_data' => $booking_form_show_array['_all_fields_'],
920 'form_show' => $booking_form_show_array['content'], //strip_tags( $parsed_form_show ),
921 'dates_short' => array(
922 $my_dates4emeil_check_in_out[0]
923 , '-'
924 , $my_dates4emeil_check_in_out[ count( $my_dates4emeil_check_in_out ) - 1 ]
925 )
926 ) );
927 $replace['add_to_google_cal_url'] = htmlspecialchars_decode( esc_url( $google_calendar_link ) );
928 $replace['add_to_google_cal_button'] = '<a href="' . esc_attr( $replace['add_to_google_cal_url'] ) . '" target="_blank" rel="nofollow">Add to Google Calendar</a>';
929
930
931 // Get additional replace paramaters to the email shortcodes
932 $replace = apply_filters( 'wpbc_replace_params_for_booking', $replace, $booking_id, $bktype, $formdata ); //FixIn: 8.0.1.7
933
934 ////////////////////////////////////////////////////////////////////////////
935
936 return $replace;
937
938
939 }
940
941
942 /**
943 * Send email about New Booking to Admin
944 *
945 * @param type $booking_id - ID of booking
946 * @param type $bktype - type
947 * @param type $formdata - booking form data
948 */
949 function wpbc_send_email_new_admin( $booking_id, $bktype, $formdata ) { // function wpbc_send_email_new() - Old
950
951 $previous_active_user = apply_bk_filter( 'wpbc_mu_set_environment_for_owner_of_resource', -1, $bktype ); // MU
952
953 ////////////////////////////////////////////////////////////////////////
954 // Load Data
955 ////////////////////////////////////////////////////////////////////////
956
957 /* Check if New Email Template Exist or NOT
958 * Exist - return empty array in format: array( OPTION_NAME => array() )
959 * Its will load DATA from DB, during creattion mail_api CLASS
960 * during initial activation of the API its try to get option from DB
961 * We need to define this API before checking POST, to know all available fields
962 * Define Email Name & define field values from DB, if not exist, then default values.
963 * Not Exist - import Old Data from DB
964 * or get "default" data from settings and return array with this data
965 * This data its initial parameters for definition fields in mail_api CLASS
966 *
967 */
968
969 $init_fields_values = wpbc_import6_email__new_admin__get_fields_array_for_activation();
970
971 // 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
972 $init_fields_values_temp = array_values( $init_fields_values ); //FixIn: 7.0.1.32
973 $init_fields_values = array_shift( $init_fields_values_temp );
974
975
976 $mail_api = new WPBC_Emails_API_NewAdmin( WPBC_EMAIL_NEW_ADMIN_ID, $init_fields_values );
977
978 ////////////////////////////////////////////////////////////////////////////
979
980 if ( $mail_api->fields_values['enabled'] == 'Off' ) return false; // Email template deactivated - exit.
981
982
983 $replace = wpbc__get_replace_shortcodes__email_new_admin( $booking_id, $bktype, $formdata );
984
985 // Replace shortcodes with custom URL parameter, like: 'visitorbookingediturl', 'visitorbookingcancelurl', 'visitorbookingpayurl'
986 foreach ( array( 'visitorbookingediturl', 'visitorbookingcancelurl', 'visitorbookingpayurl' , 'visitorbookingslisting' ) as $url_shortcode ) { //FixIn: 7.0.1.8 //FixIn: 8.1.3.5.1
987
988 // Loop to search if we are having several such shortcodes in our $mail_api->fields_values['content'] (For example, if we have several languges ).
989 $pos = 0; //FixIn: 7.0.1.52
990 do {
991 $shortcode_params = wpbc_get_params_of_shortcode_in_string( $url_shortcode, $mail_api->fields_values['content'] , $pos );
992
993 if ( ( ! empty( $shortcode_params ) ) && ( isset( $shortcode_params['url'] ) ) ){
994
995 $pos = $shortcode_params['end'];
996
997 $exist_replace = substr( $mail_api->fields_values['content'], $shortcode_params['start'], ( $shortcode_params['end'] - $shortcode_params['start'] ) );
998
999 $new_replace = $url_shortcode . rand(1000,9000);
1000
1001 $pos = $shortcode_params['start'] + strlen( $new_replace ); //FixIn: 9.7.3.5.1
1002 $mail_api->fields_values['content'] = str_replace( $exist_replace, $new_replace ,$mail_api->fields_values['content'] );
1003
1004 $replace[ $new_replace ] = apply_bk_filter( 'wpdev_booking_set_booking_edit_link_at_email', '['.$exist_replace.']', $booking_id );
1005 } else if ( //FixIn: 8.1.1.8
1006 ( ! empty( $shortcode_params ) )
1007 && ( isset( $shortcode_params['end'] ) )
1008 && ( $shortcode_params['end'] < strlen( $mail_api->fields_values['content'] ) )
1009 ) {
1010 $pos = $shortcode_params['end'];
1011 } else {
1012 $shortcode_params = false; //FixIn: 7.0.1.58
1013 }
1014
1015 } while ( ! empty( $shortcode_params ) ); //FixIn: 7.0.1.52
1016
1017 }
1018
1019 $mail_api->set_replace( $replace );
1020 $mail_api->fields_values['from_name'] = $mail_api->replace_shortcodes( $mail_api->fields_values['from_name'] ); //FixIn: 7.0.1.29
1021
1022 if ( ( strpos( $mail_api->fields_values['to'], ',') === false ) && ( strpos( $mail_api->fields_values['to'], ';') === false ) ) {
1023
1024 $valid_email = sanitize_email( $mail_api->fields_values['to'] );
1025 if ( ! empty( $valid_email ) )
1026 $to = trim( wp_specialchars_decode( esc_html( stripslashes( $mail_api->fields_values['to_name'] ) ), ENT_QUOTES ) )
1027 . ' <' . $valid_email . '> ';
1028 } else {
1029
1030 // Comma separated several emails - validate all these emails in Email API class
1031 $to_array = $mail_api->fields_values['to'];
1032
1033 $to_array = str_replace(';', ',', $to_array);
1034 if ( !is_array( $to_array ) ) $to_array = explode( ',', $to_array );
1035
1036 $to_name = str_replace(';', ',', $mail_api->fields_values['to_name']);
1037 if ( !is_array( $to_name ) ) $to_name = explode( ',', $to_name );
1038
1039 $to = array();
1040 foreach ( $to_array as $to_ind => $to_email) {
1041
1042 $to_name_str = $to_name[ ( count( $to_name ) - 1 ) ];
1043
1044 if ( isset( $to_name[ $to_ind ] ) )
1045 $to_name_str = $to_name[ $to_ind ];
1046
1047 $valid_email = sanitize_email( $to_email );
1048 if ( ! empty( $valid_email ) )
1049 $to[] = trim( wp_specialchars_decode( esc_html( stripslashes( $to_name_str ) ), ENT_QUOTES ) ) . ' <' . $valid_email . '> ';
1050 }
1051 $to = implode(',', $to);
1052
1053 }
1054
1055 if ( wpbc_is_not_blank_email( $to, $replace['content'] ) ) {
1056 $email_result = $mail_api->send( $to , $replace );
1057 }
1058
1059 make_bk_action( 'wpbc_mu_set_environment_for_user', $previous_active_user ); // MU
1060
1061 $email_result = ( isset( $email_result ) ) ? $email_result : false;
1062 return $email_result;
1063 }
1064
1065 // </editor-fold>