@@ -34,67 +34,67 @@ |
||
| 34 | 34 | |
| 35 | 35 | class HasPhotoPlugin extends ServerPlugin { |
| 36 | 36 | |
| 37 | - /** @var Server */ |
|
| 38 | - protected $server; |
|
| 37 | + /** @var Server */ |
|
| 38 | + protected $server; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * Initializes the plugin and registers event handlers |
|
| 42 | - * |
|
| 43 | - * @param Server $server |
|
| 44 | - * @return void |
|
| 45 | - */ |
|
| 46 | - function initialize(Server $server) { |
|
| 47 | - $server->on('propFind', [$this, 'propFind']); |
|
| 48 | - } |
|
| 40 | + /** |
|
| 41 | + * Initializes the plugin and registers event handlers |
|
| 42 | + * |
|
| 43 | + * @param Server $server |
|
| 44 | + * @return void |
|
| 45 | + */ |
|
| 46 | + function initialize(Server $server) { |
|
| 47 | + $server->on('propFind', [$this, 'propFind']); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * Adds all CardDAV-specific properties |
|
| 52 | - * |
|
| 53 | - * @param PropFind $propFind |
|
| 54 | - * @param INode $node |
|
| 55 | - * @return void |
|
| 56 | - */ |
|
| 57 | - function propFind(PropFind $propFind, INode $node) { |
|
| 50 | + /** |
|
| 51 | + * Adds all CardDAV-specific properties |
|
| 52 | + * |
|
| 53 | + * @param PropFind $propFind |
|
| 54 | + * @param INode $node |
|
| 55 | + * @return void |
|
| 56 | + */ |
|
| 57 | + function propFind(PropFind $propFind, INode $node) { |
|
| 58 | 58 | |
| 59 | - $ns = '{http://nextcloud.com/ns}'; |
|
| 59 | + $ns = '{http://nextcloud.com/ns}'; |
|
| 60 | 60 | |
| 61 | - if ($node instanceof Card) { |
|
| 62 | - $propFind->handle($ns . 'has-photo', function () use ($node) { |
|
| 63 | - $vcard = Reader::read($node->get()); |
|
| 64 | - return ($vcard instanceof VCard && $vcard->PHOTO); |
|
| 65 | - }); |
|
| 66 | - } |
|
| 67 | - } |
|
| 61 | + if ($node instanceof Card) { |
|
| 62 | + $propFind->handle($ns . 'has-photo', function () use ($node) { |
|
| 63 | + $vcard = Reader::read($node->get()); |
|
| 64 | + return ($vcard instanceof VCard && $vcard->PHOTO); |
|
| 65 | + }); |
|
| 66 | + } |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * Returns a plugin name. |
|
| 71 | - * |
|
| 72 | - * Using this name other plugins will be able to access other plugins |
|
| 73 | - * using \Sabre\DAV\Server::getPlugin |
|
| 74 | - * |
|
| 75 | - * @return string |
|
| 76 | - */ |
|
| 77 | - public function getPluginName() { |
|
| 78 | - return 'vcard-has-photo'; |
|
| 79 | - } |
|
| 69 | + /** |
|
| 70 | + * Returns a plugin name. |
|
| 71 | + * |
|
| 72 | + * Using this name other plugins will be able to access other plugins |
|
| 73 | + * using \Sabre\DAV\Server::getPlugin |
|
| 74 | + * |
|
| 75 | + * @return string |
|
| 76 | + */ |
|
| 77 | + public function getPluginName() { |
|
| 78 | + return 'vcard-has-photo'; |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Returns a bunch of meta-data about the plugin. |
|
| 83 | - * |
|
| 84 | - * Providing this information is optional, and is mainly displayed by the |
|
| 85 | - * Browser plugin. |
|
| 86 | - * |
|
| 87 | - * The description key in the returned array may contain html and will not |
|
| 88 | - * be sanitized. |
|
| 89 | - * |
|
| 90 | - * @return array |
|
| 91 | - */ |
|
| 92 | - public function getPluginInfo() { |
|
| 93 | - return [ |
|
| 94 | - 'name' => $this->getPluginName(), |
|
| 95 | - 'description' => 'Return a boolean stating if the vcard have a photo property set or not.' |
|
| 96 | - ]; |
|
| 81 | + /** |
|
| 82 | + * Returns a bunch of meta-data about the plugin. |
|
| 83 | + * |
|
| 84 | + * Providing this information is optional, and is mainly displayed by the |
|
| 85 | + * Browser plugin. |
|
| 86 | + * |
|
| 87 | + * The description key in the returned array may contain html and will not |
|
| 88 | + * be sanitized. |
|
| 89 | + * |
|
| 90 | + * @return array |
|
| 91 | + */ |
|
| 92 | + public function getPluginInfo() { |
|
| 93 | + return [ |
|
| 94 | + 'name' => $this->getPluginName(), |
|
| 95 | + 'description' => 'Return a boolean stating if the vcard have a photo property set or not.' |
|
| 96 | + ]; |
|
| 97 | 97 | |
| 98 | - } |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | 100 | } |