htdocs/xoops_lib/Xoops/Core/Text/Sanitizer/Extensions/Clickable.php 1 location
|
@@ 106-119 (lines=14) @@
|
103 |
|
* |
104 |
|
* @return string |
105 |
|
*/ |
106 |
|
protected function truncate($text) |
107 |
|
{ |
108 |
|
$config = $this->config; |
109 |
|
if (empty($text) || empty($config['truncate_length']) || mb_strlen($text) < $config['truncate_length']) { |
110 |
|
return $text; |
111 |
|
} |
112 |
|
$len = (((mb_strlen($text) - $config['truncate_length']) - 5) / 2); |
113 |
|
if ($len < 5) { |
114 |
|
$ret = mb_substr($text, 0, $len) . ' ... ' . mb_substr($text, -$len); |
115 |
|
} else { |
116 |
|
$ret = mb_substr($text, 0, $config['truncate_length']); |
117 |
|
} |
118 |
|
return $ret; |
119 |
|
} |
120 |
|
} |
121 |
|
|
htdocs/xoops_lib/Xoops/Core/Text/Sanitizer/Extensions/Xss.php 1 location
|
@@ 76-89 (lines=14) @@
|
73 |
|
* |
74 |
|
* @return string |
75 |
|
*/ |
76 |
|
protected function truncate($text) |
77 |
|
{ |
78 |
|
$config = $this->config; |
79 |
|
if (empty($text) || empty($config['truncate_length']) || mb_strlen($text) < $config['truncate_length']) { |
80 |
|
return $text; |
81 |
|
} |
82 |
|
$len = (((mb_strlen($text) - $config['truncate_length']) - 5) / 2); |
83 |
|
if ($len < 5) { |
84 |
|
$ret = mb_substr($text, 0, $len) . ' ... ' . mb_substr($text, -$len); |
85 |
|
} else { |
86 |
|
$ret = mb_substr($text, 0, $config['truncate_length']); |
87 |
|
} |
88 |
|
return $ret; |
89 |
|
} |
90 |
|
} |
91 |
|
|