diff options
Diffstat (limited to 'library/vendor/Zend/Filter/Word')
13 files changed, 702 insertions, 0 deletions
diff --git a/library/vendor/Zend/Filter/Word/CamelCaseToDash.php b/library/vendor/Zend/Filter/Word/CamelCaseToDash.php new file mode 100644 index 0000000..4698947 --- /dev/null +++ b/library/vendor/Zend/Filter/Word/CamelCaseToDash.php @@ -0,0 +1,43 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ + +/** + * @see Zend_Filter_Interface + */ + +/** + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Filter_Word_CamelCaseToDash extends Zend_Filter_Word_CamelCaseToSeparator +{ + /** + * Constructor + * + * @return void + */ + public function __construct() + { + parent::__construct('-'); + } +} diff --git a/library/vendor/Zend/Filter/Word/CamelCaseToSeparator.php b/library/vendor/Zend/Filter/Word/CamelCaseToSeparator.php new file mode 100644 index 0000000..6592c45 --- /dev/null +++ b/library/vendor/Zend/Filter/Word/CamelCaseToSeparator.php @@ -0,0 +1,48 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ + +/** + * @see Zend_Filter_PregReplace + */ + +/** + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Filter_Word_CamelCaseToSeparator extends Zend_Filter_Word_Separator_Abstract +{ + + public function filter($value) + { + if (self::isUnicodeSupportEnabled()) { + parent::setMatchPattern(array('#(?<=(?:\p{Lu}))(\p{Lu}\p{Ll})#','#(?<=(?:\p{Ll}|\p{Nd}))(\p{Lu})#')); + parent::setReplacement(array($this->_separator . '\1', $this->_separator . '\1')); + } else { + parent::setMatchPattern(array('#(?<=(?:[A-Z]))([A-Z]+)([A-Z][A-z])#', '#(?<=(?:[a-z0-9]))([A-Z])#')); + parent::setReplacement(array('\1' . $this->_separator . '\2', $this->_separator . '\1')); + } + + return parent::filter($value); + } + +} diff --git a/library/vendor/Zend/Filter/Word/CamelCaseToUnderscore.php b/library/vendor/Zend/Filter/Word/CamelCaseToUnderscore.php new file mode 100644 index 0000000..fc2a5d7 --- /dev/null +++ b/library/vendor/Zend/Filter/Word/CamelCaseToUnderscore.php @@ -0,0 +1,43 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ + +/** + * @see Zend_Filter_CamelCaseToSeparator + */ + +/** + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Filter_Word_CamelCaseToUnderscore extends Zend_Filter_Word_CamelCaseToSeparator +{ + /** + * Constructor + * + * @return void + */ + public function __construct() + { + parent::__construct('_'); + } +} diff --git a/library/vendor/Zend/Filter/Word/DashToCamelCase.php b/library/vendor/Zend/Filter/Word/DashToCamelCase.php new file mode 100644 index 0000000..c6ff5c1 --- /dev/null +++ b/library/vendor/Zend/Filter/Word/DashToCamelCase.php @@ -0,0 +1,43 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ + +/** + * @see Zend_Filter_Interface + */ + +/** + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Filter_Word_DashToCamelCase extends Zend_Filter_Word_SeparatorToCamelCase +{ + /** + * Constructor + * + * @return void + */ + public function __construct() + { + parent::__construct('-'); + } +} diff --git a/library/vendor/Zend/Filter/Word/DashToSeparator.php b/library/vendor/Zend/Filter/Word/DashToSeparator.php new file mode 100644 index 0000000..fe86149 --- /dev/null +++ b/library/vendor/Zend/Filter/Word/DashToSeparator.php @@ -0,0 +1,41 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ + +/** + * @see Zend_Filter_PregReplace + */ + +/** + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Filter_Word_DashToSeparator extends Zend_Filter_Word_Separator_Abstract +{ + + public function filter($value) + { + $this->setMatchPattern('#-#'); + $this->setReplacement($this->_separator); + return parent::filter($value); + } +} diff --git a/library/vendor/Zend/Filter/Word/DashToUnderscore.php b/library/vendor/Zend/Filter/Word/DashToUnderscore.php new file mode 100644 index 0000000..19527dd --- /dev/null +++ b/library/vendor/Zend/Filter/Word/DashToUnderscore.php @@ -0,0 +1,44 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ + +/** + * @see Zend_Filter_PregReplace + */ + +/** + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Filter_Word_DashToUnderscore extends Zend_Filter_Word_SeparatorToSeparator +{ + /** + * Constructor + * + * @param string $separator Space by default + * @return void + */ + public function __construct() + { + parent::__construct('-', '_'); + } +} diff --git a/library/vendor/Zend/Filter/Word/Separator/Abstract.php b/library/vendor/Zend/Filter/Word/Separator/Abstract.php new file mode 100644 index 0000000..7a95034 --- /dev/null +++ b/library/vendor/Zend/Filter/Word/Separator/Abstract.php @@ -0,0 +1,74 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ + +/** + * @see Zend_Filter_PregReplace + */ + +/** + * @category Zend + * @package Zend_Filter + * @uses Zend_Filter_PregReplace + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +abstract class Zend_Filter_Word_Separator_Abstract extends Zend_Filter_PregReplace +{ + + protected $_separator = null; + + /** + * Constructor + * + * @param string $separator Space by default + * @return void + */ + public function __construct($separator = ' ') + { + $this->setSeparator($separator); + } + + /** + * Sets a new seperator + * + * @param string $separator Seperator + * @return $this + */ + public function setSeparator($separator) + { + if ($separator == null) { + throw new Zend_Filter_Exception('"' . $separator . '" is not a valid separator.'); + } + $this->_separator = $separator; + return $this; + } + + /** + * Returns the actual set seperator + * + * @return string + */ + public function getSeparator() + { + return $this->_separator; + } + +} diff --git a/library/vendor/Zend/Filter/Word/SeparatorToCamelCase.php b/library/vendor/Zend/Filter/Word/SeparatorToCamelCase.php new file mode 100644 index 0000000..7f53eb7 --- /dev/null +++ b/library/vendor/Zend/Filter/Word/SeparatorToCamelCase.php @@ -0,0 +1,63 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ + +/** + * @see Zend_Filter_PregReplace + */ + +/** + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Filter_Word_SeparatorToCamelCase extends Zend_Filter_Word_Separator_Abstract +{ + + public function filter($value) + { + // a unicode safe way of converting characters to \x00\x00 notation + $pregQuotedSeparator = preg_quote($this->_separator, '#'); + + if (self::isUnicodeSupportEnabled()) { + 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})#','#(^[A-Za-z]{1})#')); + parent::setReplacement(array('Zend_Filter_Word_SeparatorToCamelCase', '_strtoupperArray')); + } + + 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]); + } + +} diff --git a/library/vendor/Zend/Filter/Word/SeparatorToDash.php b/library/vendor/Zend/Filter/Word/SeparatorToDash.php new file mode 100644 index 0000000..aeab938 --- /dev/null +++ b/library/vendor/Zend/Filter/Word/SeparatorToDash.php @@ -0,0 +1,45 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ + +/** + * @see Zend_Filter_SeperatorToSeparator + */ + +/** + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Filter_Word_SeparatorToDash extends Zend_Filter_Word_SeparatorToSeparator +{ + /** + * Constructor + * + * @param string $searchSeparator Seperator to search for change + * @return void + */ + public function __construct($searchSeparator = ' ') + { + parent::__construct($searchSeparator, '-'); + } + +} diff --git a/library/vendor/Zend/Filter/Word/SeparatorToSeparator.php b/library/vendor/Zend/Filter/Word/SeparatorToSeparator.php new file mode 100644 index 0000000..d1ce7e9 --- /dev/null +++ b/library/vendor/Zend/Filter/Word/SeparatorToSeparator.php @@ -0,0 +1,127 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ + +/** + * @see Zend_Filter_PregReplace + */ + +/** + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Filter_Word_SeparatorToSeparator extends Zend_Filter_PregReplace +{ + + protected $_searchSeparator = null; + protected $_replacementSeparator = null; + + /** + * Constructor + * + * @param string $searchSeparator Seperator to search for + * @param string $replacementSeperator Seperator to replace with + * @return void + */ + public function __construct($searchSeparator = ' ', $replacementSeparator = '-') + { + $this->setSearchSeparator($searchSeparator); + $this->setReplacementSeparator($replacementSeparator); + } + + /** + * Sets a new seperator to search for + * + * @param string $separator Seperator to search for + * @return $this + */ + public function setSearchSeparator($separator) + { + $this->_searchSeparator = $separator; + return $this; + } + + /** + * Returns the actual set seperator to search for + * + * @return string + */ + public function getSearchSeparator() + { + return $this->_searchSeparator; + } + + /** + * Sets a new seperator which replaces the searched one + * + * @param string $separator Seperator which replaces the searched one + * @return $this + */ + public function setReplacementSeparator($separator) + { + $this->_replacementSeparator = $separator; + return $this; + } + + /** + * Returns the actual set seperator which replaces the searched one + * + * @return string + */ + public function getReplacementSeparator() + { + return $this->_replacementSeparator; + } + + /** + * Defined by Zend_Filter_Interface + * + * Returns the string $value, replacing the searched seperators with the defined ones + * + * @param string $value + * @return string + */ + public function filter($value) + { + return $this->_separatorToSeparatorFilter($value); + } + + /** + * Do the real work, replaces the seperator to search for with the replacement seperator + * + * Returns the replaced string + * + * @param string $value + * @return string + */ + protected function _separatorToSeparatorFilter($value) + { + if ($this->_searchSeparator == null) { + throw new Zend_Filter_Exception('You must provide a search separator for this filter to work.'); + } + + $this->setMatchPattern('#' . preg_quote($this->_searchSeparator, '#') . '#'); + $this->setReplacement($this->_replacementSeparator); + return parent::filter($value); + } + +} diff --git a/library/vendor/Zend/Filter/Word/UnderscoreToCamelCase.php b/library/vendor/Zend/Filter/Word/UnderscoreToCamelCase.php new file mode 100644 index 0000000..0c44700 --- /dev/null +++ b/library/vendor/Zend/Filter/Word/UnderscoreToCamelCase.php @@ -0,0 +1,43 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ + +/** + * @see Zend_Filter_Interface + */ + +/** + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Filter_Word_UnderscoreToCamelCase extends Zend_Filter_Word_SeparatorToCamelCase +{ + /** + * Constructor + * + * @return void + */ + public function __construct() + { + parent::__construct('_'); + } +} diff --git a/library/vendor/Zend/Filter/Word/UnderscoreToDash.php b/library/vendor/Zend/Filter/Word/UnderscoreToDash.php new file mode 100644 index 0000000..b63fd16 --- /dev/null +++ b/library/vendor/Zend/Filter/Word/UnderscoreToDash.php @@ -0,0 +1,44 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ + +/** + * @see Zend_Filter_PregReplace + */ + +/** + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Filter_Word_UnderscoreToDash extends Zend_Filter_Word_SeparatorToSeparator +{ + /** + * Constructor + * + * @param string $separator Space by default + * @return void + */ + public function __construct() + { + parent::__construct('_', '-'); + } +} diff --git a/library/vendor/Zend/Filter/Word/UnderscoreToSeparator.php b/library/vendor/Zend/Filter/Word/UnderscoreToSeparator.php new file mode 100644 index 0000000..cfd7ed8 --- /dev/null +++ b/library/vendor/Zend/Filter/Word/UnderscoreToSeparator.php @@ -0,0 +1,44 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ + +/** + * @see Zend_Filter_PregReplace + */ + +/** + * @category Zend + * @package Zend_Filter + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Filter_Word_UnderscoreToSeparator extends Zend_Filter_Word_SeparatorToSeparator +{ + /** + * Constructor + * + * @param string $separator Space by default + * @return void + */ + public function __construct($replacementSeparator = ' ') + { + parent::__construct('_', $replacementSeparator); + } +} |