function rearrange_code()
    {
        $rearrange_items = apply_filters('eventon_eventcard_boxes', array('ftimage' => '<p val="ftimage">' . __('Featured Image', 'eventon') . '</p>', 'eventdetails' => '<p val="eventdetails">' . __('Event Details', 'eventon') . '</p>', 'timelocation' => '<p val="timelocation">' . __('Time and Location', 'eventon') . '</p>', 'organizer' => '<p val="organizer">' . __('Event Organizer', 'eventon') . '</p>', 'locImg' => '<p val="locImg">' . __('Location Image', 'eventon') . '</p>', 'gmap' => '<p val="gmap">' . __('Google Maps', 'eventon') . '</p>', 'learnmoreICS' => '<p val="learnmoreICS">' . __('Learn More & Add to your calendar', 'eventon') . '</p>'));
        //get directions
        if (!empty($this->evcal_opt[1]['evo_getdir']) && $this->evcal_opt[1]['evo_getdir'] == 'yes') {
            $rearrange_items['getdirection'] = '<p val="getdirection">' . __('Get Directions', 'eventon') . '</p>';
        }
        //eventbrite
        if (!empty($this->evcal_opt[1]['evcal_evb_events']) && $this->evcal_opt[1]['evcal_evb_events'] == 'yes') {
            $rearrange_items['eventbrite'] = '<p val="eventbrite">' . __('eventbrite', 'eventon') . '</p>';
        }
        //paypal
        if (!empty($this->evcal_opt[1]['evcal_paypal_pay']) && $this->evcal_opt[1]['evcal_paypal_pay'] == 'yes') {
            $rearrange_items['paypal'] = '<p val="paypal">' . __('Paypal', 'eventon') . '</p>';
        }
        // custom fields
        $_cmd_num = evo_calculate_cmd_count($this->evcal_opt[1]);
        for ($x = 1; $x <= $_cmd_num; $x++) {
            if (!empty($this->evcal_opt[1]['evcal_ec_f' . $x . 'a1']) && !empty($this->evcal_opt[1]['evcal_af_' . $x]) && $this->evcal_opt[1]['evcal_af_' . $x] == 'yes') {
                $rearrange_items['customfield' . $x] = '<p val="customfield' . $x . '">' . $this->evcal_opt[1]['evcal_ec_f' . $x . 'a1'] . '</p>';
            }
        }
        //print_r($rearrange_items);
        $_saved_order = !empty($this->evcal_opt[1]['evoCard_order']) ? array_filter(explode(',', $this->evcal_opt[1]['evoCard_order'])) : null;
        //print_r($rearrange_items);
        //echo count($rearrange_items).' '.count($_saved_order);
        //print_r($_saved_order);
        // HTML
        $_rearrange_code = '<h4 class="acus_header">' . __('Re-arrange the order of eventCard event data boxes', 'eventon') . '</h4>
				<input id="evoCard_order" name="evoCard_order" value="' . (!empty($this->evcal_opt[1]['evoCard_order']) ? $this->evcal_opt[1]['evoCard_order'] : null) . '" type="hidden"/>
				<div id="evoEVC_arrange_box">';
        // if an order array exists already
        if ($_saved_order) {
            foreach ($_saved_order as $box) {
                $_rearrange_code .= array_key_exists($box, $rearrange_items) ? $rearrange_items[$box] : null;
            }
            // if there are new values in possible items add them to the bottom
            if (count($_saved_order) < count($rearrange_items)) {
                foreach ($rearrange_items as $f => $v) {
                    $_rearrange_code .= !in_array($f, $_saved_order) ? $rearrange_items[$f] : null;
                }
            }
        }
        if (empty($rearrange_items) || empty($_saved_order)) {
            $implode = implode('', $rearrange_items);
            $_rearrange_code .= $implode;
        }
        $_rearrange_code .= '</div>';
        return $_rearrange_code;
    }
function evo_retrieve_cmd_count($evopt = '')
{
    $evopt = !empty($evopt) ? $evopt : get_option('evcal_options_evcal_1');
    if (!empty($evopt['cmd_count']) && $evopt['cmd_count'] == 0) {
        return $evopt['cmd_count'];
    } else {
        $new_c = evo_calculate_cmd_count($evopt);
        $evopt['cmd_count'] = $new_c;
        //update_option('evcal_options_evcal_1', $evopt);
        return $new_c;
    }
}
/** Save the Event data meta box. **/
function eventon_save_meta_data($post_id, $post)
{
    if ($post->post_type != 'ajde_events') {
        return;
    }
    // Stop WP from clearing custom fields on autosave
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return;
    }
    // Prevent quick edit from clearing custom fields
    if (defined('DOING_AJAX') && DOING_AJAX) {
        return;
    }
    // verify this came from the our screen and with proper authorization,
    // because save_post can be triggered at other times
    if (isset($_POST['evo_noncename'])) {
        if (!wp_verify_nonce($_POST['evo_noncename'], plugin_basename(__FILE__))) {
            return;
        }
    }
    // Check permissions
    if (!current_user_can('edit_post', $post_id)) {
        return;
    }
    global $pagenow;
    $_allowed = array('post-new.php', 'post.php');
    if (!in_array($pagenow, $_allowed)) {
        return;
    }
    // $_POST FIELDS array
    $fields_ar = apply_filters('eventon_event_metafields', array('evcal_allday', 'evcal_event_color', 'evcal_event_color_n', 'evcal_location', 'evcal_location_name', 'evo_location_tax', 'evo_loc_img', 'evo_org_img', 'evcal_name_over_img', 'evcal_organizer', 'evcal_org_contact', 'evcal_org_img', 'evcal_org_exlink', 'evcal_exlink', 'evcal_lmlink', 'evcal_subtitle', 'evcal_gmap_gen', 'evcal_mu_id', 'evcal_paypal_item_price', 'evcal_paypal_text', 'evcal_paypal_email', 'evcal_repeat', 'evcal_rep_freq', 'evcal_rep_gap', 'evcal_rep_num', 'evp_repeat_rb', 'evo_repeat_wom', 'evo_rep_WK', 'evcal_lmlink_target', '_evcal_exlink_target', '_evcal_exlink_option', 'evo_hide_endtime', 'evo_span_hidden_end', 'evo_year_long', 'event_year', 'evo_evcrd_field_org', 'evo_event_timezone', 'evo_exclude_ev', '_featured', '_cancel', '_cancel_reason', '_onlyloggedin', 'evcal_lat', 'evcal_lon'));
    // append custom fields based on activated number
    $evcal_opt1 = get_option('evcal_options_evcal_1');
    $num = evo_calculate_cmd_count($evcal_opt1);
    for ($x = 1; $x <= $num; $x++) {
        if (eventon_is_custom_meta_field_good($x)) {
            $fields_ar[] = '_evcal_ec_f' . $x . 'a1_cus';
            $fields_ar[] = '_evcal_ec_f' . $x . 'a1_cusL';
            $fields_ar[] = '_evcal_ec_f' . $x . '_onw';
        }
    }
    // field names that pertains only to event date information
    $fields_sub_ar = apply_filters('eventon_event_date_metafields', array('evcal_start_date', 'evcal_end_date', 'evcal_start_time_hour', 'evcal_start_time_min', 'evcal_st_ampm', 'evcal_end_time_hour', 'evcal_end_time_min', 'evcal_et_ampm', 'evcal_allday'));
    // DATE and TIME data
    $date_POST_values = '';
    foreach ($fields_sub_ar as $ff) {
        // end date value fix for -- hide end date
        if ($ff == 'evcal_end_date' && !empty($_POST['evo_hide_endtime']) && $_POST['evo_hide_endtime'] == 'yes') {
            if ($_POST['evo_span_hidden_end'] && $_POST['evo_span_hidden_end'] == 'yes') {
                $date_POST_values['evcal_end_date'] = $_POST['evcal_end_date'];
            } else {
                $date_POST_values['evcal_end_date'] = $_POST['evcal_start_date'];
            }
            //$date_POST_values['evcal_end_date']=$_POST['evcal_end_date'];
        } else {
            if (!empty($_POST[$ff])) {
                $date_POST_values[$ff] = $_POST[$ff];
            }
        }
        // remove these values from previously saved
        delete_post_meta($post_id, $ff);
    }
    // convert the post times into proper unix time stamps
    if (!empty($_POST['_evo_date_format']) && !empty($_POST['_evo_time_format'])) {
        $proper_time = eventon_get_unix_time($date_POST_values, $_POST['_evo_date_format'], $_POST['_evo_time_format']);
    }
    // if Repeating event save repeating intervals
    if (eventon_is_good_repeat_data() && !empty($proper_time['unix_start'])) {
        $unix_E = !empty($proper_time['unix_end']) ? $proper_time['unix_end'] : $proper_time['unix_start'];
        $repeat_intervals = eventon_get_repeat_intervals($proper_time['unix_start'], $unix_E);
        // save repeat interval array as post meta
        if (!empty($repeat_intervals)) {
            asort($repeat_intervals);
            update_post_meta($post_id, 'repeat_intervals', $repeat_intervals);
        }
    }
    //update_post_meta($post_id, 'aaa', $_POST['repeat_intervals']);
    // run through all the custom meta fields
    foreach ($fields_ar as $f_val) {
        if (!empty($_POST[$f_val])) {
            $post_value = $_POST[$f_val];
            update_post_meta($post_id, $f_val, $post_value);
            // ux val for single events linking to event page
            if ($f_val == 'evcal_exlink' && $_POST['_evcal_exlink_option'] == '4') {
                update_post_meta($post_id, 'evcal_exlink', get_permalink($post_id));
            }
        } else {
            if (defined('DOING_AUTOSAVE') && !DOING_AUTOSAVE) {
                // if the meta value is set to empty, then delete that meta value
                delete_post_meta($post_id, $f_val);
            }
            delete_post_meta($post_id, $f_val);
        }
    }
    // full time converted to unix time stamp
    if (!empty($proper_time['unix_start'])) {
        update_post_meta($post_id, 'evcal_srow', $proper_time['unix_start']);
    }
    if (!empty($proper_time['unix_end'])) {
        update_post_meta($post_id, 'evcal_erow', $proper_time['unix_end']);
    }
    // save event year if not set
    if (empty($_POST['event_year']) && !empty($proper_time['unix_start']) || !empty($_POST['event_year']) && $_POST['event_year'] == 'yes') {
        $year = date('Y', $proper_time['unix_start']);
        update_post_meta($post_id, 'event_year', $year);
    }
    //set event color code to 1 for none select colors
    if (!isset($_POST['evcal_event_color_n'])) {
        update_post_meta($post_id, 'evcal_event_color_n', 1);
    }
    // save featured event data default value no
    $_featured = get_post_meta($post_id, '_featured', true);
    if (empty($_featured)) {
        update_post_meta($post_id, '_featured', 'no');
    }
    // LOCATION as taxonomy
    // if location name is choosen from the list
    if (isset($_POST['evcal_location_name_select'], $_POST['evcal_location_name']) && $_POST['evcal_location_name_select'] == $_POST['evcal_location_name']) {
        //
        if (!empty($_POST['evo_location_tax_id'])) {
            $term_name = esc_attr($_POST['evcal_location_name']);
            $term_meta = array();
            $term_meta['location_lon'] = isset($_POST['evcal_lon']) ? $_POST['evcal_lon'] : null;
            $term_meta['location_lat'] = isset($_POST['evcal_lat']) ? $_POST['evcal_lat'] : null;
            $term_meta['location_address'] = isset($_POST['evcal_location']) ? $_POST['evcal_location'] : null;
            $term_meta['evo_loc_img'] = isset($_POST['evo_loc_img']) ? $_POST['evo_loc_img'] : null;
            update_option("taxonomy_" . $_POST['evo_location_tax_id'], $term_meta);
            wp_set_post_terms($post_id, $term_name, 'event_location');
        }
    } elseif (isset($_POST['evcal_location_name'])) {
        // create new taxonomy from new values
        $term_name = esc_attr($_POST['evcal_location_name']);
        $term_slug = str_replace(" ", "-", $term_name);
        // create wp term
        $new_term_ = wp_insert_term($term_name, 'event_location', array('slug' => $term_slug));
        if (!is_wp_error($new_term_)) {
            $term_meta = array();
            $term_meta['location_lon'] = isset($_POST['evcal_lon']) ? $_POST['evcal_lon'] : null;
            $term_meta['location_lat'] = isset($_POST['evcal_lat']) ? $_POST['evcal_lat'] : null;
            $term_meta['location_address'] = isset($_POST['evcal_location']) ? $_POST['evcal_location'] : null;
            $term_meta['evo_loc_img'] = isset($_POST['evo_loc_img']) ? $_POST['evo_loc_img'] : null;
            update_option("taxonomy_" . $new_term_['term_id'], $term_meta);
            wp_set_post_terms($post_id, $term_name, 'event_location');
        }
    }
    // ORGANIZER as taxonomy
    // Selected value from list - update other values
    if (isset($_POST['evcal_organizer_name_select'], $_POST['evcal_organizer']) && $_POST['evcal_organizer_name_select'] == $_POST['evcal_organizer']) {
        if (!empty($_POST['evo_organizer_tax_id'])) {
            $term_name = esc_attr($_POST['evcal_organizer']);
            $term_meta = array();
            $term_meta['evcal_org_contact'] = isset($_POST['evcal_org_contact']) ? str_replace('"', "'", $_POST['evcal_org_contact']) : null;
            $term_meta['evo_org_img'] = isset($_POST['evo_org_img']) ? $_POST['evo_org_img'] : null;
            $term_meta['evcal_org_exlink'] = isset($_POST['evcal_org_exlink']) ? $_POST['evcal_org_exlink'] : null;
            update_option("taxonomy_" . $_POST['evo_organizer_tax_id'], $term_meta);
            wp_set_post_terms($post_id, $term_name, 'event_organizer');
        }
    } elseif (isset($_POST['evcal_organizer'])) {
        // create new taxonomy from new values
        $term_name = esc_attr($_POST['evcal_organizer']);
        $term_slug = str_replace(" ", "-", $term_name);
        // create wp term
        $new_term_ = wp_insert_term($term_name, 'event_organizer', array('slug' => $term_slug));
        if (!is_wp_error($new_term_)) {
            $term_meta = array();
            $term_meta['evcal_org_contact'] = isset($_POST['evcal_org_contact']) ? str_replace('"', "'", $_POST['evcal_org_contact']) : null;
            $term_meta['evo_org_img'] = isset($_POST['evo_org_img']) ? $_POST['evo_org_img'] : null;
            $term_meta['evcal_org_exlink'] = isset($_POST['evcal_org_exlink']) ? $_POST['evcal_org_exlink'] : null;
            update_option("taxonomy_" . $new_term_['term_id'], $term_meta);
            wp_set_post_terms($post_id, $term_name, 'event_organizer');
        }
    }
    // (---) hook for addons
    do_action('eventon_save_meta', $fields_ar, $post_id);
    // save user closed meta field boxes
    if (!empty($_POST['evo_collapse_meta_boxes'])) {
        eventon_save_collapse_metaboxes($post_id, $_POST['evo_collapse_meta_boxes'], true);
    }
}
 function rearrange_code()
 {
     $rearrange_items = apply_filters('eventon_eventcard_boxes', array('ftimage' => array('ftimage', __('Featured Image', 'eventon')), 'eventdetails' => array('eventdetails', __('Event Details', 'eventon')), 'timelocation' => array('timelocation', __('Time and Location', 'eventon')), 'organizer' => array('organizer', __('Event Organizer', 'eventon')), 'locImg' => array('locImg', __('Location Image', 'eventon')), 'gmap' => array('gmap', __('Google Maps', 'eventon')), 'learnmoreICS' => array('learnmoreICS', __('Learn More & Add to your calendar', 'eventon'))));
     // otehr values
     //get directions
     if (!empty($this->evcal_opt[1]['evo_getdir']) && $this->evcal_opt[1]['evo_getdir'] == 'yes') {
         $rearrange_items['getdirection'] = array('getdirection', __('Get Directions', 'eventon'));
     }
     //eventbrite
     if (!empty($this->evcal_opt[1]['evcal_evb_events']) && $this->evcal_opt[1]['evcal_evb_events'] == 'yes') {
         $rearrange_items['eventbrite'] = array('eventbrite', __('eventbrite', 'eventon'));
     }
     //paypal
     if (!empty($this->evcal_opt[1]['evcal_paypal_pay']) && $this->evcal_opt[1]['evcal_paypal_pay'] == 'yes') {
         $rearrange_items['paypal'] = array('paypal', __('Paypal', 'eventon'));
     }
     // custom fields
     $_cmd_num = evo_calculate_cmd_count($this->evcal_opt[1]);
     for ($x = 1; $x <= $_cmd_num; $x++) {
         if (!empty($this->evcal_opt[1]['evcal_ec_f' . $x . 'a1']) && !empty($this->evcal_opt[1]['evcal_af_' . $x]) && $this->evcal_opt[1]['evcal_af_' . $x] == 'yes') {
             $rearrange_items['customfield' . $x] = array('customfield' . $x, $this->evcal_opt[1]['evcal_ec_f' . $x . 'a1']);
         }
     }
     return $rearrange_items;
 }
 function export_events()
 {
     header("Content-type: text/csv");
     header("Content-Disposition: attachment; filename=Eventon_events_" . date("d-m-y") . ".csv");
     header("Pragma: no-cache");
     header("Expires: 0");
     $evo_opt = get_option('evcal_options_evcal_1');
     $event_type_count = evo_get_ett_count($evo_opt);
     $cmd_count = evo_calculate_cmd_count($evo_opt);
     $fields = array('publish_status', 'evcal_event_color' => 'color', 'event_name', 'event_description', 'event_start_date', 'event_start_time', 'event_end_date', 'event_end_time', 'evcal_allday' => 'all_day', 'evo_hide_endtime' => 'hide_end_time', 'evcal_gmap_gen' => 'event_gmap', '_featured' => 'featured', 'evcal_location_name' => 'location_name', 'evcal_location' => 'event_location', 'evcal_organizer' => 'event_organizer', 'evcal_subtitle' => 'evcal_subtitle', 'image_url');
     foreach ($fields as $var => $val) {
         echo $val . ',';
     }
     // event types
     for ($y = 1; $y <= $event_type_count; $y++) {
         $_ett_name = $y == 1 ? 'event_type' : 'event_type_' . $y;
         echo $_ett_name . ',';
     }
     // for event custom meta data
     for ($z = 1; $z <= $cmd_count; $z++) {
         $_cmd_name = 'cmd_' . $z;
         echo $_cmd_name . ",";
     }
     echo "\n";
     $events = new WP_Query(array('posts_per_page' => -1, 'post_type' => 'ajde_events', 'post_status' => 'any'));
     if ($events->have_posts()) {
         date_default_timezone_set('UTC');
         while ($events->have_posts()) {
             $events->the_post();
             $__id = get_the_ID();
             $pmv = get_post_meta($__id);
             echo get_post_status($__id) . ",";
             //echo (!empty($pmv['_featured'])?$pmv['_featured'][0]:'no').",";
             echo (!empty($pmv['evcal_event_color']) ? $pmv['evcal_event_color'][0] : '') . ",";
             echo '"' . get_the_title() . '",';
             $event_content = get_the_content();
             echo '"' . str_replace('"', "'", $event_content) . '",';
             // start time
             $start = !empty($pmv['evcal_srow']) ? $pmv['evcal_srow'][0] : '';
             if (!empty($start)) {
                 echo date('n/j/Y,g:i:A', $start) . ',';
             } else {
                 echo "'','',";
             }
             // end time
             $end = !empty($pmv['evcal_erow']) ? $pmv['evcal_erow'][0] : '';
             if (!empty($end)) {
                 echo date('n/j/Y,g:i:A', $end) . ',';
             } else {
                 echo "'','',";
             }
             foreach ($fields as $var => $val) {
                 // yes no values
                 if (in_array($val, array('featured', 'all_day', 'hide_end_time', 'event_gmap'))) {
                     echo (!empty($pmv[$var]) && $pmv[$var][0] == 'yes' ? 'yesf' : 'no') . ',';
                 }
                 // skip fields
                 if (in_array($val, array('featured', 'all_day', 'hide_end_time', 'event_gmap', 'color', 'publish_status', 'event_name', 'event_description', 'event_start_date', 'event_start_time', 'event_end_date', 'event_end_time'))) {
                     continue;
                 }
                 // image
                 if ($val == 'image_url') {
                     $img_id = get_post_thumbnail_id($__id);
                     if ($img_id != '') {
                         $img_src = wp_get_attachment_image_src($img_id, 'full');
                         echo $img_src[0] . ",";
                     } else {
                         echo ",";
                     }
                 } else {
                     echo (!empty($pmv[$var]) ? '"' . $pmv[$var][0] . '"' : '') . ",";
                 }
             }
             // event types
             for ($y = 1; $y <= $event_type_count; $y++) {
                 $_ett_name = $y == 1 ? 'event_type' : 'event_type_' . $y;
                 $terms = get_the_terms($__id, $_ett_name);
                 if ($terms && !is_wp_error($terms)) {
                     echo '"';
                     foreach ($terms as $term) {
                         echo $term->term_id . ',';
                     }
                     echo '",';
                 } else {
                     echo ",";
                 }
             }
             // for event custom meta data
             for ($z = 1; $z <= $cmd_count; $z++) {
                 $cmd_name = '_evcal_ec_f' . $z . 'a1_cus';
                 echo !empty($pmv[$cmd_name]) ? '"' . str_replace('"', "'", $pmv[$cmd_name][0]) . '"' : '';
                 echo ",";
             }
             echo "\n";
         }
     }
     wp_reset_postdata();
 }
