function _express_checkout_redirect()
 {
     global $event_details;
     $event_id = $event_details['ID'];
     //key( ( array ) $_SESSION['__epl'][$regis_id]['events'] );
     if (is_null($event_id)) {
         return false;
     }
     $this->epl->load_file('libraries/gateways/paypal/paypal.php');
     $url = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? "https://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] : "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     //echo "<pre class='prettyprint'>" . print_r( $_SESSION, true ) . "</pre>";
     $regis_id = $this->erm->get_regis_id();
     $gateway_info = $this->erm->get_gateway_info();
     $tickets = $_SESSION['__epl'][$regis_id]['_dates']['_att_quantity'];
     $post_ID = $_SESSION['__epl']['post_ID'];
     //echo "<pre class='prettyprint'>" . print_r($post_ID, true). "</pre>";
     $this->ecm->setup_event_details($event_id);
     $_totals = $this->erm->calculate_totals();
     $requestParams = array('RETURNURL' => esc_url_raw(add_query_arg(array('cart_action' => '', 'p_ID' => $post_ID, 'regis_id' => $regis_id, 'epl_action' => '_exp_checkout_payment_success'), $url)), 'CANCELURL' => esc_url_raw(add_query_arg(array('cart_action' => '', 'p_ID' => $post_ID, 'regis_id' => $regis_id, 'epl_action' => '_exp_checkout_payment_cancel'), $url)), "SOLUTIONTYPE" => 'Sole', "LANDINGPAGE" => epl_nz($gateway_info['_epl_pp_landing_page'], 'Login'));
     $orderParams = array('PAYMENTREQUEST_0_AMT' => $_totals['money_totals']['grand_total'], 'PAYMENTREQUEST_0_SHIPPINGAMT' => 0, 'PAYMENTREQUEST_0_CURRENCYCODE' => epl_nz(epl_get_general_setting('epl_currency_code'), 'USD'), 'PAYMENTREQUEST_0_ITEMAMT' => $_totals['money_totals']['grand_total']);
     $item = array('L_PAYMENTREQUEST_0_NAME0' => epl__('Registration'), 'L_PAYMENTREQUEST_0_DESC0' => $event_details['post_title'] . ', ' . $_totals['_att_quantity']['total'][$event_details['ID']] . ' ' . epl__('attendees'), 'L_PAYMENTREQUEST_0_AMT0' => $_totals['money_totals']['grand_total'], 'L_PAYMENTREQUEST_0_QTY0' => 1);
     /*
              $counter = 0;
             $item = array( );
             foreach ( $tickets as $event_id => $ind_tickets ) {
     
                 foreach ( $ind_tickets as $ticket_id => $ticket_qty ) {
     
                     $ticket_name = epl_get_element( $ticket_id, $event_details['_epl_price_name'] );
                     $ticket_price = epl_get_element( $ticket_id, $event_details['_epl_price'] );
                     $qty = (is_array( $ticket_qty )) ? array_sum( $ticket_qty ) : $ticket_qty;
     
                     if ( $qty > 0 ) {
                         $item['L_PAYMENTREQUEST_0_NAME' . $counter] = substr( $event_details['post_title'], 0, 126 );
                         $item['L_PAYMENTREQUEST_0_DESC' . $counter] = $ticket_name;
                         //$item['L_PAYMENTREQUEST_0_NUMBER' . $counter] = $ticket_id;
                         $item['L_PAYMENTREQUEST_0_AMT' . $counter] = $ticket_price;
                         $item['L_PAYMENTREQUEST_0_QTY' . $counter] = $qty;
     
                         $counter++;
                     }
                 }
             }
     */
     //echo "<pre class='prettyprint'>" . print_r( $requestParams + $orderParams + $item, true ) . "</pre>";
     $paypal = new EPL_Paypal();
     $response = $paypal->request('SetExpressCheckout', $requestParams + $orderParams + $item);
     if (is_array($response) && $response['ACK'] == 'Success') {
         //Request successful
         $token = $response['TOKEN'];
         if ($gateway_info['_epl_sandbox'] == 10) {
             header('Location: https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=' . urlencode($token));
         } else {
             header('Location: https://www.paypal.com/webscr?cmd=_express-checkout&token=' . urlencode($token));
         }
     } else {
         $error = 'ERROR: ' . $response['L_SHORTMESSAGE0'] . '. ' . $response['L_LONGMESSAGE0'];
         echo EPL_Util::get_instance()->epl_invoke_error(0, $error, false);
     }
 }
 function form($instance)
 {
     $defaults = array('title' => epl__('Events'), 'exclude_past_events' => epl__('Exclude Past Events'));
     $instance = wp_parse_args((array) $instance, $defaults);
     $title = $instance['title'];
     $show_past_events = epl_get_element('show_past_events', $instance);
     $data = array();
     $data += $instance;
     $data['w'] = $this;
     $this->epl->load_view('widgets/advanced-cal/form', $data);
 }
 function add_new_columns($current_columns)
 {
     $new_columns['cb'] = '<input type="checkbox" />';
     //$new_columns['id'] = __( 'ID' );
     $new_columns['title'] = _x('Setting', 'column name');
     //$new_columns['type'] = epl__( 'Type' );
     //$new_columns['images'] = __( 'Images' );
     $new_columns['author'] = epl__('Created By');
     //$new_columns['categories'] = __( 'Categories' );
     //$new_columns['events_planner_categories'] = __( 'Categories' );
     //$new_columns['tags'] = __( 'Tags' );
     //$new_columns['date'] = _x( 'Date', 'column name' );
     return $new_columns;
 }
 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);
 }
 function form($instance)
 {
     $defaults = array('title' => epl__('Events'));
     $instance = wp_parse_args((array) $instance, $defaults);
     $title = $instance['title'];
     $title_url = $instance['title_url'];
     $css_class = $instance['css_class'];
     $num_events_to_show = $instance['num_events_to_show'];
     $exclude_event_ids = $instance['exclude_event_ids'];
     $enable_tooltip = $instance['enable_tooltip'];
     $template = $instance['template'];
     $thumbnail_size = $instance['thumbnail_size'];
     $class_display_type = epl_get_element('class_display_type', $instance);
     $num_words_to_show = epl_get_element('num_words_to_show', $instance);
     $content_to_show = epl_get_element('content_to_show', $instance);
     $days_to_show = $instance['days_to_show'];
     $tax_filter = $instance['tax_filter'];
     $tax_filter_field = $this->get_field_name('tax_filter');
     //send name and value
     $args = array('name' => $tax_filter_field . '[]', 'value' => $tax_filter);
     $r = $this->epl->epl_util->epl_terms_field($args);
     $data = array();
     //send the checkbox array as a separate var
     $data['tax_filter'] = $r['field'];
     $_f = array('input_type' => 'select', 'input_name' => $this->get_field_name('enable_tooltip'), 'options' => epl_yes_no(), 'value' => $enable_tooltip);
     $r = $this->epl->epl_util->create_element($_f);
     $data['enable_tooltip'] = $r['field'];
     $_f = array('input_type' => 'select', 'input_name' => $this->get_field_name('class_display_type'), 'options' => array(1 => epl__('First Date Only'), 2 => epl__('Each Date Individually')), 'value' => $class_display_type);
     $r = $this->epl->epl_util->create_element($_f);
     $data['class_display_type'] = $r['field'];
     $template_options = apply_filters('epl_ue_available_templates', array('template-1' => epl__('Template 1'), 'template-2' => epl__('Template 2'), 'template-1-loc' => epl__('Template 1 + location'), 'template-2-loc' => epl__('Template 2 + location')));
     $_f = array('input_type' => 'select', 'input_name' => $this->get_field_name('template'), 'options' => $template_options, 'value' => $template);
     $r = $this->epl->epl_util->create_element($_f);
     $data['template'] = $r['field'];
     $_f = array('input_type' => 'select', 'input_name' => $this->get_field_name('thumbnail_size'), 'options' => get_intermediate_image_sizes(), 'value' => $thumbnail_size);
     $r = $this->epl->epl_util->create_element($_f);
     $data['thumbnail_size'] = $r['field'];
     $_f = array('input_type' => 'select', 'input_name' => $this->get_field_name('content_to_show'), 'options' => array('content' => epl__('Content'), 'excerpt' => epl__('Excerpt')), 'value' => $content_to_show);
     $r = $this->epl->epl_util->create_element($_f);
     $data['content_to_show'] = $r['field'];
     $data += $instance;
     $data['w'] = $this;
     $this->epl->load_view('widgets/upcoming-events/form', $data);
 }
 function run()
 {
     if (isset($_REQUEST['epl_action'])) {
         //POST has higher priority
         $epl_action = esc_attr(isset($_REQUEST['epl_action']) ? $_REQUEST['epl_action'] : $_REQUEST['epl_action']);
         if (method_exists($this, $epl_action)) {
             $epl_current_step = $epl_action;
             $r = $this->{$epl_action}();
         } else {
             $r = epl__('Error');
         }
     } else {
     }
     if (isset($GLOBALS['epl_ajax']) && $GLOBALS['epl_ajax'] == true) {
         echo $this->epl_util->epl_response(array('html' => $r));
         exit;
     }
     return $r;
     die($r);
 }
 /**
  * Load a view file from applicaiton/views folder
  *
  * @since 1.0.0
  * @param string $file_name (e.g. 'admin/view_name')
  * @param array  $data - data to be used in the view, is appended to _cached_vars (to be shared between views) then extracted into variables.
  * @param bool  $return - if false, echo
  * @return string content of view file
  */
 function load_view($file_name, $data = NULL, $return = FALSE)
 {
     if (is_array($data) || is_object($data)) {
         $this->_cached_vars = array_merge((array) $this->_cached_vars, $data);
     }
     $file_name = str_replace('.php', '', $file_name);
     //check for the file first in the theme directory
     $r = $this->load_template_file($file_name . '.php');
     if (is_null($r)) {
         extract($this->_cached_vars);
         ob_start();
         if (file_exists(EPL_APPLICATION_FOLDER . 'views/' . $file_name . '.php')) {
             include EPL_APPLICATION_FOLDER . 'views/' . $file_name . '.php';
         } else {
             echo epl__('Missing file') . ': ' . $file_name . '.php';
         }
         $r = ob_get_contents();
         @ob_end_clean();
     }
     if ($return) {
         return $r;
     }
     echo $r;
 }
 function send_confirmation_email($data)
 {
     global $organization_details, $customer_email, $event_details;
     $data['eb'] = '';
     $default_email_body = $this->epl->load_view('front/registration/regis-confirm-email', $data, true);
     $_notif = epl_get_element('_epl_event_notification', $event_details);
     $_notif_data = array();
     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['eb'] = nl2br($this->notif_tags(stripslashes_deep(html_entity_decode($_notif_data['post_content'], ENT_QUOTES))));
     }
     if (epl_is_empty_array($_notif) || $_notif == '' || epl_get_element('_epl_notification_replace', $event_details, 0) == 0) {
         $email_body = $this->epl->load_view('front/registration/regis-confirm-email', $data, true);
     } else {
         $email_body = $data['eb'];
     }
     $email_body = preg_replace('/<div class=\'epl_(.*?)_message\'>(.*?)<\\/div>/', '', $email_body);
     $from_name = 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 = html_entity_decode(epl_get_element('_epl_email_subject', $_notif_data, epl__('Registration Confirmation')), 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 (isset($customer_email) && $customer_email != '') {
         @wp_mail($customer_email, $subject, $email_body, $headers);
     }
     //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'));
     }
     @wp_mail($_email, epl__('New Registration') . ': ' . get_the_event_title(), $default_email_body, $headers);
 }
