38 require_once realpath(dirname(__FILE__).
"/abstract_type_renderer.inc");
46 static function format($value, $template =
"")
48 if (!$template)
return $value;
51 if ($template[0] ==
'/')
54 if (preg_match(
"/(\\/.*?\\/)(.*?)\\//", $template, $clauses))
56 return preg_replace($clauses[1], $clauses[2], $value);
60 if ($template[0] ==
'|')
63 if (preg_match(
"/(|.*?|)(.*?)|/", $template, $clauses))
65 return preg_replace($clauses[1], $clauses[2], $value);
78 return strtoupper($value);
81 return strtolower($value);
84 return ucfirst($value);
87 return lcfirst($value);
90 return ucwords(strtolower($value));
105 return formatAsHtml($value);
113 case "firstSentence":
118 if (is_numeric($template))
static format($value, $template="")
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.
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...