[AtomFormat] Change xml_encode($) to private scope
This commit is contained in:
parent
be487a6950
commit
e3c578510b
1 changed files with 12 additions and 13 deletions
|
@ -1,9 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
function xml_encode($text) {
|
|
||||||
return htmlspecialchars($text, ENT_XML1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Atom
|
* Atom
|
||||||
* Documentation Source http://en.wikipedia.org/wiki/Atom_%28standard%29 and http://tools.ietf.org/html/rfc4287
|
* Documentation Source http://en.wikipedia.org/wiki/Atom_%28standard%29 and http://tools.ietf.org/html/rfc4287
|
||||||
|
@ -18,20 +13,20 @@ class AtomFormat extends FormatAbstract{
|
||||||
$httpHost = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
|
$httpHost = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
|
||||||
$httpInfo = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '';
|
$httpInfo = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '';
|
||||||
|
|
||||||
$serverRequestUri = xml_encode($_SERVER['REQUEST_URI']);
|
$serverRequestUri = $this->xml_encode($_SERVER['REQUEST_URI']);
|
||||||
|
|
||||||
$extraInfos = $this->getExtraInfos();
|
$extraInfos = $this->getExtraInfos();
|
||||||
$title = xml_encode($extraInfos['name']);
|
$title = $this->xml_encode($extraInfos['name']);
|
||||||
$uri = $extraInfos['uri'];
|
$uri = $extraInfos['uri'];
|
||||||
$icon = xml_encode('http://icons.better-idea.org/icon?url='. $uri .'&size=64');
|
$icon = $this->xml_encode('http://icons.better-idea.org/icon?url='. $uri .'&size=64');
|
||||||
$uri = xml_encode($uri);
|
$uri = $this->xml_encode($uri);
|
||||||
|
|
||||||
$entries = '';
|
$entries = '';
|
||||||
foreach($this->getDatas() as $data){
|
foreach($this->getDatas() as $data){
|
||||||
$entryAuthor = is_null($data->author) ? $title : xml_encode($data->author);
|
$entryAuthor = is_null($data->author) ? $title : $this->xml_encode($data->author);
|
||||||
$entryTitle = is_null($data->title) ? '' : xml_encode($data->title);
|
$entryTitle = is_null($data->title) ? '' : $this->xml_encode($data->title);
|
||||||
$entryUri = is_null($data->uri) ? '' : xml_encode($data->uri);
|
$entryUri = is_null($data->uri) ? '' : $this->xml_encode($data->uri);
|
||||||
$entryTimestamp = is_null($data->timestamp) ? '' : xml_encode(date(DATE_ATOM, $data->timestamp));
|
$entryTimestamp = is_null($data->timestamp) ? '' : $this->xml_encode(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)) . ']]>';
|
||||||
|
|
||||||
|
@ -96,4 +91,8 @@ EOD;
|
||||||
|
|
||||||
return parent::display();
|
return parent::display();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function xml_encode($text) {
|
||||||
|
return htmlspecialchars($text, ENT_XML1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue