function settings_page() { if ($_POST) { $this->set_options(); } $v = $this->get_options(); $data['epl_fields'] = $this->fields; $data['tabs'] = array('general' => epl__('General'), 'registrations' => epl__('Registrations'), 'event-management' => epl__('Event Management'), 'fullcalendar-settings' => epl__('Calendar'), 'api-settings' => epl__('Advanced')); $_field_args = array('section' => $this->fields['epl_general_options'], 'fields_to_display' => array_keys($this->fields['epl_general_options']), 'meta' => array('_view' => 3, 'value' => $v['epl_general_options'])); $data['epl_general_option_fields'] = $this->epl_util->render_fields($_field_args); $data['settings_updated'] = ''; $_field_args = array('section' => $this->fields['epl_registration_options'], 'fields_to_display' => array_keys($this->fields['epl_registration_options']), 'meta' => array('_view' => 3, 'value' => $v['epl_registration_options'])); $data['epl_registration_options'] = $this->epl_util->render_fields($_field_args); $_field_args = array('section' => $this->fields['epl_event_options'], 'fields_to_display' => array_keys($this->fields['epl_event_options']), 'meta' => array('_view' => 3, 'value' => $v['epl_event_options'])); $data['epl_event_options'] = $this->epl_util->render_fields($_field_args); if (apply_filters('epl_enable_feature_override', false)) { $data['tabs']['feature-override'] = epl__('Override'); } if (epl_is_addon_active('ETDFGWETSDFGR')) { $data['tabs']['shopping-cart'] = epl__('Event Cart'); epl_sort_array_by_array($this->fields['epl_sc_options']['epl_sc_primary_regis_forms']['options'], $v['epl_sc_options']['epl_sc_primary_regis_forms']); epl_sort_array_by_array($this->fields['epl_sc_options']['epl_sc_addit_regis_forms']['options'], $v['epl_sc_options']['epl_sc_addit_regis_forms']); epl_sort_array_by_array($this->fields['epl_sc_options']['epl_sc_payment_choices']['options'], $v['epl_sc_options']['epl_sc_payment_choices']); $_field_args = array('section' => $this->fields['epl_sc_options'], 'fields_to_display' => array_keys($this->fields['epl_sc_options']), 'meta' => array('_view' => 3, 'value' => $v['epl_sc_options'])); $data['epl_sc_options'] = $this->epl_util->render_fields($_field_args); } unset($this->fields['epl_fullcalendar_options']['epl_fullcalendar_tax_bcg_color']); unset($this->fields['epl_fullcalendar_options']['epl_fullcalendar_tax_font_color']); $terms = epl_object_to_array(get_terms('epl_event_categories', array('hide_empty' => false))); if (!epl_is_empty_array($terms)) { $vals = epl_get_element('epl_fullcalendar_options', $v, array()); foreach ($terms as $k => $_v) { $_bcg_val = epl_get_element($_v['slug'], epl_get_element('epl_fullcalendar_tax_bcg_color', $vals), '#ffffff'); $_font_val = epl_get_element($_v['slug'], epl_get_element('epl_fullcalendar_tax_font_color', $vals), 'blue'); $_d = array('input_type' => 'text', 'label' => $_v['name'], 'class' => 'epl_w80'); $f = $_d + array('input_name' => 'epl_fullcalendar_tax_bcg_color[' . $_v['slug'] . ']', 'value' => $_bcg_val, 'style' => 'background-color:' . $_bcg_val); $data['_tax_color'][$_v['slug']] = $this->epl_util->create_element($f, 0); $f = $_d + array('input_name' => 'epl_fullcalendar_tax_font_color[' . $_v['slug'] . ']', 'value' => $_font_val, 'style' => 'background-color:' . $_font_val); $data['_font_color'][$_v['slug']] = $this->epl_util->create_element($f, 0); } } $_field_args = array('section' => $this->fields['epl_fullcalendar_options'], 'fields_to_display' => array_keys($this->fields['epl_fullcalendar_options']), 'meta' => array('_view' => 3, 'value' => $v['epl_fullcalendar_options'])); $data['epl_fullcalendar_options'] = $this->epl_util->render_fields($_field_args); if (epl_check_for_it()) { $_field_args = array('section' => $this->fields['epl_api_option_fields'], 'fields_to_display' => array_keys($this->fields['epl_api_option_fields']), 'meta' => array('_view' => 3, 'value' => $v['epl_api_option_fields'])); $data['epl_api_options'] = $this->epl_util->render_fields($_field_args); } $this->epl->load_view('admin/settings/settings-page', $data); }
<tr> <td colspan="7"> <?php echo $row['_epl_discount_description']['field']; ?> <?php echo $row['_epl_discount_description']['description']; ?> </td> </tr> <?php if (epl_is_addon_active('_epl_atp')) { //do not deacitvate, will not work ?> <tr> <td><?php echo $row['_epl_discount_forms']['label']; ?> </td> <td colspan="5"><?php echo $row['_epl_discount_forms']['field']; ?> </td> <td colspan="2"><?php echo $row['_epl_discount_forms_per']['label']; ?>
epl_e('Type'); ?> </th> <th> <?php epl_e('Price'); ?> </th> <th> <?php echo apply_filters('epl_cart_prices_quanitity_label', epl__('Quantity')); ?> </th> <?php if (epl_is_addon_active('_epl_atp') && $mode != 'overview' && $has_date_limit) { //do not deacitvate, will not work ?> <th> <?php epl_e('Ends'); ?> </th> <?php } ?> </tr> <?php
function epl_mailchimp_subscribe() { if (!epl_is_addon_active('ASDFAWEEFADSF')) { return; } global $event_details, $customer_email, $customer_name; $default_action = epl_get_setting('epl_api_option_fields', 'epl_mc_action'); $sign_up = epl_get_element('_epl_offer_notification_sign_up', $event_details, ''); if ($sign_up == '') { $sign_up = $default_action == 1 ? epl_get_setting('epl_api_option_fields', '_epl_mc_offer_notification_sign_up') : 0; } if ($sign_up == 0 || $default_action == 0) { return; } $who_to_sign_up = epl_get_setting('epl_registration_options', 'epl_send_customer_confirm_message_to', 1); if ($who_to_sign_up == 2 || !epl_has_primary_forms()) { $who_to_sign_up = 2; } $erm = EPL_registration_model::get_instance(); $list_id = epl_get_element('_epl_notification_list', $event_details, false); if (!$list_id && $default_action == 1) { $list_id = epl_get_setting('epl_api_option_fields', '_epl_mc_default_list'); } $double_optin = (bool) epl_get_setting('epl_api_option_fields', 'epl_mc_double_opt_in'); $send_welcome = (bool) epl_get_setting('epl_api_option_fields', 'epl_mc_send_welcome_email'); $key = trim(epl_get_setting('epl_api_option_fields', 'epl_mc_key')); $api = EPL_base::get_instance()->load_library('mailchimpSF_MCAPI', true, $key); $go = false; $newsletter_signup = epl_get_element_m('newsletter_signup', $erm->regis_id, $erm->current_data, array()); if ($sign_up == 1 && array_sum($newsletter_signup) > 0) { $go = true; } elseif ($sign_up == 3) { $go = true; } if ($list_id && $go && count($customer_email) > 0) { $customer_email = array_unique($customer_email); foreach ($customer_email as $n => $email) { if ($sign_up < 3 && $newsletter_signup[$n] == 0) { continue; } $email = $email; $merge_vars = array('FNAME' => epl_get_element_m('first_name', $n, $customer_name), 'LNAME' => epl_get_element_m('last_name', $n, $customer_name)); $r = $api->listSubscribe($list_id, $email, $merge_vars, $email_type = 'html', $double_optin, false, true, $send_welcome); } } }
/** * Adds or removes event in the session. * * @since 1.0.0 * @param int $var * @return string */ function _event_in_session($args) { $action = $args['cart_action']; $event_id = $args['event_id']; //if not multi regis, remove and re-add if (!epl_is_addon_active('_epl_multi_registration')) { unset($this->regis_meta['__epl'][$this->regis_id]['_events']); } if (!is_null($event_id)) { if ($action == 'add_event' && !isset($this->regis_meta['__epl'][$this->regis_id]['_events'][$event_id])) { $this->regis_meta['__epl'][$this->regis_id]['_events'][$event_id] = array(); } elseif ($action == 'delete') { unset($this->regis_meta['events_planner']['cart_items'][$event_id]); } elseif ($action == 'get') { return $this->regis_meta['events_planner']['cart_items'][$event_id]; } } }
epl_e('Type'); ?> </th> <th> <?php epl_e('Price'); ?> </th> <th> <?php echo apply_filters('epl_cart_prices_quanitity_label', epl__('Quantity')); ?> </th> <?php if (epl_is_addon_active('_epl_atp') && $mode != 'overview') { //do not deacitvate, will not work ?> <th> <?php epl_e('Ends'); ?> </th> <?php } ?> </tr> <?php
function _get_prices($date_id = null) { global $event_details, $regis_details; $r = ''; $data = array(); $date_specific_price = epl_get_element('_epl_date_specific_price', $event_details); $data['has_date_limit'] = array_sum((array) $event_details['_epl_price_date_from']) + array_sum((array) $event_details['_epl_price_date_to']) > 0; foreach ($event_details['_epl_price_name'] as $_price_key => $_price_name) { $date_specifc = epl_get_element_m($_price_key, '_epl_date_specific_price', $event_details, array()); //if date level and if (epl_is_date_level_price() && !epl_is_empty_array($date_specifc) && !epl_is_empty_array($date_specific_price) && !isset($date_specifc[$date_id])) { continue; } $data['price_name'] = $_price_name; $price_type = epl_get_element_m($_price_key, '_epl_price_type', $event_details); $data['price'] = $event_details['_epl_price'][$_price_key]; $data['member_price'] = epl_get_element_m($_price_key, '_epl_member_price', $event_details); $value = $this->get_current_value('_dates', '_att_quantity', $event_details['ID'], $_price_key); if (!is_null($date_id)) { $value = epl_get_element($date_id, $value); } $epl_fields = array('input_type' => 'select', 'input_name' => "_att_quantity[{$event_details['ID']}][{$_price_key}][{$date_id}]", 'options' => $this->get_allowed_quantity($_price_key), 'value' => $value, 'class' => 'epl_att_qty_dd', 'id' => "_att_quantity-{$event_details['ID']}-{$_price_key}-{$date_id}"); if (epl_is_addon_active('DASFERWEQREWE')) { if (epl_get_element_m($_price_key, '_epl_price_pack_type', $event_details) == 'time') { $mem_l = epl_get_element_m($_price_key, '_epl_price_pack_time_length', $event_details); $mem_lt = epl_get_element_m($_price_key, '_epl_price_pack_time_length_type', $event_details); $start = !epl_is_empty_array($regis_details) ? strtotime($regis_details['post_date']) : EPL_DATE; $data['price_name'] .= ' - ' . epl__('until') . ' ' . epl_formatted_date(strtotime("+ {$mem_l} {$mem_lt}", $start)); } } $epl_fields += (array) $this->overview_trigger; $qty = 0; if ($this->flow_mode == 'p') { if (!is_null($value)) { if (count($value, 1) > 1) { $qty = current(epl_get_element($_price_key, $value, array())); } else { $qty = epl_get_element(0, $value, 0); } } if ($qty > 0) { $epl_fields['options'] = $this->get_allowed_quantity($_price_key, null, null, $qty); } } $data['mode'] = $this->mode; $data['regis_expiration']['ok'] = 1; $data['regis_expiration'] = apply_filters('epl_prices_exp_dates', $_price_key, $qty); if (!$this->on_admin && $data['regis_expiration']['ok'] == 0) { $data['price_qty_dd'] = ''; } else { $data['price_qty_dd'] = $this->epl_util->create_element($epl_fields); } $member_only = epl_get_element_m($_price_key, '_epl_price_member_only', $event_details, 0) == 10; $min_level = epl_get_element_m($_price_key, '_epl_price_membership_min_level', $event_details, 0); if (!is_user_logged_in() && $this->mode != 'overview') { if ($data['member_price'] != '') { $data['price_qty_dd']['field'] .= ' ' . get_the_register_button(null, false, array('button_text' => sprintf(epl__('Login to access %s member price'), epl_get_formatted_curr($data['member_price'], null, true)), 'class' => ' ', 'member_only' => 1, 'no_modal' => true)); } if ($member_only) { $data['price_qty_dd']['field'] = get_the_register_button(null, false, array('button_text' => epl__('Login to access this members only price'), 'class' => ' ', 'member_only' => 1, 'no_modal' => true)); } } elseif ($data['member_price'] != '') { $data['price'] = $data['member_price']; } if (defined('S2MEMBER_CURRENT_USER_ACCESS_LEVEL') && is_user_logged_in()) { if (S2MEMBER_CURRENT_USER_ACCESS_LEVEL < $min_level) { $data['price_qty_dd']['field'] = epl__('Higher membership level required'); } } if (epl_get_element_m($_price_key, '_epl_price_surcharge_amount', $event_details, 0) != 0) { $_tmpsurcharge = array('total' => $data['price'], 'price_id' => $_price_key, 'qty' => 1); $_tmpsurcharge = $this->process_price_surcharge($_tmpsurcharge); $data['price_qty_dd']['field'] .= ' +' . epl_get_formatted_curr($_tmpsurcharge['surcharge'], null, true) . ($event_details['_epl_price_surcharge_per'][$_price_key] == 5 ? epl__('/each') : ''); } $data['price_note'] = epl_get_element($_price_key, $event_details['_epl_price_note']); // echo "<pre class='prettyprint'>" . __LINE__ . "> " . basename( __FILE__ ) . " > " . print_r( $data, true ) . "</pre>"; if ($this->mode == 'overview' && array_sum((array) $value) == 0 || epl_get_element($_price_key, epl_get_element('_epl_price_hide', $event_details)) == 10) { // || (!is_null( $date_id ) && !isset( $date_specifc[$date_id] ) ) ) } else { $r .= $this->epl->load_view($this->dest . '/cart/cart-prices-row', $data, true); } } return $this->epl->load_view($this->dest . '/cart/cart-prices', array('prices_table' => $r), true); }
function epl_um_is_active() { return epl_is_addon_active('DASFERWEQREWE'); }
<div style="padding:10px;border:1px solid #eee;display: block;margin-bottom:10px;"> <button class="button-primary epl_fl_r" id="epl_send_email_button" style="float:right;"><?php epl_e('Send Email'); ?> </button> <?php echo $available_notifications['label']; ?> <?php echo $available_notifications['field']; ?> <?php if (epl_is_addon_active('_epl_atp') && epl_get_setting('epl_api_option_fields', 'epl_invoice_attach_to_conf', false)) { //do not deacitvate, will not work ?> <?php epl_e('Attach PDF invoice'); ?> <input type="checkbox" name="attach_pdf_invoice" id="attach_pdf_invoice" value="1" /> <?php } ?> </div> <div style="padding:10px;border:1px solid #eee;display: block;margin-bottom:10px;overflow:hidden;" id="epl_email_editor_wrapper"> <div class="epl_warning"><?php epl_e('Please select a template to begin.');
function epl_get_api_fields() { global $epl_fields; $epl_fields['epl_api_option_fields'] = array('epl_api_key' => array('input_type' => 'text', 'input_name' => 'epl_api_key', 'label' => epl__('Support License Key'), 'help_text' => 'The Support License Key will enable the pro version, allow automatic downloads of new versions of the plugin and modules that you have purchased. The key can be obtained from ' . get_option('epl_help_url', true), 'class' => 'epl_w400', 'required' => true), 'epl_api_section' => array('input_type' => 'section', 'label' => '', 'class' => '', 'style' => 'font-size:12px', 'content' => "Custom Tables" . "<div style='font-size:12px;'>Version 2.0 introduces custom registration db tables. They need to be populated with current registration data. " . "WARNING. It is highly encouraged to do a backup of your database, just in case things go wrong (unlikely but we want to be safe). If you have a large data set (>1000 registrations), this may take up to a few minutes. " . epl_anchor(admin_url('/edit.php?post_type=epl_event&epl_action=populate_db_tables&epl_controller=epl_registration&r=1&epl_download_trigger=1'), 'Click here', '_self', 'class="button-secondary"') . " to populate/repopulate the tables." . " Latest run was performed on: " . '<strong>' . get_option('_epl_last_table_refresh', 'Never') . '</strong>')); if (epl_is_addon_active('_epl_atp')) { $epl_fields['epl_api_option_fields'] += array('epl_atp_section' => array('input_type' => 'section', 'label' => '', 'class' => 'epl_font_555 epl_font_bold', 'content' => epl__('Advanced Time/Price Settings')), 'epl_atp_enable_date_specific_time' => array('input_type' => 'select', 'input_name' => 'epl_atp_enable_date_specific_time', 'options' => epl_yes_no(), 'default_value' => 10, 'label' => epl__('Enable date specific times?')), 'epl_atp_enable_date_specific_price' => array('input_type' => 'select', 'input_name' => 'epl_atp_enable_date_specific_price', 'options' => epl_yes_no(), 'default_value' => 10, 'label' => epl__('Enable date specific price?')), 'epl_atp_enable_price_specific_form' => array('input_type' => 'select', 'input_name' => 'epl_atp_enable_price_specific_form', 'options' => epl_yes_no(), 'default_value' => 10, 'label' => epl__('Enable price specific forms?')), 'epl_atp_enable_table_price_type' => array('input_type' => 'select', 'input_name' => 'epl_atp_enable_table_price_type', 'options' => epl_yes_no(), 'default_value' => 10, 'label' => epl__('Enable table price type?'))); } if (!epl_is_addon_active('ASDFAWEEFADSF')) { return $epl_fields; } $epl_fields['epl_api_option_fields'] += array('epl_mc_section' => array('input_type' => 'section', 'label' => '', 'class' => 'epl_font_555 epl_font_bold', 'content' => epl__('MailChimp Settings. Please enter your key and hit Save Changes to begin.')), 'epl_mc_key' => array('input_type' => 'password', 'input_name' => 'epl_mc_key', 'label' => epl__('Mailchimp API Key'), 'class' => 'epl_w400', 'required' => true)); if (epl_get_setting('epl_api_option_fields', 'epl_mc_key') != '') { $epl_fields['epl_api_option_fields'] += array('epl_mc_action' => array('input_type' => 'select', 'input_name' => 'epl_mc_action', 'options' => array(0 => epl__('No'), 1 => epl__('Enable for all current and future events'), 2 => epl__('I will choose for each event')), 'help_text' => epl__('If you select No, this feature will be diabled at global and event level. If you select the second option, you can still override it for each event.'), 'id' => 'epl_mc_default_action', 'label' => epl__('Enable MailChimp Extension'), 'help_icon_type' => '-red', 'default_value' => 1, 'class' => 'epl_field_type', 'default_value' => ''), 'epl_mc_double_opt_in' => array('input_type' => 'select', 'input_name' => 'epl_mc_double_opt_in', 'options' => epl_yes_no(), 'id' => 'epl_mc_double_opt_in', 'label' => epl__('Double Opt In (global)'), 'help_text' => epl__('When this option is enabled, MailChimp will send a confirmation email to the user and will only add them to your MailChimp list upon confirmation.'), 'default_value' => 0), 'epl_mc_send_welcome_email' => array('input_type' => 'select', 'input_name' => 'epl_mc_send_welcome_email', 'id' => 'epl_mc_send_welcome_email', 'label' => epl__('Send Welcome Email (global)'), 'help_text' => epl__('When this option is enabled, users will receive an automatic welcome email from MailChimp upon being added to your MailChimp list.'), 'options' => epl_yes_no(), 'class' => 'epl_field_type', 'default_value' => ''), '_epl_mc_offer_notification_sign_up' => array('input_type' => 'select', 'input_name' => '_epl_mc_offer_notification_sign_up', 'options' => array(1 => epl__('Ask'), 3 => epl__('Automatically add')), 'default_value' => 1, 'label' => epl__('User Signup Method (default)')), 'epl_mc_permission_label' => array('input_type' => 'text', 'input_name' => 'epl_mc_permission_label', 'label' => epl__('Permission Label'), 'help_text' => epl__('This label will be displayed during the registration process if you choose to ask the users for permission to sign them up.'), 'class' => 'epl_w400', 'default_value' => epl__('Subscribe to our newsletter')), '_epl_mc_default_list' => array('input_type' => 'select', 'input_name' => '_epl_mc_default_list', 'options' => epl_get_mailchimp_lists(), 'empty_row' => true, 'default_value' => '', 'label' => epl__('Default Notification List'))); } if (epl_um_is_active()) { $epl_fields['epl_api_option_fields'] += array('epl_um_section' => array('input_type' => 'section', 'label' => '', 'class' => 'epl_font_555 epl_font_bold', 'content' => epl__('User Manager Settings') . '<br/><span style="font-size:12px;"> - ' . epl__("Please note that this feature will only work if the Primary Registrant form is enabled.") . '</span>'), 'epl_um_enable_user_regis' => array('input_type' => 'select', 'input_name' => 'epl_um_enable_user_regis', 'label' => epl__('Enable User Registration?'), 'options' => array(0 => epl__('No'), 1 => epl__('Yes')), 'default_value' => 0), 'epl_um_user_regis_username' => array('input_type' => 'select', 'input_name' => 'epl_um_user_regis_username', 'label' => epl__('Username'), 'options' => array(1 => epl__('Email'), 2 => epl__('Let user choose')), 'default_value' => 1), 'epl_um_user_regis_password' => array('input_type' => 'select', 'input_name' => 'epl_um_user_regis_password', 'label' => epl__('Password'), 'options' => array(1 => epl__('Automatic'), 2 => epl__('Let user choose')), 'default_value' => 1), 'epl_um_user_regis_role' => array('input_type' => 'select', 'input_name' => 'epl_um_user_regis_role', 'label' => epl__('Role to assign'), 'options' => epl_get_roles_arr(), 'default_value' => 'subscriber')); } $epl_fields['epl_api_option_fields'] += array('epl_invoice_section' => array('input_type' => 'section', 'label' => '', 'class' => 'epl_font_555 epl_font_bold', 'content' => epl__('Invoice Settings')), 'epl_invoice_attach_to_conf' => array('input_type' => 'select', 'input_name' => 'epl_invoice_attach_to_conf', 'id' => 'epl_invoice_send_in_conf', 'label' => epl__('Attach invoice to confirmation emails?'), 'help_text' => epl__('If no, you can still attach invoices to emails that are sent manually.'), 'options' => epl_yes_no(), 'default_value' => 0), 'epl_invoice_logo' => array('input_type' => 'text', 'input_name' => 'epl_invoice_logo', 'id' => 'epl_invoice_logo', 'class' => 'epl_w400', 'label' => epl__('Invoice Logo'), 'description' => epl_anchor('#', epl__('Select File'), null, ' id="epl_invoice_logo_select"')), 'epl_invoice_display_id' => array('input_type' => 'select', 'input_name' => 'epl_invoice_display_id', 'id' => 'epl_invoice_display_id', 'label' => epl__('Invoice Id'), 'options' => array(1 => epl__('Registration Post ID'), 2 => epl__('Registration Title'), 3 => epl__('Incremental ID'))), 'epl_invoice_due' => array('input_type' => 'text', 'input_name' => 'epl_invoice_due', 'class' => 'epl_w40', 'label' => epl__('Invoice Payment Due'), 'help_text' => epl__('Number of days after issue date when the payment is due.')), 'epl_invoice_company_info' => array('input_type' => 'textarea', 'input_name' => 'epl_invoice_company_info', 'id' => 'epl_invoice_company_info', 'label' => epl__('Invoice Company Information'), 'help_text' => epl__('This will be posted on the top right cornerof the invoice. Can use HTML'), 'style' => 'width:300px;height:120px;', '_save_func' => 'wp_kses_post'), 'epl_invoice_instruction' => array('input_type' => 'textarea', 'input_name' => 'epl_invoice_instruction', 'id' => 'epl_invoice_instruction', 'label' => epl__('Instructions'), 'help_text' => epl__('This will be posted on the bottom of the invoice.'), 'style' => 'width:90%;height:120px;', '_save_func' => 'wp_kses_post')); return $epl_fields; }
function thank_you_page($add_to_db = true) { global $cart_totals, $wpdb; if ($this->erm->is_empty_cart()) { return $this->epl_util->epl_invoke_error(20, null, false); } global $event_details; $this->erm->_set_relevant_data(); if (epl_is_waitlist_flow()) { $this->erm->add_registration_to_db(); } // echo "<pre class='prettyprint'>" . __LINE__ . "> " . print_r($_SESSION, true). "</pre>"; $this->ecm->setup_event_details($this->erm->get_current_event_id()); if (epl_regis_flow() == 2 && $add_to_db) { $this->erm->add_registration_to_db(); } if (epl_regis_flow() == 10) { if ($this->erm->ok_to_proceed(true) !== true) { return $this->erm->ok_to_proceed; } } $post_ID = epl_get_element_m('post_ID', '__epl', $_SESSION, null); if (!$post_ID) { $regis_key = $_SESSION['__epl']['_regis_id']; $post_ID = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts}\n WHERE post_status ='publish' \n AND post_type='epl_registration' \n AND post_title=%s\n ORDER BY ID DESC\n LIMIT 1", $regis_key)); $_SESSION['__epl']['post_ID'] = $post_ID; } $this->regis_id = $post_ID; $this->ecm->setup_regis_details($post_ID); $this->erm->set_mode('overview'); $_totals = $this->erm->calculate_cart_totals(); $grand_total = $cart_totals['money_totals']['grand_total']; $data['cart_data'] = $this->erm->show_cart(); $data['regis_form'] = $this->erm->regis_form(null, false, false, false); $gateway_info = $this->erm->get_gateway_info(); $data['post_ID'] = $post_ID; $data['_epl_regis_status'] = 1; $data['_epl_payment_method'] = epl_is_free_event() || epl_is_zero_total() ? '1' : $gateway_info['_epl_pay_type']; $data['payment_instructions'] = ''; if (!epl_is_waitlist_flow() && (epl_is_free_event() || epl_is_zero_total())) { $data['_epl_regis_status'] = 5; $data['_epl_grand_total'] = '0'; $data['_epl_payment_amount'] = '0'; $data['_epl_payment_date'] = ''; $data['_epl_payment_method'] = '1'; $data['_epl_transaction_id'] = ''; $this->erm->update_payment_data($data); } elseif ($this->erm->has_selected_offline_payment() || epl_is_waitlist_flow()) { $data['_epl_regis_status'] = epl_is_waitlist_flow() ? 20 : 2; $data['_epl_payment_method'] = epl_is_waitlist_flow() ? '' : $gateway_info['_epl_pay_type']; $data['_epl_prediscount_total'] = epl_get_element('pre_discount_total', $cart_totals['money_totals'], 0); $data['_epl_discount_amount'] = epl_get_element('discount_amount', $cart_totals['money_totals'], 0); $data['_epl_grand_total'] = $grand_total; $data['_epl_balance_due'] = $grand_total; $data['_epl_transaction_id'] = ''; $data['payment_instructions'] = $this->epl->load_view('front/registration/regis-payment-instr', array('gateway_info' => $gateway_info), true); $this->erm->update_payment_data($data); } $this->ecm->setup_regis_details($post_ID); $data['payment_details'] = $this->epl->load_view('front/registration/regis-payment-details', $data, true); $data = apply_filters('epl_update_payment_data_thank_you_page', $data); if ($this->erm->has_selected_offline_payment()) { $data['payment_instructions'] = epl_get_element('_epl_check_instructions', $gateway_info); } $data['mode'] = 'overview'; $data['tracking_code'] = 1; $data['overview'] = $this->epl->load_view('front/registration/regis-thank-you-page', $data, true); $this->epl_util->regis_id = $post_ID; if (epl_is_addon_active('ASDFAWEEFADSF')) { epl_mailchimp_subscribe(); } do_action('epl_efc__thank_you_page__before_session_destroy', $post_ID); $new_user = $this->erm->maybe_add_new_user(); if ($new_user !== false) { $this->erm->assign_event_to_user($post_ID, $new_user); } $this->epl->load_model('epl-db-model'); EPL_db_model::get_instance()->reset_table_for_registration($post_ID, get_current_user_id()); $this->epl_util->send_confirmation_email($data); $url = apply_filters('epl_efc__thank_you_page__redirect_url', ''); $_SESSION['__epl'] = array(); unset($_SESSION['__epl']); @session_destroy(); $_SESSION = array(); epl_delete_transient(); if ($url != '' || $this->epl->locate_template('single-epl_registration.php')) { $url = $url != '' ? $url : get_permalink($this->regis_id); $url_params = array(); if (epl_get_regis_setting('epl_tracking_code')) { $url_params['cnv_tr'] = 1; } $url_params['epl_token'] = epl_get_token(); $url_params = apply_filters('epl_efc__thank_you_page__url_params', $url_params); $url = add_query_arg($url_params, $url); wp_redirect($url, 301); die; } return $data['overview']; }
function send_confirmation_email($data) { global $organization_details, $customer_email, $event_details, $email_regis_form; //$data['email_body'] = ''; $attach_pdf = epl_get_setting('epl_api_option_fields', 'epl_invoice_attach_to_conf', 0) == 10 && epl_is_addon_active('_epl_atp'); $attach_pdf = apply_filters('epl_attach_invoice_to_conf_email', $attach_pdf); $defaults = array('admin_subject' => epl__('New Registration'), 'subject' => epl__('Registration Confirmation')); $default_email_body = $this->epl->load_view('email/default/template-no-custom', $data, true); $_notif = epl_get_element('_epl_event_notification', $event_details); if (epl_is_waitlist_flow()) { $_notif = epl_get_element('_epl_waitlist_notification', $event_details); $defaults['admin_subject'] = epl__('New Waitlist Addition'); } $_notif_data = array(); if (epl_sc_is_enabled() && !epl_is_waitlist_flow()) { $_notif = epl_get_setting('epl_sc_options', 'epl_sc_notification'); } if ($_notif && (!epl_is_empty_array($_notif) || $_notif != '')) { $id = is_array($_notif) ? current($_notif) : $_notif; $_notif_data = get_post($id, ARRAY_A) + (array) $this->ecm->get_post_meta_all($id); $data['email_body'] = $this->notif_tags($_notif_data['post_content'], $data); } if (epl_is_empty_array($_notif) || $_notif == '') { $email_template = 'email/default/template-no-custom'; $email_template_name = epl_get_element('_epl_email_template', $_notif_data); $email_template = $email_template_name ? 'email/' . $email_template_name . '/template.php' : $email_template; $data['base_url'] = EPL_EMAIL_TEMPLATES_URL . $email_template_name . '/'; $email_body = $this->epl->load_view($email_template, $data, true); } else { $email_body = $data['email_body']; } $email_body = preg_replace('/<div class=\'epl_(.*?)_message\'>(.*?)<\\/div>/', '', $email_body); $from_name = stripslashes_deep(html_entity_decode(epl_get_element('_epl_email_from_name', $_notif_data, get_bloginfo('name')), ENT_QUOTES)); $from_email = epl_get_element('_epl_from_email', $_notif_data, get_bloginfo('admin_email')); $subject = stripslashes_deep(html_entity_decode(epl_get_element('_epl_email_subject', $_notif_data, $defaults['subject']), ENT_QUOTES)); $headers = "From: \"" . $from_name . "\" <{$from_email}> \r\n"; $headers .= 'Reply-To: ' . $from_email . "\r\n"; $headers .= 'X-Mailer: PHP/' . phpversion(); $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=UTF-8\r\n"; if ($attach_pdf) { $invoice = $this->erptm->invoice($data['post_ID']); $data['attachment'] = $this->make_pdf($invoice, true, true); } if (isset($customer_email) && count($customer_email) > 0) { $to = implode(',', $customer_email); @wp_mail($to, $subject, $email_body, $headers, epl_get_element('attachment', $data, null)); } //admin email $_email = epl_get_event_property('_epl_alt_admin_email'); if ($_email == '') { $_email = epl_nz(epl_get_event_option('epl_default_notification_email'), get_bloginfo('admin_email')); } $admin_email = array('email' => $_email, 'title' => $defaults['admin_subject'] . ': ' . get_the_event_title(), 'email_body' => $email_body, 'headers' => $headers, 'data' => $data); $admin_email = apply_filters('epl_admin_send_confirmation_email_args', $admin_email); @wp_mail($admin_email['email'], $admin_email['title'], $admin_email['email_body'], $admin_email['headers'], epl_get_element('attachment', $admin_email['data'], null)); if ($attach_pdf) { $this->delete_file($data['attachment']); } }