diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-09-09 18:56:31 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-09-09 18:56:31 +0200 |
commit | daaf87749dae9c70ccd46911a08c6da1d9ad8150 (patch) | |
tree | c6848b753574c1fc4fb8370d78230d00629e73fa /db/feed.php | |
parent | 03baa5ba68daa09110940c416b3cb065a9e9ca7a (diff) |
add css custom classes
Diffstat (limited to 'db/feed.php')
-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() { |