function __construct()
 {
     global $wpdb;
     parent::__construct();
     $this->db = $wpdb;
     $this->ecm = EPL_base::get_instance()->load_model('epl-common-model');
 }
 function load_components()
 {
     $this->epl = EPL_base::get_instance();
     $this->ecm = $this->epl->load_model('epl-common-model');
     $this->rm = $this->epl->load_model('epl-recurrence-model');
     $this->opt = $this->ecm->get_epl_options();
 }
 function load_components()
 {
     if (!headers_sent()) {
         if (!session_id()) {
             session_start();
             if (isset($_GET['destroy_epl_sess'])) {
                 session_destroy();
             }
             if (!isset($_SESSION['__epl'])) {
                 @session_regenerate_id(true);
                 $_SESSION['__epl'] = array();
             }
         }
     }
     $this->epl = EPL_base::get_instance();
     $this->ecm = $this->epl->load_model('epl-common-model');
     $this->erm = $this->epl->load_model('epl-registration-model');
     $this->rm = $this->epl->load_model('epl-recurrence-model');
     $this->erptm = $this->epl->load_model('epl-report-model');
     $this->opt = $this->ecm->get_epl_options();
     $this->override_fields = stripslashes_deep(get_option('_epl_override'));
 }
function epl_mailchimp_subscribe()
{
    if (!epl_is_addon_active('ASDFAWEEFADSF')) {
        return;
    }
    global $event_details, $customer_email, $customer_name;
    $default_action = epl_get_setting('epl_api_option_fields', 'epl_mc_action');
    $sign_up = epl_get_element('_epl_offer_notification_sign_up', $event_details, '');
    if ($sign_up == '') {
        $sign_up = $default_action == 1 ? epl_get_setting('epl_api_option_fields', '_epl_mc_offer_notification_sign_up') : 0;
    }
    if ($sign_up == 0 || $default_action == 0) {
        return;
    }
    $who_to_sign_up = epl_get_setting('epl_registration_options', 'epl_send_customer_confirm_message_to', 1);
    if ($who_to_sign_up == 2 || !epl_has_primary_forms()) {
        $who_to_sign_up = 2;
    }
    $erm = EPL_registration_model::get_instance();
    $list_id = epl_get_element('_epl_notification_list', $event_details, false);
    if (!$list_id && $default_action == 1) {
        $list_id = epl_get_setting('epl_api_option_fields', '_epl_mc_default_list');
    }
    $double_optin = (bool) epl_get_setting('epl_api_option_fields', 'epl_mc_double_opt_in');
    $send_welcome = (bool) epl_get_setting('epl_api_option_fields', 'epl_mc_send_welcome_email');
    $key = trim(epl_get_setting('epl_api_option_fields', 'epl_mc_key'));
    $api = EPL_base::get_instance()->load_library('mailchimpSF_MCAPI', true, $key);
    $go = false;
    $newsletter_signup = epl_get_element_m('newsletter_signup', $erm->regis_id, $erm->current_data, array());
    if ($sign_up == 1 && array_sum($newsletter_signup) > 0) {
        $go = true;
    } elseif ($sign_up == 3) {
        $go = true;
    }
    if ($list_id && $go && count($customer_email) > 0) {
        $customer_email = array_unique($customer_email);
        foreach ($customer_email as $n => $email) {
            if ($sign_up < 3 && $newsletter_signup[$n] == 0) {
                continue;
            }
            $email = $email;
            $merge_vars = array('FNAME' => epl_get_element_m('first_name', $n, $customer_name), 'LNAME' => epl_get_element_m('last_name', $n, $customer_name));
            $r = $api->listSubscribe($list_id, $email, $merge_vars, $email_type = 'html', $double_optin, false, true, $send_welcome);
        }
    }
}
 function EPL_upcoming_events_widget()
 {
     $this->epl = EPL_base::get_instance();
     $widget_ops = array('classname' => 'epl_upcoming_events_widget', 'description' => 'Use this widget to put a list of upcoming events in the sidebar.');
     $this->WP_Widget('EPL_upcoming_events_widget', 'Events Planner Upcoming Events', $widget_ops);
 }
function __epl_erm__add_registration_to_db($regis_post_ID, $event_id, $user_id = 0)
{
    if (!epl_is_addon_active('DASFERWEQREWE')) {
        return;
    }
    EPL_base::get_instance()->load_model('epl-db-model');
    $user_id = $user_id > 0 ? $user_id : EPL_db_model::get_instance()->find_user_id_for_regis($regis_post_ID);
    if ($user_id != 0) {
        update_user_meta($user_id, '_epl_regis_post_id_' . $regis_post_ID, $regis_post_ID . EPL_PLUGIN_DB_DELIM . $event_id);
    }
}
 function EPL_advanced_cal_widget()
 {
     $this->epl = EPL_base::get_instance();
     $widget_ops = array('classname' => 'epl_advanced_cal_widget_class', 'description' => 'Use this widget to put an interactive Events Planner calendar on any page.');
     $this->WP_Widget('EPL_advanced_cal_widget', 'Events Planner Advanced Calendar', $widget_ops);
 }
