forked from blallo/rss-bridge
[formats] Fix missing element conditions
This fixes download behavior when requesting Atom/Mrss formats, which was caused by is_null attempting to expand missing array elements.
This commit is contained in:
parent
3c1706aa47
commit
059b099436
2 changed files with 12 additions and 12 deletions
|
@ -7,7 +7,7 @@ class AtomFormat extends FormatAbstract{
|
|||
|
||||
public function stringify(){
|
||||
/* Datas preparation */
|
||||
$https = ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '' );
|
||||
$https = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '';
|
||||
$httpHost = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
|
||||
$httpInfo = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '';
|
||||
|
||||
|
@ -21,11 +21,11 @@ class AtomFormat extends FormatAbstract{
|
|||
|
||||
$entries = '';
|
||||
foreach($this->getDatas() as $data){
|
||||
$entryAuthor = is_null($data['author']) ? '' : $this->xml_encode($data['author']);
|
||||
$entryTitle = is_null($data['title']) ? '' : $this->xml_encode($data['title']);
|
||||
$entryUri = is_null($data['uri']) ? '' : $this->xml_encode($data['uri']);
|
||||
$entryTimestamp = is_null($data['timestamp']) ? '' : $this->xml_encode(date(DATE_ATOM, $data['timestamp']));
|
||||
$entryContent = is_null($data['content']) ? '' : $this->xml_encode($this->sanitizeHtml($data['content']));
|
||||
$entryAuthor = isset($data['author']) ? $this->xml_encode($data['author']) : '';
|
||||
$entryTitle = isset($data['title']) ? $this->xml_encode($data['title']) : '';
|
||||
$entryUri = isset($data['uri']) ? $this->xml_encode($data['uri']) : '';
|
||||
$entryTimestamp = isset($data['timestamp']) ? $this->xml_encode(date(DATE_ATOM, $data['timestamp'])) : '';
|
||||
$entryContent = isset($data['content']) ? $this->xml_encode($this->sanitizeHtml($data['content'])) : '';
|
||||
$entries .= <<<EOD
|
||||
|
||||
<entry>
|
||||
|
|
|
@ -7,7 +7,7 @@ class MrssFormat extends FormatAbstract{
|
|||
|
||||
public function stringify(){
|
||||
/* Datas preparation */
|
||||
$https = ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '' );
|
||||
$https = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '';
|
||||
$httpHost = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
|
||||
$httpInfo = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '';
|
||||
|
||||
|
@ -19,11 +19,11 @@ class MrssFormat extends FormatAbstract{
|
|||
|
||||
$items = '';
|
||||
foreach($this->getDatas() as $data){
|
||||
$itemAuthor = is_null($data['author']) ? '' : $this->xml_encode($data['author']);
|
||||
$itemTitle = strip_tags(is_null($data['title']) ? '' : $this->xml_encode($data['title']));
|
||||
$itemUri = is_null($data['uri']) ? '' : $this->xml_encode($data['uri']);
|
||||
$itemTimestamp = is_null($data['timestamp']) ? '' : $this->xml_encode(date(DATE_RFC2822, $data['timestamp']));
|
||||
$itemContent = is_null($data['content']) ? '' : $this->xml_encode($this->sanitizeHtml($data['content']));
|
||||
$itemAuthor = isset($data['author']) ? $this->xml_encode($data['author']) : '';
|
||||
$itemTitle = strip_tags(isset($data['title']) ? $this->xml_encode($data['title']) : '');
|
||||
$itemUri = isset($data['uri']) ? $this->xml_encode($data['uri']) : '';
|
||||
$itemTimestamp = isset($data['timestamp']) ? $this->xml_encode(date(DATE_RFC2822, $data['timestamp'])) : '';
|
||||
$itemContent = isset($data['content']) ? $this->xml_encode($this->sanitizeHtml($data['content'])) : '';
|
||||
$items .= <<<EOD
|
||||
|
||||
<item>
|
||||
|
|
Loading…
Reference in a new issue