Exemplo n.º 6
0
function evo_retrieve_cmd_count($evopt = '')
{
    global $eventon;
    $opt = $eventon->frontend->evo_options;
    $evopt = !empty($evopt) ? $evopt : $opt;
    if (!empty($evopt['cmd_count']) && $evopt['cmd_count'] == 0) {
        return $evopt['cmd_count'];
    } else {
        $new_c = evo_calculate_cmd_count($evopt);
        $evopt['cmd_count'] = $new_c;
        //update_option('evcal_options_evcal_1', $evopt);
        return $new_c;
    }
}
    /**
     * Settings page.
     *
     * Handles the display of the main EventON settings page in admin.
     *
     * @access public
     * @return void
     */
    function eventon_settings()
    {
        global $eventon, $ajde;
        do_action('eventon_settings_start');
        // Settings Tabs array
        $evcal_tabs = apply_filters('eventon_settings_tabs', array('evcal_1' => __('Settings', 'eventon'), 'evcal_2' => __('Language', 'eventon'), 'evcal_3' => __('Styles', 'eventon'), 'evcal_4' => __('Addons & Licenses', 'eventon'), 'evcal_5' => __('Support', 'eventon')));
        // Get current tab/section
        $focus_tab = isset($_GET['tab']) ? sanitize_text_field(urldecode($_GET['tab'])) : 'evcal_1';
        $current_section = isset($_GET['section']) ? sanitize_text_field(urldecode($_GET['section'])) : '';
        // Update or add options
        if (isset($_POST['evcal_noncename']) && isset($_POST)) {
            if (wp_verify_nonce($_POST['evcal_noncename'], AJDE_EVCAL_BASENAME)) {
                foreach ($_POST as $pf => $pv) {
                    if ($pf != 'evcal_styles' && $focus_tab != 'evcal_4' || $pf != 'evcal_sort_options') {
                        $pv = is_array($pv) ? $pv : addslashes(esc_html(stripslashes($pv)));
                        $evcal_options[$pf] = $pv;
                    }
                    if ($pf == 'evcal_sort_options') {
                        $evcal_options[$pf] = $pv;
                    }
                }
                // General settings page - write styles to head option
                if ($focus_tab == 'evcal_1' && isset($_POST['evcal_css_head']) && $_POST['evcal_css_head'] == 'yes') {
                    ob_start();
                    include AJDE_EVCAL_PATH . '/assets/css/dynamic_styles.php';
                    $evo_dyn_css = ob_get_clean();
                    update_option('evo_dyn_css', $evo_dyn_css);
                }
                //language tab
                if ($focus_tab == 'evcal_2') {
                    $new_lang_opt = '';
                    $_lang_version = !empty($_GET['lang']) ? $_GET['lang'] : 'L1';
                    $lang_opt = get_option('evcal_options_evcal_2');
                    if (!empty($lang_opt)) {
                        $new_lang_opt[$_lang_version] = $evcal_options;
                        $new_lang_opt = array_merge($lang_opt, $new_lang_opt);
                    } else {
                        $new_lang_opt[$_lang_version] = $evcal_options;
                    }
                    update_option('evcal_options_evcal_2', $new_lang_opt);
                } elseif ($focus_tab == 'evcal_1' || empty($focus_tab)) {
                    // store custom meta box count
                    $cmd_count = evo_calculate_cmd_count();
                    $evcal_options['cmd_count'] = $cmd_count;
                    update_option('evcal_options_' . $focus_tab, $evcal_options);
                    // all other settings tabs
                } else {
                    update_option('evcal_options_' . $focus_tab, $evcal_options);
                }
                // STYLES
                if (isset($_POST['evcal_styles'])) {
                    update_option('evcal_styles', strip_tags(stripslashes($_POST['evcal_styles'])));
                }
                $_POST['settings-updated'] = 'true';
                eventon_generate_options_css();
                // nonce check
            } else {
                die(__('Action failed. Please refresh the page and retry.', 'eventon'));
            }
        }
        // Load eventon settings values for current tab
        $current_tab_number = substr($focus_tab, -1);
        if (!is_numeric($current_tab_number)) {
            // if the tab last character is not numeric then get the whole tab name as the variable name for the options
            $current_tab_number = $focus_tab;
        }
        $evcal_opt[$current_tab_number] = get_option('evcal_options_' . $focus_tab);
        // activation notification
        if (!$eventon->evo_updater->is_activated('eventon')) {
            echo '<div class="update-nag">' . __('Your eventON license is not saved. eventON should still work fine. <a href="' . get_admin_url() . 'admin.php?page=eventon&tab=evcal_4">Enter License Now</a>', 'eventon') . '</div>';
        }
        // TABBBED HEADER
        ?>
<div class="wrap" id='evcal_settings'>
	<h2><?php 
        _e('EventON Settings', 'eventon');
        ?>
 (ver <?php 
        echo get_option('eventon_plugin_version');
        ?>
) <?php 
        do_action('eventon_updates_in_settings');
        ?>
</h2>
	<h2 class='nav-tab-wrapper' id='meta_tabs'>
		<?php 
        foreach ($evcal_tabs as $nt => $ntv) {
            $evo_notification = '';
            echo "<a href='?page=eventon&tab=" . $nt . "' class='nav-tab " . ($focus_tab == $nt ? 'nav-tab-active' : null) . " {$nt}' evcal_meta='evcal_{$nt}'>" . $ntv . $evo_notification . "</a>";
        }
        ?>
		
	</h2>	
<div class='evo_settings_box'>	
<?php 
        // SETTINGS SAVED MESSAGE
        $updated_code = isset($_POST['settings-updated']) && $_POST['settings-updated'] == 'true' ? '<div class="updated fade"><p>' . __('Settings Saved', 'eventon') . '</p></div>' : null;
        echo $updated_code;
        // TABS
        switch ($focus_tab) {
            case "evcal_1":
                // Event type custom taxonomy NAMES
                $event_type_names = evo_get_ettNames($evcal_opt[1]);
                $evt_name = $event_type_names[1];
                $evt_name2 = $event_type_names[2];
                ?>
		<form method="post" action=""><?php 
                settings_fields('evcal_field_group');
                wp_nonce_field(AJDE_EVCAL_BASENAME, 'evcal_noncename');
                ?>
		<div id="evcal_1" class=" evcal_admin_meta evcal_focus">		
			
			<div class="evo_inside">
				<?php 
                require_once AJDE_EVCAL_PATH . '/includes/admin/settings/class-settings-settings.php';
                $settings = new evo_settings_settings($evcal_opt);
                $ajde->load_ajde_backender();
                print_ajde_customization_form($settings->content(), $evcal_opt[1]);
                ?>
			</div>	
		</div>
		<div class='evo_diag'>
			<input type="submit" class="evo_admin_btn btn_prime" value="<?php 
                _e('Save Changes');
                ?>
" /> <a id='resetColor' style='display:none' class='evo_admin_btn btn_secondary'><?php 
                _e('Reset to default colors', 'eventon');
                ?>
</a><br/><br/>
			<a target='_blank' href='http://www.myeventon.com/support/'><img src='<?php 
                echo AJDE_EVCAL_URL;
                ?>
/assets/images/myeventon_resources.png'/></a>
		</div>
		
		</form>
	
<?php 
                break;
                // LANGUAGE TAB
            // LANGUAGE TAB
            case "evcal_2":
                require_once AJDE_EVCAL_PATH . '/includes/admin/settings/settings_language_tab.php';
                $settings_lang = new evo_settings_lang($evcal_opt);
                $settings_lang->get_content();
                break;
                // STYLES TAB
            // STYLES TAB
            case "evcal_3":
                echo '<form method="post" action="">';
                //settings_fields('evcal_field_group');
                wp_nonce_field(AJDE_EVCAL_BASENAME, 'evcal_noncename');
                // styles settings tab content
                require_once AJDE_EVCAL_PATH . '/includes/admin/settings/settings_styles_tab.php';
                break;
                // ADDON TAB
            // ADDON TAB
            case "evcal_4":
                // Addons settings tab content
                require_once AJDE_EVCAL_PATH . '/includes/admin/settings/settings_addons_tab.php';
                break;
                // support TAB
            // support TAB
            case "evcal_5":
                // Addons settings tab content
                require_once AJDE_EVCAL_PATH . '/includes/admin/settings/settings_support_tab.php';
                break;
                // ADVANDED extra field
            // ADVANDED extra field
            case "extra":
                // advanced tab content
                require_once AJDE_EVCAL_PATH . '/includes/admin/settings/settings_advanced_tab.php';
                break;
            default:
                do_action('eventon_settings_tabs_' . $focus_tab);
                break;
        }
        echo "</div>";
    }
