Skip to content
This repository was archived by the owner on Mar 5, 2023. It is now read-only.

Commit b8914ef

Browse files
authored
Merge pull request #51 from 8fold/feed-rss
Update Channel.php
2 parents fcbd3ea + f458b79 commit b8914ef

File tree

1 file changed

+14
-58
lines changed

1 file changed

+14
-58
lines changed

src/Feed/Rss/Channel.php

Lines changed: 14 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010

1111
class Channel extends Element
1212
{
13-
private $xmlVersion = "1.0";
13+
// private $xmlVersion = "1.0";
1414
private $rssVersion = "2.0";
1515

1616
private $title = "";
1717
private $link = "";
1818
private $description = "";
19-
private $otherChannelMeta = [];
19+
// private $content = [];
20+
// private $otherChannelMeta = [];
2021

2122
private $language = "";
2223

@@ -68,67 +69,22 @@ public function unfold(): string
6869
Element::description($this->description)
6970
]);
7071

71-
Shoop::dictionary($this->otherChannelMeta)->each(
72-
function($value, $element) use (&$content) {
73-
$content = $content->plus(Element::fold($element, $value));
74-
});
72+
// Shoop::dictionary($this->otherChannelMeta)->each(
73+
// function($value, $element) use (&$content) {
74+
// $content = $content->plus(Element::fold($element, $value));
75+
// });
7576

7677
return Shoop::string(
7778
Element::rss(
78-
Element::channel(...$content)
79+
Element::channel(
80+
...Shoop::array($this->content)
81+
->each(function($item) {
82+
dd($item->unfold());
83+
return $item->unfold();
84+
})
85+
)
7986
)->attr("version ". $this->rssVersion)->unfold()
8087
)->start('<?xml version="'. $this->xmlVersion .'"?>'."\n")->unfold();
81-
82-
// return Shoop::string(
83-
// Element::fold("rss",
84-
// Element::fold("channel",
85-
// Element::fold("title", static::rssTitle()),
86-
// Element::fold("link", static::rssLink()),
87-
// Element::fold("description", static::rssDescription()),
88-
// Element::fold("language", "en-us"),
89-
// Element::fold("copyright", static::copyright()->unfold()),
90-
// ...static::rssItemsStoreItems()->each(function($path) {
91-
// $markdown = static::uriContentStore($path)->markdown();
92-
93-
// $title = $markdown->meta()->title;
94-
// $link = Shoop::string(static::rssLink())
95-
// ->plus($path)->unfold();
96-
97-
// $description = ($markdown->meta()->description === null)
98-
// ? $markdown->html()
99-
// : $markdown->meta()->description();
100-
// if ($description->count()->isUnfolded(0)) {
101-
// return "";
102-
// }
103-
// $description = $description->replace(static::rssDescriptionReplacements())
104-
// ->dropTags()->divide(" ")->isGreaterThan(50, function($result, $description) {
105-
// return ($result)
106-
// ? $description->first(50)->join(" ")->plus("...")
107-
// : $description->join(" ");
108-
// });
109-
110-
// $timestamp = ($markdown->meta()->created === null)
111-
// ? ""
112-
// : Carbon::createFromFormat("Ymd", $markdown->meta()->created, "America/Detroit")
113-
// ->hour(12)
114-
// ->minute(0)
115-
// ->second(0)
116-
// ->toRssString();
117-
// $t = (strlen($timestamp) > 0)
118-
// ? Element::fold("pubDate", $timestamp)
119-
// : "";
120-
121-
// $item = Element::fold(
122-
// "item",
123-
// Element::fold("title", htmlspecialchars($title)),
124-
// Element::fold("link", $link),
125-
// Element::fold("guid", $link),
126-
// Element::fold("description", htmlspecialchars($description)),
127-
// $t
128-
// );
129-
// return $item;
130-
// })->noEmpties()
131-
// )
13288
}
13389

13490
/**

0 commit comments

Comments
 (0)