annotate vendor/sabre/vobject/lib/Component/VJournal.php @ 38:ac106d4c8961 default tip

flip /etc/roundcube to point here
author Charlie Root
date Sat, 29 Dec 2018 05:39:53 -0500
parents 430dbd5346f7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
1 <?php
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
2
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
3 namespace Sabre\VObject\Component;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
4
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
5 use Sabre\VObject;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
6
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
7 /**
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
8 * VJournal component
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
9 *
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
10 * This component contains some additional functionality specific for VJOURNALs.
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
11 *
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
12 * @copyright Copyright (C) 2011-2015 fruux GmbH (https://fruux.com/).
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
13 * @author Evert Pot (http://evertpot.com/)
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
14 * @license http://sabre.io/license/ Modified BSD License
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
15 */
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
16 class VJournal extends VObject\Component {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
17
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
18 /**
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
19 * Returns true or false depending on if the event falls in the specified
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
20 * time-range. This is used for filtering purposes.
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
21 *
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
22 * The rules used to determine if an event falls within the specified
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
23 * time-range is based on the CalDAV specification.
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
24 *
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
25 * @param DateTime $start
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
26 * @param DateTime $end
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
27 * @return bool
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
28 */
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
29 public function isInTimeRange(\DateTime $start, \DateTime $end) {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
30
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
31 $dtstart = isset($this->DTSTART)?$this->DTSTART->getDateTime():null;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
32 if ($dtstart) {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
33 $effectiveEnd = clone $dtstart;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
34 if (!$this->DTSTART->hasTime()) {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
35 $effectiveEnd->modify('+1 day');
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
36 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
37
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
38 return ($start <= $effectiveEnd && $end > $dtstart);
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
39
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
40 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
41 return false;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
42
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
43 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
44
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
45 /**
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
46 * A simple list of validation rules.
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
47 *
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
48 * This is simply a list of properties, and how many times they either
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
49 * must or must not appear.
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
50 *
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
51 * Possible values per property:
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
52 * * 0 - Must not appear.
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
53 * * 1 - Must appear exactly once.
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
54 * * + - Must appear at least once.
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
55 * * * - Can appear any number of times.
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
56 *
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
57 * @var array
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
58 */
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
59 public function getValidationRules() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
60
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
61 return array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
62 'UID' => 1,
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
63 'DTSTAMP' => 1,
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
64
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
65 'CLASS' => '?',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
66 'CREATED' => '?',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
67 'DTSTART' => '?',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
68 'LAST-MODIFICATION' => '?',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
69 'ORGANIZER' => '?',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
70 'RECURRENCE-ID' => '?',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
71 'SEQUENCE' => '?',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
72 'STATUS' => '?',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
73 'SUMMARY' => '?',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
74 'URL' => '?',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
75
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
76 'RRULE' => '?',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
77
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
78 'ATTACH' => '*',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
79 'ATTENDEE' => '*',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
80 'CATEGORIES' => '*',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
81 'COMMENT' => '*',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
82 'CONTACT' => '*',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
83 'DESCRIPTION' => '*',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
84 'EXDATE' => '*',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
85 'RELATED-TO' => '*',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
86 'RDATE' => '*',
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
87 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
88
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
89 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
90 }