phpList / phplist3

Fully functional Open Source email marketing manager for creating, sending, integrating, and analysing email campaigns and newsletters.
https://www.phplist.org
GNU Affero General Public License v3.0
752 stars 269 forks source link

Shortening text that needs to be multibyte aware #877

Closed bramley closed 2 years ago

bramley commented 2 years ago

Description

shortenTextDisplay() currently returns a span element which can be used when displaying URLs or email addresses.

This change splits the part of shortening text that needs to be multibyte aware into a separate function so that it can be used on its own to shorten other text, such as an attribute name in a select list.

It also fixes a few small issues that were introduced in earlier pull requests

Related Issue

The new function shortenText() can be used instead of shortenTextDisplay() in PR https://github.com/phpList/phplist3/pull/876

Screenshots (if appropriate):

michield commented 2 years ago

I've tested this and it works fine. I will also push the tests I use to the repo in a new PR. It related to #876 which can be updated to use the new shortenText. There's a slight difference in that substr takes the first X characters, where shortenText takes the first and the last and puts ... in between. But that's cosmetic.

phpListDockerBot commented 2 years ago

This pull request has been mentioned on phpList Discuss. There might be relevant details there:

https://discuss.phplist.org/t/3-6-9-release-candidate-ready-for-testing/8445/1

phpListDockerBot commented 2 years ago

This pull request has been mentioned on phpList Discuss. There might be relevant details there:

https://discuss.phplist.org/t/phplist-3-6-9-is-available-for-download/8474/1