<table class="epl_prices_table">
    <tr>
        <th>
            <?php 
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 
}
?>
<?php

global $epl_fields;
$epl_fields['epl_fields'] = array('input_name' => array('input_type' => 'hidden', 'input_name' => 'input_name'), 'label' => array('input_type' => 'text', 'input_name' => 'label', 'label' => 'Field Label', 'description' => epl__('Will be used in the field label.'), 'required' => true, 'class' => 'epl_w300'), 'input_slug' => array('input_type' => 'text', 'input_name' => 'input_slug', 'label' => epl__('Input Slug'), 'description' => epl__('Will be used in email templates. Ex. your_city, your_weight, height...'), 'required' => true, 'class' => 'epl_w300 input_name'), 'input_type' => array('input_type' => 'select', 'input_name' => 'input_type', 'options' => array('text' => 'Text', 'textarea' => 'Textarea', 'select' => 'Dropdown', 'radio' => 'Radio', 'checkbox' => 'Checkbox', 'hidden' => 'Hidden'), 'id' => 'input_type', 'label' => 'Field Type', 'description' => '', 'style' => '', 'class' => 'epl_field_type', 'default_value' => 'text'), 'epl_field_choices' => array('input_type' => 'section', 'class' => 'epl_field_choices'), 'epl_field_choice_default' => array('return' => 0, 'input_name' => 'epl_field_choice_default[]'), 'epl_field_choice_text' => array('return' => 0, 'input_name' => 'epl_field_choice_text[]'), 'epl_field_choice_value' => array('return' => 0, 'input_name' => 'epl_field_choice_value[]'), 'description' => array('input_type' => 'textarea', 'input_name' => 'description', 'label' => 'Field Description', 'description' => epl__('Will be displayed below the field.  Can be used as help text.'), 'class' => 'epl_w300'), 'required' => array('input_type' => 'select', 'input_name' => 'required', 'label' => 'Required', 'options' => epl_yes_no(), 'default_value' => 0, 'display_inline' => true), 'default_value' => array('input_type' => 'text', 'input_name' => 'default_value', 'label' => 'Default Value', 'description' => epl__('Default value for the field, ONLY FOR Text, Hidden, Textarea (for now).'), 'class' => 'epl_w300'), 'validation' => array('input_type' => 'select', 'input_name' => 'validation', 'options' => array('email' => 'Email'), 'empty_row' => true, 'id' => 'input_type', 'label' => 'Validation', 'description' => epl__('More Coming Soon.'), 'style' => '', 'class' => 'epl_field_type', 'default_value' => 'text'), 'epl_controller' => array('input_type' => 'hidden', 'input_name' => 'epl_controller', 'default_value' => 'epl_form_manager'), 'epl_system' => array('input_type' => 'hidden', 'input_name' => 'epl_system', 'value' => 1));
$epl_fields['epl_fields_choices'] = array('epl_field_choice_text' => array('input_type' => 'text', 'input_name' => 'epl_field_choice_text[]'), 'epl_field_choice_value' => array('input_type' => 'text', 'input_name' => 'epl_field_choice_value[]'));
$epl_fields['epl_forms'] = array('epl_form_id' => array('input_type' => 'hidden', 'input_name' => 'epl_form_id'), 'epl_form_label' => array('input_type' => 'text', 'input_name' => 'epl_form_label', 'id' => 'epl_form_label', 'label' => 'Form Label', 'description' => 'Displayed form identifier', 'class' => 'epl_w300', 'required' => true), 'epl_form_slug' => array('input_type' => 'text', 'input_name' => 'epl_form_slug', 'label' => 'Form Slug', 'description' => epl__('Will be used in emails.'), 'class' => 'epl_w300 make_slug', 'required' => true), 'epl_form_descritption' => array('input_type' => 'textarea', 'input_name' => 'epl_form_descritption', 'label' => 'Form Description', 'description' => 'If you would like to give some form instructions, you can type them here. ', 'class' => 'epl_w300'), 'epl_form_options' => array('input_type' => 'checkbox', 'input_name' => 'epl_form_options[]', 'label' => 'On the registration form:', 'description' => '', 'options' => array(0 => 'Show Form Name.', 10 => 'Show Form Description.'), 'class' => ''), 'epl_form_fields' => array('return' => 0, 'input_name' => 'epl_form_fields'), 'epl_controller' => array('input_type' => 'hidden', 'input_name' => 'epl_controller', 'default_value' => 'epl_form_manager'), 'epl_system' => array('input_type' => 'hidden', 'input_name' => 'epl_system', 'value' => 1));
 /**
  * Get Day Names
  *
  * Returns an array of day names (Sunday, Monday, etc.) based
  * on the type.  Options: long, short, abrev
  *
  * @access	public
  * @param	string
  * @return	array
  */
 function get_day_names($day_type = '')
 {
     if ($day_type != '') {
         $this->day_type = $day_type;
     }
     if ($this->day_type == 'long') {
         $day_names = array(epl__('Sunday'), epl__('Monday'), epl__('Tuesday'), epl__('Wednesday'), epl__('Thursday'), epl__('Friday'), epl__('Saturday'));
     } elseif ($this->day_type == 'short') {
         $day_names = array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat');
     } else {
         $day_names = array(epl__('Su'), epl__('Mo'), epl__('Tu'), epl__('We'), epl__('Th'), epl__('Fr'), epl__('Sa'));
     }
     $days = array();
     foreach ($day_names as $val) {
         //$days[] = ($this->CI->lang->line('cal_'.$val) === FALSE) ? ucfirst($val) : $this->CI->lang->line('cal_'.$val);
         $days[] = ucfirst($val);
     }
     return $days;
 }
