Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
wip #44
Browse files Browse the repository at this point in the history
  • Loading branch information
Roumen Damianoff committed Dec 14, 2015
1 parent 524957a commit cb313b6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 29 deletions.
34 changes: 11 additions & 23 deletions src/Roumen/Feed/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,36 +133,24 @@ public function render($format = null, $cache = null, $key = null)

foreach($this->items as $k => $v)
{
$this->items[$k]['title'] = html_entity_decode(strip_tags($this->items[$k]['title']));
$this->items[$k]['pubdate'] = $this->formatDate($this->items[$k]['pubdate'], $format);
}

$channel = array(
'title'=>$this->title,
'description'=>$this->description,
'logo' => $this->logo,
'icon' => $this->icon,
'link'=>$this->link,
'pubdate'=>$this->pubdate,
'lang'=>$this->lang
'title' => html_entity_decode(strip_tags($this->title)),
'description' => $this->description,
'logo' => $this->logo,
'icon' => $this->icon,
'link' => $this->link,
'pubdate' => $this->formatDate($this->pubdate, $format),
'lang' => $this->lang
);

if ($format == 'rss')
{
$channel['title'] = html_entity_decode(strip_tags($channel['title']));
$channel['description'] = html_entity_decode(strip_tags($channel['description']));

foreach($this->items as $k => $v)
{
// escaping & in description, based on http://stackoverflow.com/questions/1328538/how-do-i-escape-ampersands-in-xml
$this->items[$k]['description'] = str_replace('&', '&', html_entity_decode(strip_tags($this->items[$k]['description'])));
$this->items[$k]['title'] = html_entity_decode(strip_tags($this->items[$k]['title']));
}
}

$viewData = array(
'items' => $this->items,
'channel' => $channel,
'namespaces' => $this->getNamespaces()
'items' => $this->items,
'channel' => $channel,
'namespaces' => $this->getNamespaces()
);

// if cache is on put this feed in cache and return it
Expand Down
8 changes: 4 additions & 4 deletions src/views/atom.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{ '<'.'?'.'xml version="1.0" encoding="UTF-8" ?>'."\n" }}
<feed xmlns="http://www.w3.org/2005/Atom"<?php foreach($namespaces as $n) echo " ".$n; ?>>
<title type="html">{{ $channel['title'] }}</title>
<subtitle type="html">{{ $channel['description'] }}</subtitle>
<title type="text">{{ $channel['title'] }}</title>
<subtitle type="html"><![CDATA[{{ $channel['description'] }}]]></subtitle>
<link href="{{ Request::url() }}"></link>
<id>{{ $channel['link'] }}</id>
<link rel="alternate" type="text/html" href="{{ Request::url() }}" ></link>
Expand All @@ -16,9 +16,9 @@
@foreach($items as $item)
<entry>
<author>
<name><![CDATA[{{ $item['author'] }}]]></name>
<name>{{ $item['author'] }}</name>
</author>
<title type="html"><![CDATA[{{ $item['title'] }}]]></title>
<title type="text">{{ $item['title'] }}</title>
<link rel="alternate" type="text/html" href="{{ $item['link'] }}"></link>
<id>{{ $item['link'] }}</id>
<summary type="html"><![CDATA[{{ $item['description'] }}]]></summary>
Expand Down
4 changes: 2 additions & 2 deletions src/views/rss.blade.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{ '<'.'?'.'xml version="1.0" encoding="UTF-8" ?>'."\n" }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/"<?php foreach($namespaces as $n) echo " ".$n; ?>>
<channel>
<title><![CDATA[{{ $channel['title'] }}]]></title>
<title>{{ $channel['title'] }}</title>
<link>{{ Request::url() }}</link>
<description>{{ $channel['description'] }}</description>
<description><![CDATA[{{ $channel['description'] }}]]></description>
<atom:link href="{{ $channel['link'] }}" rel="self"></atom:link>
@if (!empty($channel['logo']))
<image>
Expand Down

0 comments on commit cb313b6

Please sign in to comment.