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();
?>
 function get_payment_options()
 {
     global $event_details;
     $this->payment_choices();
     $offline_payments = array('_cash', '_check');
     $_o = array();
     $data = array();
     $date['date'] = '';
     $date['field'] = '';
     $value = $this->get_payment_profile_id();
     foreach ((array) $this->payment_choices as $payment_choice) {
         $q = $this->ecm->get_post_meta_all($payment_choice);
         if (!$q) {
             continue;
         }
         $label = epl_get_element('_epl_pay_display', $q);
         if (($pay_discount = epl_get_element('_epl_pay_discount_amount', $q)) > 0) {
             $label .= epl_wrap(epl_get_element('_epl_pay_discount_label', $q), ' (', ')');
         }
         $_payment = array('input_type' => 'radio', 'input_name' => '_epl_payment_method[]', 'label' => $label, 'options' => array($payment_choice => ''), 'default_checked' => is_null($value) && ($this->default_selected == $payment_choice || is_null($this->default_selected)) || count($this->payment_choices) == 1 ? 1 : 0, 'display_inline' => 1, 'required' => true, 'value' => $value);
         $data['payment_choice'] = $this->epl_util->create_element($_payment);
         $data['offline'] = in_array(epl_get_element('_epl_pay_type', $q), $offline_payments) ? 'epl_offline_payment' : '';
         $date['field'] .= $this->epl->load_view('front/cart/cart-payment-choices', $data, true);
     }
     return '<table class="epl_payment_options">' . $date['field'] . '</table>';
 }
        $payment_display = get_post_meta($p['_epl_payment_method'], '_epl_pay_display', true);
        $total_paid += $p['_epl_payment_amount'];
        ?>
            <tr>
                <td>
                    <?php 
        echo epl_formatted_date($p['_epl_payment_date']);
        ?>
                </td>
                <td class="epl_ta_r epl_w300">
                    <?php 
        echo epl_get_formatted_curr($p['_epl_payment_amount'], null, true);
        ?>
<br />
                    <small><?php 
        echo epl_wrap($payment_display, '(', ')');
        ?>
</small>
                </td>
            </tr>
            <?php 
    }
}
?>

