<div class="" style=""> <?php if (epl_sc_is_enabled()) { ?> <div class="epl_error"><?php epl_e('Events specific discounts are not available when event cart is enabled. Please use global discounts instead.'); ?> </div> <?php } ?> <?php if (!isset($_POST['event_list_discount_import_dd'])) { ?> <div class="epl_info"> <?php echo epl__('Import') . ' ' . epl__('and') . ' ' . $discount_import_action['field'] . ' ' . epl__('from') . ' ' . $event_list_discount_import_dd['field']; ?> </div> <table class="epl_form_data_table" cellspacing ="0"> <thead> <th colspan="2"></th> </thead> <?php echo current($epl_discount_option_fields);
function epl_has_attendee_forms() { global $event_details; if (epl_sc_is_enabled() && epl_get_setting('epl_sc_options', 'epl_sc_forms_to_use') == 1) { $f = epl_get_setting('epl_sc_options', 'epl_sc_addit_regis_forms'); return !empty($f); } return !empty($event_details['_epl_addit_regis_forms']); }
function form_data($regis_id, $_regis_key, $event_id, $tickets_to_show = null) { global $event_details, $regis_details, $wpdb; $attendee_info = $regis_details['__epl'][$_regis_key]['_attendee_info']; if ($this->debug) { echo "<pre class='prettyprint'>" . __LINE__ . "> " . basename(__FILE__) . " > " . print_r($attendee_info, true) . "</pre>"; } $event_ticket_buyer_forms = array_flip(epl_get_element('_epl_primary_regis_forms', $event_details, array())); $event_addit_forms = epl_get_element('_epl_addit_regis_forms', $event_details) ? array_flip($event_details['_epl_addit_regis_forms']) : array(); if (version_compare(epl_regis_plugin_version(), '1.4', '>=') && epl_sc_is_enabled() && epl_get_setting('epl_sc_options', 'epl_sc_forms_to_use') == 1) { $sc_event_ticket_buyer_forms = array_flip(epl_get_setting('epl_sc_options', 'epl_sc_primary_regis_forms', array())); $event_ticket_buyer_forms = $sc_event_ticket_buyer_forms; // + $event_ticket_buyer_forms; $event_addit_forms = array_flip(epl_get_setting('epl_sc_options', 'epl_sc_addit_regis_forms', array())); } if (empty($event_ticket_buyer_forms)) { $event_ticket_buyer_forms = array('4e8b3920c839b' => 1); } /* * find price forms if any. */ $price_forms = epl_get_element('_epl_price_forms', $event_details, array()); $_price_forms = array(); foreach ($price_forms as $k => $v) { $_price_forms += $v; } //find the list of all forms $available_forms = $this->ecm->get_list_of_available_forms(); $available_fields = $this->ecm->get_list_of_available_fields(); //isolate the ticket buyer forms that are selected inside the event $ticket_buyer_forms = array_intersect_key($available_forms, $event_ticket_buyer_forms); //isolate the additional forms for attendees. $addit_forms = array_intersect_key($available_forms, array_merge($event_addit_forms, $_price_forms)); //This will combine all the fields in all the forms so that we can construct a header row. $tickey_buyer_fields = array(); foreach ($ticket_buyer_forms as $_form_id => $_form_info) { $tickey_buyer_fields = array_merge($tickey_buyer_fields, $_form_info['epl_form_fields']); } //combine all the fields from the attendee forms $event_addit_fields = array(); foreach ($addit_forms as $_form_id => $_form_info) { //$event_addit_fields += $_form_info['epl_form_fields']; $event_addit_fields = array_merge($event_addit_fields, $_form_info['epl_form_fields']); } $epl_fields_inside_form = array_flip($tickey_buyer_fields); //get the field ids inside the form $epl_addit_fields_inside_form = array_flip($event_addit_fields); //get the field ids inside the form //when creating a form in form manager, the user may rearrange fields. Find their desired order $epl_fields_to_display = $this->epl_util->sort_array_by_array($available_fields, $epl_fields_inside_form); $epl_addit_fields_to_display = $this->epl_util->sort_array_by_array($available_fields, $epl_addit_fields_inside_form); //final list of all the fields to display //$epl_fields_to_display = $epl_fields_to_display + $epl_addit_fields_to_display; $ins = array(); $ins['regis_id'] = $regis_id; $ins['event_id'] = $event_id; $ins['field_id'] = array(); $ins['input_slug'] = array(); $ins['value'] = array(); if (!$this->primary_pulled) { //################################### Ticket buyer form data ############################################ if ($this->debug) { echo "<pre class='prettyprint'>" . __LINE__ . "> " . basename(__FILE__) . " > " . print_r($epl_fields_to_display, true) . "</pre>"; } $form_data_array_tmp = array(); foreach ($epl_fields_to_display as $field_id => $field_atts) { //1.3 stores in [field id][event id][0] //2.0 stores in [field id][0] //if ( epl_sc_is_enabled() && isset( $attendee_info[$field_id][0] ) ) { if (isset($attendee_info[$field_id][0])) { $value = epl_get_element(0, $attendee_info[$field_id]); } else { $value = isset($attendee_info[$field_id]) ? epl_get_element(0, $attendee_info[$field_id][$event_id]) : ''; } $raw_value = $value; if ($field_atts['input_slug'] == 'email') { $email_list[$regis_post_id] = $value; if ($regis_post_id && $regis_post_id != $this_regis_post_id) { unset($email_list[$regis_post_id]); } } if ($field_atts['input_type'] == 'select' || $field_atts['input_type'] == 'radio') { $value = $raw_value; //(isset( $field_atts['epl_field_choice_text'][$value] ) && $field_atts['epl_field_choice_text'][$value] !== '') ? $field_atts['epl_field_choice_text'][$value] : $value; } elseif ($field_atts['input_type'] == 'checkbox') { if (!epl_is_empty_array($field_atts['epl_field_choice_value'])) { $value = implode(',', (array) $raw_value); } elseif (is_array($value)) { $value = implode(',', $raw_value); } } //if ( $value != '' ) { $ins['field_id'][] = $field_id; $ins['input_slug'][] = $field_atts['input_slug']; $ins['form_no'] = $this->form_no; $ins['value'][] = str_replace($this->delim, " ", $value); //$wpdb->insert( $wpdb->epl_regis_form_data, $ins ); //} } $ins['field_id'] = implode($this->delim, $ins['field_id']); $ins['input_slug'] = implode($this->delim, $ins['input_slug']); $ins['form_no'] = $this->form_no; $ins['value'] = implode($this->delim, $ins['value']); if ($this->debug) { echo "<pre class='prettyprint'>" . __LINE__ . "> " . basename(__FILE__) . " > " . print_r($ins, true) . "</pre>"; } $wpdb->insert($wpdb->epl_regis_form_data, $ins); //################### End Ticket Buyer Data ######################################### } //$this->primary_pulled = true; $ins['event_id'] = $event_id; $ins['field_id'] = array(); $ins['input_slug'] = array(); $ins['value'] = array(); $counter = 0; $att_counter = 1; foreach ($tickets_to_show as $ticket_id => $ticket_quantities) { if (is_array($ticket_quantities)) { $tmp_price_inner_keys = array_keys($ticket_quantities); $ticket_qty = array_sum($ticket_quantities); } if ($ticket_qty == 0) { continue; } if (epl_is_empty_array($price_forms)) { } if ($this->debug) { echo "<pre class='prettyprint'>" . __LINE__ . "> " . basename(__FILE__) . " > " . print_r($epl_addit_fields_to_display, true) . "</pre>"; } foreach ($ticket_quantities as $ticket_qty_id => $quantities) { if (version_compare($version, '1.2.9', '<')) { $counter = 1; } for ($i = 0; $i < $quantities; $i++) { $this->form_no++; //not good, runs every time in the loop /* if ( $pack_regis && $attendance_dates = epl_get_element( "_pack_attendance_dates_{$event_id}_{$ticket_id}_" . ($i + 1), $regis_data, null ) ) { $pack_count = count( $attendance_dates ); $attendance_date_number = array_search( $date_id, array_keys( $attendance_dates ) ) + 1; } if ( $pack_regis && $date_id && !isset( $attendance_dates[$date_id] ) ) { break; continue; } */ $ticket_label = epl_escape_csv_val(epl_get_element($ticket_id, $event_details['_epl_price_name'])); if (epl_is_date_level_price()) { $reserved_date_key = $ticket_qty_id; $reserved_dates = epl_get_element_m($ticket_qty_id, '_epl_start_date', $event_details); } if (epl_is_date_level_time()) { $reserved_time_key = $reserved_times[$ticket_qty_id]; $reserved_times_display = epl_get_element_m($reserved_time_key, '_epl_start_time', $event_details); } $ins['field_id'] = array(); $ins['input_slug'] = array(); $ins['value'] = array(); foreach ($epl_addit_fields_to_display as $field_id => $field_atts) { $value = ''; //if ( $this->debug ) // echo "<pre class='prettyprint'>" . __LINE__ . "> " . basename( __FILE__ ) . " > " . print_r( epl_get_num_events_in_cart(), true ) . "</pre>"; //new v1.2.b9+ //if ( epl_sc_is_enabled() || isset( $attendee_info[$field_id][0] ) ) { //if this, price specific forms will get the primary form vals also if (epl_sc_is_enabled()) { $value = epl_get_element(0, $attendee_info[$field_id]); } else { $value = isset($attendee_info[$field_id]) ? epl_get_element(0, $attendee_info[$field_id][$event_id]) : ''; } if (isset($attendee_info[$field_id][$event_id][$ticket_id])) { $value = epl_get_element($counter, $attendee_info[$field_id][$event_id][$ticket_id]); } elseif (isset($attendee_info[$field_id][$event_id][$counter])) { $value = $attendee_info[$field_id][$event_id][$counter]; } $raw_value = $value; if ($field_atts['input_type'] == 'select' || $field_atts['input_type'] == 'radio') { $value = $raw_value; //(isset( $field_atts['epl_field_choice_text'][$value] ) && $field_atts['epl_field_choice_text'][$value] !== '') ? $field_atts['epl_field_choice_text'][$value] : $value; } elseif ($field_atts['input_type'] == 'checkbox') { if (!epl_is_empty_array($field_atts['epl_field_choice_value'])) { $value = implode(',', (array) $raw_value); } elseif (!epl_is_empty_array($value)) { $value = implode(',', $raw_value); } else { $value = html_entity_decode(htmlspecialchars_decode($value)); } } /* else { $value = html_entity_decode( htmlspecialchars_decode( $value ) ); } */ // if ( $value != '' ) { //FOR NOW, WILL ENTER EMPTY ROW IN THE TABLE, WILL HELP TRACK COUNTS $ins['field_id'][] = $field_id; $ins['input_slug'][] = $field_atts['input_slug']; $ins['form_no'] = $this->form_no; $ins['value'][] = str_replace($this->delim, " ", $value); //$wpdb->insert( $wpdb->epl_regis_form_data, $ins ); //} } //if ( !epl_is_empty_array( $ins['field_id'] ) ) { // echo "<pre class='prettyprint'>" . __LINE__ . "> " . print_r($ins, true). "</pre>"; $ins['field_id'] = implode($this->delim, $ins['field_id']); $ins['input_slug'] = implode($this->delim, $ins['input_slug']); $ins['form_no'] = $this->form_no; $ins['value'] = implode($this->delim, $ins['value']); if ($this->debug) { echo "<pre class='prettyprint'>" . __LINE__ . "> " . basename(__FILE__) . " >counter:{$counter} , ticket_id: {$ticket_id} " . print_r($ins, true) . "</pre>"; } $wpdb->insert($wpdb->epl_regis_form_data, $ins); //} $counter++; $att_counter++; } } } }
function get_regis_forms($event_id = null, $scope = '') { global $event_details; $primary_form = $this->erm->get_registration_forms(array('scope' => 'ticket_buyer', 'event_id' => $event_id, 'process' => 'non_esc', 'forms' => '_epl_primary_regis_forms', 'price_name' => '', 'date_display' => '', 'price_id' => null, 'return' => true)); $sc = epl_sc_is_enabled() && epl_get_setting('epl_sc_options', 'epl_sc_forms_to_use') == 1; $_att = array('scope' => 'regis_forms', 'event_id' => $event_id, 'process' => $sc ? 'esc' : 'non_esc', 'forms' => $sc ? 'epl_sc_addit_regis_forms' : '_epl_addit_regis_forms', 'attendee_qty' => 1, 'price_id' => null, 'date_display' => '', 'return' => true); $att_form = $this->erm->get_registration_forms($_att); $_other_forms = array(); $price_forms = epl_get_element('_epl_price_forms', $event_details, array()); if (!epl_is_empty_array($price_forms)) { foreach ($price_forms as $forms) { $_other_forms += $forms; } $forms_to_display = $this->ecm->get_list_of_available_forms(); $_other_forms = array_intersect_key($forms_to_display, $_other_forms); } $discount_forms = epl_get_element('_epl_discount_forms', $event_details, array()); if (!epl_is_empty_array($discount_forms)) { foreach ($discount_forms as $forms) { $_other_forms += $forms; } $forms_to_display = $this->ecm->get_list_of_available_forms(); $_other_forms = array_intersect_key($forms_to_display, $_other_forms); } if ($scope == 'primary_form') { return $primary_form; } if ($scope == 'att_form' && !empty($att_form)) { return $att_form; } if ($scope == 'other' && !empty($_other_forms)) { return $_other_forms; } if (!$primary_form) { $primary_form = array(); } if (!epl_is_empty_array($att_form)) { $primary_form += $att_form; } if (!epl_is_empty_array($_other_forms)) { $primary_form += $_other_forms; } return $primary_form; }
function regis_form($values = null, $primary_only = false, $show_cc_form = true, $show_new_user_form = true, $meta = array()) { global $event_details, $epl_error, $email_regis_form; $email_regis_form = ''; if (epl_is_empty_array($event_details)) { $this->ecm->setup_event_details((int) $_REQUEST['event_id']); } $data = array(); $data['forms'] = ''; $action = epl_get_element('epl_action', $_GET); if ($this->mode == 'edit') { //not overview $_data = apply_filters('epl_regis_form_edit_mode', $_REQUEST); $this->_set_relevant_data(); $this->set_event_capacity_info(); // $this->ok_to_proceed(); //Are there available spaces for the dates, times, prices in the cart? $this->event_snapshot(); } if (epl_regis_flow() == 2 && $action == 'regis_form' || $this->mode == 'overview' && $action == 'show_cart_overview' || $action == 'payment_page') { //overview mode comes after user enters their info in the fields and submits if ($_GET['epl_action'] != 'payment_page') { //$this->_set_relevant_data( '_attendee_info', $_POST ); //from the regis form, add to session //$this->add_registration_to_db( $this->current_data ); //create the record } $data['cc_form'] = ''; if ($this->has_selected_cc_payment() && $show_cc_form && !epl_is_zero_total() && !epl_is_waitlist_flow()) { $_f = epl_cc_billing_fields(); $gateway_info = $this->get_gateway_info(); $accepted_cards = (array) $gateway_info['_epl_accepted_cards']; //Temp solution foreach ($_f['epl_cc_billing_fields']['_epl_cc_card_type']['options'] as $k => $v) { if (!in_array($k, $accepted_cards)) { unset($_f['epl_cc_billing_fields']['_epl_cc_card_type']['options'][$k]); } } $_field_args = array('section' => $_f['epl_cc_billing_fields'], 'fields_to_display' => array_keys($_f['epl_cc_billing_fields']), 'meta' => array('_view' => 0, '_type' => 'ind', 'value' => $_POST)); $data['_f'] = $this->epl_util->render_fields($_field_args); if ($this->has_selected_cc_payment(null, true) == '_stripe') { $egm = $this->epl->load_model('epl-gateway-model'); $data['cc_form'] = $egm->setup_stripe_form(); } else { $data['cc_form'] = $this->epl->load_view($this->dest . '/registration/regis-cc-form', $data, true); } } } $this->num_events_in_cart = 0; if (is_null($values)) { $values = $this->get_cart_values('_events'); } else { $values = $values['_events']; } if (empty($values)) { return $this->epl_util->epl_invoke_error(20); } $r = ''; $data['forms'] .= $this->get_user_list_dd(); //$events = array_keys( $values['_epl_start_date'] ); //if ( epl_sc_is_enabled() && epl_get_num_events_in_cart() > 1 ) { $is_waitlist = !empty($meta['waitlist_flow']) || epl_is_waitlist_flow(); if (version_compare(epl_regis_plugin_version(), '1.4', '>=') && epl_sc_is_enabled() && epl_get_setting('epl_sc_options', 'epl_sc_forms_to_use') == 1) { if (!$primary_pulled) { $data['forms'] .= $this->get_registration_forms(array('scope' => $is_waitlist ? 'waitlist' : 'ticket_buyer', 'process' => 'esc', 'forms' => 'epl_sc_primary_regis_forms', 'price_name' => '', 'date_display' => '', 'price_id' => null)); $data['forms'] .= $this->get_new_user_form($show_new_user_form); $primary_pulled = true; } $_cart = $this->get_cart_values('_dates'); $attendee_forms = epl_get_setting('epl_sc_options', 'epl_sc_addit_regis_forms'); if (!epl_is_empty_array($attendee_forms) && !epl_is_waitlist_flow()) { foreach ((array) $_cart['_att_quantity'] as $event_id => $quantities) { if (!isset($values[$event_id])) { continue; } setup_event_details($event_id); $reset_count = true; foreach ($quantities as $price_id => $qty) { $attendee_qty = is_array($qty) ? array_sum($qty) : $qty; if ($attendee_qty > 0) { $data['forms'] .= $this->get_registration_forms(array('scope' => 'regis_forms', 'event_id' => $event_id, 'process' => 'esc', 'forms' => 'epl_sc_addit_regis_forms', 'attendee_qty' => $attendee_qty, 'price_id' => $price_id, 'date_display' => '', 'reset_count' => $reset_count, 'price_name' => $event_details['_epl_price_name'][$price_id])); $reset_count = false; } } } } } else { $primary_pulled = false; $_cart = $this->get_cart_values('_dates'); $this->pulling_forms = 'pri'; $this->num_events_in_cart = count($values); foreach ($values as $event_id => $event_dates) { if (!empty($meta['event_id']) && $meta['event_id'] != $event_id) { continue; } setup_event_details($event_id); //display the ticket purchaser form. //we need to combine primary forms so the info is only displayed once. if (!$primary_pulled) { $data['forms'] .= $this->get_registration_forms(array('scope' => $is_waitlist ? 'waitlist' : 'ticket_buyer', 'event_id' => $event_id, 'process' => 'non_esc', 'forms' => '_epl_primary_regis_forms', 'price_name' => '', 'date_display' => '', 'price_id' => null)); //$primary_pulled = true; } } $data['forms'] .= $this->get_new_user_form($show_new_user_form); $this->pulling_forms = 'att'; //if ( !$primary_only ) { if (!epl_is_waitlist_flow()) { foreach ($values as $event_id => $event_dates) { //if ( epl_is_empty_array( epl_get_element( '_epl_addit_regis_forms', $event_details ) ) ) // continue; setup_event_details($event_id); foreach ((array) $_cart['_att_quantity'][$event_id] as $price_id => $qty) { $attendee_qty = is_array($qty) ? array_sum($qty) : $qty; if ($attendee_qty > 0) { $data['forms'] .= $this->get_registration_forms(array('scope' => 'regis_forms', 'event_id' => $event_id, 'process' => 'non_esc', 'forms' => '_epl_addit_regis_forms', 'attendee_qty' => $attendee_qty, 'price_id' => $price_id, 'date_display' => '', 'price_name' => $event_details['_epl_price_name'][$price_id])); } } } //$data['forms'] .= $this->get_registration_forms( array( 'scope' => 'regis_forms', 'event_id' => $event_id, 'forms' => '_epl_addit_regis_forms', 'attendee_qty' => $attendee_qty ) ); //$r .= $thiis->epl->load_view( 'front/registration/regis-page', $data, true ); } } //TODO - temp solution $egm = $this->epl->load_model('epl-gateway-model'); $data['redirect_form_data'] = $egm->get_redirect_form_data(); $r = $this->epl->load_view($this->dest . '/registration/regis-page', $data, true); return $r; }
function get_event_form_setup($event_id) { global $event_details; setup_event_details($event_id); $attendee_form = false; $one_form = false; //if sc and sc forms if (version_compare(epl_regis_plugin_version(), '1.4', '>=') && epl_sc_is_enabled() && epl_get_setting('epl_sc_options', 'epl_sc_forms_to_use') == 1) { $attendee_form = epl_get_setting('epl_sc_options', 'epl_sc_addit_regis_forms', false); if ($af) { $attendee_form = true; } return $attendee_form; } $price_form = !epl_is_empty_array(epl_get_element('_epl_price_forms', $event_details, array())); if ($price_form) { $attendee_form = true; //epl_is_empty_array(epl_get_element('_epl_price_forms_per', $event_details, array())) } if (!$attendee_form && !epl_is_empty_array(epl_get_element('_epl_addit_regis_forms', $event_details, array()))) { $attendee_form = true; } return $attendee_form; }
?> " style=""> <?php if (!EPL_IS_ADMIN) { ?> <input type="hidden" class="epl_registration_max" value="<?php echo $max_regis; ?> " /> <?php } ?> <div class="epl_cart_controls"> <?php if ($mode != 'overview' && epl_sc_is_enabled()) { ?> <a href ="#" class="delete_cart_item" id="<?php echo $event_id; ?> ">Delete</a> <?php } ?> </div> <div class='epl_event_title'><?php echo $event['title']; ?> </div> <?php if (!EPL_IS_ADMIN && $max_regis > 0 && apply_filters('epl_cart__show_max_regis_message', __return_true())) {
function epl_option_fields($epl_fields) { if (!epl_sc_is_enabled()) { return $epl_fields; } $epl_fields['epl_exclude_from_sc'] = array('weight' => 15, 'input_type' => 'select', 'input_name' => '_epl_exclude_from_sc', 'options' => epl_yes_no(), 'default_value' => 0, 'label' => epl__('Exclude from cart process?'), 'help_text' => epl__('If this is set to yes and this event is added to the cart, all other events will be removed from the cart.')); return $epl_fields; }
function process_discount($totals, $glob_disc = false) { if (epl_is_empty_array($totals)) { return $totals; } static $processed = false; //if ( $processed ) // return $totals; $processed = true; global $event_details, $epl_current_step; $this->discount_config_id = $event_details['ID']; $this->all_discount_configs[$this->discount_config_id] = $event_details; $this->totals = $totals; $this->original_totals = $totals; $this->discount_configs = $event_details; if (epl_sc_is_enabled()) { $this->discount_configs = $this->get_global_discount_configs(true); } $_discount = array(); $_entered_code = strtoupper($this->discount_code_entered($this->totals)); $allow_global_discounts = epl_get_element('_epl_allow_global_discounts', $event_details, 0) == 10; //if discount code entered if ($_entered_code) { //check if the code exists $this->totals['money_totals']['discount_code'] = $_entered_code; if ((!$available_discount_codes || $glob_disc) && $allow_global_discounts) { if (epl_sc_is_enabled()) { $this->all_discount_configs = $this->get_global_discount_configs(); } elseif ($allow_global_discounts) { $this->all_discount_configs += $this->get_global_discount_configs(); } } $this->get_event_discount_codes(); if (!$this->code_discounts) { return $this->totals; } foreach ($this->code_discounts as $discount_source_id => $active_discounts) { $_code_id = array_search(strtolower($_entered_code), (array) $active_discounts); $this->discount_configs = $this->all_discount_configs[$discount_source_id]; if ($_code_id !== false) { $this->discount_source = $this->code_discounts_source[$discount_source_id]; $this->discount_source_id = $discount_source_id; break; } } if ($_code_id !== false) { //if ( !EPL_IS_ADMIN ) { //code expired if ($this->is_code_expired($_code_id)) { $this->totals['money_totals']['discount_code_id'] = ''; $this->totals['money_totals']['discount_code'] = ''; $this->totals['money_totals']['discount_message'] = epl__('The discount code has expired'); return $this->totals; } //code use count exceeded if ($this->is_code_maxed_out($_code_id, $_entered_code)) { $this->totals['money_totals']['discount_code_id'] = ''; $this->totals['money_totals']['discount_code'] = ''; $this->totals['money_totals']['discount_message'] = epl__('The discount code is no longer available'); return $this->totals; } $_categories = epl_get_element($_code_id, epl_get_element('_epl_discount_cat_include', $this->discount_configs), 0); if (!epl_is_empty_array($_categories)) { $this->adjust_discountable_amounts('category', $_categories); } /* TODO removing as of > 2.0.8 $_pay_profiles = epl_get_element( $_code_id, epl_get_element( '_epl_discount_pay_specific', $this->discount_configs ), 0 ); if ( !epl_is_empty_array( $_pay_profiles ) ) { $this->adjust_discountable_amounts( 'pay_profiles', $_pay_profiles ); } */ $is_condition_ok = $this->is_condition_ok($_code_id, $this->totals); if ($is_condition_ok !== true) { $this->totals['money_totals']['discount_code_id'] = ''; $this->totals['money_totals']['discount_code'] = ''; $this->totals['money_totals']['discount_message'] = $is_condition_ok; return $this->totals; } //} $amount_to_discount = epl_get_element($_code_id, epl_get_element('_epl_discount_amount', $this->discount_configs)); $discount_description = epl_get_element($_code_id, epl_get_element('_epl_discount_description', $this->discount_configs)); $discount_type = epl_get_element($_code_id, epl_get_element('_epl_discount_type', $this->discount_configs)); $discounted_amount = $this->calculate_discount($this->totals['money_totals'], $amount_to_discount, $discount_type); if ($discounted_amount >= 0) { $this->totals['money_totals']['pre_discount_total'] = $this->totals['money_totals']['grand_total']; //$this->totals['money_totals']['discount_amount'] = $this->discount_amount; $this->totals['money_totals']['discount_description'] = epl_suffix(', ', $this->totals['money_totals']['discount_description']) . $discount_description; $this->totals['money_totals']['discount_code_id'] = $_code_id; $this->totals['money_totals']['discount_source_id'] = $this->discount_source_id; //$this->totals['money_totals']['grand_total'] = $discounted_amount; } } else { //if ( !$glob_disc ) // $this->process_discount( $totals, true ); //else $this->totals['money_totals']['discount_message'] = epl__('This discount code is invalid'); } } else { //check for automatic discounts //get list of available automatic discounts //$this->get_event_auto_discounts(); if (epl_sc_is_enabled() || (!$available_auto_discounts || $glob_disc) || $allow_global_discounts) { if (epl_sc_is_enabled()) { $this->all_discount_configs = $this->get_global_discount_configs(); } elseif ($allow_global_discounts) { $this->all_discount_configs += $this->get_global_discount_configs(); } } $this->get_event_auto_discounts(); if (epl_is_empty_array($this->auto_discounts)) { return $this->totals; } foreach ($this->auto_discounts as $discount_source_id => $active_discounts) { $this->discount_configs = $this->all_discount_configs[$discount_source_id]; foreach ($active_discounts as $_code_id => $discount_source) { $this->discount_source = $discount_source; $this->discount_source_id = $discount_source_id; //code expired if ($this->is_code_expired($_code_id)) { continue; } //code use count exceeded if ($this->is_code_maxed_out($_code_id, null)) { continue; } /* TODO removing as of > 2.0.8 * $_pay_profiles = epl_get_element( $_code_id, epl_get_element( '_epl_discount_pay_specific', $this->discount_configs ), 0 ); if ( !epl_is_empty_array( $_pay_profiles ) ) { $this->adjust_discountable_amounts( 'pay_profiles', $_pay_profiles ); } */ $_categories = epl_get_element($_code_id, epl_get_element('_epl_discount_cat_include', $this->discount_configs), 0); if (!epl_is_empty_array($_categories)) { $this->adjust_discountable_amounts('category', $_categories); } $is_condition_ok = $this->is_condition_ok($_code_id); if ($is_condition_ok !== true) { $this->totals = $this->original_totals; continue; } $amount_to_discount = epl_get_element($_code_id, epl_get_element('_epl_discount_amount', $this->discount_configs)); $discount_description = epl_get_element($_code_id, epl_get_element('_epl_discount_description', $this->discount_configs)); $discount_type = epl_get_element($_code_id, epl_get_element('_epl_discount_type', $this->discount_configs)); $discounted_amount = $this->calculate_discount($this->totals['money_totals'], $amount_to_discount, $discount_type); if ($discounted_amount > 0) { $this->totals['money_totals']['discount_code_id'] = $_code_id; $this->totals['money_totals']['discount_source_id'] = $discount_source_id; $this->totals['money_totals']['discount_description'] = epl_suffix(', ', epl_get_element('discount_description', $this->totals['money_totals'])) . $discount_description; //only apply the first match break 2; } } } //return $this->totals; } $this->totals = apply_filters('epl__discount_model__processed_totals', $this->totals); return $this->totals; }
<div id ="epl_loader"> <img src ="<?php echo EPL_FULL_URL; ?> images/ajax-loader.gif" alt="loading..." /> </div> <?php if (!EPL_IS_ADMIN && epl_get_setting('epl_sc_options', 'epl_sc_footer_subtotal', 0) == 10) { ?> <div id="epl_cart_sticky_footer"> <div id="epl_cart_sticky_footer_content"> <?php global $post; $erm = EPL_registration_model::get_instance(); if (epl_sc_is_enabled() && !$erm->is_empty_cart() && !isset($_REQUEST['clear_cart']) && epl_get_element('epl_action', $_REQUEST) == '' && $post->post_type != 'epl_registration') { echo $erm->get_the_cart_totals(true, true); } ?> </div> </div> <?php } if (EPL_DEBUG == true) { ?> <pre class='debug_message prettyprint'></pre> <?php } ?>
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']); } }
function common_js_files() { global $epl_wp_localize_script_args; $_f = array('F', 'm', 'Y', 'j', 'l', 'd', 'S'); $_r = array('MM', 'mm', 'yy', 'd', 'DD', 'dd', ''); //$date_format_for_dp = (strpos('F', get_option( 'date_format' ) === false))?str_ireplace('Y','yy',get_option( 'date_format' )):'m/d/yy'; $date_format_for_dp = str_replace($_f, $_r, epl_nz(epl_get_general_setting('epl_admin_date_format'), get_option('date_format'))); wp_enqueue_script('jquery'); wp_enqueue_script('jquery-migrate-js', "//code.jquery.com/jquery-migrate-1.2.1.min.js", array('jquery')); if (EPL_IS_ADMIN || epl_user_is_admin()) { wp_enqueue_script('select2', $this->epl->load_asset('js/select2.min.js'), array('jquery')); } wp_enqueue_script('events_planner_js', $this->epl->load_asset('js/events-planner.js'), array('jquery')); wp_enqueue_script('tipsy-js', EPL_FULL_URL . 'js/tipsy.js', array('jquery')); wp_enqueue_script('full-calendar-js', $this->epl->load_asset('js/fullcalendar.min.js'), array('jquery')); wp_enqueue_script('jquery-form-js', $this->epl->load_asset('js/jquery.validate.min.js'), array('jquery')); //wp_enqueue_script( 'datatables-js', epl_get_protocol() . '://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js' ); wp_enqueue_script('datatables-js', $this->epl->load_asset('js/jquery.dataTables.min.js'), array('jquery')); $epl_wp_localize_script_args = array('ajaxurl' => admin_url('admin-ajax.php', epl_get_protocol()), 'plugin_url' => EPL_FULL_URL, 'date_format' => $date_format_for_dp, 'time_format' => get_option('time_format'), 'firstDay' => get_option('start_of_week'), 'yearRange' => 'c-10:c+10', 'sc' => epl_sc_is_enabled() ? 1 : 0, 'debug' => EPL_DEBUG ? 1 : 0, 'cart_added_btn_txt' => epl__('In the cart (View)')); $epl_wp_localize_script_args = apply_filters('epl_wp_localize_script_args', $epl_wp_localize_script_args); wp_localize_script('events_planner_js', 'EPL', $epl_wp_localize_script_args); do_action('epl_init_common_js_files', $this); return $this; }