/**
  * espresso_event_date
  * returns the primary date for an event
  *
  * @param string $date_format
  * @param string $time_format
  * @param bool   $EVT_ID
  * @param bool $echo
  * @return string
  */
 function espresso_event_date($date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE)
 {
     $date_format = !empty($date_format) ? $date_format : get_option('date_format');
     $time_format = !empty($time_format) ? $time_format : get_option('time_format');
     $date_format = apply_filters('FHEE__espresso_event_date__date_format', $date_format);
     $time_format = apply_filters('FHEE__espresso_event_date__time_format', $time_format);
     EE_Registry::instance()->load_helper('Event_View');
     if ($echo) {
         echo EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID);
         return '';
     }
     return EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID);
 }
예제 #2
0
 /**
  * espresso_event_date_range
  * returns the first and last dates for an event (if different)
  *
  * @param string $date_format
  * @param string $time_format
  * @param string $single_date_format
  * @param string $single_time_format
  * @param bool   $EVT_ID
  * @return string
  */
 function espresso_event_date_range($date_format = '', $time_format = '', $single_date_format = '', $single_time_format = '', $EVT_ID = FALSE)
 {
     // formats when there is an actual date range
     $date_format = !empty($date_format) ? $date_format : get_option('date_format');
     $time_format = !empty($time_format) ? $time_format : get_option('time_format');
     $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', $date_format);
     $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', $time_format);
     // format if there is only one date to display ie: no date range
     $single_date_format = !empty($single_date_format) ? $single_date_format : get_option('date_format');
     $single_time_format = !empty($single_time_format) ? $single_time_format : get_option('time_format');
     $single_date_format = apply_filters('FHEE__espresso_event_date_range__single_date_format', $single_date_format);
     $single_time_format = apply_filters('FHEE__espresso_event_date_range__single_time_format', $single_time_format);
     EE_Registry::instance()->load_helper('Event_View');
     $the_event_date = date_i18n($date_format . ' ' . $time_format, strtotime(EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID)));
     $the_event_end_date = date_i18n($date_format . ' ' . $time_format, strtotime(EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID)));
     if ($the_event_date != $the_event_end_date) {
         echo $the_event_date . __(' - ', 'event_espresso') . date_i18n($date_format . ' ' . $time_format, strtotime(EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID)));
     } else {
         echo date_i18n($single_date_format . ' ' . $single_time_format, strtotime(EEH_Event_View::the_event_date($single_date_format, $single_time_format, $EVT_ID)));
     }
 }