From: Jan Schneider Date: Tue, 8 Dec 2009 18:52:43 +0000 (+0100) Subject: Fix adding attributes as strings in fullSrcImg(). X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=bf4dea647140d43468cb8674d27d1dfc4fdc934c;p=horde.git Fix adding attributes as strings in fullSrcImg(). --- diff --git a/framework/Core/lib/Horde.php b/framework/Core/lib/Horde.php index cd77bdc44..f1097bc01 100644 --- a/framework/Core/lib/Horde.php +++ b/framework/Core/lib/Horde.php @@ -1478,19 +1478,21 @@ HTML; $src = self::url($src, true, -1); } - /* Build all of the tag attributes. */ - $attributes = !empty($options['attr']) ? $options['attr'] : array(); - $img = ' $value) { - $img .= ' ' . $attribute . '="' . htmlspecialchars($value, ENT_COMPAT, $charset) . '"'; - } - error_reporting($old_error); - - /* If the user supplied a pre-built string of attributes, add that. */ - if (!empty($options['attr']) && is_string($options['attr'])) { - $img .= ' ' . $options['attr']; + if (!empty($options['attr'])) { + /* Build all of the tag attributes. */ + if (is_array($options['attr'])) { + $old_error = error_reporting(0); + foreach ($options['attr'] as $attribute => $value) { + $img .= ' ' . $attribute . '="' . htmlspecialchars($value, ENT_COMPAT, $charset) . '"'; + } + error_reporting($old_error); + } + /* If the user supplied a pre-built string of attributes, add + * that. */ + if (is_string($options['attr'])) { + $img .= ' ' . $options['attr']; + } } /* Return the closed image tag. */