Definition at line 40 of file string_type_renderer.inc.
◆ format()
static StringTypeRenderer::format |
( |
|
$value, |
|
|
|
$template = "" |
|
) |
| |
|
static |
Reimplemented from AbstractTypeRenderer.
Definition at line 46 of file string_type_renderer.inc.
48 if (!$template)
return $value;
50 if ($template[0] ==
'/')
53 if (preg_match(
"/(\\/.*?\\/)(.*?)\\//", $template, $clauses))
55 return preg_replace($clauses[1], $clauses[2], $value);
59 if ($template[0] ==
'|')
62 if (preg_match(
"/(|.*?|)(.*?)|/", $template, $clauses))
64 return preg_replace($clauses[1], $clauses[2], $value);
77 return strtoupper($value);
80 return strtolower($value);
83 return ucfirst($value);
86 return lcfirst($value);
89 return ucwords(strtolower($value));
110 return urlencode($value);
115 case "firstSentence":
122 if (is_numeric($template))
126 else if (strpos($template,
"|") !==
false)
128 $options = explode(
"|", $template);
129 return $value ? $options[0] : $options[1];
codify($name)
Takes a text string and converts it into a code-compliant format, suitable for use as a variable name...
xmlEntities($string)
Function to provide html to XML entity renaming.
pluralize($text, $count=0)
Takes a singular string and makes it plural.
firstSentence($text)
Returns the first sentence of the supplied text.
jsSafe($str, $escapeEntities=false)
Utility function to escape a string correctly for use in a Javascript client-side call.
formatAsHTML($text)
Takes a string and formats it for display as HTML, removing any HTML tags it contains,...
ellipsis($txt, $max, $wholeWord=false)
Truncate the supplied text at the given maximum length.
prettify($name)
Takes a variable or field name and converts it into a human-readable version (assuming that the origi...
◆ phone()
static StringTypeRenderer::phone |
( |
|
$phone | ) |
|
|
static |
Definition at line 146 of file string_type_renderer.inc.
148 $phone = preg_replace(
"/[^0-9]/",
"", $phone);
150 if(strlen($phone) == 7)
151 return preg_replace(
"/([0-9]{3})([0-9]{4})/",
"$1-$2", $phone);
152 elseif(strlen($phone) == 10)
153 return preg_replace("/([0-9]{3})([0-9]{3})([0-9]{4})/
", "($1) $2-$3
", $phone);
◆ StringTypeRenderer()
StringTypeRenderer::StringTypeRenderer |
( |
| ) |
|
The documentation for this class was generated from the following file: