Format
class Format
Format Library which allows a country specific formatting of numbers and dates and various other format functions
Constants
| FORMAT_MARKDOWN |
|
| FORMAT_REVERSE_MARKDOWN |
|
| FORMAT_PLAINTEXT |
|
| FORMAT_MISC |
|
Methods
Parse links
No description
No description
builds a callable telephone number from given string.
converts letters in given telephone number to corresponding numbers
Formats the output for a table cell - if empty a NBSP is returned
No description
No description
Formats a boolean value
No description
No description
No description
Formats a date
Formats a date time
Format Duration
No description
Format file size
No description
Returns a well formatted HTML of the passed tags with special formatting of the hashtags
Highlight Passed Text using a Syntax Highlighter Engine
No description
Formats a money amount
Formats a number according to local standards and options
Formats a number to be used in javascript (replace ',' with '.' and remove any spaces
Formats a percent value
Formats an rrule to a verbose label
No description
No description
No description
Format Text String e.g. with Markdown
Formats a text to be included in javascript
Formats a time
Formats a timespan between two dates
Takes a numeric input and returns an rendered XUI_USERLINK
Format UUID (binary 16) to string representation
Formats a get_tag_cloud() return using different font-sizes
No description
DEPRECATED - Please use >image_resize_parse
Adds XF image resize params to each image in the passed HTML string
e.g.
will be replaced to:
Callback for image_resize_parse
Checks the given string for utf-8 encoding.
Checks if the last character is or isnt a space. (does it the normal way if it is) It explodes the string into an array of seperate words, the effect is... it chops off anything after and including the last space.
Parst einen Text
Converts a currency value to word representation (1.02 => one dollar two cents) If the number has not any fraction part, the "cents" number is omitted.
Universal formatting function uses option array for further parameters Can be used for providing flexible formatting options within other components
No description
No description
Converts a number to its word representation
Converts a string to the corresponding number using the local number settings
Parst einen Text
Parses the passed text
Details
at line 1622
string
_link_parse(array $matches)
Parse links
Internal links remain unchanged. External links are modified by prepend a redirect.
at line 1599
_link_parse_markdown($matches)
No description
at line 1571
_text_pre_parse_links($matches)
No description
at line 1818
string
build_telephone_number(string $number, $country = false, $alphanumeric = true)
builds a callable telephone number from given string.
Prefixes country code based on given $country (valid strings are in tbl|system_lib_country). Example: $number = "0172 / 123-456", $contry = "Germany" returns: $number = "+49172123456"
at line 1893
string
convert_letters_to_telephone_number($number, $key_pad = 'INT_STANDARD')
converts letters in given telephone number to corresponding numbers
at line 612
empty2nbsp($value)
Formats the output for a table cell - if empty a NBSP is returned
at line 456
static string
formatUUID(string $uuidHex)
No description
at line 1248
string
format_actionplaceholder(string $text, array $customPlaceholders = [])
No description
at line 578
string
format_boolean($input, $options = array())
Formats a boolean value
at line 529
mixed
format_by_callback(mixed $input, mixed $options = array())
No description
at line 421
format_cast($input, $type)
No description
at line 429
format_contrast_color($hexcolor, $dark = 'black', $light = 'white')
No description
at line 739
string
format_date(bool|int $input = false, array $options = array())
Formats a date
at line 859
string
format_datetime(int $input, array $options = array())
Formats a date time
at line 646
format_duration($seconds, mixed $options = array())
Format Duration
at line 1098
format_email($input, $options = array())
No description
at line 545
string
format_filesize($input, array $options = [])
Format file size
at line 803
string
format_friendly_date(string|int $unixTimestamp, string $dateformat = '%x %R', array $options = [])
No description
at line 1547
string|string[]|null
format_hashtags(mixed $text_with_hashtags)
Returns a well formatted HTML of the passed tags with special formatting of the hashtags
at line 129
mixed|string
format_highlight_syntax(mixed $text, string $format = 'auto')
Highlight Passed Text using a Syntax Highlighter Engine
at line 565
string
format_insert(string $input, string $target)
No description
at line 972
string
format_money(float $input, $options = array())
Formats a money amount
at line 1011
array|float|string
format_number(float $input, array $options = array())
Formats a number according to local standards and options
at line 1152
string
format_number_js($input)
Formats a number to be used in javascript (replace ',' with '.' and remove any spaces
at line 626
string
format_percent(float $input, $options = array())
Formats a percent value
at line 1126
string
format_rrule(string $rrule)
Formats an rrule to a verbose label
at line 466
format_sprintf(mixed $input, mixed $parameters)
No description
at line 487
string
format_string($string, bool $apply_gettext = true)
No description
at line 1594
format_template_specialchars($text)
No description
at line 59
mixed|string
format_text(string $text, string $style = Format::FORMAT_MARKDOWN, array $options = array())
Format Text String e.g. with Markdown
style=markdown options:
- allow_images [default:true] (true - images will be embedded in
tags [should be true for editor] | false - images will be linked to in )
- skip_code_highlight [default:false] (true - use true if converting Markdown for use in editor | false - use false for nice user output)
style=reverse_markdown options:
- allow_html [default:false] (true - unparsable html will be kept | false - no html expected in output)
- allow_images [default:true] (true -
tags will be converted to markdown syntax | false -
tags will be stripped and are not expected/allowed in HTML)
- entity_decoding [default:true] (true - use true if converting HTML to plaintext e.g. for email or SMS | false - use false for sanitizing, saving from editor )
at line 1163
string
format_text_js(string $input)
Formats a text to be included in javascript
at line 711
string
format_time(int $input, array $options = array())
Formats a time
at line 929
string
format_timespan(array $input, array $options = array())
Formats a timespan between two dates
at line 399
bool|string
format_userlink($id)
Takes a numeric input and returns an rendered XUI_USERLINK
at line 447
string
format_uuid(string $uuidHex)
Format UUID (binary 16) to string representation
at line 1339
string
get_formatted_tag_cloud(array $tag_cloud_array, array $link_params, array $options = array(), Link $xf_link = null)
Formats a get_tag_cloud() return using different font-sizes
at line 1740
mixed|string
highlight_search_words(string $subject, array $words, bool $alphanumeric = true)
No description
at line 1672
string
html_to_imgresized(string $html)
DEPRECATED - Please use >image_resize_parse
at line 1683
string
image_resize_parse(string $html)
Adds XF image resize params to each image in the passed HTML string
e.g.
will be replaced to:
at line 1691
image_resize_parse_cb(mixed $matches)
Callback for image_resize_parse
at line 1774
bool
is_utf8($str)
Checks the given string for utf-8 encoding.
at line 221
string
limit_string(string $string, int $charlimit = 200)
Checks if the last character is or isnt a space. (does it the normal way if it is) It explodes the string into an array of seperate words, the effect is... it chops off anything after and including the last space.
at line 1647
string
link_parse(string $text)
Parst einen Text
at line 1314
string
money_to_str(float $money_float, string $int_curr = '')
Converts a currency value to word representation (1.02 => one dollar two cents) If the number has not any fraction part, the "cents" number is omitted.
at line 272
string
multi_format(float $input, array $options)
Universal formatting function uses option array for further parameters Can be used for providing flexible formatting options within other components
Example Format $options['format']="money"; $options['options']['decimals']=2; $options['suffix']=" EUR";
at line 237
array|mixed
multi_format_array(array $input_array, array $options, $type = '2dim')
No description
at line 383
string
multi_format_queue(mixed $input, $format_queue)
No description
at line 1289
string
number_to_str(int $number)
Converts a number to its word representation
at line 1235
str_to_number($string)
Converts a string to the corresponding number using the local number settings
at line 1471
string
text_parse(string $text, bool $nl2br = true, bool $parse_hash_tags = false)
Parst einen Text
at line 1565
text_pre_parse($text)
Parses the passed text