Exemplo n.º 8
0
 public function au_form_fields($var = '')
 {
     $evcal_opt = $this->options;
     /* 
     	structure = 0=>name, 1=> var, 2=> field type, 3=>placeholder, 4=>lang var, 5=> required or not, 6=>special name for settings
     */
     $event_fields = array('event_name' => array('Event Name', 'event_name', 'title', '', 'evoAUL_evn'), 'event_subtitle' => array('Event Sub Title', 'evcal_subtitle', 'text', '', 'evoAUL_est'), 'event_description' => array('Event Details', 'event_description', 'textarea', '', 'evcal_evcard_details_au'), 'event_start_date' => array('Event Start Date/Time', 'evcal_start_date', 'startdate', '', 'evoAUL_esdt'), 'event_end_date' => array('Event End Date/Time', 'event_end_date', 'enddate', '', 'evoAUL_eedt'), 'event_allday' => array('All Day', 'event_allday', 'allday', '', ''), 'event_location_name' => array('Event Location Name', 'evcal_location_name', 'text', '', 'evoAUL_lca'), 'event_location' => array('Event Location Address', 'evcal_location', 'text', '', 'evoAUL_ln'), 'event_location_cord' => array('Event Location Coordinates (lat,lon Seperated by comma)', 'event_location_cord', 'text', '', 'evoAUL_lcor'), 'event_color' => array('Event Color', 'evcal_event_color', 'color', '', 'evoAUL_ec'), 'event_organizer' => array('Event Organizer', 'evcal_organizer', 'text', '', 'evoAUL_eo'), 'event_org_contact' => array('Event Organizer Contact Information', 'evcal_org_contact', 'text', '', 'evoAUL_eoc'), 'learnmorelink' => array('Learn More Link', 'evcal_lmlink', 'text', '', 'evoAUL_lml'));
     // event type categories
     $ett_verify = $this->tax_count;
     $_tax_names_array = $this->tax_names;
     for ($x = 1; $x < $ett_verify + 1; $x++) {
         $ab = $x == 1 ? '' : '_' . $x;
         $__tax_name = $_tax_names_array[$x];
         $event_fields['event_type' . $ab] = array('Select the ' . $__tax_name . ' Category', 'event_type' . $ab, 'tax', '', 'evoAUL_stet' . $x);
     }
     $event_fields_1 = array('event_image' => array('Event Image', 'event_image', 'image', '', 'evoAUL_ei'), 'yourname' => array('Your Full Name', 'yourname', 'text', '', 'evoAUL_fn', 'req'), 'youremail' => array('Your Email Address', 'youremail', 'text', '', 'evoAUL_ea', 'req'), 'user_interaction' => array('User Interaction', 'uinter', 'uiselect', '', 'evoAUL_ui'), 'event_captcha' => array('Form Human Submission Validation', 'evcal_captcha', 'captcha', '', 'evoAUL_cap'), 'event_additional' => array('Additonal Private Notes', 'evcalau_notes', 'textarea', '', 'evoAU_add', '', 'Additional private notes for admin'), 'event_html' => array('** Additonal HTML Field', 'evoau_html', 'html'));
     $event_fields = array_merge($event_fields, $event_fields_1);
     // get custom meta fields for
     $custom_field_count = evo_calculate_cmd_count($evcal_opt);
     // get activated custom field count
     for ($x = 1; $x <= $custom_field_count; $x++) {
         $new_additions = '';
         if (eventon_is_custom_meta_field_good($x, $evcal_opt)) {
             $index = 'evo_customfield_' . $x;
             $_variable_name = '_evcal_ec_f' . $x . 'a1_cus';
             $_field_name = $evcal_opt['evcal_ec_f' . $x . 'a1'];
             $content_type = $evcal_opt['evcal_ec_f' . $x . 'a2'];
             $new_additions[$index] = array($_field_name, $_variable_name, $content_type);
             $event_fields = array_merge($event_fields, $new_additions);
         }
     }
     // Filter for other additions
     $event_fields = apply_filters('evoau_form_fields', $event_fields);
     // return certain fields from above list
     if ($var == 'savefields') {
         unset($event_fields['event_name']);
         unset($event_fields['event_start_date']);
         unset($event_fields['event_end_date']);
         unset($event_fields['event_allday']);
         unset($event_fields['event_description']);
         unset($event_fields['yourname']);
         unset($event_fields['youremail']);
         unset($event_fields['event_captcha']);
         unset($event_fields['user_interaction']);
         unset($event_fields['event_location_cord']);
         unset($event_fields['event_color']);
     }
     if ($var == 'default') {
         $event_fields = array('event_name' => $event_fields['event_name'], 'event_start_date' => $event_fields['event_start_date'], 'event_end_date' => $event_fields['event_end_date'], 'event_allday' => $event_fields['event_allday']);
     }
     if ($var == 'additional') {
         unset($event_fields['event_name']);
         unset($event_fields['event_start_date']);
         unset($event_fields['event_end_date']);
         unset($event_fields['event_allday']);
     }
     if ($var == 'defaults_ar') {
         $event_fields = array('event_name', 'event_start_date', 'event_end_date', 'event_allday');
     }
     return $event_fields;
 }
Exemplo n.º 9
0
 function export_events()
 {
     header("Content-type: text/csv");
     header("Content-Disposition: attachment; filename=Eventon_events_" . date("d-m-y") . ".csv");
     header("Pragma: no-cache");
     header("Expires: 0");
     $evo_opt = get_option('evcal_options_evcal_1');
     $event_type_count = evo_get_ett_count($evo_opt);
     $cmd_count = evo_calculate_cmd_count($evo_opt);
     echo "publish_status,featured,color,event_name,event_description,event_start_date,event_start_time,event_end_date,event_end_time,all_day,hide_end_time,location_name,event_location,event_gmap,event_organizer,";
     // event types
     for ($y = 1; $y <= $event_type_count; $y++) {
         $_ett_name = $y == 1 ? 'event_type' : 'event_type_' . $y;
         echo $_ett_name . ',';
     }
     // for event custom meta data
     for ($z = 1; $z <= $cmd_count; $z++) {
         $_cmd_name = 'cmd_' . $z;
         echo $_cmd_name . ",";
     }
     echo "\n";
     $events = new WP_Query(array('posts_per_page' => -1, 'post_type' => 'ajde_events', 'post_status' => 'any'));
     if ($events->have_posts()) {
         date_default_timezone_set('UTC');
         while ($events->have_posts()) {
             $events->the_post();
             $__id = get_the_ID();
             $pmv = get_post_meta($__id);
             echo get_post_status($__id) . ",";
             echo (!empty($pmv['_featured']) ? $pmv['_featured'][0] : 'no') . ",";
             echo (!empty($pmv['evcal_event_color']) ? $pmv['evcal_event_color'][0] : '') . ",";
             echo '"' . get_the_title() . '",';
             $event_content = get_the_content();
             echo '"' . str_replace('"', "'", $event_content) . '",';
             // start time
             $start = !empty($pmv['evcal_srow']) ? $pmv['evcal_srow'][0] : '';
             if (!empty($start)) {
                 echo date('n/j/Y,g:i:A', $start) . ',';
             } else {
                 echo "'','',";
             }
             // end time
             $end = !empty($pmv['evcal_erow']) ? $pmv['evcal_erow'][0] : '';
             if (!empty($end)) {
                 echo date('n/j/Y,g:i:A', $end) . ',';
             } else {
                 echo "'','',";
             }
             echo (!empty($pmv['evcal_allday']) ? $pmv['evcal_allday'][0] : 'no') . ",";
             echo (!empty($pmv['evo_hide_endtime']) ? $pmv['evo_hide_endtime'][0] : 'no') . ",";
             echo (!empty($pmv['evcal_location_name']) ? '"' . $pmv['evcal_location_name'][0] . '"' : '') . ",";
             echo (!empty($pmv['evcal_location']) ? '"' . $pmv['evcal_location'][0] . '"' : '') . ",";
             echo (!empty($pmv['evcal_gmap_gen']) ? $pmv['evcal_gmap_gen'][0] : 'no') . ",";
             echo (!empty($pmv['evcal_organizer']) ? '"' . $pmv['evcal_organizer'][0] . '"' : '') . ",";
             // event types
             for ($y = 1; $y <= $event_type_count; $y++) {
                 $_ett_name = $y == 1 ? 'event_type' : 'event_type_' . $y;
                 $terms = get_the_terms($__id, $_ett_name);
                 if ($terms && !is_wp_error($terms)) {
                     echo '"';
                     foreach ($terms as $term) {
                         echo $term->term_id . ',';
                     }
                     echo '",';
                 } else {
                     echo ",";
                 }
             }
             // for event custom meta data
             for ($z = 1; $z <= $cmd_count; $z++) {
                 $cmd_name = '_evcal_ec_f' . $z . 'a1_cus';
                 echo !empty($pmv[$cmd_name]) ? '"' . str_replace('"', "'", $pmv[$cmd_name][0]) . '"' : '';
                 echo ",";
             }
             echo "\n";
         }
     }
     wp_reset_postdata();
 }
