Fixed HTML escaping for Atom items

This commit is contained in:
Julien Desgats 2014-10-21 14:55:18 -04:00
parent fdfd1b293c
commit a8c5c05d37

View file

@ -22,10 +22,10 @@ class AtomFormat extends FormatAbstract{
$entries = ''; $entries = '';
foreach($this->getDatas() as $data){ foreach($this->getDatas() as $data){
$entryName = is_null($data->name) ? $title : $data->name; $entryName = htmlspecialchars(is_null($data->name) ? $title : $data->name);
$entryAuthor = is_null($data->author) ? $uri : $data->author; $entryAuthor = htmlspecialchars(is_null($data->author) ? $uri : $data->author);
$entryTitle = is_null($data->title) ? '' : $data->title; $entryTitle = htmlspecialchars(is_null($data->title) ? '' : $data->title);
$entryUri = is_null($data->uri) ? '' : $data->uri; $entryUri = htmlspecialchars(is_null($data->uri) ? '' : $data->uri);
$entryTimestamp = is_null($data->timestamp) ? '' : date(DATE_ATOM, $data->timestamp); $entryTimestamp = is_null($data->timestamp) ? '' : date(DATE_ATOM, $data->timestamp);
// We prevent content from closing the CDATA too early. // We prevent content from closing the CDATA too early.
$entryContent = is_null($data->content) ? '' : '<![CDATA[' . $this->sanitizeHtml(str_replace(']]>','',$data->content)) . ']]>'; $entryContent = is_null($data->content) ? '' : '<![CDATA[' . $this->sanitizeHtml(str_replace(']]>','',$data->content)) . ']]>';
@ -92,4 +92,4 @@ EOD;
return parent::display(); return parent::display();
} }
} }