diff --git a/lib/Format.php b/lib/Format.php index 142b4c87..e89f388f 100644 --- a/lib/Format.php +++ b/lib/Format.php @@ -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{