Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shortening text that needs to be multibyte aware #877

Merged
merged 1 commit into from
Sep 29, 2022

Conversation

bramley
Copy link
Contributor

@bramley bramley commented Jul 2, 2022

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 #876

Screenshots (if appropriate):

@bramley bramley changed the title Split the part of shortening text that needs to be multibyte aware in… Shortening text that needs to be multibyte aware Jul 2, 2022
bramley added a commit to bramley/phplist-plugin-common that referenced this pull request Aug 13, 2022
@michield
Copy link
Member

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.

@marianaballa marianaballa merged commit 17c67d6 into phpList:master Sep 29, 2022
@phpListDockerBot
Copy link
Contributor

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

@bramley bramley deleted the shorten_text branch October 7, 2022 15:18
@phpListDockerBot
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants