mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Allowing array-based values in Diff->getHTMLChunks() by imploding on comma (AIR-39)
This commit is contained in:
parent
40db114218
commit
d6f4b24066
@ -788,7 +788,16 @@ class Diff
|
|||||||
// echo "<p>" . htmlentities($content) . "</p>";
|
// echo "<p>" . htmlentities($content) . "</p>";
|
||||||
return self::cleanHTML($content);
|
return self::cleanHTML($content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string|array If passed as an array, values will be concatenated with a comma.
|
||||||
|
*/
|
||||||
static function getHTMLChunks($content) {
|
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);
|
$content = str_replace(array(" ","<", ">"),array(" "," <", "> "),$content);
|
||||||
$candidateChunks = split("[\t\r\n ]+", $content);
|
$candidateChunks = split("[\t\r\n ]+", $content);
|
||||||
while(list($i,$item) = each($candidateChunks)) {
|
while(list($i,$item) = each($candidateChunks)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user