<div id="" class="epl_event_section" style="padding: 10px;">

    <?php 
if (isset($ticket_number)) {
    ?>

        <b><?php 
    echo epl__('Attendee #') . $ticket_number;
    ?>
: <?php 
    echo $price_name;
    ?>
</b>

    <?php 
}
?>
    <?php 
if (isset($form_label) && $form_label != '') {
    ?>

            <b><?php 
    echo $form_label;
    ?>
</b>

    <?php 
}
?>

    <?php 
<?php

global $epl_fields;
$epl_fields['epl_global_discount_type'] = array('_epl_global_discount_type' => array('input_type' => 'select', 'input_name' => '_epl_global_discount_type', 'label' => epl__('Discount Type'), 'id' => 'epl_global_discount_type', 'empty_row' => true, 'options' => array('global' => epl__('Internal'))));
$epl_fields['epl_global_discount_type'] = apply_filters('epl_global_discount_type', $epl_fields['epl_global_discount_type']);
$epl_fields['epl_global_discount_fields'] = array('_epl_discount_method' => array('input_type' => 'select', 'input_name' => '_epl_discount_method[]', 'options' => array(5 => epl__('Code'), 10 => epl__('Automatic')), 'label' => epl__('Discount Method'), 'class' => '', 'parent_keys' => true), '_epl_discount_code' => array('input_type' => 'text', 'input_name' => '_epl_discount_code[]', 'label' => epl__('Discount Code'), 'class' => 'epl_w80'), '_epl_discount_amount' => array('input_type' => 'text', 'input_name' => '_epl_discount_amount[]', 'label' => epl__('Amount'), 'class' => 'epl_w70'), '_epl_discount_type' => array('input_type' => 'select', 'input_name' => '_epl_discount_type[]', 'label' => epl__('Discount Type'), 'options' => array(5 => epl__('Fixed'), 10 => epl__('Percent')), 'class' => ''), '_epl_discount_max_usage' => array('input_type' => 'text', 'input_name' => '_epl_discount_max_usage[]', 'label' => epl__('Max Use'), 'class' => 'epl_w50'), '_epl_discount_end_date' => array('input_type' => 'text', 'input_name' => '_epl_discount_end_date[]', 'label' => epl__('Until'), 'class' => 'datepicker epl_w100', 'data_type' => 'unix_time', '__func' => 'epl_admin_date_display'), '_epl_discount_description' => array('input_type' => 'text', 'input_name' => '_epl_discount_description[]', 'placeholder' => epl__('Discount Description (optional)'), 'class' => 'epl_w100pct', 'help_text' => epl__('This label will appear in the total section as the discount description.')), '_epl_discount_active' => array('input_type' => 'select', 'input_name' => '_epl_discount_active[]', 'label' => epl__('Active'), 'options' => epl_yes_no(), 'default_value' => 0), '_epl_discount_cat_include' => array('input_type' => 'checkbox', 'input_name' => '_epl_discount_cat_include[]', 'label' => epl__('Include Only Categories'), 'options' => epl_term_list(), 'auto_key' => false, 'second_key' => '[]', 'display_inline' => true), '_epl_discount_condition' => array('input_type' => 'select', 'input_name' => '_epl_discount_condition[]', 'options' => array(0 => '', 5 => epl__('Total Amount'), 6 => epl__('Total Quantity'), 7 => epl__('Number of Events')), 'class' => ''), '_epl_discount_condition_logic' => array('input_type' => 'select', 'input_name' => '_epl_discount_condition_logic[]', 'options' => array('=' => '=', '>' => '>', '>=' => '>=', '<=' => '<=', 'between' => epl__('Between')), 'class' => ''), '_epl_discount_condition_value' => array('input_type' => 'text', 'input_name' => '_epl_discount_condition_value[]', 'class' => 'epl_w70'), '_epl_discount_condition_value2' => array('input_type' => 'text', 'input_name' => '_epl_discount_condition_value2[]', 'class' => 'epl_w70'), '_epl_discount_target' => array('input_type' => 'select', 'input_name' => '_epl_discount_target[]', 'options' => array(5 => epl__('Total Amount')), 'class' => ''), '_epl_discount_target_price_id' => array('input_type' => 'select', 'input_name' => '_epl_discount_target_price_id[]', 'options' => array(), 'class' => ''), '_epl_discount_forms' => array('weight' => 60, 'input_type' => 'checkbox', 'input_name' => '_epl_discount_forms[]', 'label' => epl__('Discount Specific Form'), 'options' => array(), 'second_key' => '[]'), '_epl_discount_forms_per' => array('weight' => 65, 'input_type' => 'select', 'input_name' => '_epl_discount_forms_per[]', 'label' => epl__('Display the form '), 'options' => array(1 => epl__('For each Attendee'), 2 => epl__('Only Once'), 3 => epl__('Do not show any attendee forms'))));
$epl_fields['epl_global_discount_fields'] = apply_filters('epl_global_discount_fields', $epl_fields['epl_global_discount_fields']);
//uasort( $epl_fields['epl_discount_fields'], 'epl_sort_by_weight' );
$epl_fields['epl_global_discount_rule_fields'] = array('_epl_discount_trigger' => array('input_type' => 'select', 'input_name' => '_epl_discount_trigger[]', 'options' => array(0 => '', 5 => epl__('Total Amount'), 6 => epl__('Total Quantity')), 'class' => ''), '_epl_discount_amount' => array('input_type' => 'text', 'input_name' => '_epl_discount_amount[]', 'label' => epl__('Amount'), 'class' => 'epl_w70'), '_epl_discount_type' => array('input_type' => 'select', 'input_name' => '_epl_discount_type[]', 'label' => epl__('Discount Type'), 'options' => array(5 => epl__('Fixed'), 10 => epl__('Percent')), 'class' => ''), '_epl_discount_max_usage' => array('input_type' => 'text', 'input_name' => '_epl_discount_max_usage[]', 'label' => epl__('Max Use'), 'class' => 'epl_w50'), '_epl_discount_end_date' => array('input_type' => 'text', 'input_name' => '_epl_discount_end_date[]', 'label' => epl__('Until'), 'class' => 'datepicker epl_w80', 'data_type' => 'unix_time'), '_epl_discount_active' => array('input_type' => 'select', 'input_name' => '_epl_discount_active[]', 'label' => epl__('Until'), 'options' => epl_yes_no(), 'default_value' => 0));
$epl_fields['epl_global_discount_rule_fields'] = apply_filters('epl_global_discount_rule_fields', $epl_fields['epl_global_discount_rule_fields']);
$epl_fields['epl_social_discount_fields'] = array('_epl_discount_code' => array('input_type' => 'text', 'input_name' => '_epl_discount_code[]', 'label' => epl__('Discount Code'), 'parent_keys' => true), '_epl_discount_buyer' => array('input_type' => 'text', 'input_name' => '_epl_discount_buyer[]', 'label' => epl__('Buyer')), '_epl_discount_amount' => array('input_type' => 'text', 'input_name' => '_epl_discount_amount[]', 'label' => epl__('Amount'), 'class' => 'epl_w70'), '_epl_discount_type' => array('input_type' => 'select', 'input_name' => '_epl_discount_type[]', 'label' => epl__('Discount Type'), 'options' => array(5 => epl__('Fixed'), 10 => epl__('Percent')), 'class' => ''), '_epl_discount_max_usage' => array('input_type' => 'text', 'input_name' => '_epl_discount_max_usage[]', 'label' => epl__('Max Use'), 'class' => 'epl_w40'), '_epl_discount_status' => array('input_type' => 'text', 'input_name' => '_epl_discount_Status[]', 'label' => epl__('Status'), 'class' => ''), '_epl_discount_end_date' => array('input_type' => 'text', 'input_name' => '_epl_discount_end_date[]', 'label' => epl__('Until'), 'class' => '', 'data_type' => 'unix_time', '__func' => 'epl_admin_date_display'), '_epl_discount_active' => array('input_type' => 'select', 'input_name' => '_epl_discount_active[]', 'label' => epl__('Active'), 'options' => epl_yes_no(), 'default_value' => 0));
<?php

