' . $event_label . ' Information : ', 'mage-eventpress') . get_the_title(get_the_id()), array($this, 'mp_event_all_in_tab'), 'mep_events', 'normal', 'high');
add_meta_box('mep-event-template', __('Template', 'mage-eventpress'), array($this, 'mep_event_template_meta_box_cb'), 'mep_events', 'side', 'low');
}
public function mp_event_all_in_tab()
{
$event_label = mep_get_option('mep_event_label', 'general_setting_sec', 'Events');
$post_id = get_the_id();
?>
')) {
// Block editor.
$block_editor = true;
}
if (!$gutenberg && !$block_editor) {
return false;
}
include_once ABSPATH . 'wp-admin/includes/plugin.php';
if (!is_plugin_active('classic-editor/classic-editor.php')) {
return true;
}
$use_block_editor = (get_option('classic-editor-replace') === 'no-replace');
return $use_block_editor;
}
public function mp_event_venue($post_id)
{
$event_label = mep_get_option('mep_event_label', 'general_setting_sec', 'Events');
$values = get_post_custom($post_id);
$user_api = mep_get_option('google-map-api', 'general_setting_sec', '');
$map_type = mep_get_option('mep_google_map_type', 'general_setting_sec', 'iframe');
$mep_org_address = array_key_exists('mep_org_address', $values) ? $values['mep_org_address'][0] : 0;
$map_visible = array_key_exists('mep_sgm', $values) ? $values['mep_sgm'][0] : 0;
$author_id = get_post_field('post_author', $post_id);
if ($this->is_gutenberg_active()) { ?>
mp_event_reg_status($post_id);
$this->mp_event_enddatetime_status($post_id);
$this->mp_event_available_seat_status($post_id);
$this->mp_event_reset_booking_count($post_id);
do_action('mp_event_switching_button_hook', $post_id);
$this->mp_event_speaker_ticket_type($post_id);
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Settings -> Tax Area', 'mage-eventpress'); ?>
|
ID);
$global_template = mep_get_option('mep_global_single_template', 'single_event_setting_sec', 'theme-2');
if (array_key_exists('mep_event_template', $values)) {
$current_template = $values['mep_event_template'][0];
} else {
$current_template = '';
}
if ($current_template) {
$_current_template = $current_template;
} else {
$_current_template = $global_template;
}
?>
prefix . 'event_extra_options';
if (
!isset($_POST['mep_events_extra_price_nonce']) ||
!wp_verify_nonce($_POST['mep_events_extra_price_nonce'], 'mep_events_extra_price_nonce')
) {
return;
}
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
}
if (!current_user_can('edit_post', $post_id)) {
return;
}
if (get_post_type($post_id) == 'mep_events') {
$old = get_post_meta($post_id, 'mep_events_extra_prices', true);
$new = array();
$names = isset($_POST['option_name']) ? mage_array_strip($_POST['option_name']) : [];
$urls = isset($_POST['option_price']) ? mage_array_strip($_POST['option_price']) : [];
$qty = isset($_POST['option_qty']) ? mage_array_strip($_POST['option_qty']) : [];
$qty_type = isset($_POST['option_qty_type']) ? mage_array_strip($_POST['option_qty_type']) : [];
$order_id = 0;
$count = count($names);
for ($i = 0; $i < $count; $i++) {
if ($names[$i] != '') :
$new[$i]['option_name'] = stripslashes(strip_tags($names[$i]));
endif;
if ($urls[$i] != '') :
$new[$i]['option_price'] = stripslashes(strip_tags($urls[$i]));
endif;
if ($qty[$i] != '') :
$new[$i]['option_qty'] = stripslashes(strip_tags($qty[$i]));
endif;
if ($qty_type[$i] != '') :
$new[$i]['option_qty_type'] = stripslashes(strip_tags($qty_type[$i]));
endif;
}
if (!empty($new) && $new != $old) {
update_post_meta($post_id, 'mep_events_extra_prices', $new);
} elseif (empty($new) && $old) {
delete_post_meta($post_id, 'mep_events_extra_prices', $old);
}
}
}
/**
* Now Saving the Event Meta Field Data
*/
add_action('save_post', 'mep_event_meta_save');
function mep_event_meta_save($post_id)
{
global $wpdb;
$table_name = $wpdb->prefix . "posts";
if (!isset($_POST['mep_event_ricn_text_nonce']) || !wp_verify_nonce($_POST['mep_event_ricn_text_nonce'], 'mep_event_ricn_text_nonce')) {
return;
}
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
}
if (!current_user_can('edit_post', $post_id)) {
return;
}
/**
* If the saving post is event then go on
*/
if (get_post_type($post_id) == 'mep_events') {
$pid = $post_id;
$oldm = get_post_meta($post_id, 'mep_event_more_date', true);
$more_start_date = isset($_POST['event_more_start_date']) ? mage_array_strip($_POST['event_more_start_date']) : array();
$more_start_time = isset($_POST['event_more_start_time']) ? mage_array_strip($_POST['event_more_start_time']) : '';
$more_end_date = isset($_POST['event_more_end_date']) ? mage_array_strip($_POST['event_more_end_date']) : '';
$more_end_time = isset($_POST['event_more_end_time']) ? mage_array_strip($_POST['event_more_end_time']) : '';
$mdate = [];
$mcount = count($more_start_date);
for ($m = 0; $m < $mcount; $m++) {
if ($more_start_date[$m] != '') :
$mdate[$m]['event_more_start_date'] = stripslashes(sanitize_text_field($more_start_date[$m]));
$mdate[$m]['event_more_start_time'] = stripslashes(sanitize_text_field($more_start_time[$m]));
$mdate[$m]['event_more_end_date'] = stripslashes(sanitize_text_field($more_end_date[$m]));
$mdate[$m]['event_more_end_time'] = stripslashes(sanitize_text_field($more_end_time[$m]));
endif;
}
$event_rt_status = sanitize_text_field($_POST['mep_rt_event_status']);
$event_rt_atdnce_mode = sanitize_text_field($_POST['mep_rt_event_attandence_mode']);
$event_rt_prv_date = sanitize_text_field($_POST['mep_rt_event_prvdate']);
$seat = 0;
$rsvs = 0;
$mep_location_venue = isset($_POST['mep_location_venue']) ? sanitize_text_field($_POST['mep_location_venue']) : "";
$mep_street = isset($_POST['mep_street']) ? sanitize_text_field($_POST['mep_street']) : "";
$mep_city = isset($_POST['mep_city']) ? sanitize_text_field($_POST['mep_city']) : "";
$mep_state = isset($_POST['mep_state']) ? sanitize_text_field($_POST['mep_state']) : "";
$mep_postcode = isset($_POST['mep_postcode']) ? sanitize_text_field($_POST['mep_postcode']) : "";
$mep_country = isset($_POST['mep_country']) ? sanitize_text_field($_POST['mep_country']) : "";
$mep_sgm = isset($_POST['mep_sgm']) ? sanitize_text_field($_POST['mep_sgm']) : "";
$mep_org_address = isset($_POST['mep_org_address']) ? sanitize_text_field($_POST['mep_org_address']) : "";
$_price = isset($_POST['_price']) ? sanitize_text_field($_POST['_price']) : "";
$event_start_date = sanitize_text_field($_POST['event_start_date']);
$event_start_time = sanitize_text_field($_POST['event_start_time']);
$event_end_date = sanitize_text_field($_POST['event_end_date']);
$event_end_time = sanitize_text_field($_POST['event_end_time']);
$latitude = isset($_POST['latitude']) ? sanitize_text_field($_POST['latitude']) : "";
$longitude = isset($_POST['latitude']) ? sanitize_text_field($_POST['longitude']) : "";
$location_name = isset($_POST['location_name']) ? sanitize_text_field($_POST['location_name']) : "";
$mep_full_name = isset($_POST['mep_full_name']) ? sanitize_text_field($_POST['mep_full_name']) : "";
$mep_reg_email = isset($_POST['mep_reg_email']) ? sanitize_text_field($_POST['mep_reg_email']) : "";
$mep_reg_phone = isset($_POST['mep_reg_phone']) ? sanitize_text_field($_POST['mep_reg_phone']) : "";
$mep_reg_address = isset($_POST['mep_reg_address']) ? sanitize_text_field($_POST['mep_reg_address']) : "";
$mep_reg_designation = isset($_POST['mep_reg_designation']) ? sanitize_text_field($_POST['mep_reg_designation']) : "";
$mep_reg_website = isset($_POST['mep_reg_website']) ? sanitize_text_field($_POST['mep_reg_website']) : "";
$mep_reg_veg = isset($_POST['mep_reg_veg']) ? sanitize_text_field($_POST['mep_reg_veg']) : "";
$mep_reg_company = isset($_POST['mep_reg_company']) ? sanitize_text_field($_POST['mep_reg_company']) : "";
$mep_reg_gender = isset($_POST['mep_reg_gender']) ? sanitize_text_field($_POST['mep_reg_gender']) : "";
$mep_reg_tshirtsize = isset($_POST['mep_reg_tshirtsize']) ? sanitize_text_field($_POST['mep_reg_tshirtsize']) : "";
$mep_reg_tshirtsize_list = isset($_POST['mep_reg_tshirtsize_list']) ? sanitize_text_field($_POST['mep_reg_tshirtsize_list']) : "";
$mep_event_template = isset($_POST['mep_event_template']) ? sanitize_text_field($_POST['mep_event_template']) : "";
$event_start_datetime = date('Y-m-d H:i:s', strtotime($event_start_date . ' ' . $event_start_time));
$event_end_datetime = date('Y-m-d H:i:s', strtotime($event_end_date . ' ' . $event_end_time));
$md = sizeof($mdate) > 0 ? end($mdate) : array();
$event_expire_datetime = sizeof($md) > 0 ? date('Y-m-d H:i:s', strtotime($md['event_more_end_date'] . ' ' . $md['event_more_end_time'])) : $event_end_datetime;
$mep_reg_status = isset($_POST['mep_reg_status']) ? sanitize_text_field($_POST['mep_reg_status']) : 'off';
$mep_show_advance_col_status = isset($_POST['mep_show_advance_col_status']) ? sanitize_text_field($_POST['mep_show_advance_col_status']) : 'off';
$mep_enable_custom_dt_format = isset($_POST['mep_enable_custom_dt_format']) ? sanitize_text_field($_POST['mep_enable_custom_dt_format']) : 'off';
$mep_show_end_datetime = isset($_POST['mep_show_end_datetime']) ? sanitize_text_field($_POST['mep_show_end_datetime']) : 'no';
$mep_reset_status = isset($_POST['mep_reset_status']) ? sanitize_text_field($_POST['mep_reset_status']) : 'off';
$mep_available_seat = isset($_POST['mep_available_seat']) ? sanitize_text_field($_POST['mep_available_seat']) : 'off';
$_tax_status = isset($_POST['_tax_status']) ? sanitize_text_field($_POST['_tax_status']) : 'none';
$_tax_class = isset($_POST['_tax_class']) ? sanitize_text_field($_POST['_tax_class']) : '';
$mep_member_only_user_role = isset($_POST['mep_member_only_user_role']) ? mage_array_strip(maybe_unserialize($_POST['mep_member_only_user_role'])) : maybe_unserialize(array('all'));
$sku = isset($_POST['mep_event_sku']) ? sanitize_text_field($_POST['mep_event_sku']) : $post_id;
$mep_rich_text_status = isset($_POST['mep_rich_text_status']) ? sanitize_text_field($_POST['mep_rich_text_status']) : 'enable';
if ($mep_reset_status == 'on') {
mep_reset_event_booking($post_id);
}
$date_format = get_option('date_format');
$time_format = get_option('time_format');
$date_format_arr = mep_date_format_list();
$time_format_arr = mep_time_format_list();
$current_global_date_format = mep_get_option('mep_global_date_format','datetime_setting_sec',$date_format);
$current_global_time_format = mep_get_option('mep_global_time_format','datetime_setting_sec',$time_format);
$current_global_custom_date_format = mep_get_option('mep_global_custom_date_format','datetime_setting_sec',$date_format);
$current_global_custom_time_format = mep_get_option('mep_global_custom_time_format','datetime_setting_sec',$time_format);
$current_global_timezone_display = mep_get_option('mep_global_timezone_display','datetime_setting_sec','no');
$mep_event_date_format = isset($_POST['mep_event_date_format']) ? sanitize_text_field($_POST['mep_event_date_format']) : $current_global_date_format;
$mep_event_time_format = isset($_POST['mep_event_time_format']) ? sanitize_text_field($_POST['mep_event_time_format']) : $current_global_time_format;
$mep_event_custom_date_format = isset($_POST['mep_event_custom_date_format']) ? sanitize_text_field($_POST['mep_event_custom_date_format']) : $current_global_custom_date_format;
$mep_custom_event_time_format = isset($_POST['mep_custom_event_time_format']) ? sanitize_text_field($_POST['mep_custom_event_time_format']) : $current_global_custom_time_format;
$mep_time_zone_display = isset($_POST['mep_time_zone_display']) ? sanitize_text_field($_POST['mep_time_zone_display']) : $current_global_timezone_display;
$mep_event_cc_email_text = isset($_POST['mep_event_cc_email_text']) ? wp_kses_post($_POST['mep_event_cc_email_text']) : '';
if($mep_reg_status == 'on'){
update_post_meta($post_id, 'mep_event_date_format', $mep_event_date_format);
update_post_meta($post_id, 'mep_event_time_format', $mep_event_time_format);
update_post_meta($post_id, 'mep_event_custom_date_format', $mep_event_custom_date_format);
update_post_meta($post_id, 'mep_custom_event_time_format', $mep_custom_event_time_format);
update_post_meta($post_id, 'mep_time_zone_display', $mep_time_zone_display);
}
update_post_meta($post_id, 'mep_event_cc_email_text', $mep_event_cc_email_text);
update_post_meta($post_id, 'mep_show_end_datetime', $mep_show_end_datetime);
update_post_meta($post_id, 'mep_rich_text_status', $mep_rich_text_status);
update_post_meta($post_id, 'mep_available_seat', $mep_available_seat);
update_post_meta($post_id, 'mep_reg_status', $mep_reg_status);
update_post_meta($post_id, 'mep_show_advance_col_status', $mep_show_advance_col_status);
update_post_meta($post_id, 'mep_enable_custom_dt_format', $mep_enable_custom_dt_format);
update_post_meta($post_id, '_tax_status', $_tax_status);
update_post_meta($post_id, '_tax_class', $_tax_class);
update_post_meta($post_id, 'mep_rt_event_status', $event_rt_status);
update_post_meta($post_id, 'mep_rt_event_attandence_mode', $event_rt_atdnce_mode);
update_post_meta($post_id, 'mep_rt_event_prvdate', $event_rt_prv_date);
update_post_meta($pid, 'mep_full_name', $mep_full_name);
update_post_meta($pid, 'mep_reg_email', $mep_reg_email);
update_post_meta($pid, 'mep_reg_phone', $mep_reg_phone);
update_post_meta($pid, 'mep_reg_address', $mep_reg_address);
update_post_meta($pid, 'mep_reg_designation', $mep_reg_designation);
update_post_meta($pid, 'mep_reg_website', $mep_reg_website);
update_post_meta($pid, 'mep_reg_veg', $mep_reg_veg);
update_post_meta($pid, 'mep_reg_company', $mep_reg_company);
update_post_meta($pid, 'mep_reg_gender', $mep_reg_gender);
update_post_meta($pid, 'mep_reg_tshirtsize', $mep_reg_tshirtsize);
update_post_meta($pid, 'mep_reg_tshirtsize_list', $mep_reg_tshirtsize_list);
update_post_meta($pid, 'mep_event_template', $mep_event_template);
update_post_meta($pid, 'mep_org_address', $mep_org_address);
update_post_meta($pid, 'event_start_date', $event_start_date);
update_post_meta($pid, 'event_start_time', $event_start_time);
update_post_meta($pid, 'event_end_date', $event_end_date);
update_post_meta($pid, 'event_end_time', $event_end_time);
update_post_meta($post_id, 'event_start_datetime', $event_start_datetime);
update_post_meta($post_id, 'event_end_datetime', $event_end_datetime);
update_post_meta($post_id, 'event_expire_datetime', $event_expire_datetime);
update_post_meta($pid, '_stock', $seat);
update_post_meta($pid, '_stock_msg', 'new');
update_post_meta($pid, 'longitude', $longitude);
update_post_meta($pid, 'latitude', $latitude);
update_post_meta($pid, 'location_name', $location_name);
update_post_meta($pid, 'mep_location_venue', $mep_location_venue);
update_post_meta($pid, 'mep_street', $mep_street);
update_post_meta($pid, '_sold_individually', 'no');
update_post_meta($pid, 'mep_city', $mep_city);
update_post_meta($pid, 'mep_state', $mep_state);
update_post_meta($pid, 'mep_postcode', $mep_postcode);
update_post_meta($pid, 'mep_country', $mep_country);
update_post_meta($pid, 'mep_sgm', $mep_sgm);
update_post_meta($pid, '_price', 0);
update_post_meta($pid, '_virtual', 'yes');
update_post_meta($pid, '_sku', $sku);
update_post_meta($pid, 'mep_member_only_user_role', $mep_member_only_user_role);
if (isset($_POST['mep_event_type']) && mage_array_strip($_POST['mep_event_type'])) {
$mep_event_type = 'online';
} else {
$mep_event_type = 'offline';
}
if (isset($_POST['mep_member_only_event']) && mage_array_strip($_POST['mep_member_only_event'])) {
$mep_event_member_type = 'member_only';
} else {
$mep_event_member_type = 'for_all';
}
update_post_meta($pid, 'mep_member_only_event', $mep_event_member_type);
update_post_meta($pid, 'mep_event_type', $mep_event_type);
$mp_event_virtual_type_des = isset($_POST['mp_event_virtual_type_des']) ? htmlspecialchars(mage_array_strip($_POST['mp_event_virtual_type_des'])) : "";
update_post_meta($pid, 'mp_event_virtual_type_des', $mp_event_virtual_type_des);
$_mdate = apply_filters('mep_more_date_arr_save', $mdate);
if (!empty($_mdate) && $_mdate != $oldm) {
update_post_meta($post_id, 'mep_event_more_date', $_mdate);
} elseif (empty($_mdate) && $oldm) {
delete_post_meta($post_id, 'mep_event_more_date', $oldm);
}
}
}