From bf4dea647140d43468cb8674d27d1dfc4fdc934c Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Tue, 8 Dec 2009 19:52:43 +0100 Subject: [PATCH] Fix adding attributes as strings in fullSrcImg(). --- framework/Core/lib/Horde.php | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) 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. */ -- 2.11.0