|
|
@@ -39,14 +39,26 @@ class Zend_Filter_Word_SeparatorToCamelCase extends Zend_Filter_Word_Separator_A
|
|
|
$pregQuotedSeparator = preg_quote($this->_separator, '#');
|
|
|
|
|
|
if (self::isUnicodeSupportEnabled()) {
|
|
|
- parent::setMatchPattern(array('#('.$pregQuotedSeparator.')(\p{L}{1})#e','#(^\p{Ll}{1})#e'));
|
|
|
- parent::setReplacement(array("strtoupper('\\2')","strtoupper('\\1')"));
|
|
|
+ parent::setMatchPattern(array('#('.$pregQuotedSeparator.')(\p{L}{1})#','#(^\p{Ll}{1})#'));
|
|
|
+ parent::setReplacement(array('Zend_Filter_Word_SeparatorToCamelCase', '_strtoupperArray'));
|
|
|
} else {
|
|
|
- parent::setMatchPattern(array('#('.$pregQuotedSeparator.')([A-Za-z]{1})#e','#(^[A-Za-z]{1})#e'));
|
|
|
- parent::setReplacement(array("strtoupper('\\2')","strtoupper('\\1')"));
|
|
|
+ parent::setMatchPattern(array('#('.$pregQuotedSeparator.')([A-Za-z]{1})#','#(^[A-Za-z]{1})#'));
|
|
|
+ parent::setReplacement(array('Zend_Filter_Word_SeparatorToCamelCase', '_strtoupperArray'));
|
|
|
}
|
|
|
|
|
|
- return parent::filter($value);
|
|
|
+ return preg_replace_callback($this->_matchPattern, $this->_replacement, $value);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param array $matches
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ private static function _strtoupperArray(array $matches)
|
|
|
+ {
|
|
|
+ if (array_key_exists(2, $matches)) {
|
|
|
+ return strtoupper($matches[2]);
|
|
|
+ }
|
|
|
+ return strtoupper($matches[1]);
|
|
|
}
|
|
|
|
|
|
}
|