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