| @@ -139,24 +139,12 @@ | ||
| 139 | 139 | * @param int $limit Maximum length in characters, ellipsis included. |
| 140 | 140 | * @return string |
| 141 | 141 | */ |
| 142 | 142 | private function trim_to_length(string $description, int $limit): string { |
| 143 | - if (mb_strlen($description) <= $limit) { | |
| 144 | - return $description; | |
| 145 | - } | |
| 146 | - | |
| 147 | - // Reserve one character for the ellipsis. | |
| 148 | - $budget = $limit - 1; | |
| 149 | - $cut = mb_substr($description, 0, $budget); | |
| 150 | - $last_gap = mb_strrpos($cut, ' '); | |
| 151 | - | |
| 152 | - // Only honour a word boundary that is not absurdly early — otherwise a | |
| 153 | - // long unbroken token would collapse the description to a few chars. | |
| 154 | - if (false !== $last_gap && $last_gap > (int) ($budget * 0.6)) { | |
| 155 | - $cut = mb_substr($cut, 0, $last_gap); | |
| 156 | - } | |
| 157 | - | |
| 158 | - return rtrim($cut) . '…'; | |
| 143 | + // The implementation moved to Seo_Text so the four other | |
| 144 | + // description paths could stop carrying the broken version of it | |
| 145 | + // (#687). This stays as the local name the author-archive code reads. | |
| 146 | + return \ThinkRank\Core\Seo_Text::trim_to_length($description, $limit); | |
| 159 | 147 | } |
| 160 | 148 | |
| 161 | 149 | /** |
| 162 | 150 | * Modify document title for author archives |