</table>
<?php 
if (!empty($ck_out_button)) {
    ?>
    <div class="epl_fr">
        <!--<a href="<?php 
 function the_list_of_active_events($show_date = false)
 {
     global $wpdb, $event_details;
     static $events = array();
     if (!empty($events)) {
         return $events;
     }
     $_events = $wpdb->get_results("\n\t\t\tSELECT id, post_title\n\t\t\tFROM {$wpdb->posts} WHERE post_type = 'epl_event' and post_status = 'publish'\n\t\t\tORDER BY post_title ASC\n\t\t", OBJECT_K);
     $_events = epl_object_to_array($_events);
     foreach ($_events as $k => $v) {
         setup_event_details($k);
         //if(!epl_event_fully_expired()){
         $events[$k] = $v['post_title'] . epl_wrap($v['id'], ' (', ') ') . ' - ' . epl_formatted_date(current((array) $event_details['_epl_start_date']), 'D, M d ');
         //}
     }
     return $events;
 }
function epl_pay_profile_manager_fields($epl_fields)
{
    $epl_fields['_pp_pro_fields'] = array('_epl_pay_help' => array('input_type' => 'section', 'label' => epl__('PayPal PRO'), 'content' => sprintf(epl__('Accept Credit and Debit Cards without having the customer leave your website. Currently available for US and Canada.
                <br />%sMUST USE SSL FOR PCI COMPLIANCE.  You can enable SSL from Events Planner > Settings > Registration tab.%s'), '<br /><span class="epl_font_red"><strong>', '</strong></span>')), '_epl_pay_type' => array('input_type' => 'hidden', 'input_name' => '_epl_pay_type', 'default_value' => '_pp_pro'), '_epl_pay_display' => array('input_type' => 'textarea', 'input_name' => '_epl_pay_display', 'label' => epl__('Label'), 'help_text' => epl__('What the customer will see as an option.  You can use text or embed and image.'), 'class' => 'epl_w300', 'required' => true), '_epl_user' => array('input_type' => 'text', 'input_name' => '_epl_user', 'id' => '', 'label' => epl__('API Username'), 'help_text' => epl__('Ex: some_api1.youremailaddress.com'), 'class' => 'epl_w300', 'required' => true), '_epl_pwd' => array('input_type' => 'password', 'input_name' => '_epl_pwd', 'id' => '', 'label' => epl__('API Password'), 'help_text' => epl__('Ex: SDFE23D5SFD324'), 'class' => '_epl_w300', 'required' => true), '_epl_sig' => array('input_type' => 'password', 'input_name' => '_epl_sig', 'id' => '', 'label' => epl__('Signature'), 'help_text' => epl__('Will be a very long string. Ex. SRl31AbcSd9fIqew......'), 'class' => 'epl_w300', 'required' => true), '_epl_accepted_cards' => array('input_type' => 'checkbox', 'input_name' => '_epl_accepted_cards[]', 'label' => epl__('Accepted Cards'), 'auto_key' => true, 'options' => array('Visa' => 'Visa', 'MasterCard' => 'Master Card', 'Discover' => 'Discover', 'Amex' => 'Amex'), 'help_text' => epl__('For Canada, only MasterCard and Visa are allowable and Interac debit cards are not supported.'), 'default_checked' => 1, 'required' => true), '_epl_sandbox' => array('input_type' => 'select', 'input_name' => '_epl_sandbox', 'label' => epl__('Test Mode?'), 'options' => epl_yes_no(), 'help_text' => epl__('If yes, please make sure you use Sandbox credentials above.'), 'class' => ''), '_epl_default_selected' => array('input_type' => 'select', 'input_name' => '_epl_default_selected', 'label' => epl__('Automatically assign to all new events?'), 'options' => epl_yes_no(), 'help_text' => epl__('If this option is set to yes, all future events will have this payment profile automatically selected as a payment choice.'), 'class' => ''));
    $epl_fields['_pp_pro_fields'] = apply_filters('epl_pp_pro_fields', $epl_fields['_pp_pro_fields']);
    $epl_fields['_pp_payflow_fields'] = array('_epl_pay_help' => array('input_type' => 'section', 'label' => epl__('PayPal PayFlow PRO'), 'content' => sprintf(epl__('Accept Credit and Debit Cards without having the customer leave your website.
                <br />%sMUST USE SSL FOR PCI COMPLIANCE.  You can enable SSL from Events Planner > Settings > Registration tab.%s'), '<br /><span class="epl_font_red"><strong>', '</strong></span>')), '_epl_pay_type' => array('input_type' => 'hidden', 'input_name' => '_epl_pay_type', 'default_value' => '_pp_payflow'), '_epl_pay_display' => array('input_type' => 'textarea', 'input_name' => '_epl_pay_display', 'label' => epl__('Label'), 'help_text' => epl__('What the customer will see as an option.  You can use text or embed and image.'), 'class' => 'epl_w300', 'required' => true), '_epl_partner' => array('input_type' => 'text', 'input_name' => '_epl_partner', 'id' => '', 'label' => epl__('Partner'), 'class' => 'epl_w300', 'required' => true), '_epl_vendor' => array('input_type' => 'text', 'input_name' => '_epl_vendor', 'id' => '', 'label' => epl__('Vendor'), 'class' => 'epl_w300', 'required' => true), '_epl_user' => array('input_type' => 'text', 'input_name' => '_epl_user', 'id' => '', 'label' => epl__('User'), 'class' => 'epl_w300', 'required' => true), '_epl_pwd' => array('input_type' => 'password', 'input_name' => '_epl_pwd', 'id' => '', 'label' => epl__('Password'), 'class' => '_epl_w300', 'required' => true), '_epl_accepted_cards' => array('input_type' => 'checkbox', 'input_name' => '_epl_accepted_cards[]', 'label' => epl__('Accepted Cards'), 'auto_key' => true, 'options' => array('Visa' => 'Visa', 'MasterCard' => 'Master Card', 'Discover' => 'Discover', 'Amex' => 'Amex'), 'help_text' => epl__('For Canada, only MasterCard and Visa are allowable and Interac debit cards are not supported.'), 'default_checked' => 1, 'required' => true), '_epl_sandbox' => array('input_type' => 'select', 'input_name' => '_epl_sandbox', 'label' => epl__('Test Mode?'), 'options' => epl_yes_no(), 'help_text' => epl__('If yes, please make sure you use Sandbox credentials above.'), 'class' => ''), '_epl_default_selected' => array('input_type' => 'select', 'input_name' => '_epl_default_selected', 'label' => epl__('Automatically assign to all new events?'), 'options' => epl_yes_no(), 'help_text' => epl__('If this option is set to yes, all future events will have this payment profile automatically selected as a payment choice.'), 'class' => ''));
    $epl_fields['_pp_payflow_fields'] = apply_filters('epl_pp_payflow_fields', $epl_fields['_pp_payflow_fields']);
    $epl_fields['_auth_net_aim_fields'] = array('_epl_pay_help' => array('input_type' => 'section', 'label' => epl__('Authorize.net AIM'), 'content' => sprintf(epl__('Accept Credit and Debit Cards without having the customer leave your website. %sMUST USE SSL FOR PCI COMPLIANCE.
                You can enable SSL from Events Planner > Settings > Registration tab.%s'), '<br /><span class="epl_font_red"><strong>', '</strong></span>')), '_epl_pay_type' => array('input_type' => 'hidden', 'input_name' => '_epl_pay_type', 'default_value' => '_auth_net_aim'), '_epl_pay_display' => array('input_type' => 'textarea', 'input_name' => '_epl_pay_display', 'id' => '', 'label' => epl__('Label'), 'help_text' => epl__('What the customer will see as an option.  Ex. Credit Card.'), 'class' => 'epl_w300', 'required' => true), '_epl_user' => array('input_type' => 'password', 'input_name' => '_epl_user', 'id' => '', 'label' => epl__('API Login ID'), 'help_text' => epl__('This number can be obtained by logging into Authorize.net > Account > API Login ID and Transaction Key'), 'class' => 'epl_w300', 'required' => true), '_epl_pwd' => array('input_type' => 'password', 'input_name' => '_epl_pwd', 'id' => '', 'label' => epl__('API Transactioin Key'), 'class' => 'epl_w300', 'required' => true), '_epl_accepted_cards' => array('input_type' => 'checkbox', 'input_name' => '_epl_accepted_cards[]', 'label' => epl__('Accepted Cards'), 'auto_key' => true, 'options' => array('Visa' => 'Visa', 'MasterCard' => 'Master Card', 'Discover' => 'Discover', 'Amex' => 'Amex'), 'class' => ''), '_epl_sandbox' => array('input_type' => 'select', 'input_name' => '_epl_sandbox', 'label' => epl__('Test Mode?'), 'options' => epl_yes_no(), 'help_text' => epl__('If yes, please make sure you use Sandbox credentials above.'), 'class' => ''), '_epl_default_selected' => array('input_type' => 'select', 'input_name' => '_epl_default_selected', 'label' => epl__('Automatically assign to all new events?'), 'options' => epl_yes_no(), 'help_text' => epl__('If this option is set to yes, all future events will have this payment profile automatically selected as a payment choice.'), 'class' => ''));
    $epl_fields['_auth_net_aim_fields'] = apply_filters('epl_auth_net_aim_fields', $epl_fields['_auth_net_aim_fields']);
    $epl_fields['_auth_net_sim_fields'] = array('_epl_pay_help' => array('input_type' => 'section', 'label' => epl__('Authorize.net SIM'), 'content' => epl__('Accept credit cards on Authorize.net hosted page.')), '_epl_pay_type' => array('input_type' => 'hidden', 'input_name' => '_epl_pay_type', 'default_value' => '_auth_net_sim'), '_epl_pay_display' => array('input_type' => 'textarea', 'input_name' => '_epl_pay_display', 'id' => '', 'label' => epl__('Label'), 'help_text' => epl__('What the customer will see as an option.  Ex. Credit Card.'), 'class' => 'epl_w300', 'required' => true), '_epl_user' => array('input_type' => 'password', 'input_name' => '_epl_user', 'id' => '', 'label' => epl__('API Login ID'), 'help_text' => epl__('This number can be obtained by logging into Authorize.net > Account > API Login ID and Transaction Key'), 'class' => 'epl_w300', 'required' => true), '_epl_pwd' => array('input_type' => 'password', 'input_name' => '_epl_pwd', 'id' => '', 'label' => epl__('API Transactioin Key'), 'class' => 'epl_w300', 'required' => true), '_epl_md5_hash' => array('input_type' => 'password', 'input_name' => '_epl_md5_hash', 'id' => '', 'label' => 'MD5 Hash', 'class' => 'epl_w300', 'required' => true, 'help_text' => 'If you entered an MD5 Hash in your authorize.net account admin settings, enter it here also.'), '_epl_sandbox' => array('input_type' => 'select', 'input_name' => '_epl_sandbox', 'label' => epl__('Test Mode?'), 'options' => epl_yes_no(), 'help_text' => epl__('If yes, please make sure you use Sandbox credentials above.'), 'class' => ''), '_epl_default_selected' => array('input_type' => 'select', 'input_name' => '_epl_default_selected', 'label' => epl__('Automatically assign to all new events?'), 'options' => epl_yes_no(), 'help_text' => epl__('If this option is set to yes, all future events will have this payment profile automatically selected as a payment choice.'), 'class' => ''));
    $epl_fields['_auth_net_sim_fields'] = apply_filters('epl_auth_net_sim_fields', $epl_fields['_auth_net_sim_fields']);
    $epl_fields['_qbmc_fields'] = array('_epl_pay_help' => array('input_type' => 'section', 'label' => epl__('QuickBooks Merc. Serv.'), 'content' => sprintf(epl__('Accept Credit and Debit Cards using QuickBooks Merchant Services. %sMUST USE SSL FOR PCI COMPLIANCE.
                You can enable SSL from Events Planner > Settings > Registration tab.%s'), '<br /><span class="epl_font_red"><strong>', '</strong></span>')), '_epl_pay_type' => array('input_type' => 'hidden', 'input_name' => '_epl_pay_type', 'default_value' => '_qbmc'), '_epl_pay_display' => array('input_type' => 'textarea', 'input_name' => '_epl_pay_display', 'id' => '', 'label' => epl__('Label'), 'help_text' => epl__('What the customer will see as an option.  Ex. Credit Card.'), 'class' => 'epl_w300', 'required' => true), '_epl_user' => array('input_type' => 'password', 'input_name' => '_epl_user', 'id' => '', 'label' => epl__('Application Login'), 'help_text' => '', 'class' => 'epl_w300', 'required' => true), '_epl_pwd' => array('input_type' => 'password', 'input_name' => '_epl_pwd', 'id' => '', 'label' => epl__('Connection Ticket'), 'class' => 'epl_w300', 'required' => true), '_epl_accepted_cards' => array('input_type' => 'checkbox', 'input_name' => '_epl_accepted_cards[]', 'label' => epl__('Accepted Cards'), 'options' => array('Visa' => 'Visa', 'MasterCard' => 'Master Card', 'Discover' => 'Discover', 'Amex' => 'Amex'), 'class' => ''), '_epl_sandbox' => array('input_type' => 'select', 'input_name' => '_epl_sandbox', 'label' => epl__('Test Mode?'), 'options' => epl_yes_no(), 'help_text' => epl__('If yes, please make sure you use Sandbox credentials above.'), 'class' => ''), '_epl_default_selected' => array('input_type' => 'select', 'input_name' => '_epl_default_selected', 'label' => epl__('Automatically assign to all new events?'), 'options' => epl_yes_no(), 'help_text' => epl__('If this option is set to yes, all future events will have this payment profile automatically selected as a payment choice.'), 'class' => ''));
    $epl_fields['_qbmc_fields'] = apply_filters('epl_qbmc_fields', $epl_fields['_qbmc_fields']);
    $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'), 'help_text' => 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'), 'help_text' => 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'), 'help_text' => epl__('The address.'), 'class' => 'epl_w300'), '_epl_instructions' => array('input_type' => 'textarea', 'input_name' => '_epl_instructions', 'id' => '', 'label' => epl__('Instructions'), 'help_text' => epl__('Special Instruction to the customer.'), 'class' => 'epl_w300'), '_epl_default_selected' => array('input_type' => 'select', 'input_name' => '_epl_default_selected', 'label' => epl__('Automatically assign to all new events?'), 'options' => epl_yes_no(), 'help_text' => epl__('If this option is set to yes, all future events will have this payment profile automatically selected as a payment choice.'), 'class' => ''), '_epl_pay_discount_amount' => array('input_type' => 'text', 'input_name' => '_epl_pay_discount_amount', 'label' => epl__('Discount for using this payment method'), 'help_text' => epl__('Leave empty if no discount.  Enter in 3.00 or 0.1 format.  Please note that this amount is applied before any other discount.'), 'class' => 'epl_w40'), '_epl_pay_discount_type' => array('input_type' => 'select', 'input_name' => '_epl_pay_discount_type', 'label' => epl__('Discount Type'), 'options' => array(5 => epl__('Fixed'), 10 => epl__('Percent'))), '_epl_pay_discount_label' => array('input_type' => 'text', 'input_name' => '_epl_pay_discount_label', 'label' => epl__('Discount label'), 'class' => 'epl_w300'));
    $epl_fields['_check_fields'] = apply_filters('epl_check_fields', $epl_fields['_check_fields']);
    $epl_fields['_cash_fields'] = array('_epl_pay_help' => array('input_type' => 'section', 'label' => epl__('Cash'), 'content' => epl__('You can use this to give your customers the ability to pay using Cash.')), '_epl_pay_type' => array('input_type' => 'hidden', 'input_name' => '_epl_pay_type', 'default_value' => '_cash'), '_epl_pay_display' => array('input_type' => 'textarea', 'input_name' => '_epl_pay_display', 'id' => '', 'label' => epl__('Display Label'), 'help_text' => epl__('What the customer will see as an option.'), 'class' => 'epl_w300'), '_epl_instructions' => array('input_type' => 'textarea', 'input_name' => '_epl_instructions', 'id' => '', 'label' => epl__('Instructions'), 'help_text' => epl__('Special Instruction to the customer.'), 'class' => 'epl_w300'), '_epl_default_selected' => array('input_type' => 'select', 'input_name' => '_epl_default_selected', 'label' => epl__('Automatically assign to all new events?'), 'options' => epl_yes_no(), 'help_text' => epl__('If this option is set to yes, all future events will have this payment profile automatically selected as a payment choice.'), 'class' => ''), '_epl_pay_discount_amount' => array('input_type' => 'text', 'input_name' => '_epl_pay_discount_amount', 'label' => epl__('Discount for using this payment method'), 'help_text' => epl__('Leave empty if no discount.  Enter in 3.00 or 0.1 format.  Please note that this amount is applied before any other discount.'), 'class' => 'epl_w40'), '_epl_pay_discount_type' => array('input_type' => 'select', 'input_name' => '_epl_pay_discount_type', 'label' => epl__('Discount Type'), 'options' => array(5 => epl__('Fixed'), 10 => epl__('Percent'))), '_epl_pay_discount_label' => array('input_type' => 'text', 'input_name' => '_epl_pay_discount_label', 'label' => epl__('Discount label'), 'class' => 'epl_w300'));
    $epl_fields['_cash_fields'] = apply_filters('epl_cash_fields', $epl_fields['_cash_fields']);
    $epl_fields['_payson_fields'] = array('_epl_pay_help' => array('input_type' => 'section', 'label' => epl__('PAYSON'), 'content' => epl__('Safely and securely accept payments on hosted Payson servers.')), '_epl_pay_type' => array('input_type' => 'hidden', 'input_name' => '_epl_pay_type', 'default_value' => '_payson'), '_epl_pay_display' => array('input_type' => 'textarea', 'input_name' => '_epl_pay_display', 'id' => '', 'label' => epl__('Label'), 'help_text' => epl__('What the customer will see as an option.  Ex. Credit Card.'), 'class' => 'epl_w300', 'required' => true), '_epl_seller_email' => array('input_type' => 'text', 'input_name' => '_epl_seller_email', 'id' => '', 'label' => epl__('Seller Email'), 'class' => 'epl_w300', 'required' => true), '_epl_user' => array('input_type' => 'password', 'input_name' => '_epl_user', 'id' => '', 'label' => epl__('Agent ID'), 'help_text' => epl__('This number can be obtained by logging into Authorize.net > Account > API Login ID and Transaction Key'), 'class' => 'epl_w300', 'required' => true), '_epl_pwd' => array('input_type' => 'password', 'input_name' => '_epl_pwd', 'id' => '', 'label' => epl__('MD5'), 'class' => 'epl_w300', 'required' => true), '_epl_selected_by_default' => array('input_type' => 'radio', 'input_name' => '_epl_selected_by_default', 'id' => '', 'label' => epl__('Assign by default to new events?'), 'options' => epl_yes_no(), 'display_inline' => true, 'default_value' => 0, 'help_text' => epl__('When you create new events, this paymetn profile will be automatically assigned to that event.'), 'required' => true), '_epl_default_selected' => array('input_type' => 'select', 'input_name' => '_epl_default_selected', 'label' => epl__('Automatically assign to all new events?'), 'options' => epl_yes_no(), 'help_text' => epl__('If this option is set to yes, all future events will have this payment profile automatically selected as a payment choice.'), 'class' => ''));
    $epl_fields['_payson_fields'] = apply_filters('epl_payson_fields', $epl_fields['_payson_fields']);
    $epl_fields['_moneris_fields'] = array('_epl_pay_help' => array('input_type' => 'section', 'label' => epl__('Moneris Hosted Paypage'), 'content' => epl__('Accept payments using Moneris Hosted Paypage.')), '_epl_pay_type' => array('input_type' => 'hidden', 'input_name' => '_epl_pay_type', 'default_value' => '_moneris'), '_epl_pay_display' => array('input_type' => 'textarea', 'input_name' => '_epl_pay_display', 'id' => '', 'label' => epl__('Label'), 'help_text' => epl__('What the customer will see as an option.  Ex. Credit Card.'), 'class' => 'epl_w300', 'required' => true), '_epl_moneris_country' => array('input_type' => 'select', 'input_name' => '_epl_moneris_country', 'label' => epl__('Version'), 'options' => array('ca' => epl__('Canada'), 'usa' => epl__('USA')), 'class' => ''), '_epl_user' => array('input_type' => 'password', 'input_name' => '_epl_user', 'id' => '', 'label' => epl__('Store ID') . ', ' . epl__('HHP_id for USA'), 'help_text' => '', 'class' => 'epl_w300', 'required' => true), '_epl_pwd' => array('input_type' => 'password', 'input_name' => '_epl_pwd', 'id' => '', 'label' => epl__('HPP Key'), 'class' => 'epl_w300', 'required' => true), '_epl_sandbox' => array('input_type' => 'select', 'input_name' => '_epl_sandbox', 'label' => epl__('Test Mode?'), 'options' => epl_yes_no(), 'help_text' => epl__('If yes, please make sure you use Sandbox credentials above.'), 'class' => ''), '_epl_pay_urls' => array('input_type' => 'section', 'label' => epl__('Your paypage urls'), 'content' => epl__('Approved URL:') . ' ' . add_query_arg(array('epl_action' => '_moneris_process'), epl_get_sortcode_url()) . '<br />' . epl__('Decline URL:') . ' ' . add_query_arg(array('epl_action' => '_moneris_process'), epl_get_sortcode_url())), '_epl_default_selected' => array('input_type' => 'select', 'input_name' => '_epl_default_selected', 'label' => epl__('Automatically assign to all new events?'), 'options' => epl_yes_no(), 'help_text' => epl__('If this option is set to yes, all future events will have this payment profile automatically selected as a payment choice.'), 'class' => ''));
    $epl_fields['_moneris_fields'] = apply_filters('epl_moneris_fields', $epl_fields['_moneris_fields']);
    $epl_fields['_firstdata_fields'] = array('_epl_pay_help' => array('input_type' => 'section', 'label' => epl__('Firstdata'), 'content' => sprintf(epl__('Accept Credit and Debit Cards without having the customer leave your website. %sMUST USE SSL FOR PCI COMPLIANCE.
                You can enable SSL from Events Planner > Settings > Registration tab.%s'), '<br /><span class="epl_font_red"><strong>', '</strong></span>')), '_epl_pay_pem_location' => array('input_type' => 'section', 'content' => epl_wrap('<span class="epl_font_red">', '<span>', sprintf(epl__('Please place your .pem file in %s'), epl_upload_dir_path(true) . 'firstdata/'))), '_epl_pay_type' => array('input_type' => 'hidden', 'input_name' => '_epl_pay_type', 'default_value' => '_firstdata'), '_epl_pay_display' => array('input_type' => 'textarea', 'input_name' => '_epl_pay_display', 'id' => '', 'label' => epl__('Label'), 'help_text' => epl__('What the customer will see as an option.  Ex. Credit Card.'), 'class' => 'epl_w300', 'required' => true), '_epl_user' => array('input_type' => 'password', 'input_name' => '_epl_user', 'id' => '', 'label' => epl__('Store Number'), 'class' => 'epl_w300', 'required' => true), '_epl_accepted_cards' => array('input_type' => 'checkbox', 'input_name' => '_epl_accepted_cards[]', 'label' => epl__('Accepted Cards'), 'auto_key' => true, 'required' => true, 'options' => array('Visa' => 'Visa', 'MasterCard' => 'Master Card', 'Discover' => 'Discover', 'Amex' => 'Amex'), 'class' => ''), '_epl_sandbox' => array('input_type' => 'select', 'input_name' => '_epl_sandbox', 'label' => epl__('Test Mode?'), 'options' => epl_yes_no(), 'help_text' => epl__('If yes, please make sure you use Sandbox credentials above.'), 'class' => ''), '_epl_default_selected' => array('input_type' => 'select', 'input_name' => '_epl_default_selected', 'label' => epl__('Automatically assign to all new events?'), 'options' => epl_yes_no(), 'help_text' => epl__('If this option is set to yes, all future events will have this payment profile automatically selected as a payment choice.'), 'help_text' => epl__('If this option is set to yes, all future events will have this payment profile automatically selected as a payment choice.'), 'class' => ''));
    $epl_fields['_firstdata_fields'] = apply_filters('epl_firstdata_fields', $epl_fields['_firstdata_fields']);
    $epl_fields['_usa_epay_fields'] = array('_epl_pay_help' => array('input_type' => 'section', 'label' => epl__('USA ePay'), 'content' => sprintf(epl__('Accept Credit and Debit Cards without having the customer leave your website. %sMUST USE SSL FOR PCI COMPLIANCE.
                You can enable SSL from Events Planner > Settings > Registration tab.%s'), '<br /><span class="epl_font_red"><strong>', '</strong></span>')), '_epl_pay_type' => array('input_type' => 'hidden', 'input_name' => '_epl_pay_type', 'default_value' => '_usa_epay'), '_epl_pay_display' => array('input_type' => 'textarea', 'input_name' => '_epl_pay_display', 'id' => '', 'label' => epl__('Label'), 'help_text' => epl__('What the customer will see as an option.  Ex. Credit Card.'), 'class' => 'epl_w300', 'required' => true), '_epl_pwd' => array('input_type' => 'password', 'input_name' => '_epl_pwd', 'id' => '', 'label' => epl__('Merchant Key'), 'class' => 'epl_w300', 'required' => true), '_epl_sandbox' => array('input_type' => 'select', 'input_name' => '_epl_sandbox', 'label' => epl__('Test Mode?'), 'options' => epl_yes_no(), 'help_text' => epl__('If yes, please make sure you use Sandbox credentials above.'), 'class' => ''), '_epl_default_selected' => array('input_type' => 'select', 'input_name' => '_epl_default_selected', 'label' => epl__('Automatically assign to all new events?'), 'options' => epl_yes_no(), 'help_text' => epl__('If this option is set to yes, all future events will have this payment profile automatically selected as a payment choice.'), 'class' => ''));
    $epl_fields['_usa_epay_fields'] = apply_filters('epl_usa_epay_fields', $epl_fields['_usa_epay_fields']);
    $epl_fields['_stripe_fields'] = array('_epl_pay_help' => array('input_type' => 'section', 'label' => epl__('Stripe'), 'content' => sprintf(epl__('Accept Credit and Debit Cards without having the customer leave your website. %sMUST USE SSL FOR PCI COMPLIANCE.
                You can enable SSL from Events Planner > Settings > Registration tab.%s'), '<br /><span class="epl_font_red"><strong>', '</strong></span>')), '_epl_pay_type' => array('input_type' => 'hidden', 'input_name' => '_epl_pay_type', 'default_value' => '_stripe'), '_epl_pay_display' => array('input_type' => 'textarea', 'input_name' => '_epl_pay_display', 'id' => '', 'label' => epl__('Label'), 'help_text' => epl__('What the customer will see as an option.  Ex. Credit Card.'), 'class' => 'epl_w300', 'required' => true), '_epl_secret_key' => array('input_type' => 'password', 'input_name' => '_epl_secret_key', 'id' => '', 'label' => epl__('Secret Key'), 'class' => 'epl_w300', 'required' => true), '_epl_publishable_key' => array('input_type' => 'password', 'input_name' => '_epl_publishable_key', 'id' => '', 'label' => epl__('Publishable Key'), 'class' => 'epl_w300', 'required' => true), '_epl_sandbox' => array('input_type' => 'select', 'input_name' => '_epl_sandbox', 'label' => epl__('Test Mode?'), 'options' => epl_yes_no(), 'help_text' => epl__('If yes, please make sure you use Sandbox credentials above.'), 'class' => ''), '_epl_default_selected' => array('input_type' => 'select', 'input_name' => '_epl_default_selected', 'label' => epl__('Automatically assign to all new events?'), 'options' => epl_yes_no(), 'help_text' => epl__('If this option is set to yes, all future events will have this payment profile automatically selected as a payment choice.'), 'class' => ''));
    $epl_fields['_usa_epay_fields'] = apply_filters('epl_usa_epay_fields', $epl_fields['_usa_epay_fields']);
    return $epl_fields;
}
 /**
  * Create a form field
  *
  * @param array $args (input_type,name, value, id, options, opt_key,opt_value, multiple, label, description, class, wrapper, size,readonly, multiple, size, $style)
  *
  * @return form field
  */
 function create_element($args = array(), $response_view = 0)
 {
     if (empty($args)) {
         return null;
     }
     $response_veiws = array('', 'common/form-table-row', 'common/form-table-cell');
     //views used for returning the fields
     $defaults = array('input_type' => '', 'input_name' => '', 'input_slug' => '', 'return' => 1, 'name' => '', 'key' => '', 'second_key' => '', 'auto_key' => false, 'value' => null, 'placeholder' => '', 'default_value' => null, 'default_checked' => false, 'force_uncheck' => false, 'id' => '', 'options' => '', 'empty_options_msg' => '', 'empty_row' => false, 'opt_key' => '', 'opt_value' => '', 'label' => '', 'description' => '', 'help_text' => '', 'help_icon_type' => '', 'class' => '', 'rel' => '', 'wrapper' => '', 'size' => '', 'readonly' => false, 'required' => 0, 'validation' => '', 'multiple' => false, 'style' => '', 'content' => '', 'display_inline' => false, 'overview' => 0, 'tmp_key' => '', 'data_type' => '', '__func' => '', 'weight' => 0, 'show_value_only' => false, 'data_id' => null, 'data_attr' => array());
     $args = wp_parse_args($args, $defaults);
     if (EPL_IS_ADMIN && epl_get_element_m('active', $args['input_slug'], $this->override_fields, 10) != 10) {
         return null;
     }
     $args['label'] = epl_get_element_m('label', $args['input_slug'], $this->override_fields, $args['label']);
     $args['help_text'] = epl_get_element_m('help_text', $args['input_slug'], $this->override_fields, $args['help_text']);
     extract($args);
     if ($return == 0) {
         return null;
     }
     $value = stripslashes_deep($value == '' && !is_null($default_value) ? $default_value : $value);
     //all the values come in as strings.  For cbox, radio and selects,
     //the options loop key is numeric.  I am doing a cast comparison so
     //string 0 != int 0, lots of issues.
     //NEW issue:  phone number is converted to int if it comes in 5557778888
     $value = is_numeric($value) && $value < 1000 && ($data_type == 'int' || $data_type != 'float') ? (int) $value : $value;
     $data = array('label' => '', 'description' => '', 'response_view' => $response_view, 'input_type' => $input_type, 'overview' => '', 'weight' => $weight);
     $name = $input_name != '' ? $input_name : $name;
     //Doing this for the very first key of the a new record.
     //Since we want to keep track of keys for registration purposes,
     //leaving [] will make the key assignment automatic, creating problems when deleting or adding.moving records.
     $name = ($input_type == 'text' || $input_type == 'hidden' || $input_type == 'select' || $input_type == 'textarea') && $key === '' ? str_replace("[]", "[{$tmp_key}]", $name) : $name;
     //if a text field has already been saved with a key, assign the key to the name
     if ($key !== '' && ($input_type == 'text' || $input_type == 'hidden' || $input_type == 'select' || $input_type == 'textarea')) {
         $name = str_replace("[", "[" . $key, $name);
         $value = html_entity_decode(epl_get_element($key, $value));
     }
     // TODO -  why stripslashes here and above?
     if (!is_numeric($value)) {
         $value = stripslashes_deep($value);
     }
     //echo "<pre class='prettyprint'>" . __LINE__ . '> ' . print_r($value, true). "</pre>";
     if ($readonly != false && !$overview) {
         $readonly = 'readonly="readonly"';
         if ($input_type == 'checkbox') {
             //$readonly .= ' disabled="disabled"';
             $style .= "visibility:hidden;";
         }
         if ($input_type == 'radio') {
             $readonly = ' disabled="disabled"';
             $style .= "visibility:hidden;";
         }
     }
     if ($size != '') {
         $size = "size='{$size}'";
     }
     if ($multiple != false) {
         $multiple = 'multiple="multiple"';
         $size = $size != '' ? "size='{$size}'" : "size='5'";
         //default size needed for wordpress
         $style .= " height:auto !important;";
         //override wp height
     }
     if ($required != 0) {
         $required = '<em>*</em>';
         $class .= ' required';
     } else {
         $required = '';
     }
     if ($validation != '') {
         $class .= ' ' . $validation;
     }
     if ($input_type == 'datepicker') {
         $class .= ' datepicker';
     }
     $data_attr = $this->make_data_attr($data_attr);
     //if ( $help_text != '' && $label != $help_text )
     //  $help_text = "class='help_tooltip_trigger' original-title='" . $help_text . "'";
     if ($label != '' || $response_view == 2) {
         $data['label_text'] = stripslashes_deep($label);
         $data['label'] = "<label for='{$id}'>" . $data['label_text'] . "{$required}</label>";
     }
     if ($description != '' || $response_view == 2) {
         $data['description'] = "<span class='description'>{$description}</span>";
     }
     if ($help_text != '') {
         $data['label'] .= "<img src='" . EPL_FULL_URL . "images/information-balloon{$help_icon_type}.png' class='help_tooltip_trigger' original-title='" . $help_text . "'>";
     }
     $class = trim($class);
     $data_id = epl_wrap($data_id, " data-id='", "'");
     $data['field'] = '';
     switch ($input_type) {
         case 'section':
             $data['response_view'] = 8;
             $data['field'] = "<div id=\"{$id}\"  class=\"{$class}\" style=\"font-size:16px;\">{$content}</div> \n";
             break;
         case 'datepicker':
             $input_type = 'text';
             EPL_Init::get_instance()->load_datepicker_files();
         case 'text':
             $data['overview'] = $value;
             $value = esc_attr($value);
         case 'hidden':
         case 'password':
         case 'submit':
             if ($__func != '') {
                 if (function_exists($__func)) {
                     $value = $__func($value);
                 }
             }
             $data['field'] = "<input type=\"{$input_type}\" id=\"{$id}\" name=\"{$name}\" class=\"{$class}\" rel=\"{$rel}\" placeholder=\"{$placeholder}\" style=\"{$style}\" {$size} value=\"{$value}\" {$readonly} {$data_id} {$data_attr} /> \n";
             $data['value'] = $value;
             break;
         case 'textarea':
             if ($__func != '') {
                 if (function_exists($__func)) {
                     $value = $__func($value);
                 }
             }
             $data['overview'] = $value;
             $value = esc_attr($value);
             $data['field'] = "<textarea cols = '60' rows='3' id='{$id}' name='{$name}'  class='{$class}'  style='{$style}' {$data_attr}>{$value}</textarea> \n";
             $data['value'] = $value;
             break;
             /* separated out cb and radio, easier to manage */
         /* separated out cb and radio, easier to manage */
         case 'table_checkbox':
             $data['response_view'] = 'table_checkbox';
         case 'checkbox':
             if ($default_checked == 1) {
                 $checked = ' checked = "checked"';
             }
             $display_inline = $display_inline ? '' : '<br />';
             $data['table_checkbox'] = array();
             if (is_array($options) && !empty($options)) {
                 foreach ($options as $k => $v) {
                     $v = stripslashes(html_entity_decode($v));
                     if (isset($this->override_fields[$args['input_slug']])) {
                         $v = epl_get_element_m($k, 'options', $this->override_fields[$args['input_slug']], $v);
                     }
                     $checked = '';
                     if ($default_checked == 1 && ($value === '' || is_null($value))) {
                         $checked = 'checked = "checked"';
                     } elseif ($k === $value || is_array($value) && in_array(strval($k), $value, true) || epl_is_multi_array($value) && in_array(strval($k), epl_get_element($key, $value, array()), true)) {
                         $checked = 'checked = "checked"';
                     }
                     if ($force_uncheck) {
                         $checked = '';
                     }
                     if ($checked != '') {
                         $data['overview'] .= " {$v}  \n" . $display_inline;
                     }
                     $_name = $name;
                     if (!$auto_key && strpos($name, '[') !== false) {
                         $_name = str_replace("[", "[" . ($key != '' ? $key : $tmp_key), $name);
                     }
                     if ($second_key != '') {
                         $second_key = "[{$k}]";
                     }
                     $data['field'] .= "<input type=\"checkbox\" id=\"{$id}\" name=\"{$_name}{$second_key}\"  class=\"{$class}\"  style='{$style}' value=\"{$k}\" {$checked} {$readonly} {$data_id} {$data_attr} /> {$v} \n" . $display_inline;
                     $data['table_checkbox'][$k]['f'] = "<input type=\"checkbox\" id=\"{$id}\" name=\"{$_name}{$second_key}\"  class=\"{$class}\"  style='{$style}' value=\"{$k}\" {$checked} {$readonly} {$data_id} {$data_attr}/> \n";
                     $data['table_checkbox'][$k]['l'] = "{$v} \n";
                 }
             } else {
                 $checked = isset($k) && $value == '' && in_array($k, (array) $value, true) ? 'checked = "checked"' : '';
                 $data['field'] .= "<input type=\"checkbox\" id=\"{$name}\" name=\"{$name}\"  class=\"{$class}\"  style='{$style}' value=\"1\" {$checked} {$data_id} {$data_attr} /> \n" . $display_inline;
                 $data['overview'] .= " {$value}  \n" . $display_inline;
             }
             break;
         case 'radio':
             $display_inline = $display_inline ? '' : '<br />';
             if (is_array($options) && !empty($options)) {
                 foreach ($options as $k => $v) {
                     $v = stripslashes(html_entity_decode($v));
                     if (isset($this->override_fields[$args['input_slug']])) {
                         $v = epl_get_element_m($k, 'options', $this->override_fields[$args['input_slug']], $v);
                     }
                     $checked = '';
                     if ($default_checked == 1 && ($value === '' || is_null($value))) {
                         $checked = 'checked = "checked"';
                     } elseif (is_array($value) && in_array((string) $k, $value, true) || !is_array($value) && (string) $value === (string) $k) {
                         $checked = 'checked = "checked"';
                     }
                     if ($checked != '') {
                         $data['overview'] = " {$v}  \n" . $display_inline;
                     }
                     $data['field'] .= "<input type=\"{$input_type}\" id=\"{$id}\" name=\"{$name}\"  class=\"{$class}\"  style='{$style}' value=\"{$k}\" {$checked} {$readonly} {$data_id} {$data_attr} /> {$v}  \n" . $display_inline;
                 }
             } else {
                 $checked = in_array($k, (array) $value, true) ? 'checked = "checked"' : '';
                 $data['field'] .= "<input type=\"{$input_type}\" id=\"{$name}\" name=\"{$name}\"  class=\"{$class}\"  style='{$style}' value=\"1\" {$checked} {$data_id} {$data_attr} /> \n" . $display_inline;
                 $data['overview'] .= " {$v}  \n" . $display_inline;
             }
             break;
         case 'radio-switch':
             //will investigate using this in dynamic table fields.
             //$tmp_key = $this->make_unique_id(7);
             $display_inline = '';
             //$display_inline ? '' : '<br />';
             if (is_array($options) && !empty($options)) {
                 $counter = 1;
                 foreach ($options as $k => $v) {
                     $v = stripslashes(html_entity_decode($v));
                     if (isset($this->override_fields[$args['input_slug']])) {
                         $v = epl_get_element_m($k, 'options', $this->override_fields[$args['input_slug']], $v);
                     }
                     $checked = '';
                     if ($default_checked == 1 && ($value === '' || is_null($value))) {
                         $checked = 'checked = "checked"';
                     } elseif ((string) $k === (string) $value || is_array($value) && in_array((string) $k, $value, true)) {
                         $checked = 'checked = "checked"';
                     }
                     if ($checked != '') {
                         $data['overview'] = " {$v}  \n" . $display_inline;
                     }
                     $id = $k . str_replace(array('[', ']'), '', $name) . $tmp_key;
                     //using tmp key for dynamic rows.
                     $data['field'] .= "<input type=\"radio\" id=\"{$id}\" name=\"{$name}\" value=\"{$k}\" {$checked} {$readonly} {$data_id} {$data_attr} /><label for=\"{$id}\" onclick=\"\">{$v}</label>";
                 }
             }
             $data['field'] = '<div class="switch-toggle candy yellow">' . $data['field'] . '<a></a></div>';
             break;
         case 'select':
             if (!epl_is_empty_array($options)) {
                 $select = "<select name = '{$name}' id = '{$id}' class='{$class}' style='{$style}' {$multiple} {$size} {$readonly} {$data_id} {$data_attr}>";
                 if ($empty_row) {
                     $select .= "<option></option>  \n";
                 }
                 foreach ((array) $options as $k => $v) {
                     $v = stripslashes(html_entity_decode($v));
                     if (isset($this->override_fields[$args['input_slug']])) {
                         $v = epl_get_element_m($k, 'options', $this->override_fields[$args['input_slug']], $v);
                     }
                     $selected = is_array($value) && in_array((string) $k, $value) || !is_array($value) && (string) $value === (string) $k ? "selected = 'selected'" : '';
                     if ($show_value_only && $selected == '') {
                         continue;
                     }
                     $select .= "<option value='{$k}' {$selected}>{$v}</option>";
                     if ($selected != '') {
                         $data['overview'] = " {$v}  \n";
                     }
                 }
                 $data['field'] = $select . "</select>";
             } else {
                 $data['field'] = $empty_options_msg;
             }
             $data['value'] = $v;
             break;
     }
     if ($overview) {
         //echo "<br />OVERVIEW2 " . $data['overview'] . "<br >";
         $data['field'] = "<div class='overview_value' style='{$style}'>" . $data['overview'] . '</div>';
         unset($data['overview']);
     }
     if ($data['response_view'] === 0 || $data['response_view'] == 'raw') {
         return $data;
     }
     $r = $this->epl->load_view('common/form-field-view', $data, true);
     return $r;
 }