forked from blallo/rss-bridge
[Format] Trim all items elements
This removes unnecessary whitespace in output data
This commit is contained in:
parent
e46a480c5d
commit
f49fca516d
1 changed files with 10 additions and 1 deletions
|
@ -49,7 +49,8 @@ abstract class FormatAbstract implements FormatInterface{
|
|||
}
|
||||
|
||||
public function setItems(array $items){
|
||||
$this->items = $items;
|
||||
$this->items = array_map(array($this, 'array_trim'), $items);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -105,6 +106,14 @@ abstract class FormatAbstract implements FormatInterface{
|
|||
// We leave alone object and embed so that videos can play in RSS readers.
|
||||
return $html;
|
||||
}
|
||||
|
||||
protected function array_trim($elements){
|
||||
foreach($elements as $key => $value){
|
||||
if(is_string($value))
|
||||
$elements[$key] = trim($value);
|
||||
}
|
||||
return $elements;
|
||||
}
|
||||
}
|
||||
|
||||
class Format{
|
||||
|
|
Loading…
Reference in a new issue