phplist3
phplist3 copied to clipboard
Shortening text that needs to be multibyte aware
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
- the non multibyte version of the function had a
sprintf()
with more parameters than %s placeholders - the multibyte version had an
ondblclick()
handler which had been removed from the non multibyte version - when a URL had been shortened the title tooltip didn't show the original text but that with leading https:// removed
Related Issue
The new function shortenText()
can be used instead of shortenTextDisplay()
in PR https://github.com/phpList/phplist3/pull/876
Screenshots (if appropriate):
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.
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
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