From d6f4b2406601dbe393b01bfe44a5a3800dc5273f Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 29 Aug 2011 09:34:07 +0200 Subject: [PATCH] MINOR Allowing array-based values in Diff->getHTMLChunks() by imploding on comma (AIR-39) --- core/Diff.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/Diff.php b/core/Diff.php index ec866fcfd..b693c5756 100644 --- a/core/Diff.php +++ b/core/Diff.php @@ -788,7 +788,16 @@ class Diff // echo "

" . htmlentities($content) . "

"; return self::cleanHTML($content); } + + /** + * @param string|array If passed as an array, values will be concatenated with a comma. + */ static function getHTMLChunks($content) { + if($content && !is_string($content) && !is_array($content) && !is_numeric($content)) { + throw new InvalidArgumentException('$content parameter needs to be a string or array'); + } + if(is_array($content)) $content = implode(',', $content); + $content = str_replace(array(" ","<", ">"),array(" "," <", "> "),$content); $candidateChunks = split("[\t\r\n ]+", $content); while(list($i,$item) = each($candidateChunks)) {