@@ -29,52 +29,52 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | class CalendarData implements XmlDeserializable |
| 31 | 31 | { |
| 32 | - /** |
|
| 33 | - * The deserialize method is called during xml parsing. |
|
| 34 | - * |
|
| 35 | - * This method is called statically, this is because in theory this method |
|
| 36 | - * may be used as a type of constructor, or factory method. |
|
| 37 | - * |
|
| 38 | - * Often you want to return an instance of the current class, but you are |
|
| 39 | - * free to return other data as well. |
|
| 40 | - * |
|
| 41 | - * You are responsible for advancing the reader to the next element. Not |
|
| 42 | - * doing anything will result in a never-ending loop. |
|
| 43 | - * |
|
| 44 | - * If you just want to skip parsing for this element altogether, you can |
|
| 45 | - * just call $reader->next(); |
|
| 46 | - * |
|
| 47 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 48 | - * the next element. |
|
| 49 | - * |
|
| 50 | - * @return mixed |
|
| 51 | - */ |
|
| 52 | - public static function xmlDeserialize(Reader $reader) |
|
| 53 | - { |
|
| 54 | - $result = [ |
|
| 55 | - 'contentType' => $reader->getAttribute('content-type') ?: 'text/calendar', |
|
| 56 | - 'version' => $reader->getAttribute('version') ?: '2.0', |
|
| 57 | - ]; |
|
| 32 | + /** |
|
| 33 | + * The deserialize method is called during xml parsing. |
|
| 34 | + * |
|
| 35 | + * This method is called statically, this is because in theory this method |
|
| 36 | + * may be used as a type of constructor, or factory method. |
|
| 37 | + * |
|
| 38 | + * Often you want to return an instance of the current class, but you are |
|
| 39 | + * free to return other data as well. |
|
| 40 | + * |
|
| 41 | + * You are responsible for advancing the reader to the next element. Not |
|
| 42 | + * doing anything will result in a never-ending loop. |
|
| 43 | + * |
|
| 44 | + * If you just want to skip parsing for this element altogether, you can |
|
| 45 | + * just call $reader->next(); |
|
| 46 | + * |
|
| 47 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 48 | + * the next element. |
|
| 49 | + * |
|
| 50 | + * @return mixed |
|
| 51 | + */ |
|
| 52 | + public static function xmlDeserialize(Reader $reader) |
|
| 53 | + { |
|
| 54 | + $result = [ |
|
| 55 | + 'contentType' => $reader->getAttribute('content-type') ?: 'text/calendar', |
|
| 56 | + 'version' => $reader->getAttribute('version') ?: '2.0', |
|
| 57 | + ]; |
|
| 58 | 58 | |
| 59 | - $elems = (array) $reader->parseInnerTree(); |
|
| 60 | - foreach ($elems as $elem) { |
|
| 61 | - switch ($elem['name']) { |
|
| 62 | - case '{'.Plugin::NS_CALDAV.'}expand': |
|
| 63 | - $result['expand'] = [ |
|
| 64 | - 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
| 65 | - 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
| 66 | - ]; |
|
| 59 | + $elems = (array) $reader->parseInnerTree(); |
|
| 60 | + foreach ($elems as $elem) { |
|
| 61 | + switch ($elem['name']) { |
|
| 62 | + case '{'.Plugin::NS_CALDAV.'}expand': |
|
| 63 | + $result['expand'] = [ |
|
| 64 | + 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
| 65 | + 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
| 66 | + ]; |
|
| 67 | 67 | |
| 68 | - if (!$result['expand']['start'] || !$result['expand']['end']) { |
|
| 69 | - throw new BadRequest('The "start" and "end" attributes are required when expanding calendar-data'); |
|
| 70 | - } |
|
| 71 | - if ($result['expand']['end'] <= $result['expand']['start']) { |
|
| 72 | - throw new BadRequest('The end-date must be larger than the start-date when expanding calendar-data'); |
|
| 73 | - } |
|
| 74 | - break; |
|
| 75 | - } |
|
| 76 | - } |
|
| 68 | + if (!$result['expand']['start'] || !$result['expand']['end']) { |
|
| 69 | + throw new BadRequest('The "start" and "end" attributes are required when expanding calendar-data'); |
|
| 70 | + } |
|
| 71 | + if ($result['expand']['end'] <= $result['expand']['start']) { |
|
| 72 | + throw new BadRequest('The end-date must be larger than the start-date when expanding calendar-data'); |
|
| 73 | + } |
|
| 74 | + break; |
|
| 75 | + } |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - return $result; |
|
| 79 | - } |
|
| 78 | + return $result; |
|
| 79 | + } |
|
| 80 | 80 | } |
@@ -25,96 +25,96 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | class Invite implements XmlSerializable |
| 27 | 27 | { |
| 28 | - /** |
|
| 29 | - * The list of users a calendar has been shared to. |
|
| 30 | - * |
|
| 31 | - * @var Sharee[] |
|
| 32 | - */ |
|
| 33 | - protected $sharees; |
|
| 28 | + /** |
|
| 29 | + * The list of users a calendar has been shared to. |
|
| 30 | + * |
|
| 31 | + * @var Sharee[] |
|
| 32 | + */ |
|
| 33 | + protected $sharees; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Creates the property. |
|
| 37 | - * |
|
| 38 | - * @param Sharee[] $sharees |
|
| 39 | - */ |
|
| 40 | - public function __construct(array $sharees) |
|
| 41 | - { |
|
| 42 | - $this->sharees = $sharees; |
|
| 43 | - } |
|
| 35 | + /** |
|
| 36 | + * Creates the property. |
|
| 37 | + * |
|
| 38 | + * @param Sharee[] $sharees |
|
| 39 | + */ |
|
| 40 | + public function __construct(array $sharees) |
|
| 41 | + { |
|
| 42 | + $this->sharees = $sharees; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Returns the list of users, as it was passed to the constructor. |
|
| 47 | - * |
|
| 48 | - * @return array |
|
| 49 | - */ |
|
| 50 | - public function getValue() |
|
| 51 | - { |
|
| 52 | - return $this->sharees; |
|
| 53 | - } |
|
| 45 | + /** |
|
| 46 | + * Returns the list of users, as it was passed to the constructor. |
|
| 47 | + * |
|
| 48 | + * @return array |
|
| 49 | + */ |
|
| 50 | + public function getValue() |
|
| 51 | + { |
|
| 52 | + return $this->sharees; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * The xmlSerialize method is called during xml writing. |
|
| 57 | - * |
|
| 58 | - * Use the $writer argument to write its own xml serialization. |
|
| 59 | - * |
|
| 60 | - * An important note: do _not_ create a parent element. Any element |
|
| 61 | - * implementing XmlSerializable should only ever write what's considered |
|
| 62 | - * its 'inner xml'. |
|
| 63 | - * |
|
| 64 | - * The parent of the current element is responsible for writing a |
|
| 65 | - * containing element. |
|
| 66 | - * |
|
| 67 | - * This allows serializers to be re-used for different element names. |
|
| 68 | - * |
|
| 69 | - * If you are opening new elements, you must also close them again. |
|
| 70 | - */ |
|
| 71 | - public function xmlSerialize(Writer $writer) |
|
| 72 | - { |
|
| 73 | - $cs = '{'.Plugin::NS_CALENDARSERVER.'}'; |
|
| 55 | + /** |
|
| 56 | + * The xmlSerialize method is called during xml writing. |
|
| 57 | + * |
|
| 58 | + * Use the $writer argument to write its own xml serialization. |
|
| 59 | + * |
|
| 60 | + * An important note: do _not_ create a parent element. Any element |
|
| 61 | + * implementing XmlSerializable should only ever write what's considered |
|
| 62 | + * its 'inner xml'. |
|
| 63 | + * |
|
| 64 | + * The parent of the current element is responsible for writing a |
|
| 65 | + * containing element. |
|
| 66 | + * |
|
| 67 | + * This allows serializers to be re-used for different element names. |
|
| 68 | + * |
|
| 69 | + * If you are opening new elements, you must also close them again. |
|
| 70 | + */ |
|
| 71 | + public function xmlSerialize(Writer $writer) |
|
| 72 | + { |
|
| 73 | + $cs = '{'.Plugin::NS_CALENDARSERVER.'}'; |
|
| 74 | 74 | |
| 75 | - foreach ($this->sharees as $sharee) { |
|
| 76 | - if (DAV\Sharing\Plugin::ACCESS_SHAREDOWNER === $sharee->access) { |
|
| 77 | - $writer->startElement($cs.'organizer'); |
|
| 78 | - } else { |
|
| 79 | - $writer->startElement($cs.'user'); |
|
| 75 | + foreach ($this->sharees as $sharee) { |
|
| 76 | + if (DAV\Sharing\Plugin::ACCESS_SHAREDOWNER === $sharee->access) { |
|
| 77 | + $writer->startElement($cs.'organizer'); |
|
| 78 | + } else { |
|
| 79 | + $writer->startElement($cs.'user'); |
|
| 80 | 80 | |
| 81 | - switch ($sharee->inviteStatus) { |
|
| 82 | - case DAV\Sharing\Plugin::INVITE_ACCEPTED: |
|
| 83 | - $writer->writeElement($cs.'invite-accepted'); |
|
| 84 | - break; |
|
| 85 | - case DAV\Sharing\Plugin::INVITE_DECLINED: |
|
| 86 | - $writer->writeElement($cs.'invite-declined'); |
|
| 87 | - break; |
|
| 88 | - case DAV\Sharing\Plugin::INVITE_NORESPONSE: |
|
| 89 | - $writer->writeElement($cs.'invite-noresponse'); |
|
| 90 | - break; |
|
| 91 | - case DAV\Sharing\Plugin::INVITE_INVALID: |
|
| 92 | - $writer->writeElement($cs.'invite-invalid'); |
|
| 93 | - break; |
|
| 94 | - } |
|
| 81 | + switch ($sharee->inviteStatus) { |
|
| 82 | + case DAV\Sharing\Plugin::INVITE_ACCEPTED: |
|
| 83 | + $writer->writeElement($cs.'invite-accepted'); |
|
| 84 | + break; |
|
| 85 | + case DAV\Sharing\Plugin::INVITE_DECLINED: |
|
| 86 | + $writer->writeElement($cs.'invite-declined'); |
|
| 87 | + break; |
|
| 88 | + case DAV\Sharing\Plugin::INVITE_NORESPONSE: |
|
| 89 | + $writer->writeElement($cs.'invite-noresponse'); |
|
| 90 | + break; |
|
| 91 | + case DAV\Sharing\Plugin::INVITE_INVALID: |
|
| 92 | + $writer->writeElement($cs.'invite-invalid'); |
|
| 93 | + break; |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - $writer->startElement($cs.'access'); |
|
| 97 | - switch ($sharee->access) { |
|
| 98 | - case DAV\Sharing\Plugin::ACCESS_READWRITE: |
|
| 99 | - $writer->writeElement($cs.'read-write'); |
|
| 100 | - break; |
|
| 101 | - case DAV\Sharing\Plugin::ACCESS_READ: |
|
| 102 | - $writer->writeElement($cs.'read'); |
|
| 103 | - break; |
|
| 104 | - } |
|
| 105 | - $writer->endElement(); // access |
|
| 106 | - } |
|
| 96 | + $writer->startElement($cs.'access'); |
|
| 97 | + switch ($sharee->access) { |
|
| 98 | + case DAV\Sharing\Plugin::ACCESS_READWRITE: |
|
| 99 | + $writer->writeElement($cs.'read-write'); |
|
| 100 | + break; |
|
| 101 | + case DAV\Sharing\Plugin::ACCESS_READ: |
|
| 102 | + $writer->writeElement($cs.'read'); |
|
| 103 | + break; |
|
| 104 | + } |
|
| 105 | + $writer->endElement(); // access |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - $href = new DAV\Xml\Property\Href($sharee->href); |
|
| 109 | - $href->xmlSerialize($writer); |
|
| 108 | + $href = new DAV\Xml\Property\Href($sharee->href); |
|
| 109 | + $href->xmlSerialize($writer); |
|
| 110 | 110 | |
| 111 | - if (isset($sharee->properties['{DAV:}displayname'])) { |
|
| 112 | - $writer->writeElement($cs.'common-name', $sharee->properties['{DAV:}displayname']); |
|
| 113 | - } |
|
| 114 | - if ($sharee->comment) { |
|
| 115 | - $writer->writeElement($cs.'summary', $sharee->comment); |
|
| 116 | - } |
|
| 117 | - $writer->endElement(); // organizer or user |
|
| 118 | - } |
|
| 119 | - } |
|
| 111 | + if (isset($sharee->properties['{DAV:}displayname'])) { |
|
| 112 | + $writer->writeElement($cs.'common-name', $sharee->properties['{DAV:}displayname']); |
|
| 113 | + } |
|
| 114 | + if ($sharee->comment) { |
|
| 115 | + $writer->writeElement($cs.'summary', $sharee->comment); |
|
| 116 | + } |
|
| 117 | + $writer->endElement(); // organizer or user |
|
| 118 | + } |
|
| 119 | + } |
|
| 120 | 120 | } |
@@ -21,51 +21,51 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | class EmailAddressSet implements XmlSerializable |
| 23 | 23 | { |
| 24 | - /** |
|
| 25 | - * emails. |
|
| 26 | - * |
|
| 27 | - * @var array |
|
| 28 | - */ |
|
| 29 | - private $emails; |
|
| 24 | + /** |
|
| 25 | + * emails. |
|
| 26 | + * |
|
| 27 | + * @var array |
|
| 28 | + */ |
|
| 29 | + private $emails; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * __construct. |
|
| 33 | - */ |
|
| 34 | - public function __construct(array $emails) |
|
| 35 | - { |
|
| 36 | - $this->emails = $emails; |
|
| 37 | - } |
|
| 31 | + /** |
|
| 32 | + * __construct. |
|
| 33 | + */ |
|
| 34 | + public function __construct(array $emails) |
|
| 35 | + { |
|
| 36 | + $this->emails = $emails; |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Returns the email addresses. |
|
| 41 | - * |
|
| 42 | - * @return array |
|
| 43 | - */ |
|
| 44 | - public function getValue() |
|
| 45 | - { |
|
| 46 | - return $this->emails; |
|
| 47 | - } |
|
| 39 | + /** |
|
| 40 | + * Returns the email addresses. |
|
| 41 | + * |
|
| 42 | + * @return array |
|
| 43 | + */ |
|
| 44 | + public function getValue() |
|
| 45 | + { |
|
| 46 | + return $this->emails; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * The xmlSerialize method is called during xml writing. |
|
| 51 | - * |
|
| 52 | - * Use the $writer argument to write its own xml serialization. |
|
| 53 | - * |
|
| 54 | - * An important note: do _not_ create a parent element. Any element |
|
| 55 | - * implementing XmlSerializable should only ever write what's considered |
|
| 56 | - * its 'inner xml'. |
|
| 57 | - * |
|
| 58 | - * The parent of the current element is responsible for writing a |
|
| 59 | - * containing element. |
|
| 60 | - * |
|
| 61 | - * This allows serializers to be re-used for different element names. |
|
| 62 | - * |
|
| 63 | - * If you are opening new elements, you must also close them again. |
|
| 64 | - */ |
|
| 65 | - public function xmlSerialize(Writer $writer) |
|
| 66 | - { |
|
| 67 | - foreach ($this->emails as $email) { |
|
| 68 | - $writer->writeElement('{http://calendarserver.org/ns/}email-address', $email); |
|
| 69 | - } |
|
| 70 | - } |
|
| 49 | + /** |
|
| 50 | + * The xmlSerialize method is called during xml writing. |
|
| 51 | + * |
|
| 52 | + * Use the $writer argument to write its own xml serialization. |
|
| 53 | + * |
|
| 54 | + * An important note: do _not_ create a parent element. Any element |
|
| 55 | + * implementing XmlSerializable should only ever write what's considered |
|
| 56 | + * its 'inner xml'. |
|
| 57 | + * |
|
| 58 | + * The parent of the current element is responsible for writing a |
|
| 59 | + * containing element. |
|
| 60 | + * |
|
| 61 | + * This allows serializers to be re-used for different element names. |
|
| 62 | + * |
|
| 63 | + * If you are opening new elements, you must also close them again. |
|
| 64 | + */ |
|
| 65 | + public function xmlSerialize(Writer $writer) |
|
| 66 | + { |
|
| 67 | + foreach ($this->emails as $email) { |
|
| 68 | + $writer->writeElement('{http://calendarserver.org/ns/}email-address', $email); |
|
| 69 | + } |
|
| 70 | + } |
|
| 71 | 71 | } |
@@ -28,97 +28,97 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | class ScheduleCalendarTransp implements Element |
| 30 | 30 | { |
| 31 | - const TRANSPARENT = 'transparent'; |
|
| 32 | - const OPAQUE = 'opaque'; |
|
| 31 | + const TRANSPARENT = 'transparent'; |
|
| 32 | + const OPAQUE = 'opaque'; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * value. |
|
| 36 | - * |
|
| 37 | - * @var string |
|
| 38 | - */ |
|
| 39 | - protected $value; |
|
| 34 | + /** |
|
| 35 | + * value. |
|
| 36 | + * |
|
| 37 | + * @var string |
|
| 38 | + */ |
|
| 39 | + protected $value; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Creates the property. |
|
| 43 | - * |
|
| 44 | - * @param string $value |
|
| 45 | - */ |
|
| 46 | - public function __construct($value) |
|
| 47 | - { |
|
| 48 | - if (self::TRANSPARENT !== $value && self::OPAQUE !== $value) { |
|
| 49 | - throw new \InvalidArgumentException('The value must either be specified as "transparent" or "opaque"'); |
|
| 50 | - } |
|
| 51 | - $this->value = $value; |
|
| 52 | - } |
|
| 41 | + /** |
|
| 42 | + * Creates the property. |
|
| 43 | + * |
|
| 44 | + * @param string $value |
|
| 45 | + */ |
|
| 46 | + public function __construct($value) |
|
| 47 | + { |
|
| 48 | + if (self::TRANSPARENT !== $value && self::OPAQUE !== $value) { |
|
| 49 | + throw new \InvalidArgumentException('The value must either be specified as "transparent" or "opaque"'); |
|
| 50 | + } |
|
| 51 | + $this->value = $value; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Returns the current value. |
|
| 56 | - * |
|
| 57 | - * @return string |
|
| 58 | - */ |
|
| 59 | - public function getValue() |
|
| 60 | - { |
|
| 61 | - return $this->value; |
|
| 62 | - } |
|
| 54 | + /** |
|
| 55 | + * Returns the current value. |
|
| 56 | + * |
|
| 57 | + * @return string |
|
| 58 | + */ |
|
| 59 | + public function getValue() |
|
| 60 | + { |
|
| 61 | + return $this->value; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * The xmlSerialize method is called during xml writing. |
|
| 66 | - * |
|
| 67 | - * Use the $writer argument to write its own xml serialization. |
|
| 68 | - * |
|
| 69 | - * An important note: do _not_ create a parent element. Any element |
|
| 70 | - * implementing XmlSerializable should only ever write what's considered |
|
| 71 | - * its 'inner xml'. |
|
| 72 | - * |
|
| 73 | - * The parent of the current element is responsible for writing a |
|
| 74 | - * containing element. |
|
| 75 | - * |
|
| 76 | - * This allows serializers to be re-used for different element names. |
|
| 77 | - * |
|
| 78 | - * If you are opening new elements, you must also close them again. |
|
| 79 | - */ |
|
| 80 | - public function xmlSerialize(Writer $writer) |
|
| 81 | - { |
|
| 82 | - switch ($this->value) { |
|
| 83 | - case self::TRANSPARENT: |
|
| 84 | - $writer->writeElement('{'.Plugin::NS_CALDAV.'}transparent'); |
|
| 85 | - break; |
|
| 86 | - case self::OPAQUE: |
|
| 87 | - $writer->writeElement('{'.Plugin::NS_CALDAV.'}opaque'); |
|
| 88 | - break; |
|
| 89 | - } |
|
| 90 | - } |
|
| 64 | + /** |
|
| 65 | + * The xmlSerialize method is called during xml writing. |
|
| 66 | + * |
|
| 67 | + * Use the $writer argument to write its own xml serialization. |
|
| 68 | + * |
|
| 69 | + * An important note: do _not_ create a parent element. Any element |
|
| 70 | + * implementing XmlSerializable should only ever write what's considered |
|
| 71 | + * its 'inner xml'. |
|
| 72 | + * |
|
| 73 | + * The parent of the current element is responsible for writing a |
|
| 74 | + * containing element. |
|
| 75 | + * |
|
| 76 | + * This allows serializers to be re-used for different element names. |
|
| 77 | + * |
|
| 78 | + * If you are opening new elements, you must also close them again. |
|
| 79 | + */ |
|
| 80 | + public function xmlSerialize(Writer $writer) |
|
| 81 | + { |
|
| 82 | + switch ($this->value) { |
|
| 83 | + case self::TRANSPARENT: |
|
| 84 | + $writer->writeElement('{'.Plugin::NS_CALDAV.'}transparent'); |
|
| 85 | + break; |
|
| 86 | + case self::OPAQUE: |
|
| 87 | + $writer->writeElement('{'.Plugin::NS_CALDAV.'}opaque'); |
|
| 88 | + break; |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * The deserialize method is called during xml parsing. |
|
| 94 | - * |
|
| 95 | - * This method is called statically, this is because in theory this method |
|
| 96 | - * may be used as a type of constructor, or factory method. |
|
| 97 | - * |
|
| 98 | - * Often you want to return an instance of the current class, but you are |
|
| 99 | - * free to return other data as well. |
|
| 100 | - * |
|
| 101 | - * You are responsible for advancing the reader to the next element. Not |
|
| 102 | - * doing anything will result in a never-ending loop. |
|
| 103 | - * |
|
| 104 | - * If you just want to skip parsing for this element altogether, you can |
|
| 105 | - * just call $reader->next(); |
|
| 106 | - * |
|
| 107 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 108 | - * the next element. |
|
| 109 | - * |
|
| 110 | - * @return mixed |
|
| 111 | - */ |
|
| 112 | - public static function xmlDeserialize(Reader $reader) |
|
| 113 | - { |
|
| 114 | - $elems = Deserializer\enum($reader, Plugin::NS_CALDAV); |
|
| 92 | + /** |
|
| 93 | + * The deserialize method is called during xml parsing. |
|
| 94 | + * |
|
| 95 | + * This method is called statically, this is because in theory this method |
|
| 96 | + * may be used as a type of constructor, or factory method. |
|
| 97 | + * |
|
| 98 | + * Often you want to return an instance of the current class, but you are |
|
| 99 | + * free to return other data as well. |
|
| 100 | + * |
|
| 101 | + * You are responsible for advancing the reader to the next element. Not |
|
| 102 | + * doing anything will result in a never-ending loop. |
|
| 103 | + * |
|
| 104 | + * If you just want to skip parsing for this element altogether, you can |
|
| 105 | + * just call $reader->next(); |
|
| 106 | + * |
|
| 107 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 108 | + * the next element. |
|
| 109 | + * |
|
| 110 | + * @return mixed |
|
| 111 | + */ |
|
| 112 | + public static function xmlDeserialize(Reader $reader) |
|
| 113 | + { |
|
| 114 | + $elems = Deserializer\enum($reader, Plugin::NS_CALDAV); |
|
| 115 | 115 | |
| 116 | - if (in_array('transparent', $elems)) { |
|
| 117 | - $value = self::TRANSPARENT; |
|
| 118 | - } else { |
|
| 119 | - $value = self::OPAQUE; |
|
| 120 | - } |
|
| 116 | + if (in_array('transparent', $elems)) { |
|
| 117 | + $value = self::TRANSPARENT; |
|
| 118 | + } else { |
|
| 119 | + $value = self::OPAQUE; |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - return new self($value); |
|
| 123 | - } |
|
| 122 | + return new self($value); |
|
| 123 | + } |
|
| 124 | 124 | } |
@@ -23,32 +23,32 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | class SupportedCollationSet implements XmlSerializable |
| 25 | 25 | { |
| 26 | - /** |
|
| 27 | - * The xmlSerialize method is called during xml writing. |
|
| 28 | - * |
|
| 29 | - * Use the $writer argument to write its own xml serialization. |
|
| 30 | - * |
|
| 31 | - * An important note: do _not_ create a parent element. Any element |
|
| 32 | - * implementing XmlSerializable should only ever write what's considered |
|
| 33 | - * its 'inner xml'. |
|
| 34 | - * |
|
| 35 | - * The parent of the current element is responsible for writing a |
|
| 36 | - * containing element. |
|
| 37 | - * |
|
| 38 | - * This allows serializers to be re-used for different element names. |
|
| 39 | - * |
|
| 40 | - * If you are opening new elements, you must also close them again. |
|
| 41 | - */ |
|
| 42 | - public function xmlSerialize(Writer $writer) |
|
| 43 | - { |
|
| 44 | - $collations = [ |
|
| 45 | - 'i;ascii-casemap', |
|
| 46 | - 'i;octet', |
|
| 47 | - 'i;unicode-casemap', |
|
| 48 | - ]; |
|
| 26 | + /** |
|
| 27 | + * The xmlSerialize method is called during xml writing. |
|
| 28 | + * |
|
| 29 | + * Use the $writer argument to write its own xml serialization. |
|
| 30 | + * |
|
| 31 | + * An important note: do _not_ create a parent element. Any element |
|
| 32 | + * implementing XmlSerializable should only ever write what's considered |
|
| 33 | + * its 'inner xml'. |
|
| 34 | + * |
|
| 35 | + * The parent of the current element is responsible for writing a |
|
| 36 | + * containing element. |
|
| 37 | + * |
|
| 38 | + * This allows serializers to be re-used for different element names. |
|
| 39 | + * |
|
| 40 | + * If you are opening new elements, you must also close them again. |
|
| 41 | + */ |
|
| 42 | + public function xmlSerialize(Writer $writer) |
|
| 43 | + { |
|
| 44 | + $collations = [ |
|
| 45 | + 'i;ascii-casemap', |
|
| 46 | + 'i;octet', |
|
| 47 | + 'i;unicode-casemap', |
|
| 48 | + ]; |
|
| 49 | 49 | |
| 50 | - foreach ($collations as $collation) { |
|
| 51 | - $writer->writeElement('{'.Plugin::NS_CALDAV.'}supported-collation', $collation); |
|
| 52 | - } |
|
| 53 | - } |
|
| 50 | + foreach ($collations as $collation) { |
|
| 51 | + $writer->writeElement('{'.Plugin::NS_CALDAV.'}supported-collation', $collation); |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | 54 | } |
@@ -24,34 +24,34 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | class SupportedCalendarData implements XmlSerializable |
| 26 | 26 | { |
| 27 | - /** |
|
| 28 | - * The xmlSerialize method is called during xml writing. |
|
| 29 | - * |
|
| 30 | - * Use the $writer argument to write its own xml serialization. |
|
| 31 | - * |
|
| 32 | - * An important note: do _not_ create a parent element. Any element |
|
| 33 | - * implementing XmlSerializable should only ever write what's considered |
|
| 34 | - * its 'inner xml'. |
|
| 35 | - * |
|
| 36 | - * The parent of the current element is responsible for writing a |
|
| 37 | - * containing element. |
|
| 38 | - * |
|
| 39 | - * This allows serializers to be re-used for different element names. |
|
| 40 | - * |
|
| 41 | - * If you are opening new elements, you must also close them again. |
|
| 42 | - */ |
|
| 43 | - public function xmlSerialize(Writer $writer) |
|
| 44 | - { |
|
| 45 | - $writer->startElement('{'.Plugin::NS_CALDAV.'}calendar-data'); |
|
| 46 | - $writer->writeAttributes([ |
|
| 47 | - 'content-type' => 'text/calendar', |
|
| 48 | - 'version' => '2.0', |
|
| 49 | - ]); |
|
| 50 | - $writer->endElement(); // calendar-data |
|
| 51 | - $writer->startElement('{'.Plugin::NS_CALDAV.'}calendar-data'); |
|
| 52 | - $writer->writeAttributes([ |
|
| 53 | - 'content-type' => 'application/calendar+json', |
|
| 54 | - ]); |
|
| 55 | - $writer->endElement(); // calendar-data |
|
| 56 | - } |
|
| 27 | + /** |
|
| 28 | + * The xmlSerialize method is called during xml writing. |
|
| 29 | + * |
|
| 30 | + * Use the $writer argument to write its own xml serialization. |
|
| 31 | + * |
|
| 32 | + * An important note: do _not_ create a parent element. Any element |
|
| 33 | + * implementing XmlSerializable should only ever write what's considered |
|
| 34 | + * its 'inner xml'. |
|
| 35 | + * |
|
| 36 | + * The parent of the current element is responsible for writing a |
|
| 37 | + * containing element. |
|
| 38 | + * |
|
| 39 | + * This allows serializers to be re-used for different element names. |
|
| 40 | + * |
|
| 41 | + * If you are opening new elements, you must also close them again. |
|
| 42 | + */ |
|
| 43 | + public function xmlSerialize(Writer $writer) |
|
| 44 | + { |
|
| 45 | + $writer->startElement('{'.Plugin::NS_CALDAV.'}calendar-data'); |
|
| 46 | + $writer->writeAttributes([ |
|
| 47 | + 'content-type' => 'text/calendar', |
|
| 48 | + 'version' => '2.0', |
|
| 49 | + ]); |
|
| 50 | + $writer->endElement(); // calendar-data |
|
| 51 | + $writer->startElement('{'.Plugin::NS_CALDAV.'}calendar-data'); |
|
| 52 | + $writer->writeAttributes([ |
|
| 53 | + 'content-type' => 'application/calendar+json', |
|
| 54 | + ]); |
|
| 55 | + $writer->endElement(); // calendar-data |
|
| 56 | + } |
|
| 57 | 57 | } |
@@ -25,94 +25,94 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | class SupportedCalendarComponentSet implements Element |
| 27 | 27 | { |
| 28 | - /** |
|
| 29 | - * List of supported components. |
|
| 30 | - * |
|
| 31 | - * This array will contain values such as VEVENT, VTODO and VJOURNAL. |
|
| 32 | - * |
|
| 33 | - * @var array |
|
| 34 | - */ |
|
| 35 | - protected $components = []; |
|
| 28 | + /** |
|
| 29 | + * List of supported components. |
|
| 30 | + * |
|
| 31 | + * This array will contain values such as VEVENT, VTODO and VJOURNAL. |
|
| 32 | + * |
|
| 33 | + * @var array |
|
| 34 | + */ |
|
| 35 | + protected $components = []; |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Creates the property. |
|
| 39 | - */ |
|
| 40 | - public function __construct(array $components) |
|
| 41 | - { |
|
| 42 | - $this->components = $components; |
|
| 43 | - } |
|
| 37 | + /** |
|
| 38 | + * Creates the property. |
|
| 39 | + */ |
|
| 40 | + public function __construct(array $components) |
|
| 41 | + { |
|
| 42 | + $this->components = $components; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Returns the list of supported components. |
|
| 47 | - * |
|
| 48 | - * @return array |
|
| 49 | - */ |
|
| 50 | - public function getValue() |
|
| 51 | - { |
|
| 52 | - return $this->components; |
|
| 53 | - } |
|
| 45 | + /** |
|
| 46 | + * Returns the list of supported components. |
|
| 47 | + * |
|
| 48 | + * @return array |
|
| 49 | + */ |
|
| 50 | + public function getValue() |
|
| 51 | + { |
|
| 52 | + return $this->components; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * The xmlSerialize method is called during xml writing. |
|
| 57 | - * |
|
| 58 | - * Use the $writer argument to write its own xml serialization. |
|
| 59 | - * |
|
| 60 | - * An important note: do _not_ create a parent element. Any element |
|
| 61 | - * implementing XmlSerializable should only ever write what's considered |
|
| 62 | - * its 'inner xml'. |
|
| 63 | - * |
|
| 64 | - * The parent of the current element is responsible for writing a |
|
| 65 | - * containing element. |
|
| 66 | - * |
|
| 67 | - * This allows serializers to be re-used for different element names. |
|
| 68 | - * |
|
| 69 | - * If you are opening new elements, you must also close them again. |
|
| 70 | - */ |
|
| 71 | - public function xmlSerialize(Writer $writer) |
|
| 72 | - { |
|
| 73 | - foreach ($this->components as $component) { |
|
| 74 | - $writer->startElement('{'.Plugin::NS_CALDAV.'}comp'); |
|
| 75 | - $writer->writeAttributes(['name' => $component]); |
|
| 76 | - $writer->endElement(); |
|
| 77 | - } |
|
| 78 | - } |
|
| 55 | + /** |
|
| 56 | + * The xmlSerialize method is called during xml writing. |
|
| 57 | + * |
|
| 58 | + * Use the $writer argument to write its own xml serialization. |
|
| 59 | + * |
|
| 60 | + * An important note: do _not_ create a parent element. Any element |
|
| 61 | + * implementing XmlSerializable should only ever write what's considered |
|
| 62 | + * its 'inner xml'. |
|
| 63 | + * |
|
| 64 | + * The parent of the current element is responsible for writing a |
|
| 65 | + * containing element. |
|
| 66 | + * |
|
| 67 | + * This allows serializers to be re-used for different element names. |
|
| 68 | + * |
|
| 69 | + * If you are opening new elements, you must also close them again. |
|
| 70 | + */ |
|
| 71 | + public function xmlSerialize(Writer $writer) |
|
| 72 | + { |
|
| 73 | + foreach ($this->components as $component) { |
|
| 74 | + $writer->startElement('{'.Plugin::NS_CALDAV.'}comp'); |
|
| 75 | + $writer->writeAttributes(['name' => $component]); |
|
| 76 | + $writer->endElement(); |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * The deserialize method is called during xml parsing. |
|
| 82 | - * |
|
| 83 | - * This method is called statically, this is because in theory this method |
|
| 84 | - * may be used as a type of constructor, or factory method. |
|
| 85 | - * |
|
| 86 | - * Often you want to return an instance of the current class, but you are |
|
| 87 | - * free to return other data as well. |
|
| 88 | - * |
|
| 89 | - * You are responsible for advancing the reader to the next element. Not |
|
| 90 | - * doing anything will result in a never-ending loop. |
|
| 91 | - * |
|
| 92 | - * If you just want to skip parsing for this element altogether, you can |
|
| 93 | - * just call $reader->next(); |
|
| 94 | - * |
|
| 95 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 96 | - * the next element. |
|
| 97 | - * |
|
| 98 | - * @return mixed |
|
| 99 | - */ |
|
| 100 | - public static function xmlDeserialize(Reader $reader) |
|
| 101 | - { |
|
| 102 | - $elems = $reader->parseInnerTree(); |
|
| 80 | + /** |
|
| 81 | + * The deserialize method is called during xml parsing. |
|
| 82 | + * |
|
| 83 | + * This method is called statically, this is because in theory this method |
|
| 84 | + * may be used as a type of constructor, or factory method. |
|
| 85 | + * |
|
| 86 | + * Often you want to return an instance of the current class, but you are |
|
| 87 | + * free to return other data as well. |
|
| 88 | + * |
|
| 89 | + * You are responsible for advancing the reader to the next element. Not |
|
| 90 | + * doing anything will result in a never-ending loop. |
|
| 91 | + * |
|
| 92 | + * If you just want to skip parsing for this element altogether, you can |
|
| 93 | + * just call $reader->next(); |
|
| 94 | + * |
|
| 95 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
| 96 | + * the next element. |
|
| 97 | + * |
|
| 98 | + * @return mixed |
|
| 99 | + */ |
|
| 100 | + public static function xmlDeserialize(Reader $reader) |
|
| 101 | + { |
|
| 102 | + $elems = $reader->parseInnerTree(); |
|
| 103 | 103 | |
| 104 | - $components = []; |
|
| 104 | + $components = []; |
|
| 105 | 105 | |
| 106 | - foreach ((array) $elems as $elem) { |
|
| 107 | - if ($elem['name'] === '{'.Plugin::NS_CALDAV.'}comp') { |
|
| 108 | - $components[] = $elem['attributes']['name']; |
|
| 109 | - } |
|
| 110 | - } |
|
| 106 | + foreach ((array) $elems as $elem) { |
|
| 107 | + if ($elem['name'] === '{'.Plugin::NS_CALDAV.'}comp') { |
|
| 108 | + $components[] = $elem['attributes']['name']; |
|
| 109 | + } |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | - if (!$components) { |
|
| 113 | - throw new ParseException('supported-calendar-component-set must have at least one CALDAV:comp element'); |
|
| 114 | - } |
|
| 112 | + if (!$components) { |
|
| 113 | + throw new ParseException('supported-calendar-component-set must have at least one CALDAV:comp element'); |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | - return new self($components); |
|
| 117 | - } |
|
| 116 | + return new self($components); |
|
| 117 | + } |
|
| 118 | 118 | } |
@@ -27,55 +27,55 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | class AllowedSharingModes implements XmlSerializable |
| 29 | 29 | { |
| 30 | - /** |
|
| 31 | - * Whether or not a calendar can be shared with another user. |
|
| 32 | - * |
|
| 33 | - * @var bool |
|
| 34 | - */ |
|
| 35 | - protected $canBeShared; |
|
| 30 | + /** |
|
| 31 | + * Whether or not a calendar can be shared with another user. |
|
| 32 | + * |
|
| 33 | + * @var bool |
|
| 34 | + */ |
|
| 35 | + protected $canBeShared; |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Whether or not the calendar can be placed on a public url. |
|
| 39 | - * |
|
| 40 | - * @var bool |
|
| 41 | - */ |
|
| 42 | - protected $canBePublished; |
|
| 37 | + /** |
|
| 38 | + * Whether or not the calendar can be placed on a public url. |
|
| 39 | + * |
|
| 40 | + * @var bool |
|
| 41 | + */ |
|
| 42 | + protected $canBePublished; |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Constructor. |
|
| 46 | - * |
|
| 47 | - * @param bool $canBeShared |
|
| 48 | - * @param bool $canBePublished |
|
| 49 | - */ |
|
| 50 | - public function __construct($canBeShared, $canBePublished) |
|
| 51 | - { |
|
| 52 | - $this->canBeShared = $canBeShared; |
|
| 53 | - $this->canBePublished = $canBePublished; |
|
| 54 | - } |
|
| 44 | + /** |
|
| 45 | + * Constructor. |
|
| 46 | + * |
|
| 47 | + * @param bool $canBeShared |
|
| 48 | + * @param bool $canBePublished |
|
| 49 | + */ |
|
| 50 | + public function __construct($canBeShared, $canBePublished) |
|
| 51 | + { |
|
| 52 | + $this->canBeShared = $canBeShared; |
|
| 53 | + $this->canBePublished = $canBePublished; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * The xmlSerialize method is called during xml writing. |
|
| 58 | - * |
|
| 59 | - * Use the $writer argument to write its own xml serialization. |
|
| 60 | - * |
|
| 61 | - * An important note: do _not_ create a parent element. Any element |
|
| 62 | - * implementing XmlSerializable should only ever write what's considered |
|
| 63 | - * its 'inner xml'. |
|
| 64 | - * |
|
| 65 | - * The parent of the current element is responsible for writing a |
|
| 66 | - * containing element. |
|
| 67 | - * |
|
| 68 | - * This allows serializers to be re-used for different element names. |
|
| 69 | - * |
|
| 70 | - * If you are opening new elements, you must also close them again. |
|
| 71 | - */ |
|
| 72 | - public function xmlSerialize(Writer $writer) |
|
| 73 | - { |
|
| 74 | - if ($this->canBeShared) { |
|
| 75 | - $writer->writeElement('{'.Plugin::NS_CALENDARSERVER.'}can-be-shared'); |
|
| 76 | - } |
|
| 77 | - if ($this->canBePublished) { |
|
| 78 | - $writer->writeElement('{'.Plugin::NS_CALENDARSERVER.'}can-be-published'); |
|
| 79 | - } |
|
| 80 | - } |
|
| 56 | + /** |
|
| 57 | + * The xmlSerialize method is called during xml writing. |
|
| 58 | + * |
|
| 59 | + * Use the $writer argument to write its own xml serialization. |
|
| 60 | + * |
|
| 61 | + * An important note: do _not_ create a parent element. Any element |
|
| 62 | + * implementing XmlSerializable should only ever write what's considered |
|
| 63 | + * its 'inner xml'. |
|
| 64 | + * |
|
| 65 | + * The parent of the current element is responsible for writing a |
|
| 66 | + * containing element. |
|
| 67 | + * |
|
| 68 | + * This allows serializers to be re-used for different element names. |
|
| 69 | + * |
|
| 70 | + * If you are opening new elements, you must also close them again. |
|
| 71 | + */ |
|
| 72 | + public function xmlSerialize(Writer $writer) |
|
| 73 | + { |
|
| 74 | + if ($this->canBeShared) { |
|
| 75 | + $writer->writeElement('{'.Plugin::NS_CALENDARSERVER.'}can-be-shared'); |
|
| 76 | + } |
|
| 77 | + if ($this->canBePublished) { |
|
| 78 | + $writer->writeElement('{'.Plugin::NS_CALENDARSERVER.'}can-be-published'); |
|
| 79 | + } |
|
| 80 | + } |
|
| 81 | 81 | } |
@@ -15,205 +15,205 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class SharedCalendar extends Calendar implements ISharedCalendar |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Returns the 'access level' for the instance of this shared resource. |
|
| 20 | - * |
|
| 21 | - * The value should be one of the Sabre\DAV\Sharing\Plugin::ACCESS_ |
|
| 22 | - * constants. |
|
| 23 | - * |
|
| 24 | - * @return int |
|
| 25 | - */ |
|
| 26 | - public function getShareAccess() |
|
| 27 | - { |
|
| 28 | - return isset($this->calendarInfo['share-access']) ? $this->calendarInfo['share-access'] : SPlugin::ACCESS_NOTSHARED; |
|
| 29 | - } |
|
| 18 | + /** |
|
| 19 | + * Returns the 'access level' for the instance of this shared resource. |
|
| 20 | + * |
|
| 21 | + * The value should be one of the Sabre\DAV\Sharing\Plugin::ACCESS_ |
|
| 22 | + * constants. |
|
| 23 | + * |
|
| 24 | + * @return int |
|
| 25 | + */ |
|
| 26 | + public function getShareAccess() |
|
| 27 | + { |
|
| 28 | + return isset($this->calendarInfo['share-access']) ? $this->calendarInfo['share-access'] : SPlugin::ACCESS_NOTSHARED; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * This function must return a URI that uniquely identifies the shared |
|
| 33 | - * resource. This URI should be identical across instances, and is |
|
| 34 | - * also used in several other XML bodies to connect invites to |
|
| 35 | - * resources. |
|
| 36 | - * |
|
| 37 | - * This may simply be a relative reference to the original shared instance, |
|
| 38 | - * but it could also be a urn. As long as it's a valid URI and unique. |
|
| 39 | - * |
|
| 40 | - * @return string |
|
| 41 | - */ |
|
| 42 | - public function getShareResourceUri() |
|
| 43 | - { |
|
| 44 | - return $this->calendarInfo['share-resource-uri']; |
|
| 45 | - } |
|
| 31 | + /** |
|
| 32 | + * This function must return a URI that uniquely identifies the shared |
|
| 33 | + * resource. This URI should be identical across instances, and is |
|
| 34 | + * also used in several other XML bodies to connect invites to |
|
| 35 | + * resources. |
|
| 36 | + * |
|
| 37 | + * This may simply be a relative reference to the original shared instance, |
|
| 38 | + * but it could also be a urn. As long as it's a valid URI and unique. |
|
| 39 | + * |
|
| 40 | + * @return string |
|
| 41 | + */ |
|
| 42 | + public function getShareResourceUri() |
|
| 43 | + { |
|
| 44 | + return $this->calendarInfo['share-resource-uri']; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Updates the list of sharees. |
|
| 49 | - * |
|
| 50 | - * Every item must be a Sharee object. |
|
| 51 | - * |
|
| 52 | - * @param \Sabre\DAV\Xml\Element\Sharee[] $sharees |
|
| 53 | - */ |
|
| 54 | - public function updateInvites(array $sharees) |
|
| 55 | - { |
|
| 56 | - $this->caldavBackend->updateInvites($this->calendarInfo['id'], $sharees); |
|
| 57 | - } |
|
| 47 | + /** |
|
| 48 | + * Updates the list of sharees. |
|
| 49 | + * |
|
| 50 | + * Every item must be a Sharee object. |
|
| 51 | + * |
|
| 52 | + * @param \Sabre\DAV\Xml\Element\Sharee[] $sharees |
|
| 53 | + */ |
|
| 54 | + public function updateInvites(array $sharees) |
|
| 55 | + { |
|
| 56 | + $this->caldavBackend->updateInvites($this->calendarInfo['id'], $sharees); |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Returns the list of people whom this resource is shared with. |
|
| 61 | - * |
|
| 62 | - * Every item in the returned array must be a Sharee object with |
|
| 63 | - * at least the following properties set: |
|
| 64 | - * |
|
| 65 | - * * $href |
|
| 66 | - * * $shareAccess |
|
| 67 | - * * $inviteStatus |
|
| 68 | - * |
|
| 69 | - * and optionally: |
|
| 70 | - * |
|
| 71 | - * * $properties |
|
| 72 | - * |
|
| 73 | - * @return \Sabre\DAV\Xml\Element\Sharee[] |
|
| 74 | - */ |
|
| 75 | - public function getInvites() |
|
| 76 | - { |
|
| 77 | - return $this->caldavBackend->getInvites($this->calendarInfo['id']); |
|
| 78 | - } |
|
| 59 | + /** |
|
| 60 | + * Returns the list of people whom this resource is shared with. |
|
| 61 | + * |
|
| 62 | + * Every item in the returned array must be a Sharee object with |
|
| 63 | + * at least the following properties set: |
|
| 64 | + * |
|
| 65 | + * * $href |
|
| 66 | + * * $shareAccess |
|
| 67 | + * * $inviteStatus |
|
| 68 | + * |
|
| 69 | + * and optionally: |
|
| 70 | + * |
|
| 71 | + * * $properties |
|
| 72 | + * |
|
| 73 | + * @return \Sabre\DAV\Xml\Element\Sharee[] |
|
| 74 | + */ |
|
| 75 | + public function getInvites() |
|
| 76 | + { |
|
| 77 | + return $this->caldavBackend->getInvites($this->calendarInfo['id']); |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * Marks this calendar as published. |
|
| 82 | - * |
|
| 83 | - * Publishing a calendar should automatically create a read-only, public, |
|
| 84 | - * subscribable calendar. |
|
| 85 | - * |
|
| 86 | - * @param bool $value |
|
| 87 | - */ |
|
| 88 | - public function setPublishStatus($value) |
|
| 89 | - { |
|
| 90 | - $this->caldavBackend->setPublishStatus($this->calendarInfo['id'], $value); |
|
| 91 | - } |
|
| 80 | + /** |
|
| 81 | + * Marks this calendar as published. |
|
| 82 | + * |
|
| 83 | + * Publishing a calendar should automatically create a read-only, public, |
|
| 84 | + * subscribable calendar. |
|
| 85 | + * |
|
| 86 | + * @param bool $value |
|
| 87 | + */ |
|
| 88 | + public function setPublishStatus($value) |
|
| 89 | + { |
|
| 90 | + $this->caldavBackend->setPublishStatus($this->calendarInfo['id'], $value); |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - /** |
|
| 94 | - * Returns a list of ACE's for this node. |
|
| 95 | - * |
|
| 96 | - * Each ACE has the following properties: |
|
| 97 | - * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are |
|
| 98 | - * currently the only supported privileges |
|
| 99 | - * * 'principal', a url to the principal who owns the node |
|
| 100 | - * * 'protected' (optional), indicating that this ACE is not allowed to |
|
| 101 | - * be updated. |
|
| 102 | - * |
|
| 103 | - * @return array |
|
| 104 | - */ |
|
| 105 | - public function getACL() |
|
| 106 | - { |
|
| 107 | - $acl = []; |
|
| 93 | + /** |
|
| 94 | + * Returns a list of ACE's for this node. |
|
| 95 | + * |
|
| 96 | + * Each ACE has the following properties: |
|
| 97 | + * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are |
|
| 98 | + * currently the only supported privileges |
|
| 99 | + * * 'principal', a url to the principal who owns the node |
|
| 100 | + * * 'protected' (optional), indicating that this ACE is not allowed to |
|
| 101 | + * be updated. |
|
| 102 | + * |
|
| 103 | + * @return array |
|
| 104 | + */ |
|
| 105 | + public function getACL() |
|
| 106 | + { |
|
| 107 | + $acl = []; |
|
| 108 | 108 | |
| 109 | - switch ($this->getShareAccess()) { |
|
| 110 | - case SPlugin::ACCESS_NOTSHARED: |
|
| 111 | - case SPlugin::ACCESS_SHAREDOWNER: |
|
| 112 | - $acl[] = [ |
|
| 113 | - 'privilege' => '{DAV:}share', |
|
| 114 | - 'principal' => $this->calendarInfo['principaluri'], |
|
| 115 | - 'protected' => true, |
|
| 116 | - ]; |
|
| 117 | - $acl[] = [ |
|
| 118 | - 'privilege' => '{DAV:}share', |
|
| 119 | - 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-write', |
|
| 120 | - 'protected' => true, |
|
| 121 | - ]; |
|
| 122 | - // no break intentional! |
|
| 123 | - case SPlugin::ACCESS_READWRITE: |
|
| 124 | - $acl[] = [ |
|
| 125 | - 'privilege' => '{DAV:}write', |
|
| 126 | - 'principal' => $this->calendarInfo['principaluri'], |
|
| 127 | - 'protected' => true, |
|
| 128 | - ]; |
|
| 129 | - $acl[] = [ |
|
| 130 | - 'privilege' => '{DAV:}write', |
|
| 131 | - 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-write', |
|
| 132 | - 'protected' => true, |
|
| 133 | - ]; |
|
| 134 | - // no break intentional! |
|
| 135 | - case SPlugin::ACCESS_READ: |
|
| 136 | - $acl[] = [ |
|
| 137 | - 'privilege' => '{DAV:}write-properties', |
|
| 138 | - 'principal' => $this->calendarInfo['principaluri'], |
|
| 139 | - 'protected' => true, |
|
| 140 | - ]; |
|
| 141 | - $acl[] = [ |
|
| 142 | - 'privilege' => '{DAV:}write-properties', |
|
| 143 | - 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-write', |
|
| 144 | - 'protected' => true, |
|
| 145 | - ]; |
|
| 146 | - $acl[] = [ |
|
| 147 | - 'privilege' => '{DAV:}read', |
|
| 148 | - 'principal' => $this->calendarInfo['principaluri'], |
|
| 149 | - 'protected' => true, |
|
| 150 | - ]; |
|
| 151 | - $acl[] = [ |
|
| 152 | - 'privilege' => '{DAV:}read', |
|
| 153 | - 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-read', |
|
| 154 | - 'protected' => true, |
|
| 155 | - ]; |
|
| 156 | - $acl[] = [ |
|
| 157 | - 'privilege' => '{DAV:}read', |
|
| 158 | - 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-write', |
|
| 159 | - 'protected' => true, |
|
| 160 | - ]; |
|
| 161 | - $acl[] = [ |
|
| 162 | - 'privilege' => '{'.Plugin::NS_CALDAV.'}read-free-busy', |
|
| 163 | - 'principal' => '{DAV:}authenticated', |
|
| 164 | - 'protected' => true, |
|
| 165 | - ]; |
|
| 166 | - break; |
|
| 167 | - } |
|
| 109 | + switch ($this->getShareAccess()) { |
|
| 110 | + case SPlugin::ACCESS_NOTSHARED: |
|
| 111 | + case SPlugin::ACCESS_SHAREDOWNER: |
|
| 112 | + $acl[] = [ |
|
| 113 | + 'privilege' => '{DAV:}share', |
|
| 114 | + 'principal' => $this->calendarInfo['principaluri'], |
|
| 115 | + 'protected' => true, |
|
| 116 | + ]; |
|
| 117 | + $acl[] = [ |
|
| 118 | + 'privilege' => '{DAV:}share', |
|
| 119 | + 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-write', |
|
| 120 | + 'protected' => true, |
|
| 121 | + ]; |
|
| 122 | + // no break intentional! |
|
| 123 | + case SPlugin::ACCESS_READWRITE: |
|
| 124 | + $acl[] = [ |
|
| 125 | + 'privilege' => '{DAV:}write', |
|
| 126 | + 'principal' => $this->calendarInfo['principaluri'], |
|
| 127 | + 'protected' => true, |
|
| 128 | + ]; |
|
| 129 | + $acl[] = [ |
|
| 130 | + 'privilege' => '{DAV:}write', |
|
| 131 | + 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-write', |
|
| 132 | + 'protected' => true, |
|
| 133 | + ]; |
|
| 134 | + // no break intentional! |
|
| 135 | + case SPlugin::ACCESS_READ: |
|
| 136 | + $acl[] = [ |
|
| 137 | + 'privilege' => '{DAV:}write-properties', |
|
| 138 | + 'principal' => $this->calendarInfo['principaluri'], |
|
| 139 | + 'protected' => true, |
|
| 140 | + ]; |
|
| 141 | + $acl[] = [ |
|
| 142 | + 'privilege' => '{DAV:}write-properties', |
|
| 143 | + 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-write', |
|
| 144 | + 'protected' => true, |
|
| 145 | + ]; |
|
| 146 | + $acl[] = [ |
|
| 147 | + 'privilege' => '{DAV:}read', |
|
| 148 | + 'principal' => $this->calendarInfo['principaluri'], |
|
| 149 | + 'protected' => true, |
|
| 150 | + ]; |
|
| 151 | + $acl[] = [ |
|
| 152 | + 'privilege' => '{DAV:}read', |
|
| 153 | + 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-read', |
|
| 154 | + 'protected' => true, |
|
| 155 | + ]; |
|
| 156 | + $acl[] = [ |
|
| 157 | + 'privilege' => '{DAV:}read', |
|
| 158 | + 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-write', |
|
| 159 | + 'protected' => true, |
|
| 160 | + ]; |
|
| 161 | + $acl[] = [ |
|
| 162 | + 'privilege' => '{'.Plugin::NS_CALDAV.'}read-free-busy', |
|
| 163 | + 'principal' => '{DAV:}authenticated', |
|
| 164 | + 'protected' => true, |
|
| 165 | + ]; |
|
| 166 | + break; |
|
| 167 | + } |
|
| 168 | 168 | |
| 169 | - return $acl; |
|
| 170 | - } |
|
| 169 | + return $acl; |
|
| 170 | + } |
|
| 171 | 171 | |
| 172 | - /** |
|
| 173 | - * This method returns the ACL's for calendar objects in this calendar. |
|
| 174 | - * The result of this method automatically gets passed to the |
|
| 175 | - * calendar-object nodes in the calendar. |
|
| 176 | - * |
|
| 177 | - * @return array |
|
| 178 | - */ |
|
| 179 | - public function getChildACL() |
|
| 180 | - { |
|
| 181 | - $acl = []; |
|
| 172 | + /** |
|
| 173 | + * This method returns the ACL's for calendar objects in this calendar. |
|
| 174 | + * The result of this method automatically gets passed to the |
|
| 175 | + * calendar-object nodes in the calendar. |
|
| 176 | + * |
|
| 177 | + * @return array |
|
| 178 | + */ |
|
| 179 | + public function getChildACL() |
|
| 180 | + { |
|
| 181 | + $acl = []; |
|
| 182 | 182 | |
| 183 | - switch ($this->getShareAccess()) { |
|
| 184 | - case SPlugin::ACCESS_NOTSHARED: |
|
| 185 | - case SPlugin::ACCESS_SHAREDOWNER: |
|
| 186 | - case SPlugin::ACCESS_READWRITE: |
|
| 187 | - $acl[] = [ |
|
| 188 | - 'privilege' => '{DAV:}write', |
|
| 189 | - 'principal' => $this->calendarInfo['principaluri'], |
|
| 190 | - 'protected' => true, |
|
| 191 | - ]; |
|
| 192 | - $acl[] = [ |
|
| 193 | - 'privilege' => '{DAV:}write', |
|
| 194 | - 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-write', |
|
| 195 | - 'protected' => true, |
|
| 196 | - ]; |
|
| 197 | - // no break intentional |
|
| 198 | - case SPlugin::ACCESS_READ: |
|
| 199 | - $acl[] = [ |
|
| 200 | - 'privilege' => '{DAV:}read', |
|
| 201 | - 'principal' => $this->calendarInfo['principaluri'], |
|
| 202 | - 'protected' => true, |
|
| 203 | - ]; |
|
| 204 | - $acl[] = [ |
|
| 205 | - 'privilege' => '{DAV:}read', |
|
| 206 | - 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-write', |
|
| 207 | - 'protected' => true, |
|
| 208 | - ]; |
|
| 209 | - $acl[] = [ |
|
| 210 | - 'privilege' => '{DAV:}read', |
|
| 211 | - 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-read', |
|
| 212 | - 'protected' => true, |
|
| 213 | - ]; |
|
| 214 | - break; |
|
| 215 | - } |
|
| 183 | + switch ($this->getShareAccess()) { |
|
| 184 | + case SPlugin::ACCESS_NOTSHARED: |
|
| 185 | + case SPlugin::ACCESS_SHAREDOWNER: |
|
| 186 | + case SPlugin::ACCESS_READWRITE: |
|
| 187 | + $acl[] = [ |
|
| 188 | + 'privilege' => '{DAV:}write', |
|
| 189 | + 'principal' => $this->calendarInfo['principaluri'], |
|
| 190 | + 'protected' => true, |
|
| 191 | + ]; |
|
| 192 | + $acl[] = [ |
|
| 193 | + 'privilege' => '{DAV:}write', |
|
| 194 | + 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-write', |
|
| 195 | + 'protected' => true, |
|
| 196 | + ]; |
|
| 197 | + // no break intentional |
|
| 198 | + case SPlugin::ACCESS_READ: |
|
| 199 | + $acl[] = [ |
|
| 200 | + 'privilege' => '{DAV:}read', |
|
| 201 | + 'principal' => $this->calendarInfo['principaluri'], |
|
| 202 | + 'protected' => true, |
|
| 203 | + ]; |
|
| 204 | + $acl[] = [ |
|
| 205 | + 'privilege' => '{DAV:}read', |
|
| 206 | + 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-write', |
|
| 207 | + 'protected' => true, |
|
| 208 | + ]; |
|
| 209 | + $acl[] = [ |
|
| 210 | + 'privilege' => '{DAV:}read', |
|
| 211 | + 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-read', |
|
| 212 | + 'protected' => true, |
|
| 213 | + ]; |
|
| 214 | + break; |
|
| 215 | + } |
|
| 216 | 216 | |
| 217 | - return $acl; |
|
| 218 | - } |
|
| 217 | + return $acl; |
|
| 218 | + } |
|
| 219 | 219 | } |