$sanitizer->line() method

Sanitize any string of text to single line, no HTML, and no specific max-length (unless given)

This is the same as the text() sanitizer but does not impose a maximum character length (or byte length) unless given one in the $maxLength argument. This is useful in cases where the text sanitizer’s built in 255 character max length (1020 max bytes) is not enough, or when you want to specify a max length as part of the method arguments.

Please note that like with the text sanitizer, the max length refers to a maximum number of characters, not bytes. The maxBytes is automatically set to the maxLength * 4, or can be specifically set via the maxBytes option.

Available since version 3.0.157.

Usage

// basic usage
$string = $sanitizer->line(string $value);

// usage with all arguments
$string = $sanitizer->line(string $value, $maxLength = 0, array $options = []);

Arguments

NameType(s)Description
valuestring

String to sanitize

maxLength (optional)int, array

Maximum length in characters, omit (0) for no max-length, or substitute $options array

options (optional)array

Options to modify behavior, see text() sanitizer for all options.

Return value

string

See Also


$sanitizer methods and properties

API reference based on ProcessWire core version 3.0.214

Twitter updates

  • This week ProcessWire 3.0.214 is on the dev branch. Relative to 3.0.213 this version has 16 new commits which include the addition of 3 new pull requests, 6 issue fixes, a new WireNumberTools utility class, and various other improvements. More
    17 March 2023
  • ProcessWire 3.0.213 core updates: This week we’ll look at the new WireSitemapXML module, a new WireNumberTools core class, and a new ability for Fieldtype modules to specify useful ready-to-use configurations when creating new fields. More
    24 February 2023
  • ProcessWire 3.0.212 core updates— More
    17 February 2023

Latest news

  • ProcessWire Weekly #462
    In the 462nd issue of ProcessWire Weekly we'll cover the latest core updates, check out a new third party module called Template Access Log, and more. Read on!
    Weekly.pw / 18 March 2023
  • ProcessWire 3.0.213 core updates
    This week we’ll look at the new WireSitemapXML module, a new WireNumberTools core class, and a new ability for Fieldtype modules to specify useful ready-to-use configurations when creating new fields.
    Blog / 24 February 2023
  • Subscribe to weekly ProcessWire news

“Yesterday I sent the client a short documentation for their ProcessWire-powered website. Today all features already used with no questions. #cmsdoneright—Marc Hinse, Web designer/developer