Skip to content

Commit

Permalink
fixed displayed format of starttime
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Burtscher committed Jan 29, 2018
1 parent 75e844f commit ac409f5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 21 deletions.
2 changes: 1 addition & 1 deletion admin/includes/admin-main.php
Expand Up @@ -69,7 +69,7 @@ public function events_custom_columns($column_name, $pid) {
switch($column_name) {
case 'eventdate':
$event = new EL_Event($pid);
echo $this->format_event_date($event->startdate, $event->enddate, $event->display_time($event->starttime));
echo $this->format_event_date($event->startdate, $event->enddate, $event->starttime_i18n());
break;
case 'location':
$event = new EL_Event($pid);
Expand Down
14 changes: 3 additions & 11 deletions includes/event.php
Expand Up @@ -132,20 +132,12 @@ private static function set_categories($pid, $cats) {
return wp_set_object_terms($pid, $cats, EL_Events_Post_Type::get_instance()->taxonomy);
}

public function display_time($timestring) {
$timestamp = strtotime($timestring);
public function starttime_i18n() {
$timestamp = strtotime($this->starttime);
if($timestamp) {
return date_i18n(get_option('time_format'), $timestamp);
}
return $timestring;
}

private function convert_event_timeformat($event) {
$timestamp = strtotime($event->starttime);
if($timestamp) {
$event->starttime = date_i18n(get_option('time_format'), $timestamp);
}
return $event;
return $this->starttime;
}

private function validate_date($datestring) {
Expand Down
7 changes: 0 additions & 7 deletions includes/events.php
Expand Up @@ -187,13 +187,6 @@ public function count_events( $slug ) {
return $wpdb->get_var( $sql );
}

private function convert_events_timeformat($events) {
foreach($events as $event) {
$this->convert_event_timeformat($event);
}
return $events;
}

private function get_sql_filter_string($date_filter=null, $cat_filter=null) {
$sql_filter_string = '';
// date filter
Expand Down
4 changes: 2 additions & 2 deletions includes/sc_event-list.php
Expand Up @@ -213,9 +213,9 @@ private function html_event(&$event, &$a, $single_day_only=false) {
// event starttime
if('' != $event->starttime && $this->is_visible($a['show_starttime'])) {
if('' == $this->options->get('el_html_tags_in_time')) {
$event->starttime = esc_attr($event->starttime);
$event->starttime = esc_attr($event->starttime_i18n());
}
$out .= '<span class="event-time">'.$event->starttime.'</span>';
$out .= '<span class="event-time">'.$event->starttime_i18n().'</span>';
}
// event location
if('' != $event->location && $this->is_visible($a['show_location'])) {
Expand Down

0 comments on commit ac409f5

Please sign in to comment.