global $epl_fields;
$epl_fields['epl_general_options'] = array('epl_currency_code' => array('input_type' => 'select', 'input_name' => 'epl_currency_code', 'label' => epl__('Currency Code'), 'description' => epl__('This will be used in payment gateways. '), 'options' => array('AUD' => 'AUD', 'CAD' => 'CAD', 'EUR' => 'EUR', 'GBP' => 'GBP', 'NOK' => 'NOK', 'USD' => 'USD')), 'epl_currency_symbol' => array('input_type' => 'text', 'input_name' => 'epl_currency_symbol', 'label' => epl__('Currency Symbol'), 'description' => epl__('This will appear next to all the currency figures on the website.  Ex. $, USD, €... '), 'class' => 'epl_w50'), 'epl_currency_display_format' => array('input_type' => 'select', 'input_name' => 'epl_currency_display_format', 'options' => array(1 => '1,234.56', 2 => '1,234', 3 => '1234', 4 => '1234.56', 5 => '1 234,00'), 'default_value' => 1, 'label' => epl__('Currency display format'), 'description' => epl__('This determines how your currency is displayed.  Ex. 1,234.56 or 1,200 or 1200.')));
$epl_fields['epl_registration_options'] = array('epl_regis_id_length' => array('input_type' => 'select', 'input_name' => 'epl_regis_id_length', 'label' => epl__('Registration ID length?'), 'description' => epl__('This will be an alphanumeric string.'), 'options' => epl_make_array(10, 40), 'default_value' => 10));
                <?php 
    echo get_the_location_city();
    ?>
 <?php 
    echo get_the_location_state();
    ?>
 <?php 
    echo get_the_location_zip();
    ?>
