[Format] Trim all items elements

This removes unnecessary whitespace in output data
This commit is contained in:
logmanoriginal 2016-08-29 20:50:02 +02:00
parent e46a480c5d
commit f49fca516d

View file

@ -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{