Jump to content

Recommended Posts

Posted

This week's version of ProcessWire on the dev branch continues resolution of GitHub issue reports, and it also adds a new text truncation function to our $sanitizer API, something requested from our requests repository:

https://processwire.com/blog/posts/processwire-3.0.101-core-updates/ 

We didn't have a blog post for last week's version 3.0.100—see the core updates section in ProcessWire Weekly #207 for more details on that version.

  • Like 17
Posted

There is a typo in your post @ryan.

You write:

Quote

.. and it also adds a new text truncation function to our $sanitizer API ...

The correct sentence should be:

Quote

... and it also adds a new swiss-army-knife-like truncation function to our $sanitizer API

But okay... I'm fine with your sentence, too.

  • Like 4
Posted

Wow, that truncate function will truncate my search for the ultimate truncate function! ?

I wonder if the default for the "visible" option should be true rather than false. If my string included entities and markup tags I think in nearly all cases I wouldn't want those invisible items affecting the visible string length.

  • Like 4
Posted
Quote

I wonder if the default for the "visible" option should be true rather than false. If my string included entities and markup tags I think in nearly all cases I wouldn't want those invisible items affecting the visible string length.

That's a good point, and maybe we'll change that before this gets off the dev branch. I left it false by default because it means a little more work for the function to perform. With defaults, I try and find a balance between the most likely to be used settings, with those that perform with the lowest overhead. There's also the matter of the "visible" option being more useful when the "keepTags" or "keepFormatTags" options are in use, where it can make a big difference. Though even without those options in use, there could still be entities counted as more than 1 character, so perhaps visible as true by default might be better. 

  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...