@@ -67,25 +67,25 @@ |
||
67 | 67 | if (is_array($elems)) { |
68 | 68 | foreach ($elems as $elem) { |
69 | 69 | switch ($elem['name']) { |
70 | - case '{' . Plugin::NS_CARDDAV . '}param-filter': |
|
71 | - $result['param-filters'][] = $elem['value']; |
|
72 | - break; |
|
73 | - case '{' . Plugin::NS_CARDDAV . '}is-not-defined': |
|
74 | - $result['is-not-defined'] = true; |
|
75 | - break; |
|
76 | - case '{' . Plugin::NS_CARDDAV . '}text-match': |
|
77 | - $matchType = isset($elem['attributes']['match-type']) ? $elem['attributes']['match-type'] : 'contains'; |
|
70 | + case '{' . Plugin::NS_CARDDAV . '}param-filter': |
|
71 | + $result['param-filters'][] = $elem['value']; |
|
72 | + break; |
|
73 | + case '{' . Plugin::NS_CARDDAV . '}is-not-defined': |
|
74 | + $result['is-not-defined'] = true; |
|
75 | + break; |
|
76 | + case '{' . Plugin::NS_CARDDAV . '}text-match': |
|
77 | + $matchType = isset($elem['attributes']['match-type']) ? $elem['attributes']['match-type'] : 'contains'; |
|
78 | 78 | |
79 | - if (!in_array($matchType, ['contains', 'equals', 'starts-with', 'ends-with'])) { |
|
80 | - throw new BadRequest('Unknown match-type: ' . $matchType); |
|
81 | - } |
|
82 | - $result['text-matches'][] = [ |
|
83 | - 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
84 | - 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;unicode-casemap', |
|
85 | - 'value' => $elem['value'], |
|
86 | - 'match-type' => $matchType, |
|
87 | - ]; |
|
88 | - break; |
|
79 | + if (!in_array($matchType, ['contains', 'equals', 'starts-with', 'ends-with'])) { |
|
80 | + throw new BadRequest('Unknown match-type: ' . $matchType); |
|
81 | + } |
|
82 | + $result['text-matches'][] = [ |
|
83 | + 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
84 | + 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;unicode-casemap', |
|
85 | + 'value' => $elem['value'], |
|
86 | + 'match-type' => $matchType, |
|
87 | + ]; |
|
88 | + break; |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | } |
@@ -53,11 +53,11 @@ |
||
53 | 53 | ]; |
54 | 54 | |
55 | 55 | $elems = (array) $reader->parseInnerTree(); |
56 | - $elems = array_filter($elems, function ($element) { |
|
56 | + $elems = array_filter($elems, function($element) { |
|
57 | 57 | return '{urn:ietf:params:xml:ns:carddav}prop' === $element['name'] && |
58 | 58 | isset($element['attributes']['name']); |
59 | 59 | }); |
60 | - $result['addressDataProperties'] = array_map(function ($element) { |
|
60 | + $result['addressDataProperties'] = array_map(function($element) { |
|
61 | 61 | return $element['attributes']['name']; |
62 | 62 | }, $elems); |
63 | 63 |
@@ -61,22 +61,22 @@ |
||
61 | 61 | if (is_array($elems)) { |
62 | 62 | foreach ($elems as $elem) { |
63 | 63 | switch ($elem['name']) { |
64 | - case '{' . Plugin::NS_CARDDAV . '}is-not-defined': |
|
65 | - $result['is-not-defined'] = true; |
|
66 | - break; |
|
67 | - case '{' . Plugin::NS_CARDDAV . '}text-match': |
|
68 | - $matchType = isset($elem['attributes']['match-type']) ? $elem['attributes']['match-type'] : 'contains'; |
|
64 | + case '{' . Plugin::NS_CARDDAV . '}is-not-defined': |
|
65 | + $result['is-not-defined'] = true; |
|
66 | + break; |
|
67 | + case '{' . Plugin::NS_CARDDAV . '}text-match': |
|
68 | + $matchType = isset($elem['attributes']['match-type']) ? $elem['attributes']['match-type'] : 'contains'; |
|
69 | 69 | |
70 | - if (!in_array($matchType, ['contains', 'equals', 'starts-with', 'ends-with'])) { |
|
71 | - throw new BadRequest('Unknown match-type: ' . $matchType); |
|
72 | - } |
|
73 | - $result['text-match'] = [ |
|
74 | - 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
75 | - 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;unicode-casemap', |
|
76 | - 'value' => $elem['value'], |
|
77 | - 'match-type' => $matchType, |
|
78 | - ]; |
|
79 | - break; |
|
70 | + if (!in_array($matchType, ['contains', 'equals', 'starts-with', 'ends-with'])) { |
|
71 | + throw new BadRequest('Unknown match-type: ' . $matchType); |
|
72 | + } |
|
73 | + $result['text-match'] = [ |
|
74 | + 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
75 | + 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;unicode-casemap', |
|
76 | + 'value' => $elem['value'], |
|
77 | + 'match-type' => $matchType, |
|
78 | + ]; |
|
79 | + break; |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | { |
38 | 38 | $this->server = $server; |
39 | 39 | $this->server->on('method:GET', [$this, 'httpGet'], 90); |
40 | - $server->on('browserButtonActions', function ($path, $node, &$actions) { |
|
40 | + $server->on('browserButtonActions', function($path, $node, &$actions) { |
|
41 | 41 | if ($node instanceof IAddressBook) { |
42 | 42 | $actions .= '<a href="' . htmlspecialchars($path, ENT_QUOTES, 'UTF-8') . '?export"><span class="oi" data-glyph="book"></span></a>'; |
43 | 43 | } |
@@ -101,7 +101,7 @@ |
||
101 | 101 | '{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description', |
102 | 102 | ]; |
103 | 103 | |
104 | - $propPatch->handle($supportedProperties, function ($mutations) use ($addressBookId) { |
|
104 | + $propPatch->handle($supportedProperties, function($mutations) use ($addressBookId) { |
|
105 | 105 | $updates = []; |
106 | 106 | foreach ($mutations as $property => $newValue) { |
107 | 107 | switch ($property) { |
@@ -31,7 +31,7 @@ |
||
31 | 31 | */ |
32 | 32 | public function getMultipleCards($addressBookId, array $uris) |
33 | 33 | { |
34 | - return array_map(function ($uri) use ($addressBookId) { |
|
34 | + return array_map(function($uri) use ($addressBookId) { |
|
35 | 35 | return $this->getCard($addressBookId, $uri); |
36 | 36 | }, $uris); |
37 | 37 | } |
@@ -325,10 +325,10 @@ discard block |
||
325 | 325 | |
326 | 326 | if ($node instanceof ICalendarObjectContainer) { |
327 | 327 | $propFind->handle($ns . 'max-resource-size', $this->maxResourceSize); |
328 | - $propFind->handle($ns . 'supported-calendar-data', function () { |
|
328 | + $propFind->handle($ns . 'supported-calendar-data', function() { |
|
329 | 329 | return new Xml\Property\SupportedCalendarData(); |
330 | 330 | }); |
331 | - $propFind->handle($ns . 'supported-collation-set', function () { |
|
331 | + $propFind->handle($ns . 'supported-collation-set', function() { |
|
332 | 332 | return new Xml\Property\SupportedCollationSet(); |
333 | 333 | }); |
334 | 334 | } |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | if ($node instanceof DAVACL\IPrincipal) { |
337 | 337 | $principalUrl = $node->getPrincipalUrl(); |
338 | 338 | |
339 | - $propFind->handle('{' . self::NS_CALDAV . '}calendar-home-set', function () use ($principalUrl) { |
|
339 | + $propFind->handle('{' . self::NS_CALDAV . '}calendar-home-set', function() use ($principalUrl) { |
|
340 | 340 | $calendarHomePath = $this->getCalendarHomeForPrincipal($principalUrl); |
341 | 341 | if (is_null($calendarHomePath)) { |
342 | 342 | return null; |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | }); |
347 | 347 | // The calendar-user-address-set property is basically mapped to |
348 | 348 | // the {DAV:}alternate-URI-set property. |
349 | - $propFind->handle('{' . self::NS_CALDAV . '}calendar-user-address-set', function () use ($node) { |
|
349 | + $propFind->handle('{' . self::NS_CALDAV . '}calendar-user-address-set', function() use ($node) { |
|
350 | 350 | $addresses = $node->getAlternateUriSet(); |
351 | 351 | $addresses[] = $this->server->getBaseUri() . $node->getPrincipalUrl() . '/'; |
352 | 352 | |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | }); |
355 | 355 | // For some reason somebody thought it was a good idea to add |
356 | 356 | // another one of these properties. We're supporting it too. |
357 | - $propFind->handle('{' . self::NS_CALENDARSERVER . '}email-address-set', function () use ($node) { |
|
357 | + $propFind->handle('{' . self::NS_CALENDARSERVER . '}email-address-set', function() use ($node) { |
|
358 | 358 | $addresses = $node->getAlternateUriSet(); |
359 | 359 | $emails = []; |
360 | 360 | foreach ($addresses as $address) { |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | // The calendar-data property is not supposed to be a 'real' |
403 | 403 | // property, but in large chunks of the spec it does act as such. |
404 | 404 | // Therefore we simply expose it as a property. |
405 | - $propFind->handle('{' . self::NS_CALDAV . '}calendar-data', function () use ($node) { |
|
405 | + $propFind->handle('{' . self::NS_CALDAV . '}calendar-data', function() use ($node) { |
|
406 | 406 | $val = $node->get(); |
407 | 407 | if (is_resource($val)) { |
408 | 408 | $val = stream_get_contents($val); |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | 'time-range' => null, |
685 | 685 | ]); |
686 | 686 | |
687 | - $objects = array_map(function ($url) use ($calendar) { |
|
687 | + $objects = array_map(function($url) use ($calendar) { |
|
688 | 688 | $obj = $calendar->getChild($url)->get(); |
689 | 689 | |
690 | 690 | return $obj; |
@@ -64,28 +64,28 @@ |
||
64 | 64 | if (is_array($elems)) { |
65 | 65 | foreach ($elems as $elem) { |
66 | 66 | switch ($elem['name']) { |
67 | - case '{' . Plugin::NS_CALDAV . '}param-filter': |
|
68 | - $result['param-filters'][] = $elem['value']; |
|
69 | - break; |
|
70 | - case '{' . Plugin::NS_CALDAV . '}is-not-defined': |
|
71 | - $result['is-not-defined'] = true; |
|
72 | - break; |
|
73 | - case '{' . Plugin::NS_CALDAV . '}time-range': |
|
74 | - $result['time-range'] = [ |
|
75 | - 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
76 | - 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
77 | - ]; |
|
78 | - if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { |
|
79 | - throw new BadRequest('The end-date must be larger than the start-date'); |
|
80 | - } |
|
81 | - break; |
|
82 | - case '{' . Plugin::NS_CALDAV . '}text-match': |
|
83 | - $result['text-match'] = [ |
|
84 | - 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
85 | - 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', |
|
86 | - 'value' => $elem['value'], |
|
87 | - ]; |
|
88 | - break; |
|
67 | + case '{' . Plugin::NS_CALDAV . '}param-filter': |
|
68 | + $result['param-filters'][] = $elem['value']; |
|
69 | + break; |
|
70 | + case '{' . Plugin::NS_CALDAV . '}is-not-defined': |
|
71 | + $result['is-not-defined'] = true; |
|
72 | + break; |
|
73 | + case '{' . Plugin::NS_CALDAV . '}time-range': |
|
74 | + $result['time-range'] = [ |
|
75 | + 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null, |
|
76 | + 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null, |
|
77 | + ]; |
|
78 | + if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) { |
|
79 | + throw new BadRequest('The end-date must be larger than the start-date'); |
|
80 | + } |
|
81 | + break; |
|
82 | + case '{' . Plugin::NS_CALDAV . '}text-match': |
|
83 | + $result['text-match'] = [ |
|
84 | + 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
85 | + 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', |
|
86 | + 'value' => $elem['value'], |
|
87 | + ]; |
|
88 | + break; |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | } |
@@ -60,16 +60,16 @@ |
||
60 | 60 | if (is_array($elems)) { |
61 | 61 | foreach ($elems as $elem) { |
62 | 62 | switch ($elem['name']) { |
63 | - case '{' . Plugin::NS_CALDAV . '}is-not-defined': |
|
64 | - $result['is-not-defined'] = true; |
|
65 | - break; |
|
66 | - case '{' . Plugin::NS_CALDAV . '}text-match': |
|
67 | - $result['text-match'] = [ |
|
68 | - 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
69 | - 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', |
|
70 | - 'value' => $elem['value'], |
|
71 | - ]; |
|
72 | - break; |
|
63 | + case '{' . Plugin::NS_CALDAV . '}is-not-defined': |
|
64 | + $result['is-not-defined'] = true; |
|
65 | + break; |
|
66 | + case '{' . Plugin::NS_CALDAV . '}text-match': |
|
67 | + $result['text-match'] = [ |
|
68 | + 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'], |
|
69 | + 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap', |
|
70 | + 'value' => $elem['value'], |
|
71 | + ]; |
|
72 | + break; |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | } |