Permalink
Browse files

Init

  • Loading branch information...
0 parents commit 0c9a6c1aeaf03763831bb19f053c0fec3d665bba @robo47 committed Feb 13, 2010
Showing with 20,350 additions and 0 deletions.
  1. +26 −0 LICENSE
  2. +13 −0 README
  3. +1 −0 library/Doctrine
  4. +1 −0 library/Doctrine.php
  5. +1 −0 library/HTMLPurifier
  6. +1 −0 library/HTMLPurifier.php
  7. +33 −0 library/Robo47/Application/Exception.php
  8. +89 −0 library/Robo47/Application/Resource/Autoloader.php
  9. +83 −0 library/Robo47/Application/Resource/AutoloaderMulti.php
  10. +116 −0 library/Robo47/Application/Resource/Cache.php
  11. +83 −0 library/Robo47/Application/Resource/CacheMulti.php
  12. +78 −0 library/Robo47/Application/Resource/Config.php
  13. +91 −0 library/Robo47/Application/Resource/ErrorHandler.php
  14. +33 −0 library/Robo47/Application/Resource/Exception.php
  15. +82 −0 library/Robo47/Application/Resource/HtmlPurifier.php
  16. +82 −0 library/Robo47/Application/Resource/Log.php
  17. +235 −0 library/Robo47/Application/Resource/Object.php
  18. +81 −0 library/Robo47/Application/Resource/ObjectMulti.php
  19. +74 −0 library/Robo47/Application/Resource/Plugin/ErrorHandler.php
  20. +101 −0 library/Robo47/Application/Resource/Service/Akismet.php
  21. +98 −0 library/Robo47/Application/Resource/Service/Bitly.php
  22. +100 −0 library/Robo47/Application/Resource/Service/Gravatar.php
  23. +143 −0 library/Robo47/Auth/Adapter/Array.php
  24. +271 −0 library/Robo47/Cache/Backend/Array.php
  25. +33 −0 library/Robo47/Cache/Backend/Exception.php
  26. +221 −0 library/Robo47/Cache/DoctrineAdapter.php
  27. +33 −0 library/Robo47/Cache/Exception.php
  28. +91 −0 library/Robo47/Controller/Action/Helper/Url.php
  29. +209 −0 library/Robo47/Controller/Plugin/Tidy.php
  30. +145 −0 library/Robo47/Controller/Plugin/Title.php
  31. +79 −0 library/Robo47/Convert.php
  32. +33 −0 library/Robo47/Convert/Exception.php
  33. +54 −0 library/Robo47/Core.php
  34. +261 −0 library/Robo47/Curl.php
  35. +29 −0 library/Robo47/Curl/Exception.php
  36. +159 −0 library/Robo47/Curl/Multi.php
  37. +27 −0 library/Robo47/Curl/Multi/Exception.php
  38. +34 −0 library/Robo47/ErrorException.php
  39. +265 −0 library/Robo47/ErrorHandler.php
  40. +33 −0 library/Robo47/Exception.php
  41. +187 −0 library/Robo47/Exiftool.php
  42. +29 −0 library/Robo47/Exiftool/Exception.php
  43. +34 −0 library/Robo47/Filter/Exception.php
  44. +137 −0 library/Robo47/Filter/HtmlPurifier.php
  45. +65 −0 library/Robo47/Filter/SanitizeUrl.php
  46. +241 −0 library/Robo47/Filter/Tidy.php
  47. +185 −0 library/Robo47/Filter/UrlScheme.php
  48. +103 −0 library/Robo47/Form/Decorator/Info.php
  49. +37 −0 library/Robo47/Form/Element/Ckeditor.php
  50. +53 −0 library/Robo47/Loader/Autoloader/Ezc.php
  51. +56 −0 library/Robo47/Loader/Autoloader/HtmlPurifier.php
  52. +187 −0 library/Robo47/Log.php
  53. +34 −0 library/Robo47/Log/Exception.php
  54. +105 −0 library/Robo47/Log/Filter/Category.php
  55. +34 −0 library/Robo47/Log/Filter/Exception.php
  56. +96 −0 library/Robo47/Log/Filter/Mock.php
  57. +198 −0 library/Robo47/Log/Filter/ValidateProxy.php
  58. +63 −0 library/Robo47/Log/Writer/Abstract.php
  59. +175 −0 library/Robo47/Log/Writer/DoctrineTable.php
  60. +33 −0 library/Robo47/Log/Writer/Exception.php
  61. +94 −0 library/Robo47/Log/Writer/Mock.php
  62. +34 −0 library/Robo47/Mail/Transport/Exception.php
  63. +168 −0 library/Robo47/Mail/Transport/Log.php
  64. +14 −0 library/Robo47/Mail/Transport/Log/Formatter/Interface.php
  65. +38 −0 library/Robo47/Mail/Transport/Log/Formatter/Serialize.php
  66. +42 −0 library/Robo47/Mail/Transport/Log/Formatter/Simple.php
  67. +58 −0 library/Robo47/Mail/Transport/MockSimple.php
  68. +133 −0 library/Robo47/Mail/Transport/Multi.php
  69. +124 −0 library/Robo47/Mock.php
  70. +97 −0 library/Robo47/Paginator/Adapter/DoctrineQuery.php
  71. +84 −0 library/Robo47/Paginator/Adapter/DoctrineTable.php
  72. +633 −0 library/Robo47/Service/Bitly.php
  73. +34 −0 library/Robo47/Service/Bitly/Exception.php
  74. +34 −0 library/Robo47/Service/Exception.php
  75. +610 −0 library/Robo47/Service/Gravatar.php
  76. +34 −0 library/Robo47/Service/Gravatar/Exception.php
  77. +171 −0 library/Robo47/Validate/Doctrine/Abstract.php
  78. +48 −0 library/Robo47/Validate/Doctrine/NoRecordExists.php
  79. +48 −0 library/Robo47/Validate/Doctrine/RecordExists.php
  80. +33 −0 library/Robo47/Validate/Exception.php
  81. +140 −0 library/Robo47/Validate/MaxLineLength.php
  82. +101 −0 library/Robo47/Validate/Mock.php
  83. +105 −0 library/Robo47/Validate/StringContains.php
  84. +53 −0 library/Robo47/Validate/StringNotContains.php
  85. +78 −0 library/Robo47/Validate/Uri.php
  86. +95 −0 library/Robo47/View/Helper/Anchor.php
  87. +92 −0 library/Robo47/View/Helper/Cdn.php
  88. +316 −0 library/Robo47/View/Helper/Ckeditor.php
  89. +33 −0 library/Robo47/View/Helper/Exception.php
  90. +104 −0 library/Robo47/View/Helper/Globals.php
  91. +105 −0 library/Robo47/View/Helper/Gravatar.php
  92. +88 −0 library/Robo47/View/Helper/Url.php
  93. +1 −0 library/Zend
  94. +1 −0 library/ezc
  95. +22 −0 tests/AllTests.php
  96. +79 −0 tests/Robo47/AllTests.php
  97. +55 −0 tests/Robo47/Application/AllTests.php
  98. +100 −0 tests/Robo47/Application/Resource/AutoloaderMultiTest.php
  99. +99 −0 tests/Robo47/Application/Resource/AutoloaderTest.php
  100. +186 −0 tests/Robo47/Application/Resource/CacheMultiTest.php
  101. +146 −0 tests/Robo47/Application/Resource/CacheTest.php
  102. +98 −0 tests/Robo47/Application/Resource/ConfigTest.php
  103. +76 −0 tests/Robo47/Application/Resource/ErrorHandlerTest.php
  104. +114 −0 tests/Robo47/Application/Resource/HtmlPurifierTest.php
  105. +61 −0 tests/Robo47/Application/Resource/LogTest.php
  106. +124 −0 tests/Robo47/Application/Resource/ObjectMultiTest.php
  107. +309 −0 tests/Robo47/Application/Resource/ObjectTest.php
  108. +69 −0 tests/Robo47/Application/Resource/Plugin/ErrorHandlerTest.php
  109. +136 −0 tests/Robo47/Application/Resource/Service/AkismetTest.php
  110. +104 −0 tests/Robo47/Application/Resource/Service/BitlyTest.php
  111. +73 −0 tests/Robo47/Application/Resource/Service/GravatarTest.php
  112. +84 −0 tests/Robo47/Auth/Adapter/ArrayTest.php
  113. +15 −0 tests/Robo47/Auth/AllTests.php
  114. +19 −0 tests/Robo47/Cache/AllTests.php
  115. +264 −0 tests/Robo47/Cache/Backend/ArrayTest.php
  116. +206 −0 tests/Robo47/Cache/DoctrineAdapterTest.php
  117. +59 −0 tests/Robo47/Controller/Action/Helper/UrlTest.php
  118. +21 −0 tests/Robo47/Controller/AllTests.php
  119. +195 −0 tests/Robo47/Controller/Plugin/TidyTest.php
  120. +98 −0 tests/Robo47/Controller/Plugin/TitleTest.php
  121. +82 −0 tests/Robo47/ConvertTest.php
  122. +40 −0 tests/Robo47/CoreTest.php
  123. +19 −0 tests/Robo47/Curl/AllTests.php
  124. +65 −0 tests/Robo47/Curl/MultiTest.php
  125. +216 −0 tests/Robo47/CurlTest.php
  126. +16 −0 tests/Robo47/ErrorExceptionTest.php
  127. +183 −0 tests/Robo47/ErrorHandlerTest.php
  128. +27 −0 tests/Robo47/ExceptionTest.php
  129. +235 −0 tests/Robo47/ExiftoolTest.php
  130. +25 −0 tests/Robo47/Filter/AllTests.php
  131. +199 −0 tests/Robo47/Filter/HtmlPurifierTest.php
  132. +44 −0 tests/Robo47/Filter/SanitizeUrlTest.php
  133. +284 −0 tests/Robo47/Filter/TidyTest.php
  134. +154 −0 tests/Robo47/Filter/UrlSchemeTest.php
  135. +19 −0 tests/Robo47/Form/AllTests.php
  136. +117 −0 tests/Robo47/Form/Decorator/InfoTest.php
  137. +15 −0 tests/Robo47/Form/Element/CkeditorTest.php
  138. +20 −0 tests/Robo47/Loader/AllTests.php
  139. +46 −0 tests/Robo47/Loader/Autoloader/EzcTest.php
  140. +46 −0 tests/Robo47/Loader/Autoloader/HTMLPurifierTest.php
  141. +31 −0 tests/Robo47/Log/AllTests.php
  142. +120 −0 tests/Robo47/Log/Filter/CategoryTest.php
  143. +64 −0 tests/Robo47/Log/Filter/MockTest.php
  144. +225 −0 tests/Robo47/Log/Filter/ValidateProxyTest.php
  145. +137 −0 tests/Robo47/Log/Writer/AbstractTest.php
  146. +356 −0 tests/Robo47/Log/Writer/DoctrineTableTest.php
  147. +67 −0 tests/Robo47/Log/Writer/MockTest.php
  148. +308 −0 tests/Robo47/LogTest.php
  149. +29 −0 tests/Robo47/Mail/AllTests.php
  150. +36 −0 tests/Robo47/Mail/Transport/Log/Formatter/SerializeTest.php
  151. +37 −0 tests/Robo47/Mail/Transport/Log/Formatter/SimpleTest.php
  152. +155 −0 tests/Robo47/Mail/Transport/LogTest.php
  153. +62 −0 tests/Robo47/Mail/Transport/MockSimpleTest.php
  154. +118 −0 tests/Robo47/Mail/Transport/MultiTest.php
  155. +86 −0 tests/Robo47/MockTest.php
  156. +84 −0 tests/Robo47/Paginator/Adapter/DoctrineQueryTest.php
  157. +111 −0 tests/Robo47/Paginator/Adapter/DoctrineTableTest.php
  158. +40 −0 tests/Robo47/Paginator/Adapter/DoctrineTestCase.php
  159. +20 −0 tests/Robo47/Paginator/AllTests.php
  160. +19 −0 tests/Robo47/Service/AllTests.php
  161. +215 −0 tests/Robo47/Service/Bitly/_files/response_JSON_ERRORS.json
  162. +18 −0 tests/Robo47/Service/Bitly/_files/response_JSON_EXPANDBYHASH.json
  163. +18 −0 tests/Robo47/Service/Bitly/_files/response_JSON_EXPANDBYSHORTURL.json
  164. +45 −0 tests/Robo47/Service/Bitly/_files/response_JSON_INFOBYHASH.json
  165. +19 −0 tests/Robo47/Service/Bitly/_files/response_JSON_INFOBYHASHWITHKEYS.json
  166. +40 −0 tests/Robo47/Service/Bitly/_files/response_JSON_INFOBYSHORTURL.json
  167. +19 −0 tests/Robo47/Service/Bitly/_files/response_JSON_INFOBYSHORTURLWITHKEYS.json
  168. +22 −0 tests/Robo47/Service/Bitly/_files/response_JSON_SHORTEN.json
  169. +74 −0 tests/Robo47/Service/Bitly/_files/response_JSON_STATSBYHASH.json
  170. +74 −0 tests/Robo47/Service/Bitly/_files/response_JSON_STATSBYSHORTURL.json
  171. +9 −0 tests/Robo47/Service/Bitly/_files/response_XML_ERRORS.xml
  172. +9 −0 tests/Robo47/Service/Bitly/_files/response_XML_EXPANDBYHASH.xml
  173. +9 −0 tests/Robo47/Service/Bitly/_files/response_XML_EXPANDBYSHORTURL.xml
  174. +9 −0 tests/Robo47/Service/Bitly/_files/response_XML_INFOBYHASH.xml
  175. +9 −0 tests/Robo47/Service/Bitly/_files/response_XML_INFOBYHASHWITHKEYS.xml
  176. +9 −0 tests/Robo47/Service/Bitly/_files/response_XML_INFOBYSHORTURL.xml
  177. +9 −0 tests/Robo47/Service/Bitly/_files/response_XML_INFOBYSHORTURLWITHKEYS.xml
  178. +9 −0 tests/Robo47/Service/Bitly/_files/response_XML_SHORTEN.xml
  179. +9 −0 tests/Robo47/Service/Bitly/_files/response_XML_STATSBYHASH.xml
  180. +9 −0 tests/Robo47/Service/Bitly/_files/response_XML_STATSBYSHORTURL.xml
  181. +679 −0 tests/Robo47/Service/BitlyTest.php
  182. +585 −0 tests/Robo47/Service/GravatarTest.php
  183. +37 −0 tests/Robo47/Validate/AllTests.php
  184. +182 −0 tests/Robo47/Validate/Doctrine/AbstractTest.php
  185. +93 −0 tests/Robo47/Validate/Doctrine/NoRecordExistsTest.php
  186. +94 −0 tests/Robo47/Validate/Doctrine/RecordExistsTest.php
  187. +142 −0 tests/Robo47/Validate/MaxLineLengthTest.php
  188. +67 −0 tests/Robo47/Validate/MockTest.php
  189. +93 −0 tests/Robo47/Validate/StringContainsTest.php
  190. +48 −0 tests/Robo47/Validate/StringNotContainsTest.php
  191. +44 −0 tests/Robo47/Validate/UriTest.php
  192. +32 −0 tests/Robo47/View/AllTests.php
  193. +101 −0 tests/Robo47/View/Helper/AnchorTest.php
  194. +54 −0 tests/Robo47/View/Helper/CdnTest.php
  195. +459 −0 tests/Robo47/View/Helper/CkeditorTest.php
  196. +123 −0 tests/Robo47/View/Helper/GlobalsTest.php
  197. +135 −0 tests/Robo47/View/Helper/GravatarTest.php
  198. +73 −0 tests/Robo47/View/Helper/UrlTest.php
  199. +54 −0 tests/Robo47/_files/DoctrineTestCase.php
  200. +106 −0 tests/Robo47/_files/classes.php
  201. BIN tests/Robo47/_files/exiftoolTestImage.jpg
  202. +54 −0 tests/Robo47/_files/exiftoolwrapper1.php
  203. +123 −0 tests/TestConfiguration.php
  204. +23 −0 tests/TestHelper.php
  205. +29 −0 tests/phpunit.xml
