Filters
in package
View filters
Table of Contents
Methods
- capitalize() : string
- Returns $value as all lowercase with the first letter capitalized.
- date() : string
- Formats a date into the given $format.
- date_modify() : false|int
- Given a string or DateTime object, will return the date modified by the given value. Returns the value as a unix timestamp
- default() : string
- Returns the given default value if $value is empty or undefined.
- esc() : string
- Escapes the given value with our `esc()` helper function.
- excerpt() : string
- Returns an excerpt of the given string.
- highlight() : string
- Highlights a given phrase within the text using '<mark></mark>' tags.
- highlight_code() : string
- Highlights code samples with HTML/CSS.
- limit_chars() : string
- Limits the number of characters to $limit, and trails of with an ellipsis.
- limit_words() : string
- Limits the number of words to $limit, and trails of with an ellipsis.
- local_currency() : string
- Returns the $value displayed as a currency string.
- local_number() : string
- Returns the $value displayed in a localized manner.
- nl2br() : string
- Returns a string with all instances of newline character (\n) converted to an HTML <br> tag.
- prose() : string
- Takes a body of text and uses the auto_typography() method to turn it into prettier, easier-to-read, prose.
- round() : float|string
- Rounds a given $value in one of 3 ways;
- title() : string
- Returns a "title case" version of the string.
Methods
capitalize()
Returns $value as all lowercase with the first letter capitalized.
public
static capitalize(string $value) : string
Parameters
- $value : string
Return values
stringdate()
Formats a date into the given $format.
public
static date(int|string|null $value, string $format) : string
Parameters
- $value : int|string|null
- $format : string
Return values
stringdate_modify()
Given a string or DateTime object, will return the date modified by the given value. Returns the value as a unix timestamp
public
static date_modify(int|string|null $value, string $adjustment) : false|int
Example: my_date|date_modify(+1 day)
Parameters
- $value : int|string|null
- $adjustment : string
Return values
false|intdefault()
Returns the given default value if $value is empty or undefined.
public
static default(bool|float|int|array<int, string>|object|resource|string|null $value, string $default) : string
Parameters
- $value : bool|float|int|array<int, string>|object|resource|string|null
- $default : string
Return values
stringesc()
Escapes the given value with our `esc()` helper function.
public
static esc(string $value[, string $context = 'html' ]) : string
Parameters
- $value : string
- $context : string = 'html'
Tags
Return values
stringexcerpt()
Returns an excerpt of the given string.
public
static excerpt(string $value, string $phrase[, int $radius = 100 ]) : string
Parameters
- $value : string
- $phrase : string
- $radius : int = 100
Return values
stringhighlight()
Highlights a given phrase within the text using '<mark></mark>' tags.
public
static highlight(string $value, string $phrase) : string
Parameters
- $value : string
- $phrase : string
Return values
stringhighlight_code()
Highlights code samples with HTML/CSS.
public
static highlight_code(string $value) : string
Parameters
- $value : string
Return values
stringlimit_chars()
Limits the number of characters to $limit, and trails of with an ellipsis.
public
static limit_chars(string $value[, int $limit = 500 ]) : string
Will break at word break so may be more or less than $limit.
Parameters
- $value : string
- $limit : int = 500
Return values
stringlimit_words()
Limits the number of words to $limit, and trails of with an ellipsis.
public
static limit_words(string $value[, int $limit = 100 ]) : string
Parameters
- $value : string
- $limit : int = 100
Return values
stringlocal_currency()
Returns the $value displayed as a currency string.
public
static local_currency(float|int $value, string $currency[, string|null $locale = null ][, int $fraction = null ]) : string
Parameters
- $value : float|int
- $currency : string
- $locale : string|null = null
- $fraction : int = null
Return values
stringlocal_number()
Returns the $value displayed in a localized manner.
public
static local_number(float|int $value[, string $type = 'decimal' ][, int $precision = 4 ][, string|null $locale = null ]) : string
Parameters
- $value : float|int
- $type : string = 'decimal'
- $precision : int = 4
- $locale : string|null = null
Return values
stringnl2br()
Returns a string with all instances of newline character (\n) converted to an HTML <br> tag.
public
static nl2br(string $value) : string
Parameters
- $value : string
Return values
stringprose()
Takes a body of text and uses the auto_typography() method to turn it into prettier, easier-to-read, prose.
public
static prose(string $value) : string
Parameters
- $value : string
Return values
stringround()
Rounds a given $value in one of 3 ways;
public
static round(string $value[, int|string $precision = 2 ][, string $type = 'common' ]) : float|string
- common Normal rounding
- ceil always rounds up
- floor always rounds down
Parameters
- $value : string
- $precision : int|string = 2
-
precision or type
- $type : string = 'common'
Return values
float|stringtitle()
Returns a "title case" version of the string.
public
static title(string $value) : string
Parameters
- $value : string