add_filter('epl_date_fields', 'epl_date_fields', 1);
add_filter('epl_regis_payment_fields', 'epl_regis_payment_fields', 1);
add_filter('epl_pay_profile_manager_fields', 'epl_pay_profile_manager_fields', 1);
add_filter('epl_date_option_fields', 'epl_date_option_fields', 1);
add_filter('epl_registration_options_fields', 'epl_registration_options_fields', 1);
add_filter('epl_admin_view_event_time_price_0_price_data_row', '_epl_admin_view_event_time_price_0_price_data_row', 11, 2);
add_filter('epl_event_options_fields', '_epl_event_options_fields', 11, 1);
add_filter('epl_sys_messages', 'epl_sys_messages', 1);
add_filter('epl_other_settings_fields', 'epl_other_settings_fields', 1);
add_action('init', 'epl_extra_post_types', 1);
add_action('init', 'epl_get_api_fields', 1);
if (epl_get_element('cart_action', $_GET) != 'add') {
    add_action('init', 'epl_do_messages');
}
//activates qbms, other files are required
if (EPL_base::get_instance()->load_file('libraries/gateways/qbmc/QuickBooks.php', true)) {
    add_filter('_epl_pay_type_options', '__epl_add_qbmc_options');
    add_filter('_epl_payment_method_options', '__epl_add_qbmc_options');
}
function __epl_add_qbmc_options($fields)
{
    $fields['_qbmc'] = epl__('QB Merch. Serv.');
    return $fields;
}
function epl_extra_post_types()
{
    $instructor_post_type_args = array('public' => true, 'query_var' => 'epl_instructor', 'rewrite' => array('slug' => 'instructor', 'with_front' => false), 'supports' => array('title', 'editor', 'thumbnail'), 'labels' => array('name' => epl__('Instructors'), 'singular_name' => epl__('Instructor'), 'add_new' => epl__('Add New Instructor'), 'add_new_item' => epl__('Add New Instructor'), 'edit_item' => epl__('Edit Event Instructor'), 'new_item' => epl__('New Instructor'), 'view_item' => epl__('View Instructor'), 'search_items' => epl__('Search Instructors'), 'not_found' => epl__('No Instructors Found'), 'not_found_in_trash' => epl__('No Instructors Found In Trash')), 'capabilities' => array('publish_posts' => 'manage_options', 'edit_posts' => 'manage_options', 'edit_others_posts' => 'manage_options', 'delete_posts' => 'manage_options', 'delete_others_posts' => 'manage_options', 'read_private_posts' => 'manage_options', 'edit_post' => 'manage_options', 'delete_post' => 'manage_options', 'read_post' => 'manage_options'), 'show_in_menu' => 'edit.php?post_type=epl_event');
    $instructor_post_type_args = apply_filters('epl_instructor_post_type_args', $instructor_post_type_args);
    register_post_type('epl_instructor', $instructor_post_type_args);
    $global_disc_post_type_args = array('show_ui' => true, 'publicly_queryable' => false, 'exclude_from_search' => true, 'show_in_nav_menus' => false, 'show_in_menu' => true, 'query_var' => 'epl_global_discount', 'supports' => array('title'), 'labels' => array('name' => epl__('Global Discounts'), 'singular_name' => epl__('Global Discount'), 'add_new' => epl__('Add New Global Discount'), 'add_new_item' => epl__('Add New Global Discount'), 'edit_item' => epl__('Edit Global Discount'), 'new_item' => epl__('New Global Discount'), 'view_item' => epl__('View Global Discount'), 'search_items' => epl__('Search Global Discounts'), 'not_found' => epl__('No Global Discounts Found'), 'not_found_in_trash' => epl__('No Global Discounts Found In Trash')), 'capabilities' => array('publish_posts' => 'manage_options', 'edit_posts' => 'manage_options', 'edit_others_posts' => 'manage_options', 'delete_posts' => 'manage_options', 'delete_others_posts' => 'manage_options', 'read_private_posts' => 'manage_options', 'edit_post' => 'manage_options', 'delete_post' => 'manage_options', 'read_post' => 'manage_options'), 'show_in_menu' => 'edit.php?post_type=epl_event');
    $global_disc_post_type_args = apply_filters('epl_global_discount_post_type_args', $global_disc_post_type_args);