method getExcerpt documentation in bbn\Appui\Note
function($title, $content)
{
$excerpt = '';
if (!empty($title)) {
$excerpt .= Str::html2text($title, false) . PHP_EOL . PHP_EOL;
}
if (!empty($content)) {
if (Str::isJson($content)) {
$ct = json_decode($content, true);
foreach ($ct as $n => $c) {
if (is_string($c) && in_array($n, ['title', 'text', 'html'])) {
if (Str::isHTML($c)) {
$excerpt .= Str::html2text($c, strpos($c, PHP_EOL) > 0) . PHP_EOL . PHP_EOL;
}
else {
$excerpt .= $c;
}
} elseif (is_array($c)) {
foreach ($c as $k => $v) {
if (is_string($v)) {
if (is_string($k)) {
$excerpt .= $k . ': ';
}
$excerpt .= Str::html2text($v, strpos($v, PHP_EOL) > 0) . PHP_EOL . PHP_EOL;
}
}
}
}
}
elseif (Str::isHTML($content)) {
$excerpt .= Str::html2text($content);
}
elseif (is_string($content)) {
$excerpt .= $content;
}
}
return $excerpt;
}
BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2025
BBN Solutions