Exemplo n.º 10
0
    /**
     * Settings page.
     *
     * Handles the display of the main EventON settings page in admin.
     *
     * @access public
     * @return void
     */
    function eventon_settings()
    {
        global $eventon;
        do_action('eventon_settings_start');
        // Settings Tabs array
        $evcal_tabs = apply_filters('eventon_settings_tabs', array('evcal_1' => __('Settings', 'eventon'), 'evcal_2' => __('Language', 'eventon'), 'evcal_3' => __('Styles', 'eventon'), 'evcal_4' => __('Addons & Licenses', 'eventon'), 'evcal_5' => __('Support', 'eventon')));
        // Get current tab/section
        $focus_tab = isset($_GET['tab']) ? sanitize_text_field(urldecode($_GET['tab'])) : 'evcal_1';
        $current_section = isset($_GET['section']) ? sanitize_text_field(urldecode($_GET['section'])) : '';
        $evcal_skins[] = 'slick';
        // Update or add options
        if (isset($_POST['evcal_noncename']) && isset($_POST)) {
            if (wp_verify_nonce($_POST['evcal_noncename'], AJDE_EVCAL_BASENAME)) {
                foreach ($_POST as $pf => $pv) {
                    if ($pf != 'evcal_styles' && $focus_tab != 'evcal_4' || $pf != 'evcal_sort_options') {
                        $pv = is_array($pv) ? $pv : $pv;
                        $evcal_options[$pf] = $pv;
                    }
                    if ($pf == 'evcal_sort_options') {
                        $evcal_options[$pf] = $pv;
                    }
                }
                // General settings page - write styles to head option
                if ($focus_tab == 'evcal_1' && isset($_POST['evcal_css_head']) && $_POST['evcal_css_head'] == 'yes') {
                    ob_start();
                    include AJDE_EVCAL_PATH . '/assets/css/dynamic_styles.php';
                    $evo_dyn_css = ob_get_clean();
                    update_option('evo_dyn_css', $evo_dyn_css);
                }
                //language tab
                if ($focus_tab == 'evcal_2') {
                    $new_lang_opt = '';
                    $_lang_version = !empty($_GET['lang']) ? $_GET['lang'] : 'L1';
                    $lang_opt = get_option('evcal_options_evcal_2');
                    if (!empty($lang_opt)) {
                        $new_lang_opt[$_lang_version] = $evcal_options;
                        $new_lang_opt = array_merge($lang_opt, $new_lang_opt);
                    } else {
                        $new_lang_opt[$_lang_version] = $evcal_options;
                    }
                    update_option('evcal_options_evcal_2', $new_lang_opt);
                } elseif ($focus_tab == 'evcal_1' || empty($focus_tab)) {
                    // store custom meta box count
                    $cmd_count = evo_calculate_cmd_count();
                    $evcal_options['cmd_count'] = $cmd_count;
                    update_option('evcal_options_' . $focus_tab, $evcal_options);
                    // all other settings tabs
                } else {
                    update_option('evcal_options_' . $focus_tab, $evcal_options);
                }
                // STYLES
                if (isset($_POST['evcal_styles'])) {
                    update_option('evcal_styles', strip_tags(stripslashes($_POST['evcal_styles'])));
                }
                $_POST['settings-updated'] = 'true';
                eventon_generate_options_css();
                // nonce check
            } else {
                die(__('Action failed. Please refresh the page and retry.', 'eventon'));
            }
        }
        // Load eventon settings values for current tab
        $current_tab_number = substr($focus_tab, -1);
        if (!is_numeric($current_tab_number)) {
            // if the tab last character is not numeric then get the whole tab name as the variable name for the options
            $current_tab_number = $focus_tab;
        }
        $evcal_opt[$current_tab_number] = get_option('evcal_options_' . $focus_tab);
        //print_r(get_option('_evo_licenses'));
        //print_r($evcal_opt[1]);
        // activation notification
        if (!$eventon->evo_updater->is_activated('eventon')) {
            echo '<div class="update-nag">' . __('Your copy of EventOn is not activated yet some features may be restricted. <a href="' . get_admin_url() . 'admin.php?page=eventon&tab=evcal_4">Activate License Now</a>', 'eventon') . '</div>';
        }
        // TABBBED HEADER
        ?>
<div class="wrap" id='evcal_settings'>
	<div id='eventon'><div id="icon-themes" class="icon32"></div></div>
	<h2>EventON Settings (ver <?php 
        echo get_option('eventon_plugin_version');
        ?>
) <?php 
        do_action('eventon_updates_in_settings');
        ?>
</h2>
	<h2 class='nav-tab-wrapper' id='meta_tabs'>
		<?php 
        foreach ($evcal_tabs as $nt => $ntv) {
            $evo_notification = '';
            echo "<a href='?page=eventon&tab=" . $nt . "' class='nav-tab " . ($focus_tab == $nt ? 'nav-tab-active' : null) . " {$nt}' evcal_meta='evcal_{$nt}'>" . $ntv . $evo_notification . "</a>";
        }
        ?>
		
	</h2>	
<div class='evo_settings_box'>	
<?php 
        // SETTINGS SAVED MESSAGE
        $updated_code = isset($_POST['settings-updated']) && $_POST['settings-updated'] == 'true' ? '<div class="updated fade"><p>' . __('Settings Saved', 'eventon') . '</p></div>' : null;
        echo $updated_code;
        // TABS
        switch ($focus_tab) {
            case "evcal_1":
                // Event type custom taxonomy NAMES
                $event_type_names = evo_get_ettNames($evcal_opt[1]);
                $evt_name = $event_type_names[1];
                $evt_name2 = $event_type_names[2];
                ?>
	<form method="post" action=""><?php 
                settings_fields('evcal_field_group');
                wp_nonce_field(AJDE_EVCAL_BASENAME, 'evcal_noncename');
                ?>
	<div id="evcal_1" class=" evcal_admin_meta evcal_focus">		
		
		<div class="evo_inside">
			<?php 
                require_once AJDE_EVCAL_PATH . '/includes/admin/settings/class-settings-settings.php';
                $settings = new evo_settings_settings($evcal_opt);
                $eventon->load_ajde_backender();
                print_ajde_customization_form($settings->content(), $evcal_opt[1]);
                ?>
		</div>	
	</div>
	<div class='evo_diag'>
		<input type="submit" class="evo_admin_btn btn_prime" value="<?php 
                _e('Save Changes');
                ?>
" /> <a id='resetColor' style='display:none' class='evo_admin_btn btn_secondary'><?php 
                _e('Reset to default colors', 'eventon');
                ?>
</a><br/><br/>
		<a target='_blank' href='http://www.myeventon.com/support/'><img src='<?php 
                echo AJDE_EVCAL_URL;
                ?>
/assets/images/myeventon_resources.png'/></a>
	</div>
	
	</form>
	
	
<?php 
                break;
                // LANGUAGE TAB
            // LANGUAGE TAB
            case "evcal_2":
                //print_r($evcal_opt[1]);
                $__lang_version = !empty($_GET['lang']) ? $_GET['lang'] : 'L1';
                $lang_options = !empty($evcal_opt[2][$__lang_version]) ? $evcal_opt[2][$__lang_version] : null;
                //$lang_options =eventon_process_lang_options($lang_options);
                $eventon_months = array(1 => 'january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december');
                $eventon_days = array(1 => 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday');
                // Language variations
                $lang_variations = apply_filters('eventon_lang_variation', array('L1', 'L2', 'L3'));
                $uri_parts = explode('?', $_SERVER['REQUEST_URI'], 2);
                ?>
<form method="post" action=""><?php 
                settings_fields('evcal_field_group');
                wp_nonce_field(AJDE_EVCAL_BASENAME, 'evcal_noncename');
                ?>
<div id="evcal_2" class="postbox evcal_admin_meta">	
	<div class="inside">
		<h2><?php 
                _e('Type in custom language text for front-end calendar', 'eventon');
                ?>
</h2>
		<h4><?php 
                _e('Select your language', 'eventon');
                ?>
 <select id='evo_lang_selection' url=<?php 
                echo 'http://' . $_SERVER['HTTP_HOST'] . $uri_parts[0];
                ?>
>		
		<?php 
                foreach ($lang_variations as $lang) {
                    echo "<option value='{$lang}' " . ($__lang_version == $lang ? 'selected="select"' : null) . ">{$lang}</option>";
                }
                ?>
</select><span class='evoGuideCall'>?<em><?php 
                _e("You can use this to save upto 2 different languages for customized text. Once saved use the shortcode to show calendar text in that customized language. eg. [add_eventon lang='L2']", 'eventon');
                ?>
</em></span></h4>
		<p><i><?php 
                _e('Please use the below fields to type in custom language text that will be used to replace the default language text on the front-end of the calendar.', 'eventon');
                ?>
</i></p>
		
		<div class='evoLANG_section_header evo_settings_toghead'><?php 
                _e('Months and Dates', 'eventon');
                ?>
</div>
		<div class='evo_settings_togbox'>
			<div class='evcal_lang_box '>
				
				<?php 
                // full month names
                for ($x = 1; $x < 13; $x++) {
                    $pre_var_name = 'evcal_lang_';
                    echo "<p class='evcal_lang_p'><input type='text' name='" . $pre_var_name . $x . "' class='evcal_lang' value='";
                    echo !empty($lang_options[$pre_var_name . $x]) ? $lang_options[$pre_var_name . $x] : $eventon_months[$x];
                    echo "'/></p>";
                }
                echo "<p class='clear' style='padding-top:5px'></p>";
                // 3 letter month names
                for ($x = 1; $x < 13; $x++) {
                    $pre_var_name = 'evo_lang_3Lm_';
                    $month_3l = substr($eventon_months[$x], 0, 3);
                    echo "<p class='evcal_lang_p'><input type='text' name='" . $pre_var_name . $x . "' class='evcal_lang' value='";
                    echo !empty($lang_options[$pre_var_name . $x]) ? $lang_options[$pre_var_name . $x] : $month_3l;
                    echo "'/></p>";
                }
                echo "<p class='clear' style='padding-top:5px'></p>";
                // 1 letter month names
                for ($x = 1; $x < 13; $x++) {
                    $pre_var_name = 'evo_lang_1Lm_';
                    $month_3l = substr($eventon_months[$x], 0, 1);
                    echo "<p class='evcal_lang_p'><input type='text' name='" . $pre_var_name . $x . "' class='evcal_lang' value='";
                    echo !empty($lang_options[$pre_var_name . $x]) ? $lang_options[$pre_var_name . $x] : $month_3l;
                    echo "'/></p>";
                }
                echo "<p class='clear' style='padding-top:5px'></p>";
                ?>
<p style='clear:both'></p>			
			</div>
		
			<div class='evcal_lang_box'>
				<?php 
                // full day names
                for ($x = 1; $x < 8; $x++) {
                    $num = $x;
                    $pre_var_name = 'evcal_lang_day';
                    echo "<p class='evcal_lang_p'><input type='text' name='" . $pre_var_name . $num . "' class='evcal_lang' value='";
                    echo !empty($lang_options[$pre_var_name . $num]) ? $lang_options[$pre_var_name . $num] : $eventon_days[$x];
                    echo "'/></p>";
                }
                echo "<p class='clear' style='padding-top:5px'></p>";
                // 3 letter day names
                for ($x = 1; $x < 8; $x++) {
                    $num = $x;
                    $pre_var_name = 'evo_lang_3Ld_';
                    $day_3l = substr($eventon_days[$x], 0, 3);
                    echo "<p class='evcal_lang_p'><input type='text' name='" . $pre_var_name . $num . "' class='evcal_lang' value='";
                    echo !empty($lang_options[$pre_var_name . $num]) ? $lang_options[$pre_var_name . $num] : $day_3l;
                    echo "'/></p>";
                }
                if (has_action('eventon_lang_after_daynames')) {
                    do_action('eventon_lang_after_daynames');
                }
                ?>
				
				
				<p style='clear:both'></p>
			</div>
			
		</div>
		
		
		<?php 
                require_once AJDE_EVCAL_PATH . '/includes/admin/settings/settings_language_tab.php';
                // hook into addons
                //eventon_settings_lang_tab_content
                $eventon_custom_language_array_updated = apply_filters('eventon_settings_lang_tab_content', array_filter($eventon_custom_language_array));
                foreach ($eventon_custom_language_array_updated as $cl) {
                    if (!empty($cl['type']) && $cl['type'] == 'togheader') {
                        echo "<div class='evoLANG_section_header evo_settings_toghead'>{$cl['name']}</div>\n\t\t\t\t\t\t<div class='evo_settings_togbox'>";
                    } else {
                        if (!empty($cl['type']) && $cl['type'] == 'togend') {
                            echo '</div>';
                        } else {
                            if (!empty($cl['type']) && $cl['type'] == 'subheader') {
                                echo '<div class="evoLANG_subheader">' . $cl['label'] . '</div><div class="evoLANG_subsec">';
                            } else {
                                $val = !empty($lang_options[$cl['name']]) ? $lang_options[$cl['name']] : '';
                                $placeholder = !empty($cl['placeholder']) ? $cl['placeholder'] : '';
                                echo "\n\t\t\t\t\t\t<div class='eventon_custom_lang_line'>\n\t\t\t\t\t\t\t<div class='eventon_cl_label_out'>\n\t\t\t\t\t\t\t\t<p class='eventon_cl_label'>{$cl['label']}</p>\n\t\t\t\t\t\t\t</div>";
                                echo '<input class="eventon_cl_input" type="text" name="' . $cl['name'] . '" placeholder="' . $placeholder . '" value="' . stripslashes($val) . '"/>';
                                echo "<div class='clear'></div>\n\t\t\t\t\t\t</div>";
                                echo !empty($cl['legend']) ? "<p class='eventon_cl_legend'>{$cl['legend']}</p>" : null;
                            }
                        }
                    }
                }
                ?>
		
		
		
		
		
				
	</div>
	
</div>
<input type="submit" class="evo_admin_btn btn_prime" value="<?php 
                _e('Save Changes', 'eventon');
                ?>
" style='margin-top:15px'/>	
</form>
<?php 
                break;
                // STYLES TAB
            // STYLES TAB
            case "evcal_3":
                echo '<form method="post" action="">';
                //settings_fields('evcal_field_group');
                wp_nonce_field(AJDE_EVCAL_BASENAME, 'evcal_noncename');
                // styles settings tab content
                require_once AJDE_EVCAL_PATH . '/includes/admin/settings/settings_styles_tab.php';
                break;
                // ADDON TAB
            // ADDON TAB
            case "evcal_4":
                // Addons settings tab content
                require_once AJDE_EVCAL_PATH . '/includes/admin/settings/settings_addons_tab.php';
                break;
                // support TAB
            // support TAB
            case "evcal_5":
                // Addons settings tab content
                require_once AJDE_EVCAL_PATH . '/includes/admin/settings/settings_support_tab.php';
                break;
                // ADVANDED extra field
            // ADVANDED extra field
            case "extra":
                // advanced tab content
                require_once AJDE_EVCAL_PATH . '/includes/admin/settings/settings_advanced_tab.php';
                break;
            default:
                do_action('eventon_settings_tabs_' . $focus_tab);
                break;
        }
        echo "</div>";
    }
Exemplo n.º 11
0
    /**
     * Content for each step of the CSV import stages
     * Via switch statement
     */
    function step_content($steps)
    {
        global $eventon_csv;
        $evo_opt = get_option('evcal_options_evcal_1');
        $event_type_count = evo_get_ett_count($evo_opt);
        $cmd_count = evo_calculate_cmd_count($evo_opt);
        switch ($steps) {
            // Step nuber 1
            case 'uno':
                ?>
					
			<h2><?php 
                _e('Step 1: Upload CSV file', 'eventon');
                ?>
</h2>
			<?php 
                $this->form();
                $this->print_guidelines();
                break;
                // Step number 2
            // Step number 2
            case 'dos':
                if ($this->csv_verify_nonce_post('eventon_csvi_noncename')) {
                    ?>
				<h2><?php 
                    _e('Step 2: Verify uploaded events', 'eventon');
                    ?>
</h2>
				<p><?php 
                    _e('In this step you can see below the events we found from your uploaded CSV file. Please making sure the data is present correctly. You can also click on each event to deselect them from being imported to EventON - in the next step.', 'eventon');
                    ?>
</p>
				<?php 
                    // verified nonce
                    if (empty($_FILES['csv_import']['tmp_name'])) {
                        $this->log['error'][] = 'No file uploaded, Please try again!.';
                        $this->print_messages();
                        $this->step_content('uno');
                        return;
                    }
                    // get csv helper file
                    require_once $eventon_csv->plugin_path . '/assets/DataSource.php';
                    $time_start = microtime(true);
                    $csv = new File_CSV_DataSource();
                    $file = $_FILES['csv_import']['tmp_name'];
                    $this->stripBOM($file);
                    if (!$csv->load($file)) {
                        $this->log['error'][] = 'Failed to load file, Please try again!.';
                        $this->print_messages();
                        $this->step_content('uno');
                        return;
                    }
                    // pad shorter rows with empty values
                    $csv->symmetrize();
                    // correct wordpress time zone for event posts
                    $tz = get_option('timezone_string');
                    if ($tz && function_exists('date_default_timezone_set')) {
                        date_default_timezone_set($tz);
                    }
                    ?>
					<form class="" action='<?php 
                    echo admin_url();
                    ?>
admin.php?page=eventon&tab=evcal_csv&steps=thres' method="post" enctype="multipart/form-data">
					<?php 
                    settings_fields('eventon_csvi_field_grp');
                    wp_nonce_field($eventon_csv->plugin_path, 'eventon_csvi_dos_noncename');
                    echo "<table id='eventon_csv_data_list' class='wp-list-table widefat'>\r\n\t\t\t\t\t\t\t<thead>\r\n\t\t\t\t\t\t\t<th></th>\r\n\t\t\t\t\t\t\t<th title='Publish status for event'>Status</th>\r\n\t\t\t\t\t\t\t<th>Event Name</th>\r\n\t\t\t\t\t\t\t<th>Description</th>\r\n\t\t\t\t\t\t\t<th>Start Date & Time</th>\r\n\t\t\t\t\t\t\t<th>End Date & Time</th>\r\n\t\t\t\t\t\t\t<th>Location</th>\r\n\t\t\t\t\t\t\t<th>Organizer</th>\r\n\t\t\t\t\t\t\t</thead>";
                    // for each record
                    $x = 0;
                    foreach ($csv->connect() as $csv_data) {
                        $ev_desc_class = !empty($csv_data['event_description']) ? 'inner_check' : 'inner_check_no';
                        $ev_location_class = !empty($csv_data['event_location']) ? 'inner_check' : 'inner_check_no';
                        $ev_orga_class = !empty($csv_data['event_organizer']) ? 'inner_check' : 'inner_check_no';
                        // event date validation
                        if (!empty($csv_data['event_start_date'])) {
                            if (preg_match('/^(\\d{1,2})\\/(\\d{1,2})\\/((?:\\d{2}){1,2})$/', $csv_data['event_start_date'])) {
                                $event_start_date = $event_start_date_val = $csv_data['event_start_date'];
                            } else {
                                $event_start_date = "<p class='inner_check_no eventon_csv_icons'></p>";
                                $event_start_date_val = null;
                            }
                        } else {
                            $event_start_date = "<p class='inner_check_no eventon_csv_icons'></p>";
                            $event_start_date_val = null;
                        }
                        // event start time validation
                        if (!empty($csv_data['event_start_time'])) {
                            if (preg_match('/(1[0-2]|0?[0-9]):[0-5]?[0-9]?:(AM|PM)/', $csv_data['event_start_time'])) {
                                $event_start_time = $event_start_time_val = $csv_data['event_start_time'];
                            } else {
                                $event_start_time = "<p class='inner_check_no eventon_csv_icons'></p>";
                                $event_start_time_val = null;
                            }
                        } else {
                            $event_start_time = "<p class='inner_check_no eventon_csv_icons'></p>";
                            $event_start_time_val = null;
                        }
                        // end time
                        if (!empty($csv_data['event_end_time'])) {
                            if (preg_match('/(1[0-2]|0?[0-9]):[0-5]?[0-9]?:(AM|PM)/', $csv_data['event_end_time'])) {
                                $event_end_time = $event_end_time_val = $csv_data['event_end_time'];
                            } else {
                                $event_end_time = "<p class='inner_check_no eventon_csv_icons'></p>";
                                $event_end_time_val = $event_start_time_val;
                            }
                        } else {
                            $event_end_time = "<p class='inner_check_no eventon_csv_icons'></p>";
                            $event_end_time_val = $event_start_time_val;
                        }
                        // event end date
                        if (!empty($csv_data['event_end_date'])) {
                            if (preg_match('/^(\\d{1,2})\\/(\\d{1,2})\\/((?:\\d{2}){1,2})$/', $csv_data['event_end_date'])) {
                                $event_end_date = $event_end_date_val = $csv_data['event_end_date'];
                            } else {
                                $event_end_date = "<p class='inner_check_no eventon_csv_icons'></p>";
                                $event_end_date_val = $event_start_date_val;
                            }
                        } else {
                            // no end date present
                            $event_end_date = "<p class='inner_check_no eventon_csv_icons'></p>";
                            $event_end_date_val = $event_start_date_val;
                        }
                        // description
                        $event_description = !empty($csv_data['event_description']) ? convert_chars(addslashes($csv_data['event_description'])) : null;
                        // /print_r($csv_data);
                        $updated_csv_data = $csv_data;
                        $updated_csv_data['event_start_date'] = $event_start_date_val;
                        $updated_csv_data['event_start_time'] = $event_start_time_val;
                        $updated_csv_data['event_end_date'] = $event_end_date_val;
                        $updated_csv_data['event_end_time'] = $event_end_time_val;
                        $updated_csv_data['event_description'] = $event_description;
                        ?>
	
						<tr class='csv_list_row'>
							<?php 
                        echo $this->_html_get_hidden_input_fields($updated_csv_data, $x, $event_type_count, $cmd_count);
                        ?>
							<td class='col1'><p class='outter_check eventon_csv_icons'></p></td>
							<td><i><?php 
                        echo $csv_data['publish_status'];
                        ?>
</i></td>
							<td><?php 
                        echo $csv_data['event_name'];
                        ?>
</td>
							<td><p class='<?php 
                        echo $ev_desc_class;
                        ?>
 eventon_csv_icons'></p></td>
							<td><?php 
                        echo $event_start_date . '<br/>' . $event_start_time;
                        ?>
</td>
							<td><?php 
                        echo $event_end_date . '<br/>' . $event_end_time;
                        ?>
</td>
							<td title='<?php 
                        echo $csv_data['event_location'];
                        ?>
'><p class='<?php 
                        echo $ev_location_class;
                        ?>
 eventon_csv_icons'></p></td>
							<td title='<?php 
                        echo $csv_data['event_organizer'];
                        ?>
'><p class='<?php 
                        echo $ev_orga_class;
                        ?>
 eventon_csv_icons'></p></td>
						</tr>
						
						<?php 
                        $x++;
                    }
                    echo "</table><p class='submit'><input type='submit' class='evo_admin_btn btn_tritiary' name='submit' value='Next: Import selected events' /></p></form>";
                    if (file_exists($file)) {
                        @unlink($file);
                    }
                    $exec_time = microtime(true) - $time_start;
                    $this->log['notice'][] = sprintf("<b>Found {$x} events in %.2f seconds from the csv file.</b>", $exec_time);
                    $this->print_messages();
                }
                break;
                // Step three
            // Step three
            case 'thres':
                if ($this->csv_verify_nonce_post('eventon_csvi_dos_noncename')) {
                    if (isset($_POST['csvi'])) {
                        $skipped = 0;
                        $imported = 0;
                        $event_names_imp = array();
                        $event_names_skip = array();
                        $time_start = microtime(true);
                        //$date_format = eventon_get_timeNdate_format();
                        // Run through each event row and add them
                        foreach ($_POST['csvi'] as $event) {
                            // check is the event is selected to be imported
                            if ($event['status'] == 'yes') {
                                if ($post_id = $this->create_post($event)) {
                                    $imported++;
                                    $event_names_imp[] = $event['event_name'];
                                    /*	Event Start and end time and dates	*/
                                    if (isset($event['event_start_date']) && isset($event['event_end_date']) && isset($event['event_start_time']) && isset($event['event_end_time'])) {
                                        $start_time = explode(":", $event['event_start_time']);
                                        $end_time = explode(":", $event['event_end_time']);
                                        $date_array = array('evcal_start_date' => $event['event_start_date'], 'evcal_start_time_hour' => $start_time[0], 'evcal_start_time_min' => $start_time[1], 'evcal_st_ampm' => $start_time[2], 'evcal_end_date' => $event['event_end_date'], 'evcal_end_time_hour' => $end_time[0], 'evcal_end_time_min' => $end_time[1], 'evcal_et_ampm' => $end_time[2], 'evcal_allday' => !empty($event['all_day']) ? $event['all_day'] : 'no');
                                        $proper_time = eventon_get_unix_time($date_array, 'm/d/Y');
                                        // save required start time variables
                                        $this->create_custom_fields($post_id, 'evcal_srow', $proper_time['unix_start']);
                                        $this->create_custom_fields($post_id, 'evcal_erow', $proper_time['unix_end']);
                                        //$this->create_custom_fields($post_id, 'data', $date_format[1]);
                                    }
                                    // rest of the custom meta fields
                                    $this->save_custom_meta_fields($event, $post_id, $event_type_count, $cmd_count);
                                } else {
                                    $skipped++;
                                    $event_names_skip[] = $event['event_name'];
                                }
                            }
                        }
                        // create notices
                        if ($skipped > 0) {
                            $this->log['notice'][] = "<b>Skipped {$skipped} events (most likely due to empty title or description).</b>";
                        }
                        $exec_time = microtime(true) - $time_start;
                        $this->log['notice'][] = sprintf("<b>Imported {$imported} events in %.2f seconds.</b>", $exec_time);
                        $this->print_messages();
                        // =====
                        // Show the report on import process
                        _e('<h2>Done!</h2>', 'eventon');
                        echo "<p>Please go to <a href='" . admin_url() . "edit.php?post_type=ajde_events'>All Events</a> to further customize the events you just imported.</p>";
                        // Success report
                        if (count($event_names_imp) > 0) {
                            echo "<table id='eventon_csv_data_list' class='wp-list-table widefat'>\r\n\t\t\t\t\t\t\t\t\t<thead>\r\n\t\t\t\t\t\t\t\t\t<th>Event Name</th>\r\n\t\t\t\t\t\t\t\t\t<th>Status</th>\r\n\t\t\t\t\t\t\t\t\t</thead>";
                            foreach ($event_names_imp as $event_name) {
                                echo "<tr><td>{$event_name}</td><td>Imported</td></tr>";
                            }
                            // didnt import
                            if (count($event_names_skip) > 0) {
                                foreach ($event_names_skip as $event_name) {
                                    echo "<tr><td>{$event_name}</td><td>Not Imported</td></tr>";
                                }
                            }
                            echo "</table>";
                        }
                    }
                }
                break;
                // default step
            // default step
            default:
                ?>
				<h3><?php 
                _e('Import Events from a CSV file', 'eventon');
                ?>
</h3>
				<p>CSV Importer addon for EventON will allow you to export events from another event plugin or another event calendar, into CSV file format, and import those events into EventON Calendar.</p>
				
				<hr/>
				
				<a href='<?php 
                echo admin_url();
                ?>
admin.php?page=eventon&tab=evcal_csv&steps=uno' class='csv_import_get_start_btn evo_admin_btn btn_prime'><?php 
                _e('Get Started Now', 'eventon');
                ?>
</a>		
						
				<?php 
                $this->print_guidelines();
                break;
        }
        // end switch statement
    }
Exemplo n.º 12
0
 function export_events()
 {
     // check if admin and loggedin
     if (!is_admin() && !is_user_logged_in()) {
         die('User not loggedin!');
     }
     // verify nonce
     if (!wp_verify_nonce($_REQUEST['nonce'], 'eventon_download_events')) {
         die('Security Check Failed!');
     }
     header('Content-Encoding: UTF-8');
     header('Content-type: text/csv; charset=UTF-8');
     header("Content-Disposition: attachment; filename=Eventon_events_" . date("d-m-y") . ".csv");
     header("Pragma: no-cache");
     header("Expires: 0");
     echo "";
     // UTF-8 BOM
     $evo_opt = get_option('evcal_options_evcal_1');
     $event_type_count = evo_get_ett_count($evo_opt);
     $cmd_count = evo_calculate_cmd_count($evo_opt);
     $fields = apply_filters('evo_csv_export_fields', array('publish_status', 'evcal_event_color' => 'color', 'event_name', 'event_description', 'event_start_date', 'event_start_time', 'event_end_date', 'event_end_time', 'evcal_allday' => 'all_day', 'evo_hide_endtime' => 'hide_end_time', 'evcal_gmap_gen' => 'event_gmap', 'evo_year_long' => 'yearlong', '_featured' => 'featured', 'evo_location_id' => 'evo_location_id', 'evcal_location_name' => 'location_name', 'evcal_location' => 'event_location', 'evo_organizer_id' => 'evo_organizer_id', 'evcal_organizer' => 'event_organizer', 'evcal_subtitle' => 'evcal_subtitle', 'evcal_lmlink' => 'learnmore link', 'image_url', 'evcal_repeat' => 'repeatevent', 'evcal_rep_freq' => 'frequency', 'evcal_rep_num' => 'repeats', 'evp_repeat_rb' => 'repeatby'));
     $csvHeader = '';
     foreach ($fields as $var => $val) {
         $csvHeader .= $val . ',';
     }
     // event types
     for ($y = 1; $y <= $event_type_count; $y++) {
         $_ett_name = $y == 1 ? 'event_type' : 'event_type_' . $y;
         $csvHeader .= $_ett_name . ',';
     }
     // for event custom meta data
     for ($z = 1; $z <= $cmd_count; $z++) {
         $_cmd_name = 'cmd_' . $z;
         $csvHeader .= $_cmd_name . ",";
     }
     $csvHeader = apply_filters('evo_export_events_csv_header', $csvHeader);
     $csvHeader .= "\n";
     echo iconv("UTF-8", "ISO-8859-2", $csvHeader);
     $events = new WP_Query(array('posts_per_page' => -1, 'post_type' => 'ajde_events', 'post_status' => 'any'));
     if ($events->have_posts()) {
         date_default_timezone_set('UTC');
         // for each event
         while ($events->have_posts()) {
             $events->the_post();
             $__id = get_the_ID();
             $pmv = get_post_meta($__id);
             $csvRow = '';
             $csvRow .= get_post_status($__id) . ",";
             //echo (!empty($pmv['_featured'])?$pmv['_featured'][0]:'no').",";
             $csvRow .= (!empty($pmv['evcal_event_color']) ? $pmv['evcal_event_color'][0] : '') . ",";
             // event name
             $eventName = get_the_title();
             $eventName = htmlentities($eventName);
             //$output = iconv("utf-8", "ascii//TRANSLIT//IGNORE", $eventName);
             //$output =  preg_replace("/^'|[^A-Za-z0-9\s-]|'$/", '', $output);
             $csvRow .= '"' . $eventName . '",';
             $event_content = get_the_content();
             $event_content = str_replace('"', "'", $event_content);
             $event_content = str_replace(',', "\\,", $event_content);
             $event_content = htmlentities($event_content);
             $csvRow .= '"' . $event_content . '",';
             // start time
             $start = !empty($pmv['evcal_srow']) ? $pmv['evcal_srow'][0] : '';
             if (!empty($start)) {
                 $csvRow .= date('n/j/Y,g:i:A', $start) . ',';
             } else {
                 $csvRow .= "'','',";
             }
             // end time
             $end = !empty($pmv['evcal_erow']) ? $pmv['evcal_erow'][0] : '';
             if (!empty($end)) {
                 $csvRow .= date('n/j/Y,g:i:A', $end) . ',';
             } else {
                 $csvRow .= "'','',";
             }
             // taxonomy meta
             $taxopt = get_option("evo_tax_meta");
             // FOR EACH field
             $loctaxid = $orgtaxid = '';
             $loctaxname = $orgtaxname = '';
             foreach ($fields as $var => $val) {
                 // yes no values
                 if (in_array($val, array('featured', 'all_day', 'hide_end_time', 'event_gmap', 'evo_year_long', '_evo_month_long', 'repeatevent'))) {
                     $csvRow .= (!empty($pmv[$var]) && $pmv[$var][0] == 'yes' ? 'yes' : 'no') . ',';
                 }
                 // organizer field
                 if ($val == 'evo_organizer_id') {
                     $Orgterms = wp_get_object_terms($__id, 'event_organizer');
                     if ($Orgterms && !is_wp_error($Orgterms)) {
                         $orgtaxid = $Orgterms[0]->term_id;
                         $orgtaxname = $Orgterms[0]->name;
                         $csvRow .= '"' . $orgtaxid . '",';
                     } else {
                         $csvRow .= ",";
                     }
                 }
                 if ($val == 'evcal_organizer') {
                     if ($orgtaxname) {
                         $csvRow .= '"' . $orgtaxname . '",';
                     } elseif (!empty($pmv[$var])) {
                         $value = htmlentities($pmv[$var][0]);
                         $csvRow .= '"' . $value . '"';
                     } else {
                         $csvRow .= ",";
                     }
                     continue;
                 }
                 // location tax field
                 if ($val == 'evo_location_id') {
                     $Locterms = wp_get_object_terms($__id, 'event_location');
                     if ($Locterms && !is_wp_error($Locterms)) {
                         $loctaxid = $Locterms[0]->term_id;
                         $loctaxname = $Locterms[0]->name;
                         $csvRow .= '"' . $loctaxid . '",';
                     } else {
                         $csvRow .= ",";
                     }
                 }
                 if ($val == 'location_name') {
                     if ($loctaxname) {
                         $csvRow .= '"' . $loctaxname . '",';
                     } elseif (!empty($pmv[$var])) {
                         $value = htmlentities($pmv[$var][0]);
                         $csvRow .= '"' . $value . '"';
                     } else {
                         $csvRow .= ",";
                     }
                     update_post_meta(3089, 'aa', $loctaxname . 'yy');
                     continue;
                 }
                 if ($val == 'event_location') {
                     if ($loctaxid) {
                         $termMeta = evo_get_term_meta('event_location', $loctaxid, $taxopt, true);
                         $csvRow .= !empty($termMeta['location_address']) ? '"' . $termMeta['location_address'] . '",' : ",";
                     } elseif (!empty($pmv[$var])) {
                         $value = htmlentities($pmv[$var][0]);
                         $csvRow .= '"' . $value . '"';
                     } else {
                         $csvRow .= ",";
                     }
                     continue;
                 }
                 // skip fields
                 if (in_array($val, array('featured', 'all_day', 'hide_end_time', 'event_gmap', 'evo_year_long', '_evo_month_long', 'repeatevent', 'color', 'publish_status', 'event_name', 'event_description', 'event_start_date', 'event_start_time', 'event_end_date', 'event_end_time', 'evo_organizer_id', 'evo_location_id'))) {
                     continue;
                 }
                 // image
                 if ($val == 'image_url') {
                     $img_id = get_post_thumbnail_id($__id);
                     if ($img_id != '') {
                         $img_src = wp_get_attachment_image_src($img_id, 'full');
                         $csvRow .= $img_src[0] . ",";
                     } else {
                         $csvRow .= ",";
                     }
                 } else {
                     if (!empty($pmv[$var])) {
                         $value = htmlentities($pmv[$var][0]);
                         $csvRow .= '"' . $value . '"';
                     } else {
                         $csvRow .= '';
                     }
                     $csvRow .= ',';
                 }
             }
             // event types
             for ($y = 1; $y <= $event_type_count; $y++) {
                 $_ett_name = $y == 1 ? 'event_type' : 'event_type_' . $y;
                 $terms = get_the_terms($__id, $_ett_name);
                 if ($terms && !is_wp_error($terms)) {
                     $csvRow .= '"';
                     foreach ($terms as $term) {
                         $csvRow .= $term->term_id . ',';
                         //$csvRow.= $term->name.',';
                     }
                     $csvRow .= '",';
                 } else {
                     $csvRow .= ",";
                 }
             }
             // for event custom meta data
             for ($z = 1; $z <= $cmd_count; $z++) {
                 $cmd_name = '_evcal_ec_f' . $z . 'a1_cus';
                 $csvRow .= !empty($pmv[$cmd_name]) ? '"' . str_replace('"', "'", $pmv[$cmd_name][0]) . '"' : '';
                 $csvRow .= ",";
             }
             $csvRow = apply_filters('evo_export_events_csv_row', $csvRow, $__id, $pmv);
             $csvRow .= "\n";
             echo iconv("UTF-8", "ISO-8859-2", $csvRow);
         }
     }
     wp_reset_postdata();
 }