mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Merge branch '1.3' of github.com:cakephp/cakephp into 1.3
This commit is contained in:
commit
d6e3c318cd
2 changed files with 41 additions and 5 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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(
|
||||
'<item',
|
||||
'<title',
|
||||
'Foo bar',
|
||||
'/title',
|
||||
'<link',
|
||||
'http://example.com/foo?a=1&b=2',
|
||||
'/link',
|
||||
'<description',
|
||||
'<![CDATA[descriptive words]]',
|
||||
'/description',
|
||||
'<pubDate',
|
||||
date('r', strtotime('2008-05-31 12:00:00')),
|
||||
'/pubDate',
|
||||
'<guid',
|
||||
'http://example.com/foo?a=1&b=2',
|
||||
'/guid',
|
||||
'/item'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue