Wordless
Stop writing themes like it's 1998.
|
This module provides methods for text handling. More...
Public Member Functions | |
pluralize ($string) | |
Attempts to pluralize the specified text. More... | |
cycle () | |
Creates a Cycle object whose cycles through elements of an array every time it is called. More... | |
reset_cycle ($name="default") | |
Reset the cycle pointer. More... | |
truncate ($text, $options=array()) | |
Truncate the text to the specified length. More... | |
active_if ($check, $active="active", $inactive="inactive") | |
Run a check against $check and returns 'active' or 'inactive' string accordingly. More... | |
capitalize ($text) | |
Returns a string with the first character of each word capitalized. More... | |
titleize ($text) | |
Capitalizes the first letter of every word. More... | |
is_valid_url ($url) | |
Check if the string passed as parameter is a valid URL. More... | |
This module provides methods for text handling.
TextHelper::active_if | ( | $check, | |
$active = "active" , |
|||
$inactive = "inactive" |
|||
) |
Run a check against $check and returns 'active' or 'inactive' string accordingly.
mixed | $check | This check will be tested against truthness. Could be anything |
string | $active | (optional) Text to print when $check is true. Dafault: 'active' |
string | $inactive | (optional) Text to print when $check is false. Default: 'inactive' |
TextHelper::cycle | ( | ) |
Creates a Cycle object whose cycles through elements of an array every time it is called.
This can be used for example, to alternate classes for table rows. You can use named cycles to allow nesting in loops. Passing an Array as the last parameter with a 'name' key will create a named cycle. The default name for a cycle without a 'name' key is "default". You can manually reset a cycle by calling reset_cycle and passing the name of the cycle.
mixed | "$string, $string, array('name' => $name)" Array is optional. $string are the element through it will cycle |