-
-
Notifications
You must be signed in to change notification settings - Fork 770
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add filter actions (auto mark read) at category and global levels (#5942
) * Add filter actions (auto mark read) at category level fix #3497 * Add filter actions (auto mark read) at global level fix #2788 * Fix feed category ID * Minor comment
- Loading branch information
Showing
20 changed files
with
356 additions
and
378 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* Logic to work with (JSON) attributes (for entries, feeds, categories, tags...). | ||
*/ | ||
trait FreshRSS_AttributesTrait { | ||
/** | ||
* @var array<string,mixed> | ||
*/ | ||
private array $attributes = []; | ||
|
||
/** | ||
* @phpstan-return ($key is non-empty-string ? mixed : array<string,mixed>) | ||
* @return array<string,mixed>|mixed|null | ||
*/ | ||
public function attributes(string $key = '') { | ||
if ($key === '') { | ||
return $this->attributes; | ||
} else { | ||
return $this->attributes[$key] ?? null; | ||
} | ||
} | ||
|
||
/** @param string|array<mixed>|bool|int|null $value Value, not HTML-encoded */ | ||
public function _attributes(string $key, $value = null): void { | ||
if ($key == '') { | ||
if (is_string($value)) { | ||
$value = json_decode($value, true); | ||
} | ||
if (is_array($value)) { | ||
$this->attributes = $value; | ||
} | ||
} elseif ($value === null) { | ||
unset($this->attributes[$key]); | ||
} else { | ||
$this->attributes[$key] = $value; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.