commit vendor

This commit is contained in:
2025-11-11 14:49:30 +01:00
parent f33121a308
commit 6d03080c00
2436 changed files with 483781 additions and 0 deletions

View File

@ -0,0 +1,81 @@
<?php
declare(strict_types=1);
namespace Sabre\CalDAV\Xml\Property;
use Sabre\CalDAV\Plugin;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
/**
* AllowedSharingModes.
*
* This property encodes the 'allowed-sharing-modes' property, as defined by
* the 'caldav-sharing-02' spec, in the http://calendarserver.org/ns/
* namespace.
*
* This property is a representation of the supported-calendar_component-set
* property in the CalDAV namespace. It simply requires an array of components,
* such as VEVENT, VTODO
*
* @see https://trac.calendarserver.org/browser/CalendarServer/trunk/doc/Extensions/caldav-sharing-02.txt
*
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://sabre.io/license/ Modified BSD License
*/
class AllowedSharingModes implements XmlSerializable
{
/**
* Whether or not a calendar can be shared with another user.
*
* @var bool
*/
protected $canBeShared;
/**
* Whether or not the calendar can be placed on a public url.
*
* @var bool
*/
protected $canBePublished;
/**
* Constructor.
*
* @param bool $canBeShared
* @param bool $canBePublished
*/
public function __construct($canBeShared, $canBePublished)
{
$this->canBeShared = $canBeShared;
$this->canBePublished = $canBePublished;
}
/**
* The xmlSerialize method is called during xml writing.
*
* Use the $writer argument to write its own xml serialization.
*
* An important note: do _not_ create a parent element. Any element
* implementing XmlSerializable should only ever write what's considered
* its 'inner xml'.
*
* The parent of the current element is responsible for writing a
* containing element.
*
* This allows serializers to be re-used for different element names.
*
* If you are opening new elements, you must also close them again.
*/
public function xmlSerialize(Writer $writer)
{
if ($this->canBeShared) {
$writer->writeElement('{'.Plugin::NS_CALENDARSERVER.'}can-be-shared');
}
if ($this->canBePublished) {
$writer->writeElement('{'.Plugin::NS_CALENDARSERVER.'}can-be-published');
}
}
}

View File

@ -0,0 +1,71 @@
<?php
declare(strict_types=1);
namespace Sabre\CalDAV\Xml\Property;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
/**
* email-address-set property.
*
* This property represents the email-address-set property in the
* http://calendarserver.org/ns/ namespace.
*
* It's a list of email addresses associated with a user.
*
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
class EmailAddressSet implements XmlSerializable
{
/**
* emails.
*
* @var array
*/
private $emails;
/**
* __construct.
*/
public function __construct(array $emails)
{
$this->emails = $emails;
}
/**
* Returns the email addresses.
*
* @return array
*/
public function getValue()
{
return $this->emails;
}
/**
* The xmlSerialize method is called during xml writing.
*
* Use the $writer argument to write its own xml serialization.
*
* An important note: do _not_ create a parent element. Any element
* implementing XmlSerializable should only ever write what's considered
* its 'inner xml'.
*
* The parent of the current element is responsible for writing a
* containing element.
*
* This allows serializers to be re-used for different element names.
*
* If you are opening new elements, you must also close them again.
*/
public function xmlSerialize(Writer $writer)
{
foreach ($this->emails as $email) {
$writer->writeElement('{http://calendarserver.org/ns/}email-address', $email);
}
}
}

View File

