@@ -369,18 +369,22 @@ protected function addEvent($objEvents, $intStart, $intEnd, $strUrl, $intBegin,
369
369
$ this ->arrEvents [$ intKey ][$ intStart ][] = $ arrEvent ;
370
370
371
371
// Multi-day event
372
- for ($ i =1 ; $ i <=$ span && $ intDate <= $ intLimit ; $ i ++)
372
+ for ($ i =1 ; $ i <=$ span ; $ i ++)
373
373
{
374
374
// Only show first occurrence
375
375
if ($ this ->cal_noSpan )
376
376
{
377
377
break ;
378
378
}
379
379
380
- $ intDate = strtotime ('+ 1 day ' , $ intDate );
381
- $ intNextKey = date ('Ymd ' , $ intDate );
380
+ $ intDate = strtotime ('+1 day ' , $ intDate );
382
381
383
- $ this ->arrEvents [$ intNextKey ][$ intDate ][] = $ arrEvent ;
382
+ if ($ intDate > $ intLimit )
383
+ {
384
+ break ;
385
+ }
386
+
387
+ $ this ->arrEvents [date ('Ymd ' , $ intDate )][$ intDate ][] = $ arrEvent ;
384
388
}
385
389
}
386
390
@@ -447,134 +451,89 @@ protected function getDatesFromFormat(\Date $objDate, $strFormat)
447
451
{
448
452
case 'cal_day ' :
449
453
return array ($ objDate ->dayBegin , $ objDate ->dayEnd , $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_emptyDay ' ]);
450
- break ;
451
454
452
455
default :
453
456
case 'cal_month ' :
454
457
return array ($ objDate ->monthBegin , $ objDate ->monthEnd , $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_emptyMonth ' ]);
455
- break ;
456
458
457
459
case 'cal_year ' :
458
460
return array ($ objDate ->yearBegin , $ objDate ->yearEnd , $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_emptyYear ' ]);
459
- break ;
460
461
461
462
case 'cal_all ' : // 1970-01-01 00:00:00 - 2038-01-01 00:00:00
462
463
return array (0 , 2145913200 , $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
463
464
break ;
464
465
465
466
case 'next_7 ' :
466
- return array (time (), (strtotime ('+7 days ' ) - 1 ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
467
- break ;
467
+ return array (time (), strtotime ('+7 days ' ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
468
468
469
469
case 'next_14 ' :
470
- return array (time (), (strtotime ('+14 days ' ) - 1 ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
471
- break ;
470
+ return array (time (), strtotime ('+14 days ' ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
472
471
473
472
case 'next_30 ' :
474
- return array (time (), (strtotime ('+1 month ' ) - 1 ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
475
- break ;
473
+ return array (time (), strtotime ('+1 month ' ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
476
474
477
475
case 'next_90 ' :
478
- return array (time (), (strtotime ('+3 months ' ) - 1 ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
479
- break ;
476
+ return array (time (), strtotime ('+3 months ' ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
480
477
481
478
case 'next_180 ' :
482
- return array (time (), (strtotime ('+6 months ' ) - 1 ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
483
- break ;
479
+ return array (time (), strtotime ('+6 months ' ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
484
480
485
481
case 'next_365 ' :
486
- return array (time (), (strtotime ('+1 year ' ) - 1 ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
487
- break ;
482
+ return array (time (), strtotime ('+1 year ' ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
488
483
489
484
case 'next_two ' :
490
- return array (time (), (strtotime ('+2 years ' ) - 1 ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
491
- break ;
485
+ return array (time (), strtotime ('+2 years ' ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
492
486
493
487
case 'next_cur_month ' :
494
- $ objToday = new \Date ();
495
-
496
- return array (time (), $ objToday ->monthEnd , $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
497
- break ;
488
+ return array (time (), strtotime ('last day of this month 23:59:59 ' ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
498
489
499
490
case 'next_cur_year ' :
500
- $ objToday = new \Date ();
501
-
502
- return array (time (), $ objToday ->yearEnd , $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
503
- break ;
491
+ return array (time (), strtotime ('last day of december this year 23:59:59 ' ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
504
492
505
493
case 'next_next_month ' :
506
- $ objToday = new \Date ();
507
-
508
- return array (($ objToday ->monthEnd + 1 ), strtotime ('+1 month ' , $ objToday ->monthEnd ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
509
- break ;
494
+ return array (strtotime ('first day of next month 00:00:00 ' ), strtotime ('last day of next month 23:59:59 ' ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
510
495
511
496
case 'next_next_year ' :
512
- $ objToday = new \Date ();
513
-
514
- return array (($ objToday ->yearEnd + 1 ), strtotime ('+1 year ' , $ objToday ->yearEnd ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
515
- break ;
497
+ return array (strtotime ('first day of january next year 00:00:00 ' ), strtotime ('last day of december next year 23:59:59 ' ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
516
498
517
499
case 'next_all ' : // 2038-01-01 00:00:00
518
500
return array (time (), 2145913200 , $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
519
- break ;
520
501
521
502
case 'past_7 ' :
522
- return array (strtotime ('-7 days ' ), (time () - 1 ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
523
- break ;
503
+ return array (strtotime ('-7 days ' ), time (), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
524
504
525
505
case 'past_14 ' :
526
- return array (strtotime ('-14 days ' ), (time () - 1 ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
527
- break ;
506
+ return array (strtotime ('-14 days ' ), time (), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
528
507
529
508
case 'past_30 ' :
530
- return array (strtotime ('-1 month ' ), (time () - 1 ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
531
- break ;
509
+ return array (strtotime ('-1 month ' ), time (), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
532
510
533
511
case 'past_90 ' :
534
- return array (strtotime ('-3 months ' ), (time () - 1 ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
535
- break ;
512
+ return array (strtotime ('-3 months ' ), time (), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
536
513
537
514
case 'past_180 ' :
538
- return array (strtotime ('-6 months ' ), (time () - 1 ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
539
- break ;
515
+ return array (strtotime ('-6 months ' ), time (), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
540
516
541
517
case 'past_365 ' :
542
- return array (strtotime ('-1 year ' ), (time () - 1 ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
543
- break ;
518
+ return array (strtotime ('-1 year ' ), time (), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
544
519
545
520
case 'past_two ' :
546
- return array (strtotime ('-2 years ' ), (time () - 1 ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
547
- break ;
521
+ return array (strtotime ('-2 years ' ), time (), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
548
522
549
523
case 'past_cur_month ' :
550
- $ objToday = new \Date ();
551
-
552
- return array ($ objToday ->monthBegin , (time () - 1 ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
553
- break ;
524
+ return array (strtotime ('first day of this month 00:00:00 ' ), time (), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
554
525
555
526
case 'past_cur_year ' :
556
- $ objToday = new \Date ();
557
-
558
- return array ($ objToday ->yearBegin , (time () - 1 ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
559
- break ;
527
+ return array (strtotime ('first day of january this year 00:00:00 ' ), time (), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
560
528
561
529
case 'past_prev_month ' :
562
- $ objToday = new \Date ();
563
-
564
- return array (strtotime ('-1 month ' , $ objToday ->monthBegin ), ($ objToday ->monthBegin - 1 ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
565
- break ;
530
+ return array (strtotime ('first day of last month 00:00:00 ' ), strtotime ('last day of last month 23:59:59 ' ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
566
531
567
532
case 'past_prev_year ' :
568
- $ objToday = new \Date ();
569
-
570
- return array (strtotime ('-1 year ' , $ objToday ->yearBegin ), ($ objToday ->yearBegin - 1 ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
571
- break ;
533
+ return array (strtotime ('first day of january last year 00:00:00 ' ), strtotime ('last day of december last year 23:59:59 ' ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
572
534
573
535
case 'past_all ' : // 1970-01-01 00:00:00
574
- $ objToday = new \Date ();
575
-
576
- return array (0 , ($ objToday ->dayBegin - 1 ), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
577
- break ;
536
+ return array (0 , time (), $ GLOBALS ['TL_LANG ' ]['MSC ' ]['cal_empty ' ]);
578
537
}
579
538
}
580
539
}
0 commit comments