diff options
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/Activity/IEvent.php | 42 | ||||
-rw-r--r-- | lib/public/AppFramework/Http/StandaloneTemplateResponse.php | 37 | ||||
-rw-r--r-- | lib/public/Files/Cache/CacheInsertEvent.php | 72 | ||||
-rw-r--r-- | lib/public/Files/SimpleFS/InMemoryFile.php | 150 | ||||
-rw-r--r-- | lib/public/IAvatarManager.php | 9 | ||||
-rw-r--r-- | lib/public/INavigationManager.php | 21 | ||||
-rw-r--r-- | lib/public/Notification/INotification.php | 42 |
7 files changed, 372 insertions, 1 deletions
diff --git a/lib/public/Activity/IEvent.php b/lib/public/Activity/IEvent.php index aee00039b65..e380eca5c24 100644 --- a/lib/public/Activity/IEvent.php +++ b/lib/public/Activity/IEvent.php @@ -100,6 +100,17 @@ interface IEvent { public function setSubject(string $subject, array $parameters = []): self; /** + * Set a parsed subject + * + * HTML is not allowed in the parsed subject and will be escaped + * automatically by the clients. You can use the RichObjectString system + * provided by the Nextcloud server to highlight important parameters via + * the setRichSubject method, but make sure, that a plain text message is + * always set via setParsedSubject, to support clients which can not handle + * rich strings. + * + * See https://github.com/nextcloud/server/issues/1706 for more information. + * * @param string $subject * @return $this * @throws \InvalidArgumentException if the subject is invalid @@ -114,6 +125,16 @@ interface IEvent { public function getParsedSubject(): string; /** + * Set a RichObjectString subject + * + * HTML is not allowed in the rich subject and will be escaped automatically + * by the clients, but you can use the RichObjectString system provided by + * the Nextcloud server to highlight important parameters. + * Also make sure, that a plain text subject is always set via + * setParsedSubject, to support clients which can not handle rich strings. + * + * See https://github.com/nextcloud/server/issues/1706 for more information. + * * @param string $subject * @param array $parameters * @return $this @@ -146,6 +167,17 @@ interface IEvent { public function setMessage(string $message, array $parameters = []): self; /** + * Set a parsed message + * + * HTML is not allowed in the parsed message and will be escaped + * automatically by the clients. You can use the RichObjectString system + * provided by the Nextcloud server to highlight important parameters via + * the setRichMessage method, but make sure, that a plain text message is + * always set via setParsedMessage, to support clients which can not handle + * rich strings. + * + * See https://github.com/nextcloud/server/issues/1706 for more information. + * * @param string $message * @return $this * @throws \InvalidArgumentException if the message is invalid @@ -160,6 +192,16 @@ interface IEvent { public function getParsedMessage(): string; /** + * Set a RichObjectString message + * + * HTML is not allowed in the rich message and will be escaped automatically + * by the clients, but you can use the RichObjectString system provided by + * the Nextcloud server to highlight important parameters. + * Also make sure, that a plain text message is always set via + * setParsedMessage, to support clients which can not handle rich strings. + * + * See https://github.com/nextcloud/server/issues/1706 for more information. + * * @param string $message * @param array $parameters * @return $this diff --git a/lib/public/AppFramework/Http/StandaloneTemplateResponse.php b/lib/public/AppFramework/Http/StandaloneTemplateResponse.php new file mode 100644 index 00000000000..330b74d4b7d --- /dev/null +++ b/lib/public/AppFramework/Http/StandaloneTemplateResponse.php @@ -0,0 +1,37 @@ +<?php +declare(strict_types=1); +/** + * @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl> + * + * @author Roeland Jago Douma <roeland@famdouma.nl> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\AppFramework\Http; + +/** + * A template response that does not emit the loadAdditionalScripts events. + * + * This is useful for pages that are authenticated but do not yet show the + * full nextcloud UI. Like the 2FA page, or the grant page in the login flow. + * + * @since 16.0.0 + */ +class StandaloneTemplateResponse extends TemplateResponse { + +} diff --git a/lib/public/Files/Cache/CacheInsertEvent.php b/lib/public/Files/Cache/CacheInsertEvent.php new file mode 100644 index 00000000000..071f039d45f --- /dev/null +++ b/lib/public/Files/Cache/CacheInsertEvent.php @@ -0,0 +1,72 @@ +<?php declare(strict_types=1); +/** + * @copyright Copyright (c) 2019 Robin Appelman <robin@icewind.nl> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Files\Cache; + +use OCP\Files\Storage\IStorage; +use Symfony\Component\EventDispatcher\Event; + +/** + * @since 16.0.0 + */ +class CacheInsertEvent extends Event { + private $storage; + private $path; + private $fileId; + + /** + * CacheInsertEvent constructor. + * + * @param IStorage $storage + * @param string $path + * @param int $fileId + * @since 16.0.0 + */ + public function __construct(IStorage $storage, string $path, int $fileId) { + $this->storage = $storage; + $this->path = $path; + $this->fileId = $fileId; + } + + /** + * @return IStorage + * @since 16.0.0 + */ + public function getStorage(): IStorage { + return $this->storage; + } + + /** + * @return string + * @since 16.0.0 + */ + public function getPath(): string { + return $this->path; + } + + /** + * @return int + * @since 16.0.0 + */ + public function getFileId(): int { + return $this->fileId; + } +} diff --git a/lib/public/Files/SimpleFS/InMemoryFile.php b/lib/public/Files/SimpleFS/InMemoryFile.php new file mode 100644 index 00000000000..7976523f4e8 --- /dev/null +++ b/lib/public/Files/SimpleFS/InMemoryFile.php @@ -0,0 +1,150 @@ +<?php +declare(strict_types=1); + +/** + * @copyright Copyright (c) 2018, Michael Weimann <mail@michael-weimann.eu> + * + * @author Michael Weimann <mail@michael-weimann.eu> + * + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + */ + +namespace OCP\Files\SimpleFS; + +use OCP\Files\NotPermittedException; + +/** + * This class represents a file that is only hold in memory. + * + * @package OC\Files\SimpleFS + * @since 16.0.0 + */ +class InMemoryFile implements ISimpleFile { + /** + * Holds the file name. + * + * @var string + */ + private $name; + + /** + * Holds the file contents. + * + * @var string + */ + private $contents; + + /** + * InMemoryFile constructor. + * + * @param string $name The file name + * @param string $contents The file contents + * @since 16.0.0 + */ + public function __construct(string $name, string $contents) { + $this->name = $name; + $this->contents = $contents; + } + + /** + * @inheritdoc + * @since 16.0.0 + */ + public function getName() { + return $this->name; + } + + /** + * @inheritdoc + * @since 16.0.0 + */ + public function getSize() { + return strlen($this->contents); + } + + /** + * @inheritdoc + * @since 16.0.0 + */ + public function getETag() { + return ''; + } + + /** + * @inheritdoc + * @since 16.0.0 + */ + public function getMTime() { + return time(); + } + + /** + * @inheritdoc + * @since 16.0.0 + */ + public function getContent() { + return $this->contents; + } + + /** + * @inheritdoc + * @since 16.0.0 + */ + public function putContent($data) { + $this->contents = $data; + } + + /** + * In memory files can't be deleted. + * + * @since 16.0.0 + */ + public function delete() { + // unimplemented for in memory files + } + + /** + * @inheritdoc + * @since 16.0.0 + */ + public function getMimeType() { + $fileInfo = new \finfo(FILEINFO_MIME_TYPE); + return $fileInfo->buffer($this->contents); + } + + /** + * Stream reading is unsupported for in memory files. + * + * @throws NotPermittedException + * @since 16.0.0 + */ + public function read() { + throw new NotPermittedException( + 'Stream reading is unsupported for in memory files' + ); + } + + /** + * Stream writing isn't available for in memory files. + * + * @throws NotPermittedException + * @since 16.0.0 + */ + public function write() { + throw new NotPermittedException( + 'Stream writing is unsupported for in memory files' + ); + } +} diff --git a/lib/public/IAvatarManager.php b/lib/public/IAvatarManager.php index 4b89173d88b..890bcd1e6dd 100644 --- a/lib/public/IAvatarManager.php +++ b/lib/public/IAvatarManager.php @@ -45,4 +45,13 @@ interface IAvatarManager { */ public function getAvatar(string $user) : IAvatar; + /** + * Returns a guest user avatar instance. + * + * @param string $name The guest name, e.g. "Albert". + * @return IAvatar + * @since 16.0.0 + */ + public function getGuestAvatar(string $name): IAvatar; + } diff --git a/lib/public/INavigationManager.php b/lib/public/INavigationManager.php index 77b881b8b15..f840bc8c8a5 100644 --- a/lib/public/INavigationManager.php +++ b/lib/public/INavigationManager.php @@ -39,6 +39,25 @@ namespace OCP; * @since 6.0.0 */ interface INavigationManager { + + /** + * Navigation entries of the app navigation + * @since 16.0.0 + */ + const TYPE_APPS = 'link'; + + /** + * Navigation entries of the settings navigation + * @since 16.0.0 + */ + const TYPE_SETTINGS = 'settings'; + + /** + * Navigation entries for public page footer navigation + * @since 16.0.0 + */ + const TYPE_GUEST = 'guest'; + /** * Creates a new navigation entry * @@ -65,5 +84,5 @@ interface INavigationManager { * @return array * @since 14.0.0 */ - public function getAll(string $type = 'link'): array; + public function getAll(string $type = self::TYPE_APPS): array; } diff --git a/lib/public/Notification/INotification.php b/lib/public/Notification/INotification.php index 58f05883450..29f2a0e7943 100644 --- a/lib/public/Notification/INotification.php +++ b/lib/public/Notification/INotification.php @@ -115,6 +115,17 @@ interface INotification { public function getSubjectParameters(); /** + * Set a parsed subject + * + * HTML is not allowed in the parsed subject and will be escaped + * automatically by the clients. You can use the RichObjectString system + * provided by the Nextcloud server to highlight important parameters via + * the setRichSubject method, but make sure, that a plain text message is + * always set via setParsedSubject, to support clients which can not handle + * rich strings. + * + * See https://github.com/nextcloud/server/issues/1706 for more information. + * * @param string $subject * @return $this * @throws \InvalidArgumentException if the subject is invalid @@ -129,6 +140,16 @@ interface INotification { public function getParsedSubject(); /** + * Set a RichObjectString subject + * + * HTML is not allowed in the rich subject and will be escaped automatically + * by the clients, but you can use the RichObjectString system provided by + * the Nextcloud server to highlight important parameters. + * Also make sure, that a plain text subject is always set via + * setParsedSubject, to support clients which can not handle rich strings. + * + * See https://github.com/nextcloud/server/issues/1706 for more information. + * * @param string $subject * @param array $parameters * @return $this @@ -171,6 +192,17 @@ interface INotification { public function getMessageParameters(); /** + * Set a parsed message + * + * HTML is not allowed in the parsed message and will be escaped + * automatically by the clients. You can use the RichObjectString system + * provided by the Nextcloud server to highlight important parameters via + * the setRichMessage method, but make sure, that a plain text message is + * always set via setParsedMessage, to support clients which can not handle + * rich strings. + * + * See https://github.com/nextcloud/server/issues/1706 for more information. + * * @param string $message * @return $this * @throws \InvalidArgumentException if the message is invalid @@ -185,6 +217,16 @@ interface INotification { public function getParsedMessage(); /** + * Set a RichObjectString message + * + * HTML is not allowed in the rich message and will be escaped automatically + * by the clients, but you can use the RichObjectString system provided by + * the Nextcloud server to highlight important parameters. + * Also make sure, that a plain text message is always set via + * setParsedMessage, to support clients which can not handle rich strings. + * + * See https://github.com/nextcloud/server/issues/1706 for more information. + * * @param string $message * @param array $parameters * @return $this |