2020-01-22 07:15:24 -05:00
< ? php
2020-05-24 04:17:41 -04:00
if ( ! defined ( 'ABSPATH' )) {
die ;
} // Cannot access pages directly.
2020-01-22 07:15:24 -05:00
add_action ( 'mep_event_date' , 'mep_ev_datetime' );
2020-05-24 04:17:41 -04:00
if ( ! function_exists ( 'mep_ev_datetime' )) {
// This Function Will be depricate soon, Please don't use this any where
function mep_ev_datetime ()
{
global $event_meta ;
2020-09-23 06:57:02 -04:00
// $start_datetime = $event_meta['event_start_date'][0] . ' ' . $event_meta['event_start_time'][0];
$start_datetime = get_post_meta ( get_the_id (), 'event_start_datetime' , true );
$start_date = get_post_meta ( get_the_id (), 'event_start_date' , true ); //$event_meta['event_start_date'][0];
$start_time = get_post_meta ( get_the_id (), 'event_start_time' , true ); //$event_meta['event_start_time'][0];
2021-01-28 08:03:41 -05:00
$end_datetime = get_post_meta ( get_the_id (), 'event_end_datetime' , true ); //$event_meta['event_end_date'][0] . ' ' . $event_meta['event_end_time'][0];
2020-09-23 06:57:02 -04:00
$end_date = get_post_meta ( get_the_id (), 'event_end_date' , true ); //$event_meta['event_end_date'][0];
$end_time = get_post_meta ( get_the_id (), 'event_end_time' , true ); //$event_meta['event_end_time'][0];
2023-07-26 04:14:43 -04:00
$more_date = get_post_meta ( get_the_id (), 'mep_event_more_date' , true ) ? maybe_unserialize ( get_post_meta ( get_the_id (), 'mep_event_more_date' , true )) : [];
2020-05-24 04:17:41 -04:00
$recurring = get_post_meta ( get_the_id (), 'mep_enable_recurring' , true ) ? get_post_meta ( get_the_id (), 'mep_enable_recurring' , true ) : 'no' ;
$mep_show_upcoming_event = get_post_meta ( get_the_id (), 'mep_show_upcoming_event' , true ) ? get_post_meta ( get_the_id (), 'mep_show_upcoming_event' , true ) : 'no' ;
$cn = 1 ;
2020-01-22 07:15:24 -05:00
2020-05-24 04:17:41 -04:00
if ( $recurring == 'yes' ) {
if ( strtotime ( current_time ( 'Y-m-d H:i' )) < strtotime ( $start_datetime )) {
?>
< p >< ? php echo get_mep_datetime ( $start_datetime , 'date-text' ) . ' ' . get_mep_datetime ( $start_datetime , 'time' ); ?> - <?php if ($start_date != $end_date) {
echo get_mep_datetime ( $end_datetime , 'date-text' ) . ' - ' ;
}
echo get_mep_datetime ( $end_datetime , 'time' ); ?> </p>,
< ? php
}
foreach ( $more_date as $_more_date ) {
if ( strtotime ( current_time ( 'Y-m-d H:i' )) < strtotime ( $_more_date [ 'event_more_start_date' ] . ' ' . $_more_date [ 'event_more_start_time' ])) {
if ( $mep_show_upcoming_event == 'yes' ) {
$cnt = 1 ;
} else {
$cnt = $cn ;
}
2020-01-22 07:15:24 -05:00
2020-05-24 04:17:41 -04:00
if ( $cn == $cnt ) {
?>
2020-01-22 07:15:24 -05:00
2020-05-24 04:17:41 -04:00
< p >< ? php echo get_mep_datetime ( $_more_date [ 'event_more_start_date' ], 'date-text' ) . ' ' . get_mep_datetime ( $_more_date [ 'event_more_start_time' ], 'time' ); ?> - <?php if ($_more_date['event_more_start_date'] != $_more_date['event_more_end_date']) {
echo get_mep_datetime ( $_more_date [ 'event_more_end_date' ], 'date-text' ) . ' - ' ;
}
echo get_mep_datetime ( $_more_date [ 'event_more_end_time' ], 'time' ); ?> </p>
< ? php
$cn ++ ;
}
2020-01-22 07:15:24 -05:00
}
}
2020-05-24 04:17:41 -04:00
} elseif ( is_array ( $more_date ) && sizeof ( $more_date ) > 0 ) {
?>
< p >< ? php echo get_mep_datetime ( $start_datetime , 'date-text' ) . ' ' . get_mep_datetime ( $start_datetime , 'time' ); ?> - <?php if ($start_date != $end_date) {
echo get_mep_datetime ( $end_datetime , 'date-text' ) . ' - ' ;
}
echo get_mep_datetime ( $end_datetime , 'time' ); ?> </p>
< ? php foreach ( $more_date as $_more_date ) {
2020-01-22 07:15:24 -05:00
?>
2020-05-24 04:17:41 -04:00
< p >< ? php echo get_mep_datetime ( $_more_date [ 'event_more_start_date' ], 'date-text' ) . ' ' . get_mep_datetime ( $_more_date [ 'event_more_start_time' ], 'time' ); ?> - <?php if ($_more_date['event_more_start_date'] != $_more_date['event_more_end_date']) {
echo get_mep_datetime ( $_more_date [ 'event_more_end_date' ], 'date-text' ) . ' - ' ;
}
echo get_mep_datetime ( $_more_date [ 'event_more_end_time' ], 'time' ); ?> </p>
2020-01-22 07:15:24 -05:00
< ? php
}
2020-05-24 04:17:41 -04:00
} else {
?>
< p >< ? php echo get_mep_datetime ( $start_datetime , 'date-text' ) . ' ' . get_mep_datetime ( $start_datetime , 'time' ); ?> - <?php if ($start_date != $end_date) {
echo get_mep_datetime ( $end_datetime , 'date-text' ) . ' - ' ;
}
echo get_mep_datetime ( $end_datetime , 'time' ); ?> </p>
2020-01-22 07:15:24 -05:00
< ? php
2020-05-24 04:17:41 -04:00
}
2020-01-22 07:15:24 -05:00
}
}
2021-09-03 06:25:05 -04:00
add_action ( 'mep_event_date_default_theme' , 'mep_date_in_default_theme' , 10 , 2 );
2020-05-24 04:17:41 -04:00
if ( ! function_exists ( 'mep_date_in_default_theme' )) {
2021-09-03 06:25:05 -04:00
function mep_date_in_default_theme ( $event_id , $title = 'yes' )
2023-07-24 22:16:45 -04:00
{
$event_meta = get_post_custom ( $event_id );
$start_datetime = get_post_meta ( $event_id , 'event_start_datetime' , true ) ? get_post_meta ( $event_id , 'event_start_datetime' , true ) : '' ; //$event_meta['event_start_datetime'][0];
$start_date = get_post_meta ( $event_id , 'event_start_date' , true ) ? get_post_meta ( $event_id , 'event_start_date' , true ) : '' ; //$event_meta['event_start_date'][0];
$start_time = get_post_meta ( $event_id , 'event_start_time' , true ) ? get_post_meta ( $event_id , 'event_start_time' , true ) : '' ; //$event_meta['event_start_time'][0];
$end_datetime = get_post_meta ( $event_id , 'event_end_datetime' , true ) ? get_post_meta ( $event_id , 'event_end_datetime' , true ) : '' ; //$event_meta['event_end_datetime'][0];
$end_date = get_post_meta ( $event_id , 'event_end_date' , true ) ? get_post_meta ( $event_id , 'event_end_date' , true ) : '' ; //$event_meta['event_end_date'][0];
$end_time = get_post_meta ( $event_id , 'event_end_time' , true ) ? get_post_meta ( $event_id , 'event_end_time' , true ) : '' ; //$event_meta['event_end_time'][0];
2020-05-24 04:17:41 -04:00
$cn = 1 ;
2023-07-24 22:16:45 -04:00
// $more_date = array(get_post_meta($event_id, 'event_start_date', true) . ' ' . get_post_meta($event_id, 'event_start_time', true));
$recurring = get_post_meta ( $event_id , 'mep_enable_recurring' , true ) ? get_post_meta ( $event_id , 'mep_enable_recurring' , true ) : 'no' ;
$mep_show_upcoming_event = get_post_meta ( $event_id , 'mep_show_upcoming_event' , true ) ? get_post_meta ( $event_id , 'mep_show_upcoming_event' , true ) : 'no' ;
2023-07-26 04:14:43 -04:00
$_more_date = get_post_meta ( $event_id , 'mep_event_more_date' , true ) ? maybe_unserialize ( get_post_meta ( $event_id , 'mep_event_more_date' , true )) : array ();
2020-11-17 07:15:34 -05:00
$more_date = apply_filters ( 'mep_event_date_more_date_array' , $_more_date , $event_id );
2021-09-03 06:25:05 -04:00
$show_end_date = get_post_meta ( $event_id , 'mep_show_end_datetime' , true ) ? get_post_meta ( $event_id , 'mep_show_end_datetime' , true ) : 'yes' ;
$end_date_display_status = apply_filters ( 'mep_event_datetime_status' , $show_end_date , $event_id );
if ( $title == 'yes' ){
require ( mep_template_file_path ( 'single/date_list_title.php' ));
}
2020-05-24 04:17:41 -04:00
if ( sizeof ( $more_date ) > 2 ) {
echo '<ul id="mep_event_date_sch">' ;
} else {
echo '<ul>' ;
2020-01-22 07:15:24 -05:00
}
2020-05-24 04:17:41 -04:00
if ( $recurring == 'yes' ) {
if ( strtotime ( current_time ( 'Y-m-d H:i' )) < strtotime ( $start_datetime )) {
2020-07-12 06:42:13 -04:00
require ( mep_template_file_path ( 'single/date_list.php' ));
2020-05-24 04:17:41 -04:00
}
2020-01-22 07:15:24 -05:00
foreach ( $more_date as $_more_date ) {
2023-07-24 22:16:45 -04:00
$start_date = $_more_date [ 'event_more_start_date' ];
$end_date = $_more_date [ 'event_more_end_date' ];
$start_datetime = $_more_date [ 'event_more_start_date' ] . ' ' . $_more_date [ 'event_more_start_time' ];
$end_datetime = $_more_date [ 'event_more_end_date' ] . ' ' . $_more_date [ 'event_more_end_time' ];
2020-07-12 06:42:13 -04:00
2020-05-24 04:17:41 -04:00
if ( strtotime ( current_time ( 'Y-m-d H:i' )) < strtotime ( $_more_date [ 'event_more_start_date' ] . ' ' . $_more_date [ 'event_more_start_time' ])) {
if ( $mep_show_upcoming_event == 'yes' ) {
$cnt = 1 ;
} else {
$cnt = $cn ;
2020-01-22 07:15:24 -05:00
}
2020-05-24 04:17:41 -04:00
if ( $cn == $cnt ) {
2020-07-12 06:42:13 -04:00
require ( mep_template_file_path ( 'single/date_list.php' ));
2020-05-24 04:17:41 -04:00
$cn ++ ;
}
}
2020-01-22 07:15:24 -05:00
}
2020-11-17 07:15:34 -05:00
} elseif ( $recurring == 'everyday' ) {
do_action ( 'mep_event_everyday_date_list_display' , $event_id );
} else {
2020-05-24 04:17:41 -04:00
if ( is_array ( $more_date ) && sizeof ( $more_date ) > 0 ) {
2020-07-12 06:42:13 -04:00
require ( mep_template_file_path ( 'single/date_list.php' ));
2020-05-24 04:17:41 -04:00
foreach ( $more_date as $_more_date ) {
2023-07-24 22:16:45 -04:00
$start_date = $_more_date [ 'event_more_start_date' ];
$end_date = $_more_date [ 'event_more_end_date' ];
$start_datetime = $_more_date [ 'event_more_start_date' ] . ' ' . $_more_date [ 'event_more_start_time' ];
$end_datetime = $_more_date [ 'event_more_end_date' ] . ' ' . $_more_date [ 'event_more_end_time' ];
2020-07-12 06:42:13 -04:00
require ( mep_template_file_path ( 'single/date_list.php' ));
2020-01-22 07:15:24 -05:00
}
2020-05-24 04:17:41 -04:00
} else {
2020-07-12 06:42:13 -04:00
require ( mep_template_file_path ( 'single/date_list.php' ));
2020-05-24 04:17:41 -04:00
}
}
echo '</ul>' ;
2020-12-17 06:28:55 -05:00
if ( sizeof ( $more_date ) > 2 ) {
2020-05-24 04:17:41 -04:00
?>
2023-08-29 02:17:31 -04:00
< p id = " mep_single_view_all_date " class = " mep-tem3-title-sec mep_single_date_btn " >< ? php echo mep_get_option ( 'mep_event_view_more_date_btn_text' , 'label_setting_sec' , __ ( 'View More Date' , 'mage-eventpress' )); ?> </p>
< p id = " mep_single_hide_all_date " class = " mep-tem3-title-sec mep_single_date_btn " >< ? php echo mep_get_option ( 'mep_event_hide_date_list_btn_text' , 'label_setting_sec' , __ ( 'Hide Date Lists' , 'mage-eventpress' )); ?> </p>
2020-01-22 07:15:24 -05:00
< ? php
}
2020-04-28 06:37:33 -04:00
}
2020-01-22 07:15:24 -05:00
}
add_action ( 'mep_event_date_only' , 'mep_ev_date' );
2020-05-24 04:17:41 -04:00
if ( ! function_exists ( 'mep_ev_date' )) {
2020-11-17 07:15:34 -05:00
function mep_ev_date ( $event_id )
2020-05-24 04:17:41 -04:00
{
global $event_meta ;
2020-01-22 07:15:24 -05:00
2023-07-24 22:16:45 -04:00
$start_datetime = get_post_meta ( $event_id , 'event_start_datetime' , true ) ? get_post_meta ( $event_id , 'event_start_datetime' , true ) : '' ; //$event_meta['event_start_datetime'][0];
$start_date = get_post_meta ( $event_id , 'event_start_date' , true ) ? get_post_meta ( $event_id , 'event_start_date' , true ) : '' ; //$event_meta['event_start_date'][0];
$start_time = get_post_meta ( $event_id , 'event_start_time' , true ) ? get_post_meta ( $event_id , 'event_start_time' , true ) : '' ; //$event_meta['event_start_time'][0];
$end_datetime = get_post_meta ( $event_id , 'event_end_datetime' , true ) ? get_post_meta ( $event_id , 'event_end_datetime' , true ) : '' ; //$event_meta['event_end_datetime'][0];
$end_date = get_post_meta ( $event_id , 'event_end_date' , true ) ? get_post_meta ( $event_id , 'event_end_date' , true ) : '' ; //$event_meta['event_end_date'][0];
$end_time = get_post_meta ( $event_id , 'event_end_time' , true ) ? get_post_meta ( $event_id , 'event_end_time' , true ) : '' ; //$event_meta['event_end_time'][0];
$cn = 1 ;
$more_date = array ( get_post_meta ( $event_id , 'event_start_date' , true ) . ' ' . get_post_meta ( $event_id , 'event_start_time' , true ));
$recurring = get_post_meta ( $event_id , 'mep_enable_recurring' , true ) ? get_post_meta ( $event_id , 'mep_enable_recurring' , true ) : 'no' ;
$mep_show_upcoming_event = get_post_meta ( $event_id , 'mep_show_upcoming_event' , true ) ? get_post_meta ( $event_id , 'mep_show_upcoming_event' , true ) : 'no' ;
2020-01-22 07:15:24 -05:00
2020-05-24 04:17:41 -04:00
if ( $recurring == 'yes' ) {
2023-07-24 22:16:45 -04:00
$event_more_dates = get_post_meta ( $event_id , 'mep_event_more_date' , true ) ? get_post_meta ( $event_id , 'mep_event_more_date' , true ) : [];
2020-05-24 04:17:41 -04:00
foreach ( $event_more_dates as $md ) {
$more_date [] = $md [ 'event_more_start_date' ] . ' ' . $md [ 'event_more_start_time' ];
}
2020-01-22 07:15:24 -05:00
2020-05-24 04:17:41 -04:00
foreach ( $more_date as $ev_date ) {
if ( strtotime ( current_time ( 'Y-m-d H:i:s' )) < strtotime ( $ev_date )) {
if ( $mep_show_upcoming_event == 'yes' ) {
$cnt = 1 ;
} else {
$cnt = $cn ;
}
if ( $cn == $cnt ) {
?>
< p >< ? php echo get_mep_datetime ( $ev_date , 'date-text' ); ?> </p>
< ? php
$cn ++ ;
}
2020-01-22 07:15:24 -05:00
}
}
2020-05-24 04:17:41 -04:00
} else {
?>
2023-05-30 03:03:29 -04:00
< p >< ? php
echo apply_filters ( 'mep_display_date_only' , get_mep_datetime ( $start_datetime , 'date-text' ), $event_id ); ?> </p>
2020-05-24 04:17:41 -04:00
< ? php
2020-01-22 07:15:24 -05:00
}
}
}
add_action ( 'mep_event_time_only' , 'mep_ev_time' );
2020-05-24 04:17:41 -04:00
if ( ! function_exists ( 'mep_ev_time' )) {
2020-11-23 05:59:45 -05:00
function mep_ev_time ( $event_id )
2020-05-24 04:17:41 -04:00
{
global $event_meta ;
2023-07-24 22:16:45 -04:00
$start_datetime = get_post_meta ( $event_id , 'event_start_datetime' , true ) ? get_post_meta ( $event_id , 'event_start_datetime' , true ) : '' ; //$event_meta['event_start_datetime'][0];
$start_date = get_post_meta ( $event_id , 'event_start_date' , true ) ? get_post_meta ( $event_id , 'event_start_date' , true ) : '' ; //$event_meta['event_start_date'][0];
$start_time = get_post_meta ( $event_id , 'event_start_time' , true ) ? get_post_meta ( $event_id , 'event_start_time' , true ) : '' ; //$event_meta['event_start_time'][0];
$end_datetime = get_post_meta ( $event_id , 'event_end_datetime' , true ) ? get_post_meta ( $event_id , 'event_end_datetime' , true ) : '' ; //$event_meta['event_end_datetime'][0];
$end_date = get_post_meta ( $event_id , 'event_end_date' , true ) ? get_post_meta ( $event_id , 'event_end_date' , true ) : '' ; //$event_meta['event_end_date'][0];
$end_time = get_post_meta ( $event_id , 'event_end_time' , true ) ? get_post_meta ( $event_id , 'event_end_time' , true ) : '' ; //$event_meta['event_end_time'][0];
2020-05-24 04:17:41 -04:00
$cn = 1 ;
2023-07-24 22:16:45 -04:00
$more_date = array ( get_post_meta ( $event_id , 'event_start_date' , true ) . ' ' . get_post_meta ( $event_id , 'event_start_time' , true ));
$recurring = get_post_meta ( $event_id , 'mep_enable_recurring' , true ) ? get_post_meta ( $event_id , 'mep_enable_recurring' , true ) : 'no' ;
$mep_show_upcoming_event = get_post_meta ( $event_id , 'mep_show_upcoming_event' , true ) ? get_post_meta ( $event_id , 'mep_show_upcoming_event' , true ) : 'no' ;
2020-01-22 07:15:24 -05:00
2020-05-24 04:17:41 -04:00
if ( $recurring == 'yes' ) {
2020-11-23 05:59:45 -05:00
$event_more_dates = get_post_meta ( get_the_id (), 'mep_event_more_date' , true ) ? get_post_meta ( get_the_id (), 'mep_event_more_date' , true ) : [];
2020-05-24 04:17:41 -04:00
foreach ( $event_more_dates as $md ) {
$more_date [] = $md [ 'event_more_start_date' ] . ' ' . $md [ 'event_more_start_time' ];
}
2020-01-22 07:15:24 -05:00
2020-05-24 04:17:41 -04:00
foreach ( $more_date as $ev_date ) {
if ( strtotime ( current_time ( 'Y-m-d H:i:s' )) < strtotime ( $ev_date )) {
if ( $mep_show_upcoming_event == 'yes' ) {
$cnt = 1 ;
} else {
$cnt = $cn ;
}
if ( $cn == $cnt ) {
?>
2020-11-23 05:59:45 -05:00
< p >< ? php echo apply_filters ( 'mep_event_details_only_time' , get_mep_datetime ( $ev_date , 'time' ), $event_id ); ?> </p>
2020-05-24 04:17:41 -04:00
< ? php
$cn ++ ;
}
2020-01-22 07:15:24 -05:00
}
}
2020-05-24 04:17:41 -04:00
} else {
?>
2020-11-23 05:59:45 -05:00
< p >< ? php echo apply_filters ( 'mep_event_details_only_time' , get_mep_datetime ( $start_datetime , 'time' ), $event_id ); ?> </p>
2020-05-24 04:17:41 -04:00
< ? php
2020-01-22 07:15:24 -05:00
}
}
}
2020-05-24 04:17:41 -04:00
if ( ! function_exists ( 'mep_ev_time_ticket' )) {
function mep_ev_time_ticket ( $event_meta )
{
$start_datetime = $event_meta [ 'event_start_datetime' ][ 0 ];
echo get_mep_datetime ( $start_datetime , 'time' );
}
2020-01-22 07:15:24 -05:00
}
2020-05-24 04:17:41 -04:00
if ( ! function_exists ( 'mep_ev_date_ticket' )) {
function mep_ev_date_ticket ( $event_meta )
{
$start_datetime = $event_meta [ 'event_start_datetime' ][ 0 ];
echo get_mep_datetime ( $start_datetime , 'date-text' );
}
}