diff options
Diffstat (limited to 'app/Models')
| -rw-r--r-- | app/Models/UserQuery.php | 20 | ||||
| -rw-r--r-- | app/Models/View.php | 3 |
2 files changed, 20 insertions, 3 deletions
diff --git a/app/Models/UserQuery.php b/app/Models/UserQuery.php index 077ae0b90..26264fa24 100644 --- a/app/Models/UserQuery.php +++ b/app/Models/UserQuery.php @@ -21,6 +21,7 @@ class FreshRSS_UserQuery { private string $token = ''; private bool $shareRss = false; private bool $shareOpml = false; + private bool $publishLabelsInsteadOfTags = false; /** @var array<int,FreshRSS_Category> $categories where the key is the category ID */ private array $categories; /** @var array<int,FreshRSS_Tag> $labels where the key is the label ID */ @@ -43,7 +44,7 @@ class FreshRSS_UserQuery { /** * @param array{get?:string,name?:string,order?:string,search?:string,state?:int,url?:string,token?:string, - * shareRss?:bool,shareOpml?:bool,description?:string,imageUrl?:string} $query + * shareRss?:bool,shareOpml?:bool,publishLabelsInsteadOfTags?:bool,description?:string,imageUrl?:string} $query * @param array<FreshRSS_Category> $categories * @param array<FreshRSS_Tag> $labels */ @@ -75,6 +76,7 @@ class FreshRSS_UserQuery { unset($link['name']); unset($link['shareOpml']); unset($link['shareRss']); + unset($link['publishLabelsInsteadOfTags']); $this->url = Minz_Url::display(['params' => $link]); } } else { @@ -92,6 +94,9 @@ class FreshRSS_UserQuery { if (isset($query['shareOpml'])) { $this->shareOpml = $query['shareOpml']; } + if (isset($query['publishLabelsInsteadOfTags'])) { + $this->publishLabelsInsteadOfTags = (bool)$query['publishLabelsInsteadOfTags']; + } if (isset($query['description'])) { $this->description = $query['description']; } @@ -109,7 +114,9 @@ class FreshRSS_UserQuery { /** * Convert the current object to an array. * - * @return array{'get'?:string,'name'?:string,'order'?:string,'search'?:string,'state'?:int,'url'?:string,'token'?:string} + * @return array{get?:string,name?:string,order?:string,search?:string, + * state?:int,url?:string,token?:string,shareRss?:bool,shareOpml?:bool, + * publishLabelsInsteadOfTags?:bool,description?:string,imageUrl?:string} */ public function toArray(): array { return array_filter([ @@ -122,6 +129,7 @@ class FreshRSS_UserQuery { 'token' => $this->token, 'shareRss' => $this->shareRss, 'shareOpml' => $this->shareOpml, + 'publishLabelsInsteadOfTags' => $this->publishLabelsInsteadOfTags, 'description' => $this->description, 'imageUrl' => $this->imageUrl, ], fn($v): bool => $v !== '' && $v !== 0 && $v !== false); @@ -279,6 +287,14 @@ class FreshRSS_UserQuery { return $this->shareOpml; } + public function setPublishLabelsInsteadOfTags(bool $publishLabelsInsteadOfTags): void { + $this->publishLabelsInsteadOfTags = $publishLabelsInsteadOfTags; + } + + public function publishLabelsInsteadOfTags(): bool { + return $this->publishLabelsInsteadOfTags; + } + protected function sharedUrl(bool $xmlEscaped = true): string { $currentUser = Minz_User::name() ?? ''; return Minz_Url::display("/api/query.php?user={$currentUser}&t={$this->token}", $xmlEscaped ? 'html' : '', true); diff --git a/app/Models/View.php b/app/Models/View.php index 11ca3a105..104afb3c0 100644 --- a/app/Models/View.php +++ b/app/Models/View.php @@ -78,7 +78,7 @@ class FreshRSS_View extends Minz_View { // Export / Import public string $content; /** @var array<string,array<string>> */ - public array $entryIdsTagNames; + public array $entryIdsTagNames = []; public string $list_title; public int $queryId; public string $type; @@ -111,6 +111,7 @@ class FreshRSS_View extends Minz_View { public bool $internal_rendering = false; public string $description = ''; public string $image_url = ''; + public bool $publishLabelsInsteadOfTags = false; // Content preview public string $fatalError; |