@@ -0,0 +1,26 @@
+Copyright (c) 2008-2010, Benjamin Steininger (Robo47)
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Benjamin Steininger nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,13 @@
+Robo47 Components is a collection of classes I use in my Zend Framework / Doctrine
+based Applications.
+
+Versions I use and test those Components with:
+
+Zend Framework 1.10.1
+Doctrine 1.2.1
+HTMLPurifier 4.0.0
+ezComponents 2009.1.2
+
+Bugs in Zend Framework which can make problems using Robo47 Components:
+http://framework.zend.com/issues/browse/ZF-8520
+http://framework.zend.com/issues/browse/ZF-9064
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Robo47 Components
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.
+ * It is also available through the world-wide-web at this URL:
+ * http://robo47.net/licenses/new-bsd-license
+ * 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 robo47[at]robo47[dot]net so I can send you a copy immediately.
+ *
+ * @category Robo47
+ * @package Robo47
+ * @copyright Copyright (c) 2007-2010 Benjamin Steininger (http://robo47.net)
+ * @license http://robo47.net/licenses/new-bsd-license New BSD License
+ */
+
+/**
+ * Robo47_Application_Resource_Exception
+ *
+ * @package Robo47
+ * @subpackage Application
+ * @since 0.1
+ * @copyright Copyright (c) 2007-2010 Benjamin Steininger (http://robo47.net)
+ * @license http://robo47.net/licenses/new-bsd-license New BSD License
+ * @author Benjamin Steininger <robo47[at]robo47[dot]net>
+ */
+class Robo47_Application_Exception extends Robo47_Exception
+{
+}
@@ -0,0 +1,89 @@
+<?php
+/**
+ * Robo47 Components
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.
+ * It is also available through the world-wide-web at this URL:
+ * http://robo47.net/licenses/new-bsd-license
+ * 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 robo47[at]robo47[dot]net so I can send you a copy immediately.
+ *
+ * @category Robo47
+ * @package Robo47
+ * @copyright Copyright (c) 2007-2010 Benjamin Steininger (http://robo47.net)
+ * @license http://robo47.net/licenses/new-bsd-license New BSD License
+ */
+
+/**
+ * Robo47_Application_Resource_Autoloader
+ *
+ * Resource for setting up an additional autoloaders (for example for
+ * ezComponents or HTMLPurifier)
+ *
+ * @package Robo47
+ * @subpackage Application
+ * @since 0.1
+ * @copyright Copyright (c) 2007-2010 Benjamin Steininger (http://robo47.net)
+ * @license http://robo47.net/licenses/new-bsd-license New BSD License
+ * @author Benjamin Steininger <robo47[at]robo47[dot]net>
+ */
+class Robo47_Application_Resource_Autoloader
+ extends Zend_Application_Resource_ResourceAbstract
+{
+ /**
+ * @var Zend_Loader_Autoloader_Interface
+ */
+ protected $_autoloader = null;
+
+ public function init()
+ {
+ if (!empty($this->_options)) {
+ $this->_autoloader = $this->_setupAutoloader($this->_options);
+ } else {
+ $message = 'Empty options in resource ' .
+ 'Robo47_Application_Resource_Autoloader.';
+ throw new Robo47_Application_Resource_Exception($message);
+ }
+ }
+
+ /**
+ * Setup Autoloader
+ *
+ * @see Zend_Loader_Autoloader
+ * @param string $name
+ * @param array $config
+ */
+ public function _setupAutoloader($options)
+ {
+ if (!isset($options['classname'])) {
+ $message = 'Autoloader config doesn\'t contain classname';
+ throw new Robo47_Application_Resource_Exception($message);
+ }
+
+ if (!isset($options['prefix'])) {
+ $message = 'Autoloader config doesn\'t contain prefix';
+ throw new Robo47_Application_Resource_Exception($message);
+ }
+
+ $autoLoader = Zend_Loader_Autoloader::getInstance();
+ $classname = $options['classname'];
+ $prefix = $options['prefix'];
+ $autoLoaderInstance = new $classname();
+ $autoLoader->pushAutoloader($autoLoaderInstance, $prefix);
+ return $autoLoaderInstance;
+ }
+
+ /**
+ * Get Autoloader
+ *
+ * @return Zend_Loader_Autoloader_Interface
+ */
+ public function getAutoloader()
+ {
+ return $this->_autoloader;
+ }
+}
@@ -0,0 +1,83 @@
+<?php
+/**
+ * Robo47 Components
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.
+ * It is also available through the world-wide-web at this URL:
+ * http://robo47.net/licenses/new-bsd-license
+ * 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 robo47[at]robo47[dot]net so I can send you a copy immediately.
+ *
+ * @category Robo47
+ * @package Robo47
+ * @copyright Copyright (c) 2007-2010 Benjamin Steininger (http://robo47.net)
+ * @license http://robo47.net/licenses/new-bsd-license New BSD License
+ */
+
+/**
+ * Robo47_Application_Resource_AutoloaderMulti
+ *
+ * Resource for setting up additional autoloaders (for example for ezComponents
+ * or HTMLPurifier)
+ *
+ * @package Robo47
+ * @subpackage Application
+ * @since 0.1
+ * @copyright Copyright (c) 2007-2010 Benjamin Steininger (http://robo47.net)
+ * @license http://robo47.net/licenses/new-bsd-license New BSD License
+ * @author Benjamin Steininger <robo47[at]robo47[dot]net>
+ */
+class Robo47_Application_Resource_AutoloaderMulti
+ extends Zend_Application_Resource_ResourceAbstract
+{
+ /**
+ *
+ * @var array
+ */
+ protected $_autoloaders = null;
+
+ public function init()
+ {
+ if (!empty($this->_options)) {
+ foreach ($this->_options as $name => $opts) {
+ $resource = new Robo47_Application_Resource_Autoloader($opts);
+ $resource->init();
+ $this->_autoloaders[$name] = $resource->getAutoloader();
+ }
+ } else {
+ $message = 'Empty options in resource ' .
+ 'Robo47_Application_Resource_AutoloaderMulti.';
+ throw new Robo47_Application_Resource_Exception($message);
+ }
+ }
+
+ /**
+ * Get Autoloader
+ *
+ * @param string $name
+ * @return Zend_Loader_Autoloader_Interface
+ */
+ public function getAutoloader($name)
+ {
+ if (isset($this->_autoloaders[$name])) {
+ return $this->_autoloaders[$name];
+ } else {
+ $message = 'Autoloader \''.$name.'\' doesn\'t exist';
+ throw new Robo47_Application_Resource_Exception($message);
+ }
+ }
+
+ /**
+ * Get Autoloaders
+ *
+ * @return array
+ */
+ public function getAutoloaders()
+ {
+ return $this->_autoloaders;
+ }
+}
@@ -0,0 +1,116 @@
+<?php
+/**
+ * Robo47 Components
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.
+ * It is also available through the world-wide-web at this URL:
+ * http://robo47.net/licenses/new-bsd-license
+ * 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 robo47[at]robo47[dot]net so I can send you a copy immediately.
+ *
+ * @category Robo47
+ * @package Robo47
+ * @copyright Copyright (c) 2007-2010 Benjamin Steininger (http://robo47.net)
+ * @license http://robo47.net/licenses/new-bsd-license New BSD License
+ */
+
+/**
+ * Robo47_Application_Resource_Cache
+ *
+ * Resource for setting up a Zend_Cache_Core instance
+ *
+ * @package Robo47
+ * @subpackage Application
+ * @since 0.1
+ * @copyright Copyright (c) 2007-2010 Benjamin Steininger (http://robo47.net)
+ * @license http://robo47.net/licenses/new-bsd-license New BSD License
+ * @author Benjamin Steininger <robo47[at]robo47[dot]net>
+ * @deprecated Mostly deprecated because of Zend_Cache_Manager
+ */
+class Robo47_Application_Resource_Cache
+ extends Zend_Application_Resource_ResourceAbstract
+{
+ /**
+ *
+ * @var Zend_Cache
+ */
+ protected $_cache = array();
+
+ public function init()
+ {
+ if (!empty($this->_options)) {
+ $this->_cache = $this->_setupCache($this->_options);
+ } else {
+ $message = 'Empty options in resource ' .
+ 'Robo47_Application_Resource_Cache.';
+ throw new Robo47_Application_Resource_Exception($message);
+ }
+ }
+
+ /**
+ * Setup Cache
+ *
+ * @param array $config
+ */
+ public function _setupCache($config)
+ {
+ if (!isset($config['frontendName'])) {
+ $message = 'Cache config doesn\'t contain frontendName';
+ throw new Robo47_Application_Resource_Exception($message);
+ }
+
+ if (!isset($config['backendName'])) {
+ $message = 'Cache config doesn\'t contain backendName';
+ throw new Robo47_Application_Resource_Exception($message);
+ }
+
+ if (!isset($config['frontendOptions'])) {
+ $config['frontendOptions'] = array();
+ }
+
+ if (!isset($config['backendOptions'])) {
+ $config['backendOptions'] = array();
+ }
+
+ if (!isset($config['customFrontendNaming'])) {
+ $config['customFrontendNaming'] = false;
+ }
+
+ if (!isset($config['customBackendNaming'])) {
+ $config['customBackendNaming'] = false;
+ }
+
+ if (!isset($config['autoload'])) {
+ $config['autoload'] = false;
+ }
+
+ $cache = Zend_Cache::factory(
+ $config['frontendName'],
+ $config['backendName'],
+ $config['frontendOptions'],
+ $config['backendOptions'],
+ $config['customFrontendNaming'],
+ $config['customBackendNaming'],
+ $config['autoload']
+ );
+
+ if (isset($config['registryKey'])) {
+ Zend_Registry::set($config['registryKey'], $cache);
+ }
+ return $cache;
+ }
+
+ /**
+ * Get Cache
+ *
+ * @return Zend_Cache
+ */
+ public function getCache()
+ {
+ return $this->_cache;
+ }
+}
Oops, something went wrong.

0 comments on commit 0c9a6c1

Please sign in to comment.