Bug #20359 » extbase-t3libdiv.patch
t3lib/class.t3lib_div.php (working copy) | ||
---|---|---|
return $output;
|
||
}
|
||
|
||
/**
|
||
* Returns a given string with underscores as UpperCamelCase (not UTF8 safe)
|
||
* Example: Converts blog_example to BlogExample
|
||
*
|
||
* @param string String to be converted to camel case
|
||
* @return string UpperCamelCasedWord
|
||
*/
|
||
public static function underscoredToUpperCamelCase($string) {
|
||
$upperCamelCase = str_replace(' ', '', ucwords(str_replace('_', ' ', strtolower($string))));
|
||
return $upperCamelCase;
|
||
}
|
||
|
||
/**
|
||
* Returns a given string with underscores as lowerCamelCase (not UTF8 safe)
|
||
* Example: Converts minimal_value to minimalValue
|
||
*
|
||
* @param string String to be converted to camel case
|
||
* @return string lowerCamelCasedWord
|
||
*/
|
||
public static function underscoredToLowerCamelCase($string) {
|
||
$upperCamelCase = str_replace(' ', '', ucwords(str_replace('_', ' ', strtolower($string))));
|
||
$lowerCamelCase = strtolower(substr($upperCamelCase,0,1) ) . substr($upperCamelCase,1);
|
||
return $lowerCamelCase;
|
||
}
|
||
|
||
/**
|
||
* Returns a given CamelCasedString as an lowercase string with underscores (not UTF8 safe)
|
||
* Example: Converts BlogExample to blog_example, and minimalValue to minimal_value
|
||
*
|
||
* @param string String to be converted to lowercase underscore
|
||
* @return string lowercase_and_underscored_string
|
||
*/
|
||
public static function camelCaseToLowerCaseUnderscored($string) {
|
||
return strtolower(preg_replace('/(?<=\w)([A-Z])/', '_\\1', $string));
|
||
}
|
||
|
||
/**
|
||
* Sets the first char of a string to lowercase (not UTF8 safe)
|
||
*
|
||
* @param string $string
|
||
* @return void
|
||
*/
|
||
public static function lowercaseFirst($string) {
|
||
return strtolower(substr($string,0,1) ) . substr($string,1);
|
||
}
|
||
... | ... | |
* @return string Final class name to instantiate with "new [classname]"
|
||
*/
|
||
protected function getClassName($className) {
|
||
return class_exists('ux_' . $className) ? self::getClassName('ux_' . $className) : $className;
|
||
return class_exists('ux_' . $className, false) ? self::getClassName('ux_' . $className) : $className;
|
||
}
|
||
/**
|