From f49fca516d937fda49be01dbc3a19ff97c465e7a Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Mon, 29 Aug 2016 20:50:02 +0200 Subject: [PATCH] [Format] Trim all items elements This removes unnecessary whitespace in output data --- lib/Format.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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{