function and_list
Turns an array of strings into a friendly delimited string separated by commas and an "and"
static
void
and_list
(array $array, [string $between = ', '], [string $between_last = NULL])
-
array
$array: An array of strings
-
string
$between: Text to put between each element
-
string
$between_last: Text to put between the next-to-last element and the last element
Called to register a format function to a plugin hook, only passing the hook's first parameter to the Format function.
static
void
apply
(string $format, string $onwhat)
-
string
$format: A function name that exists in a Format class
-
string
$onwhat: A plugin hook to apply that Format function to as a filter
Called to register a format function to a plugin hook, and passes all of the hook's parameters to the Format function.
static
void
apply_with_hook_params
(string $format, string $onwhat)
-
string
$format: A function name that exists in a Format class
-
string
$onwhat: A plugin hook to apply that Format function to as a filter
function autop Converts non-HTML paragraphs separated with 2 or more new lines into HTML paragraphs while preserving any internal HTML.
New lines within the text of block elements are converted to linebreaks. New lines before and after tags are stripped.
static
string
autop
(string $value)
-
string
$value: The string to apply the formatting
function by_index Returns an indexed formatter object, for use by lambda functions created to supply additional parameters to plugin filters.
static
Format
by_index
(
integer $index)
-
integer
$index: The index of the formatter object to return.
html_messages
Creates an HTML unordered list of an array of messages
static
string
html_messages
(array $notices, array $errors)
-
array
$notices: a list of success messages
-
array
$errors: a list of error messages
humane_messages
Creates JS calls to display session messages
static
string
humane_messages
(array $notices, array $errors)
-
array
$notices: a list of success messages
-
array
$errors: a list of error messages
json_messages
Creates a JSON list of session messages
static
string
json_messages
(array $notices, array $errors)
-
array
$notices: a list of success messages
-
array
$errors: a list of error messages
function load_all
Loads and stores an instance of all declared Format classes for future use
static
void
load_all
()
Returns a truncated version of post content when the post isn't being displayed on its own.
Posts are split either at the comment <!--more--> or at the specified maximums. Use only after applying autop or other paragrpah styling methods. Apply to posts using:
static
string
more
(
string $content,
Post $post, [
string $more_text =
'Read More »'], [
integer $max_words =
null], [
integer $max_paragraphs =
null])
-
string
$content: The post content
-
Post
$post: The Post object of the post
-
string
$more_text: The text to use in the "read more" link.
-
integer
$max_words: null or the maximum number of words to use before showing the more link
-
integer
$max_paragraphs: null or the maximum number of paragraphs to use before showing the more link
function nice_date
Formats a date using a date format string
static
string
nice_date
(
HabariDateTime $date, [
string $dateformat =
'F j, Y'])
-
HabariDateTime
$date: A date as a HabariDateTime object
-
string
$dateformat: A date format string
function nice_time
Formats a time using a date format string
static
string
nice_time
(
HabariDateTime $date, [
string $dateformat =
'H:i:s'])
-
HabariDateTime
$date: A date as a HabariDateTime object
-
string
$dateformat: A date format string
Returns a shortened version of whatever is passed in.
static
string
summarize
( $text, [integer $count = 100], [integer $maxparagraphs = 1], string $value)
-
string
$value: A string to shorten
-
integer
$count: Maximum words to display [100]
-
integer
$maxparagraphs: Maximum paragraphs to display [1]
-
$text
function tag_and_list Formatting function (should be in Format class?) Turns an array of tag names into an HTML-linked list with commas and an "and".
static
string
tag_and_list
(array $array, [string $between = ', '], [string $between_last = NULL])
-
array
$array: An array of tag names
-
string
$between: Text to put between each element
-
string
$between_last: Text to put between the next to last element and the last element