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 dce91e2 commit afd2151
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 28 deletions.
30 changes: 8 additions & 22 deletions src/Roumen/Feed/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,36 +130,22 @@ public function render($format = null, $cache = null, $key = null)
if (empty($this->link)) $this->link = Config::get('application.url');
if (empty($this->pubdate)) $this->pubdate = date('D, d M Y H:i:s O');

$this->pubdate = $this->formatDate($this->pubdate, $format);

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 = [
'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($channel['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 = [
'items' => $this->items,
'channel' => $channel,
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" ?>' !!}
<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" ?>' !!}
<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 afd2151

Please sign in to comment.