<br />
                <?php 
    echo get_the_location_phone();
    ?>
<br />
                <?php 
    echo get_the_location_website() ? epl_anchor(get_the_location_website(), epl__('Visit Website') . '<br />') : '';
    ?>
                <?php 
    echo get_the_location_gmap_icon();
    ?>

            <?php 
} elseif (epl_is_multi_location()) {
    ?>

                <?php 
    epl_e('Multiple locations');
    ?>

            <?php 
}
</td>


                                <td>


<?php 
        if ($time_data['regis']) {
            $dt_array = array('date_id' => $date_id, 'time_id' => $time_id);
            $table_link_arr = array_merge($table_link_arr, $dt_array);
            $csv_link_arr += $dt_array;
            $send_email_arr = array('epl_action' => 'get_the_email_form', 'epl_controller' => 'epl_registration', 'event_id' => $event_id, 'post_type' => false);
            echo epl_anchor(add_query_arg(array_merge($table_link_arr, $dt_array) + array('names_only' => 1), $base_url), epl__('View Names'), null, 'class="epl_view_attendee_list_table button-secondary"');
            echo epl_anchor(add_query_arg($table_link_arr, $base_url), epl__('View Full Data'), null, 'class="epl_view_attendee_list_table button-secondary"');
            echo epl_anchor(add_query_arg(array_merge($csv_link_arr, $dt_array), $base_url), epl__('Export CSV'), null, 'class="button-secondary"');
            echo epl_anchor(add_query_arg($send_email_arr + $dt_array, $base_url), epl__('Send Email'), null, "class='epl_send_email_form_link button-secondary' data-post_ID='{$post_ID}' data-event_id='{$event_id}'");
        }
        ?>
                            </td>
                        </tr>

<?php 
    }
    ?>



<?php 
}
?>
        <h2><?php 
epl_e('Events Planner Settings');
?>
</h2>

        <div id="icon-options-general" class="icon32"><br></div>
        <h2 class="nav-tab-wrapper">

            <?php 
$current = 'general';
if (isset($_GET['tab'])) {
    $current = $_GET['tab'];
}
if ('true' == esc_attr($_GET['updated'])) {
    echo '<div class="updated" ><p>' . epl__('Settings updated.') . '</p></div>';
}
$base_url = epl_get_url();
foreach ($tabs as $tab => $name) {
    $class = $tab == $current ? ' nav-tab-active' : '';
    echo "<a class='nav-tab{$class}' href='" . add_query_arg(array('tab' => $tab), $base_url) . "'>{$name}</a>";
}
?>
        </h2>

        <div id="poststuff">
            <form action="<?php 
echo epl_get_url();
?>
" method="post">
                <?php 
    <?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);
    ?>
        </table>   
<?php

global $epl_fields;
$epl_fields['epl_org_fields'] = array('_epl_org_address' => array('weight' => 5, 'input_type' => 'text', 'input_name' => '_epl_org_address', 'label' => epl__('Address'), 'class' => 'epl_w300'), '_epl_org_address2' => array('weight' => 10, 'input_type' => 'text', 'input_name' => '_epl_org_address2', 'label' => epl__('Address 2'), 'class' => 'epl_w300'), '_epl_org_city' => array('weight' => 15, 'input_type' => 'text', 'input_name' => '_epl_org_city', 'label' => epl__('Zip'), 'class' => 'epl_w300'), '_epl_org_state' => array('weight' => 20, 'input_type' => 'text', 'input_name' => '_epl_org_state', 'label' => epl__('State'), 'class' => 'epl_w300'), '_epl_org_city' => array('weight' => 25, 'input_type' => 'text', 'input_name' => '_epl_org_city', 'label' => epl__('City'), 'class' => 'epl_w300'), '_epl_org_zip' => array('weight' => 30, 'input_type' => 'text', 'input_name' => '_epl_org_zip', 'label' => epl__('Zip Code'), 'class' => 'epl_w300'), '_epl_org_phone' => array('weight' => 35, 'input_type' => 'text', 'input_name' => '_epl_org_phone', 'label' => epl__('Phone'), 'class' => 'epl_w300'), '_epl_org_email' => array('weight' => 40, 'input_type' => 'text', 'input_name' => '_epl_org_email', 'label' => epl__('Email'), 'class' => 'epl_w300'), '_epl_org_website' => array('weight' => 45, 'input_type' => 'text', 'input_name' => '_epl_org_website', 'label' => epl__('Website'), 'class' => 'epl_w300'));
$epl_fields['epl_org_fields'] = apply_filters('epl_org_fields', $epl_fields['epl_org_fields']);
uasort($epl_fields['epl_org_fields'], 'epl_sort_by_weight');
    if (epl_is_pack_regis()) {
        $pack_size = epl_get_element_m($row->price_id, '_epl_price_pack_size', $event_details, 1);
        $exp = '';
        if (epl_get_element_m($row->price_id, '_epl_price_pack_type', $event_details) == 'time') {
            $mem_l = epl_get_element_m($row->price_id, '_epl_price_pack_time_length', $event_details);
            $mem_lt = epl_get_element_m($row->price_id, '_epl_price_pack_time_length_type', $event_details);
            $start = strtotime($row->regis_date);
            $until = strtotime("+ {$mem_l} {$mem_lt}", $start);
            if ($until < EPL_DATE) {
                $exp = epl_wrap(epl__("Expired"), '<span class="epl_font_red"> - ', '</span>');
            }
            $_r['package'] = epl__('Until') . ' ' . epl_formatted_date($until) . $exp;
        } else {
            $remaining = $pack_size - $_r['use_count'];
            if ($remaining <= 0) {
                $exp = epl_wrap(epl__("Credits used up"), ' <span class="epl_font_red">', '</span>');
            }
            $_r['package'] = $pack_size . $exp;
            $_r['use_count'] = "{$_r['use_count']}/{$_r['package']}";
        }
    }
    $_form = $erptm->get_form_data_array($row->field_id, $row->value);
    $_r = array_merge($_r, epl_process_fields_for_display($_form));
    $this->epl->epl_table->add_row(array_values($_r));
}
epl_sort_array_by_array($avail_fields, $_form);
$header = array_merge($header, epl_get_field_labels(array_intersect_key($avail_fields, $_form)));
$this->epl->epl_table->set_heading($header);
echo $this->epl->epl_table->generate();
?>
<?php

