From f2f298774381a77f7e38ac2b70d4f9eed78fa9a3 Mon Sep 17 00:00:00 2001 From: xbuzz Date: Thu, 29 Jul 2010 12:43:11 -0700 Subject: [PATCH 1/2] Fixed 'convertEntities' to links in RSS. Fixes #959 --- cake/libs/view/helpers/rss.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cake/libs/view/helpers/rss.php b/cake/libs/view/helpers/rss.php index 9abe3aeef..e4dc78a3d 100644 --- a/cake/libs/view/helpers/rss.php +++ b/cake/libs/view/helpers/rss.php @@ -208,6 +208,13 @@ class RssHelper extends XmlHelper { foreach ($elements as $key => $val) { $attrib = array(); + + $escape = true; + if (is_array($val) && isset($val['convertEntities'])) { + $escape = $val['convertEntities']; + unset($val['convertEntities']); + } + switch ($key) { case 'pubDate' : $val = $this->time($val); @@ -261,11 +268,6 @@ class RssHelper extends XmlHelper { $val = null; break; } - $escape = true; - if (is_array($val) && isset($val['convertEntities'])) { - $escape = $val['convertEntities']; - unset($val['convertEntities']); - } if (!is_null($val) && $escape) { $val = h($val); } From 72bb229a9cabd739a04f3ab0c6ed038854b87f9a Mon Sep 17 00:00:00 2001 From: Juan Basso Date: Wed, 4 Aug 2010 22:10:44 -0300 Subject: [PATCH 2/2] Added tests to ticket #959 --- .../cases/libs/view/helpers/rss.test.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/cake/tests/cases/libs/view/helpers/rss.test.php b/cake/tests/cases/libs/view/helpers/rss.test.php index 2b083c5ab..c302f4c40 100644 --- a/cake/tests/cases/libs/view/helpers/rss.test.php +++ b/cake/tests/cases/libs/view/helpers/rss.test.php @@ -517,6 +517,40 @@ class RssHelperTest extends CakeTestCase { '/item' ); $this->assertTags($result, $expected); + + $item = array( + 'title' => 'Foo bar', + 'link' => array( + 'url' => 'http://example.com/foo?a=1&b=2', + 'convertEntities' => false + ), + 'description' => array( + 'value' => 'descriptive words', + 'cdata' => true, + ), + 'pubDate' => '2008-05-31 12:00:00' + ); + $result = $this->Rss->item(null, $item); + $expected = array( + 'assertTags($result, $expected); } /**