diff options
Diffstat (limited to 'lib/public/RichObjectStrings')
-rw-r--r-- | lib/public/RichObjectStrings/Definitions.php | 65 | ||||
-rw-r--r-- | lib/public/RichObjectStrings/IRichTextFormatter.php | 25 | ||||
-rw-r--r-- | lib/public/RichObjectStrings/IValidator.php | 67 | ||||
-rw-r--r-- | lib/public/RichObjectStrings/InvalidObjectExeption.php | 23 |
4 files changed, 112 insertions, 68 deletions
diff --git a/lib/public/RichObjectStrings/Definitions.php b/lib/public/RichObjectStrings/Definitions.php index a0f395e43ee..d6717e54aea 100644 --- a/lib/public/RichObjectStrings/Definitions.php +++ b/lib/public/RichObjectStrings/Definitions.php @@ -1,31 +1,8 @@ <?php + /** - * @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com> - * - * @author Joas Schilling <coding@schilljs.com> - * @author Jonas Rittershofer <jotoeri@users.noreply.github.com> - * @author Julius Härtl <jus@bitgrid.net> - * @author Maxence Lange <maxence@nextcloud.com> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * @author Thomas Citharel <nextcloud@tcit.fr> - * @author Vincent Petry <vincent@nextcloud.com> - * @author Vitor Mattos <vitor@php.rio> - * - * @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/>. - * + * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ namespace OCP\RichObjectStrings; @@ -368,6 +345,42 @@ class Definitions { 'description' => 'The mtime of the file/folder as unix timestamp', 'example' => '1661854213', ], + 'etag' => [ + 'since' => '25.0.0', + 'required' => false, + 'description' => 'The ETag of the file/folder', + 'example' => 'abcdefghi', + ], + 'permissions' => [ + 'since' => '25.0.0', + 'required' => false, + 'description' => 'The permissions on the file/folder', + 'example' => '3', + ], + 'width' => [ + 'since' => '29.0.0', + 'required' => false, + 'description' => 'The width in pixels if the file is an image', + 'example' => '1920', + ], + 'height' => [ + 'since' => '29.0.0', + 'required' => false, + 'description' => 'The height in pixels if the file is an image', + 'example' => '1080', + ], + 'blurhash' => [ + 'since' => '30.0.0', + 'required' => false, + 'description' => 'The blurhash of the image', + 'example' => 'LEHV9uae2yk8pyo0adR*.7kCMdnj', + ], + 'hide-download' => [ + 'since' => '31.0.5', + 'required' => false, + 'description' => 'Whether the download option should be hidden. If not set to `yes` the option can be shown', + 'example' => 'yes', + ], ], ], 'forms-form' => [ diff --git a/lib/public/RichObjectStrings/IRichTextFormatter.php b/lib/public/RichObjectStrings/IRichTextFormatter.php new file mode 100644 index 00000000000..1d72f480b07 --- /dev/null +++ b/lib/public/RichObjectStrings/IRichTextFormatter.php @@ -0,0 +1,25 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCP\RichObjectStrings; + +/** + * Parse rich text and format it with the richobjects + * + * @since 31.0.0 + */ +interface IRichTextFormatter { + /** + * @since 31.0.0 + * @param string $message + * @param array<string,array<string,string>> $parameters + * @throws \InvalidArgumentException if a parameter has no name or no type + */ + public function richToParsed(string $message, array $parameters): string; +} diff --git a/lib/public/RichObjectStrings/IValidator.php b/lib/public/RichObjectStrings/IValidator.php index f465254eeab..fc486663c73 100644 --- a/lib/public/RichObjectStrings/IValidator.php +++ b/lib/public/RichObjectStrings/IValidator.php @@ -1,39 +1,62 @@ <?php + +declare(strict_types=1); + /** - * @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com> - * - * @author Joas Schilling <coding@schilljs.com> - * @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/>. - * + * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ namespace OCP\RichObjectStrings; /** * Class Validator * + * @psalm-type RichObjectParameter = array{ + * type: string, + * id: string, + * name: string, + * server?: string, + * link?: string, + * 'call-type'?: 'one2one'|'group'|'public', + * 'icon-url'?: string, + * 'message-id'?: string, + * boardname?: string, + * stackname?: string, + * size?: string, + * path?: string, + * mimetype?: string, + * 'preview-available'?: 'yes'|'no', + * 'hide-download'?: 'yes'|'no', + * mtime?: string, + * latitude?: string, + * longitude?: string, + * description?: string, + * thumb?: string, + * website?: string, + * visibility?: '0'|'1', + * assignable?: '0'|'1', + * conversation?: string, + * etag?: string, + * permissions?: string, + * width?: string, + * height?: string, + * blurhash?: string, + * } + * * @since 11.0.0 */ interface IValidator { /** + * Only alphanumeric, dash, underscore and dot are allowed, starting with a character + * @since 31.0.0 + */ + public const PLACEHOLDER_REGEX = '[A-Za-z][A-Za-z0-9\-_.]+'; + + /** * @param string $subject - * @param array[] $parameters + * @param array<non-empty-string, RichObjectParameter> $parameters * @throws InvalidObjectExeption * @since 11.0.0 */ - public function validate($subject, array $parameters); + public function validate(string $subject, array $parameters): void; } diff --git a/lib/public/RichObjectStrings/InvalidObjectExeption.php b/lib/public/RichObjectStrings/InvalidObjectExeption.php index 95b0cf591b3..603f4432ba6 100644 --- a/lib/public/RichObjectStrings/InvalidObjectExeption.php +++ b/lib/public/RichObjectStrings/InvalidObjectExeption.php @@ -1,25 +1,8 @@ <?php + /** - * @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com> - * - * @author Joas Schilling <coding@schilljs.com> - * @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/>. - * + * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ namespace OCP\RichObjectStrings; |