@ -0,0 +1,120 @@
<?php
declare(strict_types=1);
namespace Sabre\CalDAV\Xml\Property;
use Sabre\CalDAV\Plugin;
use Sabre\DAV;
use Sabre\DAV\Xml\Element\Sharee;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
/**
* Invite property.
*
* This property encodes the 'invite' property, as defined by
* the 'caldav-sharing-02' spec, in the http://calendarserver.org/ns/
* namespace.
*
* @see https://trac.calendarserver.org/browser/CalendarServer/trunk/doc/Extensions/caldav-sharing-02.txt
*
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
class Invite implements XmlSerializable
{
/**
* The list of users a calendar has been shared to.
*
* @var Sharee[]
*/
protected $sharees;
/**
* Creates the property.
*
* @param Sharee[] $sharees
*/
public function __construct(array $sharees)
{
$this->sharees = $sharees;
}
/**
* Returns the list of users, as it was passed to the constructor.
*
* @return array
*/
public function getValue()
{
return $this->sharees;
}
/**
* The xmlSerialize method is called during xml writing.
*
* Use the $writer argument to write its own xml serialization.
*
* An important note: do _not_ create a parent element. Any element
* implementing XmlSerializable should only ever write what's considered
* its 'inner xml'.
*
* The parent of the current element is responsible for writing a
* containing element.
*
* This allows serializers to be re-used for different element names.
*
* If you are opening new elements, you must also close them again.
*/
public function xmlSerialize(Writer $writer)
{
$cs = '{'.Plugin::NS_CALENDARSERVER.'}';
foreach ($this->sharees as $sharee) {
if (DAV\Sharing\Plugin::ACCESS_SHAREDOWNER === $sharee->access) {
$writer->startElement($cs.'organizer');
} else {
$writer->startElement($cs.'user');
switch ($sharee->inviteStatus) {
case DAV\Sharing\Plugin::INVITE_ACCEPTED:
$writer->writeElement($cs.'invite-accepted');
break;
case DAV\Sharing\Plugin::INVITE_DECLINED:
$writer->writeElement($cs.'invite-declined');
break;
case DAV\Sharing\Plugin::INVITE_NORESPONSE:
$writer->writeElement($cs.'invite-noresponse');
break;
case DAV\Sharing\Plugin::INVITE_INVALID:
$writer->writeElement($cs.'invite-invalid');
break;
}
$writer->startElement($cs.'access');
switch ($sharee->access) {
case DAV\Sharing\Plugin::ACCESS_READWRITE:
$writer->writeElement($cs.'read-write');
break;
case DAV\Sharing\Plugin::ACCESS_READ:
$writer->writeElement($cs.'read');
break;
}
$writer->endElement(); // access
}
$href = new DAV\Xml\Property\Href($sharee->href);
$href->xmlSerialize($writer);
if (isset($sharee->properties['{DAV:}displayname'])) {
$writer->writeElement($cs.'common-name', $sharee->properties['{DAV:}displayname']);
}
if ($sharee->comment) {
$writer->writeElement($cs.'summary', $sharee->comment);
}
$writer->endElement(); // organizer or user
}
}
}

View File

@ -0,0 +1,124 @@
<?php
declare(strict_types=1);
namespace Sabre\CalDAV\Xml\Property;
use Sabre\CalDAV\Plugin;
use Sabre\Xml\Deserializer;
use Sabre\Xml\Element;
use Sabre\Xml\Reader;
use Sabre\Xml\Writer;
/**
* schedule-calendar-transp property.
*
* This property is a representation of the schedule-calendar-transp property.
* This property is defined in:
*
* http://tools.ietf.org/html/rfc6638#section-9.1
*
* Its values are either 'transparent' or 'opaque'. If it's transparent, it
* means that this calendar will not be taken into consideration when a
* different user queries for free-busy information. If it's 'opaque', it will.
*
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://sabre.io/license/ Modified BSD License
*/
class ScheduleCalendarTransp implements Element
{
const TRANSPARENT = 'transparent';
const OPAQUE = 'opaque';
/**
* value.
*
* @var string
*/
protected $value;
/**
* Creates the property.
*
* @param string $value
*/
public function __construct($value)
{
if (self::TRANSPARENT !== $value && self::OPAQUE !== $value) {
throw new \InvalidArgumentException('The value must either be specified as "transparent" or "opaque"');
}
$this->value = $value;
}
/**
* Returns the current value.
*
* @return string
*/
public function getValue()
{
return $this->value;
}
/**
* The xmlSerialize method is called during xml writing.
*
* Use the $writer argument to write its own xml serialization.
*
* An important note: do _not_ create a parent element. Any element
* implementing XmlSerializable should only ever write what's considered
* its 'inner xml'.
*
* The parent of the current element is responsible for writing a
* containing element.
*
* This allows serializers to be re-used for different element names.
*
* If you are opening new elements, you must also close them again.
*/
public function xmlSerialize(Writer $writer)
{
switch ($this->value) {
case self::TRANSPARENT:
$writer->writeElement('{'.Plugin::NS_CALDAV.'}transparent');
break;
case self::OPAQUE:
$writer->writeElement('{'.Plugin::NS_CALDAV.'}opaque');
break;
}
}
/**
* The deserialize method is called during xml parsing.
*
* This method is called statically, this is because in theory this method
* may be used as a type of constructor, or factory method.
*
* Often you want to return an instance of the current class, but you are
* free to return other data as well.
*
* You are responsible for advancing the reader to the next element. Not
* doing anything will result in a never-ending loop.
*
* If you just want to skip parsing for this element altogether, you can
* just call $reader->next();
*
* $reader->parseInnerTree() will parse the entire sub-tree, and advance to
* the next element.
*
* @return mixed
*/
public static function xmlDeserialize(Reader $reader)
{
$elems = Deserializer\enum($reader, Plugin::NS_CALDAV);
if (in_array('transparent', $elems)) {
$value = self::TRANSPARENT;
} else {
$value = self::OPAQUE;
}
return new self($value);
}
}

View File

