[MrssFormat] Escape double quotes in XML attributes (#813)

XML attributes need to have certain characters escaped to be valid. The title attribute can have double quotes in it which need to be properly encoded for attributes.
This commit is contained in:
Matthew Seal 2018-09-15 06:13:05 -06:00 committed by LogMANOriginal
parent 5c92a736fa
commit e34ef6cb4f
1 changed files with 3 additions and 1 deletions

View File

@ -79,6 +79,8 @@ EOD;
$charset = $this->getCharset(); $charset = $this->getCharset();
/* xml attributes need to have certain characters escaped to be w3c compliant */
$imageTitle = htmlspecialchars($title, ENT_COMPAT);
/* Data are prepared, now let's begin the "MAGIE !!!" */ /* Data are prepared, now let's begin the "MAGIE !!!" */
$toReturn = <<<EOD $toReturn = <<<EOD
<?xml version="1.0" encoding="{$charset}"?> <?xml version="1.0" encoding="{$charset}"?>
@ -90,7 +92,7 @@ xmlns:atom="http://www.w3.org/2005/Atom">
<title>{$title}</title> <title>{$title}</title>
<link>http{$https}://{$httpHost}{$httpInfo}/</link> <link>http{$https}://{$httpHost}{$httpInfo}/</link>
<description>{$title}</description> <description>{$title}</description>
<image url="{$icon}" title="{$title}" link="{$uri}"/> <image url="{$icon}" title="{$imageTitle}" link="{$uri}"/>
<atom:link rel="alternate" type="text/html" href="{$uri}" /> <atom:link rel="alternate" type="text/html" href="{$uri}" />
<atom:link rel="self" href="http{$https}://{$httpHost}{$serverRequestUri}" /> <atom:link rel="self" href="http{$https}://{$httpHost}{$serverRequestUri}" />
{$items} {$items}