Change '...' to horizontal ellipsis character

This commit is contained in:
Peter Knut
2018-12-18 14:45:37 +01:00
committed by Jakub Vrána
parent da76e6b9b8
commit b2606cda0e
5 changed files with 19 additions and 15 deletions

View File

@@ -40,14 +40,16 @@ tinyMCE.init({
function selectVal(&$val, $link, $field, $original) {
if (preg_match("~_html~", $field["field"]) && $val != '') {
$shortened = (substr($val, -10) == "<i>...</i>");
$ellipsis = "<i></i>";
$length = strlen($ellipsis);
$shortened = (substr($val, -$length) == $ellipsis);
if ($shortened) {
$val = substr($val, 0, -10);
$val = substr($val, 0, -$length);
}
//! shorten with regard to HTML tags - http://php.vrana.cz/zkraceni-textu-s-xhtml-znackami.php
$val = preg_replace('~<[^>]*$~', '', html_entity_decode($val, ENT_QUOTES)); // remove ending incomplete tag (text can be shortened)
if ($shortened) {
$val .= "<i>...</i>";
$val .= $ellipsis;
}
if (class_exists('DOMDocument')) { // close all opened tags
$dom = new DOMDocument;