global $epl_fields;
$epl_fields['epl_gateway_type'] = array('_epl_pay_types' => array('input_type' => 'select', 'input_name' => '_epl_pay_types', 'label' => epl__('Payment Type'), 'id' => 'epl_pay_type', 'empty_row' => true, 'options' => array('_pp_exp' => epl__('PayPal Express Checkout'))));
$epl_fields['_pp_exp_fields'] = array('_epl_pay_help' => array('input_type' => 'section', 'label' => epl__('PayPal Express Checkout'), 'content' => sprintf(epl__('Visit %s for more information.'), epl_anchor('https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECGettingStarted', epl__('here')))), '_epl_pay_type' => array('input_type' => 'hidden', 'input_name' => '_epl_pay_type', 'default_value' => '_pp_exp'), '_epl_pay_display' => array('input_type' => 'textarea', 'input_name' => '_epl_pay_display', 'id' => '', 'label' => epl__('Label'), 'description' => sprintf(epl__('What the customer will see as an option.  PayPal requires you to use one of their %s'), epl_anchor('https://www.paypal.com/express-checkout-buttons', epl__('buttons'))), 'class' => 'epl_w300'), '_epl_pre_checkout_message' => array('input_type' => 'textarea', 'input_name' => '_epl_pre_checkout_message', 'label' => epl__('Pre Redirect Message'), 'description' => epl__('This will be displayed before the user is redirected to PayPal'), 'class' => 'epl_w300'), '_epl_pp_exp_user' => array('input_type' => 'text', 'input_name' => '_epl_pp_exp_user', 'id' => '', 'label' => epl__('API Username'), 'description' => epl__('Ex: some_api1.youremailaddress.com'), 'class' => 'epl_w300', 'required' => true), '_epl_pp_exp_pwd' => array('input_type' => 'password', 'input_name' => '_epl_pp_exp_pwd', 'id' => '', 'label' => epl__('API Password'), 'description' => epl__('Ex: SDFE23D5SFD324'), 'class' => '_epl_w300', 'required' => true), '_epl_pp_exp_sig' => array('input_type' => 'password', 'input_name' => '_epl_pp_exp_sig', 'id' => '', 'label' => epl__('Signature'), 'description' => epl__('Will be a very long string. Ex. SRl31AbcSd9fIqew......'), 'class' => 'epl_w300', 'required' => true), '_epl_pp_landing_page' => array('input_type' => 'radio', 'input_name' => '_epl_pp_landing_page', 'id' => '', 'label' => epl__('PayPal Landing Page'), 'description' => epl__('If "PayPal Account Optional" is set to "on" inside your PayPal account, this option selects which section the users see by default when they reach PayPal.'), 'options' => array('Login' => epl__('PayPal account login'), 'Billing' => epl__('Non-PayPal account, for credit/debit cards')), 'default_value' => 'Billing', 'default_checked' => 1), '_epl_sandbox' => array('input_type' => 'select', 'input_name' => '_epl_sandbox', 'label' => epl__('Test Mode?'), 'options' => epl_yes_no(), 'description' => epl__('If yes, please make sure you use Sandbox credentials above.'), 'class' => ''));
$epl_fields['_check_fields'] = array('_epl_pay_help' => array('input_type' => 'section', 'label' => epl__('Checks/Money Orders'), 'content' => epl__('You can use this to give your customers the ability to pay using a Check.')), '_epl_pay_type' => array('input_type' => 'hidden', 'input_name' => '_epl_pay_type', 'default_value' => '_check'), '_epl_pay_display' => array('input_type' => 'textarea', 'input_name' => '_epl_pay_display', 'id' => '', 'label' => epl__('Display Label'), 'description' => epl__('What the customer will see as an option.'), 'class' => 'epl_w300'), '_epl_check_payable_to' => array('input_type' => 'text', 'input_name' => '_epl_check_payable_to', 'id' => '_epl_form_label', 'label' => epl__('Make Payable To'), 'description' => epl__('Who will get this check?'), 'class' => 'epl_w300', 'required' => true), '_epl_check_address' => array('input_type' => 'textarea', 'input_name' => '_epl_check_address', 'label' => epl__('Send Payment To'), 'description' => epl__('The address.'), 'class' => 'epl_w300'), '_epl_check_instructions' => array('input_type' => 'textarea', 'input_name' => '_epl_check_instructions', 'id' => '', 'label' => epl__('Instructions'), 'description' => epl__('Special Instruction to the customer.'), 'class' => 'epl_w300'));
 function create_admin_menu()
 {
     add_submenu_page('edit.php?post_type=epl_event', epl__('Form Manager'), epl__('Form Manager'), 'manage_options', 'epl_form_manager', array($this, 'route'));
     add_submenu_page('edit.php?post_type=epl_event', epl__('Settings'), epl__('Settings'), 'manage_options', 'epl_settings', array($this, 'route'));
     add_submenu_page('edit.php?post_type=epl_event', epl__('Help'), '<span class="epl_font_red">' . epl__('Help') . '</span>', 'manage_options', 'epl_help', array($this, 'route'));
 }
 function epl_add_meta_boxes()
 {
     global $epl_help_links;
     if ($this->edit_mode) {
         //     $this->data['values'] = $this->epl_util->get_post_meta_all( ( int ) $_GET['post'], $this->epl_fields );
         if (isset($this->data['values']['_epl_pricing_type'])) {
             $this->pricing_type = $this->data['values']['_epl_pricing_type'];
         }
     }
     $help_link = get_help_icon(array('section' => 'event_dates', 'id' => null));
     add_meta_box('epl-dates-meta-box', epl__('Dates') . $help_link, array($this, 'event_dates_meta_box'), "epl_event", 'normal', 'core');
     $help_link = get_help_icon(array('section' => 'event_recurrence', 'id' => null));
     add_meta_box('epl-recurrence-meta-box', epl__('Recurrence Helper') . $help_link, array($this, 'event_recurrence_meta_box'), "epl_event", 'normal', 'core');
     $help_link = get_help_icon(array('section' => 'event_times', 'id' => null));
     add_meta_box('epl-times-meta-box', epl__('Times and Prices') . $help_link, array($this, 'event_times_meta_box'), "epl_event", 'normal', 'core');
     $help_link = get_help_icon(array('section' => 'event_settings', 'id' => null));
     add_meta_box('epl-other-settings-meta-box', epl__('Other Settings') . $help_link, array($this, 'other_settings_meta_box'), "epl_event", 'normal', 'core');
     $help_link = get_help_icon(array('section' => 'event_forms', 'id' => null));
     add_meta_box('epl-forms-meta-box', epl__('Registration Forms') . $help_link, array($this, 'forms_meta_box'), "epl_event", 'normal', 'core');
     //side boxes
     $help_link = get_help_icon(array('section' => 'event_options', 'id' => null));
     add_meta_box('epl-options-meta-box', epl__('Options') . $help_link, array($this, 'options_meta_box'), "epl_event", 'side', 'core');
     $help_link = get_help_icon(array('section' => 'event_display_options', 'id' => null));
     add_meta_box('epl-display-options-meta-box', epl__('Display Options') . $help_link, array($this, 'display_options_meta_box'), "epl_event", 'side', 'core');
     $help_link = get_help_icon(array('section' => 'event_capacity', 'id' => null));
     add_meta_box('epl-capacity-meta-box', epl__('Capacity Information') . $help_link, array($this, 'capacity_meta_box'), "epl_event", 'side', 'core');
     add_meta_box('epl-donation-meta-box', epl__('Donations'), array($this, 'donation_meta_box'), "epl_event", 'side', 'low');
 }
