*
* @param name Name of the string
*
+ * @param int $maxLength
+ *
* @return string An equivalent variable name
*
* @access public
* useful while converting file names to class names etc
*
* @param string $string the input string
- * @param char $char the character used to demarcate the componets
+ * @param \char|string $char $char the character used to demarcate the componets
*
* @access public
*
return CRM_Core_DAO::$_nullArray;
}
+ /**
+ * @param $str
+ * @param $stringRules
+ *
+ * @return mixed
+ */
static function redaction($str, $stringRules) {
//redact the strings
if (!empty($stringRules)) {
return $text;
}
+ /**
+ * @param $string
+ * @param $params
+ */
static function extractName($string, &$params) {
$name = trim($string);
if (empty($name)) {
}
}
+ /**
+ * @param $string
+ *
+ * @return array
+ */
static function &makeArray($string) {
$string = trim($string);
*
* @param string $string
* @param int $maxLen
+ *
+ * @return string
*/
static function ellipsify($string, $maxLen) {
$len = strlen($string);
* "admin foo" => array(NULL,"admin foo")
* "cms:admin foo" => array("cms", "admin foo")
*
+ * @param $delim
* @param string $string e.g. "view all contacts". Syntax: "[prefix:]name"
+ * @param null $defaultPrefix
+ *
* @return array (0 => string|NULL $prefix, 1 => string $value)
*/
public static function parsePrefix($delim, $string, $defaultPrefix = NULL) {
*/
public static function compareStr($strOne, $strTwo, $case) {
if ($case == TRUE) {
- // convert to lowercase and strip of empty white spaces
+ // Convert to lowercase and trim white spaces
if (strtolower(trim($strOne)) == strtolower(trim($strTwo))) {
// yes - they are identical
return TRUE;
}
}
if ($case == FALSE) {
- // convert to lowercase and strip of empty white spaces
+ // Trim white spaces
if (trim($strOne) == trim($strTwo)) {
// yes - they are identical
return TRUE;
}
}
+ /**
+ * Many parts of the codebase have a convention of internally passing around
+ * HTML-encoded URLs. This effectively means that "&" is replaced by "&"
+ * (because most other odd characters are %-escaped in URLs; and %-escaped
+ * strings don't need any extra escaping in HTML).
+ *
+ * @param string $url URL with HTML entities
+ * @return string URL without HTML entities
+ */
+ public static function unstupifyUrl($htmlUrl) {
+ return str_replace('&', '&', $htmlUrl);
+ }
}