Skip to content

Commit a52362f

Browse files
author
Chris Gårdenberg
committed
- fix: Fixing styling issues
1 parent 4b819e7 commit a52362f

1 file changed

Lines changed: 16 additions & 18 deletions

File tree

includes/edu-text-functions.php

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -238,38 +238,36 @@ function get_logical_date_groups( $dates, $short = false, $event = null, $show_d
238238

239239
function edu_get_date_range( $days, $short, $event, $show_days ) {
240240
usort( $days, "DateComparer" );
241-
$result = array();
242241

243-
if(count($days) === 1)
244-
return array(get_start_end_display_date($days[0], $days[0], $short, $event, $show_days));
245-
246-
$start_date = $days[0];
247-
$finish_date = $days[ count( $days ) - 1 ];
248-
$prevDay = 0;
242+
if ( 1 === count( $days ) ) {
243+
return array( get_start_end_display_date( $days[0], $days[0], $short, $event, $show_days ) );
244+
}
249245

250246
$added_dates = array();
251247

252-
for($x = 0; $x < count($days); $x++) {
248+
$total_days = count( $days );
249+
250+
for ( $x = 0; $x < $total_days; $x++ ) {
253251
$day = $days[ $x ];
254-
$added_dates[date('H:i', strtotime($day['StartDate'])) . '-' . date('H:i', strtotime($day['EndDate']))][] = $day;
252+
253+
$added_dates[ date( 'H:i', strtotime( $day['StartDate'] ) ) . '-' . date( 'H:i', strtotime( $day['EndDate'] ) ) ][] = $day;
255254
}
256255

257256
$ordered_dategroups = array();
258257

259-
foreach($added_dates as $time => $_days) {
260-
$start_date = $_days[0];
258+
foreach ( $added_dates as $time => $_days ) {
259+
$start_date = $_days[0];
261260
$finish_date = $_days[ count( $_days ) - 1 ];
262-
foreach($_days as $key => $date) {
263-
if($key > 0 && ( strtotime( $date['StartDate'] ) - strtotime( $_days[ $key - 1 ]['StartDate'] ) > 99999 ))
264-
{
265-
$ordered_dategroups[$start_date['StartDate']] = get_start_end_display_date( $start_date, $_days[ $key - 1 ], $short, $event, $show_days );
266-
$start_date = $date;
261+
foreach ( $_days as $key => $date ) {
262+
if ( $key > 0 && ( strtotime( $date['StartDate'] ) - strtotime( $_days[ $key - 1 ]['StartDate'] ) > 99999 ) ) {
263+
$ordered_dategroups[ $start_date['StartDate'] ] = get_start_end_display_date( $start_date, $_days[ $key - 1 ], $short, $event, $show_days );
264+
$start_date = $date;
267265
}
268266
}
269-
$ordered_dategroups[$start_date['StartDate']] = get_start_end_display_date( $start_date, $finish_date, $short, $event, $show_days );
267+
$ordered_dategroups[ $start_date['StartDate'] ] = get_start_end_display_date( $start_date, $finish_date, $short, $event, $show_days );
270268
}
271269

272-
ksort($ordered_dategroups);
270+
ksort( $ordered_dategroups );
273271

274272
if ( count( $ordered_dategroups ) > 3 ) {
275273
$n_res = array();

0 commit comments

Comments
 (0)