function epl_get_send_email_button($regis_id = false, $event_id = false, $img = false)
{
    $send_email_arr = array('epl_action' => 'get_the_email_form', 'epl_controller' => 'epl_report_manager', 'event_id' => $event_id, 'post_ID' => $regis_id);
    $anchor = epl__('Send Email');
    $class = 'button-primary';
    if ($img) {
        $anchor = '<img src="' . EPL_FULL_URL . 'images/email.png" />';
        $class = '';
    }
    return epl_anchor(add_query_arg($send_email_arr, epl_get_url()), $anchor, null, "class='epl_send_email_form_link {$class}' data-post_ID='{$regis_id}' data-event_id='{$event_id}'");
}
<div class="date"><?php 
echo $date;
?>
</div>

<?php 
if (empty($events)) {
    echo epl__('No events on this day.');
    return;
}
foreach ($events as $event_id => $d) {
    ?>
<dl>
    <dt><a href="<?php 
    echo $d['regis_link'];
    ?>
"><?php 
    echo $d['title'];
    ?>
</a></dt>
    <dd>&nbsp;</dd>
</dl>


<?php 
}
<?php

global $epl_sys_messages;
$epl_sys_messages = array('0' => epl__('Sorry but something must have gone wrong.'), '20' => epl__('Please select a quantity'), '21' => epl__('Please select a date'), '22' => epl__('Please select a time'), '23' => epl__('Sold Out'), '24' => epl__('Registration Closed'), '25' => epl__('The quantity selected exceeds the number of available spaces'), '40_5' => epl__('Please select a date.'), '90' => sprintf('Hi there.  If you are seeing this error, you need to enter a Support License Key or your key is invalid.
        If you have already purchased a Support License Key, please go %s (Events Planner > Settings > API Settings tab) and enter it in the API Settings tab.
        If you need to get one, please go to %s.  If at any point you are having issues, please contact Events Planner Helpdesk at help@wpeventsplanner.com.  Thank you. ', epl_anchor('edit.php?post_type=epl_event&page=epl_settings', "here"), epl_anchor('http://www.wpeventsplanner.com', "Events Planner Website")));
$epl_sys_messages = apply_filters('epl_sys_messages', $epl_sys_messages);
<?php

global $epl_fields;
$epl_fields['epl_notification_fields'] = array('_epl_email_template' => array('input_type' => 'select', 'input_name' => '_epl_email_template', 'label' => epl__('Email Template'), 'options' => epl_get_email_template_list(), 'default_value' => 'default', 'description' => epl__('Many thanks to') . ' ' . epl_anchor('http://www.campaignmonitor.com/templates/', 'Campaign Monitor')), '_epl_email_from_name' => array('input_type' => 'text', 'input_name' => '_epl_email_from_name', 'label' => epl__('From Name'), 'default_value' => get_bloginfo('name'), 'class' => 'epl_w300 req'), '_epl_from_email' => array('input_type' => 'text', 'input_name' => '_epl_from_email', 'label' => epl__('From Email'), 'default_value' => get_bloginfo('admin_email'), 'class' => 'epl_w300'), '_epl_email_subject' => array('input_type' => 'text', 'input_name' => '_epl_email_subject', 'label' => epl__('Email Subject'), 'class' => 'epl_w300 req'));
$epl_fields['epl_notification_fields'] = apply_filters('epl_notification_fields', $epl_fields['epl_notification_fields']);
 function setup_moneris_form_USA()
 {
     global $event_details;
     //global $customer_email;
     $event_id = $event_details['ID'];
     $gateway_info = $this->erm->get_gateway_info();
     $store_id = $gateway_info['_epl_user'];
     $api_token = $gateway_info['_epl_pwd'];
     $regis_id = $this->erm->get_regis_id();
     $post_ID = $_SESSION['__epl']['post_ID'];
     $this->ecm->setup_event_details($event_id);
     $_totals = $this->erm->calculate_cart_totals();
     $test_mode = $gateway_info['_epl_sandbox'] == 10;
     $amount = number_format($_totals['money_totals']['grand_total'], 2, '.', '');
     $ind_items = '';
     $discount_amount = epl_get_element('discount_amount', $_totals['money_totals'], 0);
     if ($discount_amount > 0) {
         $discount_description = epl_get_element('discount_description', $_totals['money_totals'], null);
         $discount_description = $discount_description ? ", ({$discount_description}) " : '';
         //-- this needs to be looked at, moneris USA doesn't do zero suffix
         $ind_items .= "<input type='hidden' name='li_description0' value='" . $event_details['post_title'] . " " . $_totals['_att_quantity']['total'][$event_details['ID']] . " " . $discount_description . "' />";
         $ind_items .= "<input type='hidden' name='li_quantity0' value='1' />";
         $ind_items .= "<input type='hidden' name='li_price0' value='{$discount_amount}' />";
     } else {
         $counter = 1;
         $tickets = $_SESSION['__epl'][$regis_id]['_dates']['_att_quantity'][$event_id];
         $dates = isset($_SESSION['__epl'][$regis_id]['_dates']['_epl_start_date'][$event_id]) ? $_SESSION['__epl'][$regis_id]['_dates']['_epl_start_date'][$event_id] : array();
         $num_days_in_cart = count($dates);
         $price_multiplier = $event_details['_epl_price_per'] == 10 ? $num_days_in_cart : 1;
         $price_multiplier_label = $price_multiplier > 1 ? ' - ' . $num_days_in_cart . ' ' . epl__('days') : '';
         $item = array();
         foreach ($tickets as $ticket_id => $ticket_qty) {
             $ticket_name = epl_get_element($ticket_id, $event_details['_epl_price_name']);
             $ticket_price = epl_get_element($ticket_id, $event_details['_epl_price']);
             $qty = is_array($ticket_qty) ? array_sum($ticket_qty) : $ticket_qty;
             if ($qty > 0) {
                 $_qty = $qty * $price_multiplier;
                 $_subtotal = number_format($_qty * $ticket_price, 2, '.', '');
                 //-- description must be sanitazied to only include alpha/num (no spaces ?)
                 $ind_items .= "<input type='hidden' name='li_description{$counter}' value='" . $event_details['post_title'] . " " . $price_multiplier_label . "'>";
                 $ind_items .= "<input type='hidden' name='li_quantity{$counter}' value='{$qty}'>";
                 $ind_items .= "<input type='hidden' name='li_price{$counter}' value='{$_subtotal}'>";
                 //-- not sure what variable to pick
                 $ind_items .= "<input type='hidden' name='li_id{$counter}' value='{$ticket_name}'>";
                 $counter++;
             }
         }
     }
     $first_name = epl_get_attendee_form_value('ticket_buyer', 'first_name');
     $last_name = epl_get_attendee_form_value('ticket_buyer', 'last_name');
     $address = epl_get_attendee_form_value('ticket_buyer', 'address');
     $city = epl_get_attendee_form_value('ticket_buyer', 'city');
     $state = epl_get_attendee_form_value('ticket_buyer', 'state');
     $zip = epl_get_attendee_form_value('ticket_buyer', 'zip');
     $email = epl_get_attendee_form_value('ticket_buyer', 'email');
     $total = number_format($_totals['money_totals']['grand_total'], 2, '.', '');
     $this->redirect_form_data = '';
     $this->redirect_form_data .= "<input type='hidden' name='hpp_id' value='{$store_id}' />";
     $this->redirect_form_data .= "<input type='hidden' name='hpp_key' value='{$api_token}' />";
     $this->redirect_form_data .= "<input type='hidden' name='amount' value='{$total}' />";
     //-- must be unique, regis_id should be OK
     $this->redirect_form_data .= "<input type='hidden' name='order_no' value='{$regis_id}' />";
     //--get registration email, so they can get receipt
     if (!$test_mode) {
         $this->redirect_form_data .= "<input type='hidden' name='client_email' value='{$email}' />";
     }
     //--not sure what to use, payee name better then nothing. max 50 chars
     //$cust_id = substr( preg_replace( "/[^a-zA-Z0-9]/", " ", $first_name . " " . $last_name ), 0, 50 );
     $this->redirect_form_data .= "<input type='hidden' name='cust_id' value='{$regis_id}' />";
     //--not sure what to use, add option in payment profile, Thank you for choosing.....
     $this->redirect_form_data .= "<input type='hidden' name='note' value='{$note}' />";
     $this->redirect_form_data .= $ind_items;
     $this->redirect_form_data .= "<input type='hidden' name='rvar_pid' value='{$post_ID}' />";
     $this->redirect_form_data .= "<input type='hidden' name='rvar_rid' value='{$regis_id}' />";
     $this->redirect_form_data .= "<input type='hidden' name='rvar_eid' value='{$event_id}' />";
     $this->redirect_form_data .= "<input type='hidden' name='li_shipping' value='0.00' />";
     $this->redirect_form_data .= "<input type='hidden' name='li_taxes' value='0.00' />";
 }
 function column_data($column_name, $id)
 {
     //global $wpdb;
     switch ($column_name) {
         case 'id':
             echo $id;
             break;
         case 'type':
             break;
         case 'usage':
             echo "<a href='#' id ='{$id}' class='epl_discount_usage_view'>" . epl__('See Usage') . "</a>";
             break;
         default:
             break;
     }
 }
            </td>
            <td class="epl_total_price epl_w100 epl_ta_r"> -<?php 
    echo epl_get_formatted_curr($money_totals['discount_amount'], null, true);
    ?>
</td>
        </tr>
    <?php 
}
?>
    <?php 
if (($surcharge = epl_get_element('surcharge', $money_totals)) > 0) {
    ?>
        <tr class="epl_surcharge">

            <td class="epl_w200"><?php 
    echo epl_get_element('_epl_surcharge_label', $event_details, epl__('Surcharge'));
    ?>
</td>
            <td class="epl_total_price epl_w100 epl_ta_r"> +<?php 
    echo epl_get_formatted_curr($surcharge, null, true);
    ?>
</td>
        </tr>
    <?php 
}
?>
    <?php 
if (($original_total = epl_get_element('original_total', $money_totals)) > 0) {
    ?>
        <tr class="epl_original_total" style="background-color: #ffcccc ">