diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/feed.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/db/feed.php b/db/feed.php index d5c7314c2..32565f09b 100644 --- a/db/feed.php +++ b/db/feed.php @@ -73,7 +73,7 @@ class Feed extends Entity implements IAPI, \JsonSerializable { * Turns entitie attributes into an array */ public function jsonSerialize() { - return $this->serializeFields([ + $serialized = $this->serializeFields([ 'id', 'userId', 'urlHash', @@ -88,6 +88,17 @@ class Feed extends Entity implements IAPI, \JsonSerializable { 'deletedAt', 'articlesPerUpdate', ]); + + $url = parse_url($this->link)['host']; + + // strip leading www. to avoid css class confusion + if (strpos($url, 'www.') === 0) { + $url = substr($url, 4); + } + + $serialized['cssClass'] = str_replace('.', '-', $url); + + return $serialized; } public function toAPI() { |