public function get_correct_formatted_event_repeat_time($post_meta, $repeat_interval = '', $format = '')
 {
     $format = !empty($format) ? $format : get_option('date_format');
     $wp_time_format = get_option('time_format');
     if (!empty($repeat_interval) && !empty($post_meta['repeat_intervals']) && $repeat_interval != '0') {
         $intervals = unserialize($post_meta['repeat_intervals'][0]);
         $formatted_unix_s = eventon_get_formatted_time($intervals[$repeat_interval][0]);
         $start = eventon_get_lang_formatted_timestr($format . ' h:i:a', $formatted_unix_s);
         return array('start' => $start, 'start_' => date($format . ' h:i:a', $intervals[$repeat_interval][0]), 'end' => date($format . ' h:i:a', $intervals[$repeat_interval][1]));
     } else {
         // no repeat interval values saved
         $start = !empty($post_meta['evcal_srow']) ? date($format . ' h:i:a', $post_meta['evcal_srow'][0]) : 0;
         return array('start' => $start, 'end' => !empty($post_meta['evcal_erow']) ? date($format . ' h:i:a', $post_meta['evcal_erow'][0]) : $start);
     }
 }
 public function generate_time_($DATE_start_val = '', $DATE_end_val = '', $pmv, $evcal_lang_allday, $focus_month_beg_range = '', $FOCUS_month_int = '', $event_start_unix = '', $event_end_unix = '')
 {
     global $eventon;
     // INITIAL variables
     // start and end row times
     $event_start_unix = !empty($event_start_unix) ? $event_start_unix : $pmv['evcal_srow'][0];
     $event_end_unix = !empty($event_end_unix) ? $event_end_unix : (!empty($pmv['evcal_erow']) ? $pmv['evcal_erow'][0] : $event_start_unix);
     $wp_time_format = get_option('time_format');
     $_is_allday = !empty($pmv['evcal_allday']) && $pmv['evcal_allday'][0] == 'yes' ? true : false;
     $_hide_endtime = !empty($pmv['evo_hide_endtime']) && $pmv['evo_hide_endtime'][0] == 'yes' ? true : false;
     $DATE_start_val = !empty($DATE_start_val) ? $DATE_start_val : eventon_get_formatted_time($event_start_unix);
     if (empty($event_end_unix)) {
         $DATE_end_val = $DATE_start_val;
     } else {
         $DATE_end_val = !empty($DATE_end_val) ? $DATE_end_val : eventon_get_formatted_time($event_end_unix);
     }
     // FOCUSED values
     $CURRENT_month_INT = !empty($FOCUS_month_int) ? $FOCUS_month_int : (!empty($focus_month_beg_range) ? date('n', $focus_month_beg_range) : date('n'));
     //
     $_current_date = !empty($focus_month_beg_range) ? date('j', $focus_month_beg_range) : 1;
     $time_format = !empty($this->evopt1['evcal_tdate_format']) ? $this->evopt1['evcal_tdate_format'] : 'F j(l) T';
     // M F j S l D
     // Universal time format
     // if activated get time values
     $__univ_time = false;
     if (!empty($this->evopt1['evo_timeF_v']) && !empty($this->evopt1['evo_timeF']) && $this->evopt1['evo_timeF'] == 'yes') {
         $__univ_time_s = eventon_get_langed_pretty_time($event_start_unix, $this->evopt1['evo_timeF_v']);
         $__univ_time = $_hide_endtime ? $__univ_time_s : $__univ_time_s . ' - ' . eventon_get_langed_pretty_time($event_end_unix, $this->evopt1['evo_timeF_v']);
     }
     //$formatted_start = date($wp_time_format,($event_start_unix));
     $formatted_start = eventon_get_lang_formatted_timestr($wp_time_format, $DATE_start_val);
     $formatted_end = eventon_get_lang_formatted_timestr($wp_time_format, $DATE_end_val);
     //$formatted_end = date($wp_time_format,($event_end_unix));
     $date_args = array('cdate' => $_current_date, 'eventstart' => $DATE_start_val, 'eventend' => $DATE_end_val, 'stime' => $formatted_start, 'etime' => $formatted_end, '_hide_endtime' => $_hide_endtime);
     // same start and end months
     if ($DATE_start_val['n'] == $DATE_end_val['n']) {
         /** EVENT TYPE = start and end in SAME DAY **/
         if ($DATE_start_val['j'] == $DATE_end_val['j']) {
             // check all days event
             if ($_is_allday) {
                 $__from_to = "<em class='evcal_alldayevent_text'>(" . $evcal_lang_allday . ": " . $DATE_start_val['l'] . ")</em>";
                 $__prettytime = $evcal_lang_allday . ' (' . ucfirst($DATE_start_val['l']) . ')';
                 $__time = "<span class='start'>" . $evcal_lang_allday . "</span>";
             } else {
                 $__from_to = $_hide_endtime ? $formatted_start : $formatted_start . ' - ' . $formatted_end;
                 $__prettytime = $__univ_time ? $__univ_time : apply_filters('eventon_evt_fe_ptime', '(' . ucfirst($DATE_start_val['l']) . ') ' . $__from_to);
                 $__time = "<span class='start'>" . $formatted_start . "</span>" . (!$_hide_endtime ? "<span class='end'>- " . $formatted_end . "</span>" : null);
             }
             $_event_date_HTML = array('html_date' => '<span class="start">' . $DATE_start_val['j'] . '<em>' . $DATE_start_val['M'] . '</em></span>', 'html_time' => $__time, 'html_fromto' => apply_filters('eventon_evt_fe_time', $__from_to), 'html_prettytime' => $__prettytime, 'class_daylength' => "sin_val", 'start_month' => $DATE_start_val['M']);
         } else {
             // different start and end date
             // check all days event
             if ($_is_allday) {
                 $__from_to = "<em class='evcal_alldayevent_text'>(" . $evcal_lang_allday . ")</em>";
                 $__prettytime = $DATE_start_val['j'] . ' (' . ucfirst($DATE_start_val['l']) . ') - ' . $DATE_end_val['j'] . ' (' . ucfirst($DATE_end_val['l']) . ')';
                 $__time = "<span class='start'>" . $evcal_lang_allday . "</span>";
             } else {
                 $__from_to = $_hide_endtime ? $formatted_start : $formatted_start . ' - ' . $formatted_end . ' (' . $DATE_end_val['j'] . ')';
                 $__prettytime = $__univ_time ? $__univ_time : apply_filters('eventon_evt_fe_ptime', $DATE_start_val['j'] . ' (' . ucfirst($DATE_start_val['l']) . ') ' . $formatted_start . (!$_hide_endtime ? ' - ' . $DATE_end_val['j'] . ' (' . ucfirst($DATE_end_val['l']) . ') ' . $formatted_end : ''));
                 // for daily view check if start day is same as focused day
                 $__time = $this->generate_time($date_args);
             }
             $_event_date_HTML = array('html_date' => '<span class="start">' . $DATE_start_val['j'] . '<em>' . $DATE_start_val['M'] . '</em></span>' . (!$_hide_endtime ? '<span class="end"> - ' . $DATE_end_val['j'] . '</span>' : ''), 'html_time' => $__time, 'html_fromto' => apply_filters('eventon_evt_fe_time', $__from_to), 'html_prettytime' => $__prettytime, 'class_daylength' => "mul_val", 'start_month' => $DATE_start_val['M']);
         }
     } else {
         /** EVENT TYPE = different start and end months **/
         /** EVENT TYPE = start month is before current month **/
         if ($CURRENT_month_INT != $DATE_start_val['n']) {
             // check all days event
             if ($_is_allday) {
                 $__from_to = "<em class='evcal_alldayevent_text'>(" . $evcal_lang_allday . ")</em>";
                 $__time = "<span class='start'>" . $evcal_lang_allday . "</span>";
             } else {
                 $__start_this = '(' . $DATE_start_val['F'] . ' ' . $DATE_start_val['j'] . ') ' . $formatted_start;
                 $__end_this = !$_hide_endtime ? ' - (' . $DATE_end_val['F'] . ' ' . $DATE_end_val['j'] . ') ' . $formatted_end : '';
                 $__from_to = $_hide_endtime ? $__start_this : $__start_this . $__end_this;
                 // for daily view check if start day is same as focused day
                 $__time = $this->generate_time($date_args);
             }
         } else {
             /** EVENT TYPE = start month is current month **/
             // check all days event
             if ($_is_allday) {
                 $__from_to = "<em class='evcal_alldayevent_text'>(" . $evcal_lang_allday . ")</em>";
                 $__time = "<span class='start'>" . $evcal_lang_allday . "</span>";
             } else {
                 $__start_this = $formatted_start;
                 $__end_this = ' - (' . $DATE_end_val['F'] . ' ' . $DATE_end_val['j'] . ') ' . $formatted_end;
                 $__from_to = $_hide_endtime ? $__start_this : $__start_this . $__end_this;
                 // for daily view check if start day is same as focused day
                 $__time = $this->generate_time($date_args);
             }
         }
         // check all days event
         if ($_is_allday) {
             $__prettytime = ucfirst($DATE_start_val['F']) . ' ' . $DATE_start_val['j'] . ' (' . ucfirst($DATE_start_val['l']) . ')' . (!$_hide_endtime ? ' - ' . ucfirst($DATE_end_val['F']) . ' ' . $DATE_end_val['j'] . ' (' . ucfirst($DATE_end_val['l']) . ')' : '');
         } else {
             $__prettytime = ucfirst($DATE_start_val['F']) . ' ' . $DATE_start_val['j'] . ' (' . ucfirst($DATE_start_val['l']) . ') ' . date($wp_time_format, $event_start_unix) . (!$_hide_endtime ? ' - ' . ucfirst($DATE_end_val['F']) . ' ' . $DATE_end_val['j'] . ' (' . ucfirst($DATE_end_val['l']) . ') ' . date($wp_time_format, $event_end_unix) : '');
         }
         // html date
         $__this_html_date = $_hide_endtime ? '<span class="start">' . $DATE_start_val['j'] . '<em>' . $DATE_start_val['M'] . '</em></span>' : '<span class="start">' . $DATE_start_val['j'] . '<em>' . $DATE_start_val['M'] . '</em></span><span class="end"> - ' . $DATE_end_val['j'] . '<em>' . $DATE_end_val['M'] . '</em></span>';
         $_event_date_HTML = apply_filters('evo_eventcard_dif_SEM', array('html_date' => $__this_html_date, 'html_time' => $__time, 'html_fromto' => apply_filters('eventon_evt_fe_time', $__from_to), 'html_prettytime' => $__univ_time ? $__univ_time : apply_filters('eventon_evt_fe_ptime', $__prettytime), 'class_daylength' => "mul_val", 'start_month' => $DATE_start_val['M']));
     }
     // year long event
     $__is_year_long = !empty($pmv['evo_year_long']) && $pmv['evo_year_long'][0] == 'yes' ? true : false;
     //if year long event
     if ($__is_year_long) {
         $evcal_lang_yrrnd = $this->lang_array['evcal_lang_yrrnd'];
         $_event_date_HTML = array('html_date' => '<span class="yearRnd"></span>', 'html_time' => '', 'html_fromto' => $evcal_lang_yrrnd, 'html_prettytime' => $evcal_lang_yrrnd, 'class_daylength' => "no_val", 'start_month' => $_event_date_HTML['start_month']);
     }
     return $_event_date_HTML;
 }
Example #3
0
 public function date($dateformat, $array)
 {
     return eventon_get_lang_formatted_timestr($dateformat, $array);
     /*$items = str_split($dateformat);
     		$newtime = '';
     		foreach($items as $item){
     			$newtime .= (array_key_exists($item, $array))? $array[$item]: $item;
     		}
     		return $newtime;*/
 }