ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Plugin.php
Go to the documentation of this file.
1 <?php
2 
4 
9 
20 class Plugin extends ServerPlugin {
21 
34 
35  $server->resourceTypeMapping['Sabre\\CalDAV\\Subscriptions\\ISubscription'] =
36  '{http://calendarserver.org/ns/}subscribed';
37 
38  $server->xml->elementMap['{http://calendarserver.org/ns/}source'] =
39  'Sabre\\DAV\\Xml\\Property\\Href';
40 
41  $server->on('propFind', [$this, 'propFind'], 150);
42 
43  }
44 
53  function getFeatures() {
54 
55  return ['calendarserver-subscribed'];
56 
57  }
58 
66  function propFind(PropFind $propFind, INode $node) {
67 
68  // There's a bunch of properties that must appear as a self-closing
69  // xml-element. This event handler ensures that this will be the case.
70  $props = [
71  '{http://calendarserver.org/ns/}subscribed-strip-alarms',
72  '{http://calendarserver.org/ns/}subscribed-strip-attachments',
73  '{http://calendarserver.org/ns/}subscribed-strip-todos',
74  ];
75 
76  foreach ($props as $prop) {
77 
78  if ($propFind->getStatus($prop) === 200) {
79  $propFind->set($prop, '', 200);
80  }
81 
82  }
83 
84  }
85 
94  function getPluginName() {
95 
96  return 'subscriptions';
97 
98  }
99 
111  function getPluginInfo() {
112 
113  return [
114  'name' => $this->getPluginName(),
115  'description' => 'This plugin allows users to store iCalendar subscriptions in their calendar-home.',
116  'link' => null,
117  ];
118 
119  }
120 }
CalDAV plugin.
Definition: Plugin.php:28
The baseclass for all server plugins.
on($eventName, callable $callBack, $priority=100)
Subscribe to an event.
getFeatures()
This method should return a list of server-features.
Definition: Plugin.php:53
This class holds all the information about a PROPFIND request.
Definition: PropFind.php:11
set($propertyName, $value, $status=null)
Sets the value of the property.
Definition: PropFind.php:121
getStatus($propertyName)
Returns the current status code for a property name.
Definition: PropFind.php:164
getPluginName()
Returns a plugin name.
Definition: Plugin.php:94
getPluginName()
Returns a plugin name.
Definition: Plugin.php:135
propFind(PropFind $propFind, INode $node)
Triggered after properties have been fetched.
Definition: Plugin.php:66
Main DAV server class.
Definition: Server.php:23
The INode interface is the base interface, and the parent class of both ICollection and IFile...
Definition: INode.php:12
getPluginInfo()
Returns a bunch of meta-data about the plugin.
Definition: Plugin.php:111
initialize(Server $server)
This initializes the plugin.
Definition: Plugin.php:33