public static function get_instance() { if (!self::$instance) { self::$instance = new EPL_util(); } return self::$instance; }
function moneris_process() { global $event_details; $event_id = $this->erm->get_current_event_id(); $regis_id = $this->erm->get_regis_id(); $msg = array(); $post_ID = $this->erm->get_regis_post_id(); $this->ecm->setup_event_details($event_id); $_totals = $this->erm->calculate_cart_totals(); $gateway_info = $this->erm->get_gateway_info(); $store_id = $gateway_info['_epl_user']; $api_token = $gateway_info['_epl_pwd']; $transactionKey = epl_get_element('transactionKey', $_POST); $response_array = EPL_util::get_instance()->clean_input($_POST); $rvar_eid = epl_get_element('rvar_eid', $response_array); $rvar_pid = epl_get_element('rvar_pid', $response_array); $rvar_rid = epl_get_element('rvar_rid', $response_array); $regis_id = $this->erm->get_regis_id(); $response_code = epl_get_element('response_code', $_POST); if ($response_code != 'null') { if ($response_code < 50) { $status = 'paid'; } else { $status = 'declined'; } } else { $status = 'incomplete'; } //approved if ($status == 'paid') { $payment_amount = epl_get_element('charge_total', $response_array); $txn_id = epl_get_element('response_order_id', $response_array); if (epl_get_element('_epl_moneris_country', $gateway_info, 'ca') == 'usa') { $payment_amount = epl_get_element('amount', $response_array); $txn_id = epl_get_element('txn_num', $response_array); } $data['post_ID'] = $post_ID; $data['_epl_grand_total'] = number_format(epl_get_balance_due(), 2, '.', ''); $data['_epl_payment_amount'] = $payment_amount; $data['_epl_payment_date'] = current_time('mysql'); $data['_epl_payment_method'] = $this->erm->get_payment_profile_id(); $data['_epl_transaction_id'] = $txn_id; $data['_epl_prediscount_total'] = number_format(epl_get_element('pre_discount_total', $_totals['money_totals'], 0), 2, '.', ''); $data['_epl_discount_amount'] = number_format(epl_get_element('discount_amount', $_totals['money_totals'], 0), 2, '.', ''); $this->erm->update_payment_data($data); return true; } else { return '<div class="epl_error">ERROR: ' . $response_array['message'] . '</div>'; } }
function epl_terms_field($args = array()) { $r = EPL_util::get_instance()->epl_terms_field($args); return $r['field']; }
function _get_time_fields($date_id = null) { global $event_details, $capacity, $current_att_count; //if it is time specific pricing, value hidden $input_type = epl_get_element('_epl_pricing_type', $event_details, 0) == 10 ? 'text' : 'select'; $times = $event_details['_epl_start_time']; if (EPL_util::get_instance()->is_empty_array($event_details['_epl_start_time'])) { return null; } //adding the end time to the displayed value. Notice the reference foreach ($times as $k => &$v) { /* if ( !is_null( $date_id ) ) $pattern = "/_total_att_{$event_details['ID']}_time_{$date_id}_{$k}/"; //_total_att_637_time_7b555a_401521 else $pattern = "/_total_att_{$event_details['ID']}_time_(.+)_{$k}/"; $avl = $this->preg_grep_keys( $pattern, $current_att_count ); */ $v .= ' - ' . $event_details['_epl_end_time'][$k]; } if (is_null($date_id)) { $value = $this->get_current_value('_dates', '_epl_start_time', $event_details['ID']); } else { $value = $this->get_current_value('_dates', '_epl_start_time', $event_details['ID'], $date_id); } $epl_fields = array('input_type' => $input_type, 'input_name' => "_epl_start_time[{$event_details['ID']}][{$date_id}]", 'options' => $times, 'value' => $value); $epl_fields += (array) $this->overview_trigger; $data['event_time'] = $this->epl_util->create_element($epl_fields); $data['event_time'] = $data['event_time']['field']; if (!is_null($date_id)) { return $data['event_time']; } return $this->epl->load_view('front/cart/cart-times', $data, true); }
function get_the_regis_id() { return EPL_util::get_instance()->get_the_regis_id(); }
function event_search_box($result_view = 'list', $search_fields = null, $shortcode_atts = array()) { global $event_list, $epl_fields; $this->epl->load_config('event-fields'); $data['filters'] = array(); $terms = epl_object_to_array(get_terms('epl_event_categories')); if (!epl_is_empty_array($terms) || isset($shortcode_atts['taxonomy'])) { $_opt = array(); $field_type = 'hidden'; $label = ''; $value = epl_get_element('taxonomy', $shortcode_atts); if (!isset($shortcode_atts['taxonomy'])) { foreach ($terms as $k => $_v) { $_opt[$_v['slug']] = $_v['name']; } $field_type = 'select'; $label = epl__('Category'); $value = null; } $_ar = array('weight' => 20, 'input_type' => $field_type, 'input_name' => 'taxonomy', 'label' => $label, 'options' => array('' => epl__('All Categories')) + $_opt, 'value' => $value); $_ar = apply_filters('epl_event_search_box_taxonomy_field_arr', $_ar); $data['filters']['taxonomy'] = EPL_util::get_instance()->create_element($_ar); } $_ar = array('weight' => 10, 'input_type' => 'datepicker', 'input_name' => '_epl_from_date', 'label' => epl__('From'), 'placeholder' => epl__('From')); $data['filters']['date_from'] = EPL_util::get_instance()->create_element($_ar); $_ar = array('weight' => 15, 'input_type' => 'datepicker', 'input_name' => '_epl_to_date', 'label' => epl__('To'), 'placeholder' => epl__('To')); $data['filters']['date_to'] = EPL_util::get_instance()->create_element($_ar); $_opt = array('' => epl__('All Locations')); $_ar = array('weight' => 25, 'input_type' => 'select', 'input_name' => '_epl_event_location', 'label' => epl__('Location'), 'options' => array('' => epl__('All Locations')) + get_list_of_available_locations()); $data['filters']['location'] = EPL_util::get_instance()->create_element($_ar); if ($search_fields) { $data['filters'] = array_intersect_key($data['filters'], array_flip($search_fields)); } $data['filters'] = apply_filters('epl_event_search_box', $data['filters']); uasort($data['filters'], 'epl_sort_by_weight'); $data['result_view'] = $result_view; $data['shortcode_atts'] = $shortcode_atts; return $this->epl->load_view('front/event-search-box', $data, true); }