xref: /plugin/davcal/vendor/sabre/dav/lib/DAV/ServerPlugin.php (revision a1a3b6794e0e143a4a8b51d3185ce2d339be61ab)
1*a1a3b679SAndreas Boehler<?php
2*a1a3b679SAndreas Boehler
3*a1a3b679SAndreas Boehlernamespace Sabre\DAV;
4*a1a3b679SAndreas Boehler
5*a1a3b679SAndreas Boehler/**
6*a1a3b679SAndreas Boehler * The baseclass for all server plugins.
7*a1a3b679SAndreas Boehler *
8*a1a3b679SAndreas Boehler * Plugins can modify or extend the servers behaviour.
9*a1a3b679SAndreas Boehler *
10*a1a3b679SAndreas Boehler * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
11*a1a3b679SAndreas Boehler * @author Evert Pot (http://evertpot.com/)
12*a1a3b679SAndreas Boehler * @license http://sabre.io/license/ Modified BSD License
13*a1a3b679SAndreas Boehler */
14*a1a3b679SAndreas Boehlerabstract class ServerPlugin {
15*a1a3b679SAndreas Boehler
16*a1a3b679SAndreas Boehler    /**
17*a1a3b679SAndreas Boehler     * This initializes the plugin.
18*a1a3b679SAndreas Boehler     *
19*a1a3b679SAndreas Boehler     * This function is called by Sabre\DAV\Server, after
20*a1a3b679SAndreas Boehler     * addPlugin is called.
21*a1a3b679SAndreas Boehler     *
22*a1a3b679SAndreas Boehler     * This method should set up the required event subscriptions.
23*a1a3b679SAndreas Boehler     *
24*a1a3b679SAndreas Boehler     * @param Server $server
25*a1a3b679SAndreas Boehler     * @return void
26*a1a3b679SAndreas Boehler     */
27*a1a3b679SAndreas Boehler    abstract function initialize(Server $server);
28*a1a3b679SAndreas Boehler
29*a1a3b679SAndreas Boehler    /**
30*a1a3b679SAndreas Boehler     * This method should return a list of server-features.
31*a1a3b679SAndreas Boehler     *
32*a1a3b679SAndreas Boehler     * This is for example 'versioning' and is added to the DAV: header
33*a1a3b679SAndreas Boehler     * in an OPTIONS response.
34*a1a3b679SAndreas Boehler     *
35*a1a3b679SAndreas Boehler     * @return array
36*a1a3b679SAndreas Boehler     */
37*a1a3b679SAndreas Boehler    function getFeatures() {
38*a1a3b679SAndreas Boehler
39*a1a3b679SAndreas Boehler        return [];
40*a1a3b679SAndreas Boehler
41*a1a3b679SAndreas Boehler    }
42*a1a3b679SAndreas Boehler
43*a1a3b679SAndreas Boehler    /**
44*a1a3b679SAndreas Boehler     * Use this method to tell the server this plugin defines additional
45*a1a3b679SAndreas Boehler     * HTTP methods.
46*a1a3b679SAndreas Boehler     *
47*a1a3b679SAndreas Boehler     * This method is passed a uri. It should only return HTTP methods that are
48*a1a3b679SAndreas Boehler     * available for the specified uri.
49*a1a3b679SAndreas Boehler     *
50*a1a3b679SAndreas Boehler     * @param string $path
51*a1a3b679SAndreas Boehler     * @return array
52*a1a3b679SAndreas Boehler     */
53*a1a3b679SAndreas Boehler    function getHTTPMethods($path) {
54*a1a3b679SAndreas Boehler
55*a1a3b679SAndreas Boehler        return [];
56*a1a3b679SAndreas Boehler
57*a1a3b679SAndreas Boehler    }
58*a1a3b679SAndreas Boehler
59*a1a3b679SAndreas Boehler    /**
60*a1a3b679SAndreas Boehler     * Returns a plugin name.
61*a1a3b679SAndreas Boehler     *
62*a1a3b679SAndreas Boehler     * Using this name other plugins will be able to access other plugins
63*a1a3b679SAndreas Boehler     * using \Sabre\DAV\Server::getPlugin
64*a1a3b679SAndreas Boehler     *
65*a1a3b679SAndreas Boehler     * @return string
66*a1a3b679SAndreas Boehler     */
67*a1a3b679SAndreas Boehler    function getPluginName() {
68*a1a3b679SAndreas Boehler
69*a1a3b679SAndreas Boehler        return get_class($this);
70*a1a3b679SAndreas Boehler
71*a1a3b679SAndreas Boehler    }
72*a1a3b679SAndreas Boehler
73*a1a3b679SAndreas Boehler    /**
74*a1a3b679SAndreas Boehler     * Returns a list of reports this plugin supports.
75*a1a3b679SAndreas Boehler     *
76*a1a3b679SAndreas Boehler     * This will be used in the {DAV:}supported-report-set property.
77*a1a3b679SAndreas Boehler     * Note that you still need to subscribe to the 'report' event to actually
78*a1a3b679SAndreas Boehler     * implement them
79*a1a3b679SAndreas Boehler     *
80*a1a3b679SAndreas Boehler     * @param string $uri
81*a1a3b679SAndreas Boehler     * @return array
82*a1a3b679SAndreas Boehler     */
83*a1a3b679SAndreas Boehler    function getSupportedReportSet($uri) {
84*a1a3b679SAndreas Boehler
85*a1a3b679SAndreas Boehler        return [];
86*a1a3b679SAndreas Boehler
87*a1a3b679SAndreas Boehler    }
88*a1a3b679SAndreas Boehler
89*a1a3b679SAndreas Boehler    /**
90*a1a3b679SAndreas Boehler     * Returns a bunch of meta-data about the plugin.
91*a1a3b679SAndreas Boehler     *
92*a1a3b679SAndreas Boehler     * Providing this information is optional, and is mainly displayed by the
93*a1a3b679SAndreas Boehler     * Browser plugin.
94*a1a3b679SAndreas Boehler     *
95*a1a3b679SAndreas Boehler     * The description key in the returned array may contain html and will not
96*a1a3b679SAndreas Boehler     * be sanitized.
97*a1a3b679SAndreas Boehler     *
98*a1a3b679SAndreas Boehler     * @return array
99*a1a3b679SAndreas Boehler     */
100*a1a3b679SAndreas Boehler    function getPluginInfo() {
101*a1a3b679SAndreas Boehler
102*a1a3b679SAndreas Boehler        return [
103*a1a3b679SAndreas Boehler            'name'        => $this->getPluginName(),
104*a1a3b679SAndreas Boehler            'description' => null,
105*a1a3b679SAndreas Boehler            'link'        => null,
106*a1a3b679SAndreas Boehler        ];
107*a1a3b679SAndreas Boehler
108*a1a3b679SAndreas Boehler    }
109*a1a3b679SAndreas Boehler
110*a1a3b679SAndreas Boehler}
111