From c53d8d026021f97075fb2f4940ba22793c38fb6e Mon Sep 17 00:00:00 2001 From: davehauenstein Date: Wed, 15 Apr 2009 22:06:42 +0000 Subject: added toolbar; functionality includes refresh button to get back to original page, print article, email a link to the article with a personal note git-svn-id: http://arc90labs-readability.googlecode.com/svn/trunk@31 d4e419ec-0920-11de-bbfd-a7c1bc4c261e --- lib/Zend/Filter/Word/CamelCaseToDash.php | 44 +++++++++ lib/Zend/Filter/Word/CamelCaseToSeparator.php | 49 ++++++++++ lib/Zend/Filter/Word/CamelCaseToUnderscore.php | 44 +++++++++ lib/Zend/Filter/Word/DashToCamelCase.php | 44 +++++++++ lib/Zend/Filter/Word/DashToSeparator.php | 42 ++++++++ lib/Zend/Filter/Word/DashToUnderscore.php | 45 +++++++++ lib/Zend/Filter/Word/Separator/Abstract.php | 76 +++++++++++++++ lib/Zend/Filter/Word/SeparatorToCamelCase.php | 52 ++++++++++ lib/Zend/Filter/Word/SeparatorToDash.php | 46 +++++++++ lib/Zend/Filter/Word/SeparatorToSeparator.php | 129 +++++++++++++++++++++++++ lib/Zend/Filter/Word/UnderscoreToCamelCase.php | 44 +++++++++ lib/Zend/Filter/Word/UnderscoreToDash.php | 45 +++++++++ lib/Zend/Filter/Word/UnderscoreToSeparator.php | 45 +++++++++ 13 files changed, 705 insertions(+) create mode 100644 lib/Zend/Filter/Word/CamelCaseToDash.php create mode 100644 lib/Zend/Filter/Word/CamelCaseToSeparator.php create mode 100644 lib/Zend/Filter/Word/CamelCaseToUnderscore.php create mode 100644 lib/Zend/Filter/Word/DashToCamelCase.php create mode 100644 lib/Zend/Filter/Word/DashToSeparator.php create mode 100644 lib/Zend/Filter/Word/DashToUnderscore.php create mode 100644 lib/Zend/Filter/Word/Separator/Abstract.php create mode 100644 lib/Zend/Filter/Word/SeparatorToCamelCase.php create mode 100644 lib/Zend/Filter/Word/SeparatorToDash.php create mode 100644 lib/Zend/Filter/Word/SeparatorToSeparator.php create mode 100644 lib/Zend/Filter/Word/UnderscoreToCamelCase.php create mode 100644 lib/Zend/Filter/Word/UnderscoreToDash.php create mode 100644 lib/Zend/Filter/Word/UnderscoreToSeparator.php (limited to 'lib/Zend/Filter/Word') diff --git a/lib/Zend/Filter/Word/CamelCaseToDash.php b/lib/Zend/Filter/Word/CamelCaseToDash.php new file mode 100644 index 0000000..c4717f2 --- /dev/null +++ b/lib/Zend/Filter/Word/CamelCaseToDash.php @@ -0,0 +1,44 @@ +_separator . '\1', $this->_separator . '\1')); + } else { + parent::setMatchPattern(array('#(?<=(?:[A-Z]))([A-Z]+)([A-Z][A-z])#', '#(?<=(?:[a-z]))([A-Z])#')); + parent::setReplacement(array('\1' . $this->_separator . '\2', $this->_separator . '\1')); + } + + return parent::filter($value); + } + +} diff --git a/lib/Zend/Filter/Word/CamelCaseToUnderscore.php b/lib/Zend/Filter/Word/CamelCaseToUnderscore.php new file mode 100644 index 0000000..659dfb4 --- /dev/null +++ b/lib/Zend/Filter/Word/CamelCaseToUnderscore.php @@ -0,0 +1,44 @@ +setMatchPattern('#-#'); + $this->setReplacement($this->_separator); + return parent::filter($value); + } +} diff --git a/lib/Zend/Filter/Word/DashToUnderscore.php b/lib/Zend/Filter/Word/DashToUnderscore.php new file mode 100644 index 0000000..404598a --- /dev/null +++ b/lib/Zend/Filter/Word/DashToUnderscore.php @@ -0,0 +1,45 @@ +setSeparator($separator); + } + + /** + * Sets a new seperator + * + * @param string $separator Seperator + * @return $this + */ + public function setSeparator($separator) + { + if ($separator == null) { + require_once 'Zend/Filter/Exception.php'; + 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; + } + +} \ No newline at end of file diff --git a/lib/Zend/Filter/Word/SeparatorToCamelCase.php b/lib/Zend/Filter/Word/SeparatorToCamelCase.php new file mode 100644 index 0000000..853ec1b --- /dev/null +++ b/lib/Zend/Filter/Word/SeparatorToCamelCase.php @@ -0,0 +1,52 @@ +_separator, '#'); + + if (self::isUnicodeSupportEnabled()) { + parent::setMatchPattern(array('#('.$pregQuotedSeparator.')(\p{L}{1})#e','#(^\p{Ll}{1})#e')); + parent::setReplacement(array("strtoupper('\\2')","strtoupper('\\1')")); + } else { + parent::setMatchPattern(array('#('.$pregQuotedSeparator.')([A-Z]{1})#e','#(^[a-z]{1})#e')); + parent::setReplacement(array("strtoupper('\\2')","strtoupper('\\1')")); + } + + return parent::filter($value); + } + +} diff --git a/lib/Zend/Filter/Word/SeparatorToDash.php b/lib/Zend/Filter/Word/SeparatorToDash.php new file mode 100644 index 0000000..d5eab06 --- /dev/null +++ b/lib/Zend/Filter/Word/SeparatorToDash.php @@ -0,0 +1,46 @@ +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) { + require_once 'Zend/Filter/Exception.php'; + 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); + } + +} \ No newline at end of file diff --git a/lib/Zend/Filter/Word/UnderscoreToCamelCase.php b/lib/Zend/Filter/Word/UnderscoreToCamelCase.php new file mode 100644 index 0000000..aabbba9 --- /dev/null +++ b/lib/Zend/Filter/Word/UnderscoreToCamelCase.php @@ -0,0 +1,44 @@ +