@ -0,0 +1,118 @@
<?php
declare(strict_types=1);
namespace Sabre\CalDAV\Xml\Property;
use Sabre\CalDAV\Plugin;
use Sabre\Xml\Element;
use Sabre\Xml\ParseException;
use Sabre\Xml\Reader;
use Sabre\Xml\Writer;
/**
* SupportedCalendarComponentSet property.
*
* This class represents the
* {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set property, as
* defined in:
*
* https://tools.ietf.org/html/rfc4791#section-5.2.3
*
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
class SupportedCalendarComponentSet implements Element
{
/**
* List of supported components.
*
* This array will contain values such as VEVENT, VTODO and VJOURNAL.
*
* @var array
*/
protected $components = [];
/**
* Creates the property.
*/
public function __construct(array $components)
{
$this->components = $components;
}
/**
* Returns the list of supported components.
*
* @return array
*/
public function getValue()
{
return $this->components;
}
/**
* The xmlSerialize method is called during xml writing.
*
* Use the $writer argument to write its own xml serialization.
*
* An important note: do _not_ create a parent element. Any element
* implementing XmlSerializable should only ever write what's considered
* its 'inner xml'.
*
* The parent of the current element is responsible for writing a
* containing element.
*
* This allows serializers to be re-used for different element names.
*
* If you are opening new elements, you must also close them again.
*/
public function xmlSerialize(Writer $writer)
{
foreach ($this->components as $component) {
$writer->startElement('{'.Plugin::NS_CALDAV.'}comp');
$writer->writeAttributes(['name' => $component]);
$writer->endElement();
}
}
/**
* The deserialize method is called during xml parsing.
*
* This method is called statically, this is because in theory this method
* may be used as a type of constructor, or factory method.
*
* Often you want to return an instance of the current class, but you are
* free to return other data as well.
*
* You are responsible for advancing the reader to the next element. Not
* doing anything will result in a never-ending loop.
*
* If you just want to skip parsing for this element altogether, you can
* just call $reader->next();
*
* $reader->parseInnerTree() will parse the entire sub-tree, and advance to
* the next element.
*
* @return mixed
*/
public static function xmlDeserialize(Reader $reader)
{
$elems = $reader->parseInnerTree();
$components = [];
foreach ((array) $elems as $elem) {
if ($elem['name'] === '{'.Plugin::NS_CALDAV.'}comp') {
$components[] = $elem['attributes']['name'];
}
}
if (!$components) {
throw new ParseException('supported-calendar-component-set must have at least one CALDAV:comp element');
}
return new self($components);
}
}

View File

@ -0,0 +1,57 @@
<?php
declare(strict_types=1);
namespace Sabre\CalDAV\Xml\Property;
use Sabre\CalDAV\Plugin;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
/**
* Supported-calendar-data property.
*
* This property is a representation of the supported-calendar-data property
* in the CalDAV namespace. SabreDAV only has support for text/calendar;2.0
* so the value is currently hardcoded.
*
* This property is defined in:
* http://tools.ietf.org/html/rfc4791#section-5.2.4
*
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://sabre.io/license/ Modified BSD License
*/
class SupportedCalendarData implements XmlSerializable
{
/**
* The xmlSerialize method is called during xml writing.
*
* Use the $writer argument to write its own xml serialization.
*
* An important note: do _not_ create a parent element. Any element
* implementing XmlSerializable should only ever write what's considered
* its 'inner xml'.
*
* The parent of the current element is responsible for writing a
* containing element.
*
* This allows serializers to be re-used for different element names.
*
* If you are opening new elements, you must also close them again.
*/
public function xmlSerialize(Writer $writer)
{
$writer->startElement('{'.Plugin::NS_CALDAV.'}calendar-data');
$writer->writeAttributes([
'content-type' => 'text/calendar',
'version' => '2.0',
]);
$writer->endElement(); // calendar-data
$writer->startElement('{'.Plugin::NS_CALDAV.'}calendar-data');
$writer->writeAttributes([
'content-type' => 'application/calendar+json',
]);
$writer->endElement(); // calendar-data
}
}

View File

@ -0,0 +1,54 @@
<?php
declare(strict_types=1);
namespace Sabre\CalDAV\Xml\Property;
use Sabre\CalDAV\Plugin;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
/**
* supported-collation-set property.
*
* This property is a representation of the supported-collation-set property
* in the CalDAV namespace.
*
* This property is defined in:
* http://tools.ietf.org/html/rfc4791#section-7.5.1
*
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
class SupportedCollationSet implements XmlSerializable
{
/**
* The xmlSerialize method is called during xml writing.
*
* Use the $writer argument to write its own xml serialization.
*
* An important note: do _not_ create a parent element. Any element
* implementing XmlSerializable should only ever write what's considered
* its 'inner xml'.
*
* The parent of the current element is responsible for writing a
* containing element.
*
* This allows serializers to be re-used for different element names.
*
* If you are opening new elements, you must also close them again.
*/
public function xmlSerialize(Writer $writer)
{
$collations = [
'i;ascii-casemap',
'i;octet',
'i;unicode-casemap',
];
foreach ($collations as $collation) {
$writer->writeElement('{'.Plugin::NS_CALDAV.'}supported-collation', $collation);
}
}
}