This method does not work with xlanguage. With the first language, no problem but if we activate the second then Xoops crashes.
To avoid the problem I wrote this in my module:
$xoTheme->addMeta('meta', 'description', \Xmf\Metagen::generateDescription(preg_replace("/\[.*?\]/", '', $content->getVar('content_text')), 30));
I don't know if it's really good what I'm doing. We can add this code to the method "asPlainText()"
$text = preg_replace('/\[.*?\]/', ' ', $text);
The full code:
protected static function asPlainText($rawText)
{
$text = $rawText;
$text = static::html2text($text);
$text = static::purifyText($text);
$text = str_replace(array("\n", "\r"), ' ', $text);
$text = preg_replace('/[ ]* [ ]*/', ' ', $text);
$text = preg_replace('/\[.*?\]/', ' ', $text);
return trim($text);
}
This method does not work with xlanguage. With the first language, no problem but if we activate the second then Xoops crashes.
To avoid the problem I wrote this in my module:
$xoTheme->addMeta('meta', 'description', \Xmf\Metagen::generateDescription(preg_replace("/\[.*?\]/", '', $content->getVar('content_text')), 30));I don't know if it's really good what I'm doing. We can add this code to the method "asPlainText()"
$text = preg_replace('/\[.*?\]/', ' ', $text);The full code: