/** * Shorten short text * * @param * @return */ function shortenShortText($text) { $a_length = 196; if ($this->getTermId() > 0) { include_once "./Modules/Glossary/classes/class.ilObjGlossary.php"; include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php"; $glo_id = ilGlossaryTerm::_lookGlossaryId($this->getTermId()); $snippet_length = ilObjGlossary::lookupSnippetLength($glo_id); if ($snippet_length > 0) { $a_length = $snippet_length; } } $text = str_replace("<br/>", "<br>", $text); $text = strip_tags($text, "<br>"); if (is_int(strpos(substr($text, $a_length - 16 - 5, 10), "[tex]"))) { $offset = 5; } $short = ilUtil::shortenText($text, $a_length - 16 + $offset, true); // make short text longer, if tex end tag is missing $ltexs = strrpos($short, "[tex]"); $ltexe = strrpos($short, "[/tex]"); if ($ltexs > $ltexe) { $ltexe = strpos($text, "[/tex]", $ltexs); if ($ltexe > 0) { $short = ilUtil::shortenText($text, $ltexe + 6, true); } } $short = ilUtil::shortenText($text, $a_length, true); return $short; }