Upgrade to 3.7.1

This commit is contained in:
Bastian Allgeier
2022-07-12 13:33:21 +02:00
parent 7931eb5e47
commit 1ad1eaf387
377 changed files with 63981 additions and 63824 deletions

View File

@@ -17,42 +17,42 @@ use Kirby\Toolkit\Str;
*/
class SiteRules
{
/**
* Validates if the site title can be changed
*
* @param \Kirby\Cms\Site $site
* @param string $title
* @return bool
* @throws \Kirby\Exception\InvalidArgumentException If the title is empty
* @throws \Kirby\Exception\PermissionException If the user is not allowed to change the title
*/
public static function changeTitle(Site $site, string $title): bool
{
if ($site->permissions()->changeTitle() !== true) {
throw new PermissionException(['key' => 'site.changeTitle.permission']);
}
/**
* Validates if the site title can be changed
*
* @param \Kirby\Cms\Site $site
* @param string $title
* @return bool
* @throws \Kirby\Exception\InvalidArgumentException If the title is empty
* @throws \Kirby\Exception\PermissionException If the user is not allowed to change the title
*/
public static function changeTitle(Site $site, string $title): bool
{
if ($site->permissions()->changeTitle() !== true) {
throw new PermissionException(['key' => 'site.changeTitle.permission']);
}
if (Str::length($title) === 0) {
throw new InvalidArgumentException(['key' => 'site.changeTitle.empty']);
}
if (Str::length($title) === 0) {
throw new InvalidArgumentException(['key' => 'site.changeTitle.empty']);
}
return true;
}
return true;
}
/**
* Validates if the site can be updated
*
* @param \Kirby\Cms\Site $site
* @param array $content
* @return bool
* @throws \Kirby\Exception\PermissionException If the user is not allowed to update the site
*/
public static function update(Site $site, array $content = []): bool
{
if ($site->permissions()->update() !== true) {
throw new PermissionException(['key' => 'site.update.permission']);
}
/**
* Validates if the site can be updated
*
* @param \Kirby\Cms\Site $site
* @param array $content
* @return bool
* @throws \Kirby\Exception\PermissionException If the user is not allowed to update the site
*/
public static function update(Site $site, array $content = []): bool
{
if ($site->permissions()->update() !== true) {
throw new PermissionException(['key' => 'site.update.permission']);
}
return true;
}
return true;
}
}