From 8bd1c93821f3329c8c107b10650b0d39bb3b0ae3 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl <57864086+pabzm@users.noreply.github.com> Date: Wed, 19 Feb 2025 18:01:49 +0100 Subject: [PATCH] html class: Allow to pass array as content (#9782) This allows for a little cleaner code --- program/lib/Roundcube/html.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/program/lib/Roundcube/html.php b/program/lib/Roundcube/html.php index a87c2a609f..385691a7de 100644 --- a/program/lib/Roundcube/html.php +++ b/program/lib/Roundcube/html.php @@ -63,7 +63,7 @@ public function show() * * @param string $tagname Tag name * @param array|string $attrib Tag attributes as key/value pairs, or 'class' attribute value - * @param string $content Optional Tag content (creates a container tag) + * @param array|string $content Optional Tag content (creates a container tag) * @param array $allowed List with allowed attributes, omit to allow all * * @return string The XHTML tag @@ -81,6 +81,9 @@ public static function tag($tagname, $attrib = [], $content = null, $allowed = n if (isset($content) || in_array($tagname, self::$containers)) { $suffix = !empty($attrib['noclose']) ? $suffix : '' . $suffix; unset($attrib['noclose'], $attrib['nl']); + if (is_array($content)) { + $content = implode('', $content); + } return '<' . $tagname . self::attrib_string($attrib, $allowed) . '>' . $content . $suffix; }