Lib_ZF - Version 1.12.3.0

Version Notes

1.12.3.0

Download this release

Release Info

Developer Magento Core Team
Extension Lib_ZF
Version 1.12.3.0
Comparing to
See all releases


Code changes from version 1.11.1.0 to 1.12.3.0

Files changed (447) hide show
  1. lib/Zend/Acl.php +15 -10
  2. lib/Zend/Acl/Assert/Interface.php +3 -3
  3. lib/Zend/Acl/Exception.php +3 -3
  4. lib/Zend/Acl/Resource.php +3 -3
  5. lib/Zend/Acl/Resource/Interface.php +3 -3
  6. lib/Zend/Acl/Role.php +4 -4
  7. lib/Zend/Acl/Role/Interface.php +3 -3
  8. lib/Zend/Acl/Role/Registry.php +3 -3
  9. lib/Zend/Acl/Role/Registry/Exception.php +3 -3
  10. lib/Zend/Amf/Adobe/Auth.php +3 -3
  11. lib/Zend/Amf/Adobe/DbInspector.php +3 -3
  12. lib/Zend/Amf/Adobe/Introspector.php +3 -3
  13. lib/Zend/Amf/Auth/Abstract.php +3 -3
  14. lib/Zend/Amf/Constants.php +3 -3
  15. lib/Zend/Amf/Exception.php +3 -3
  16. lib/Zend/Amf/Parse/Amf0/Deserializer.php +3 -3
  17. lib/Zend/Amf/Parse/Amf0/Serializer.php +15 -15
  18. lib/Zend/Amf/Parse/Amf3/Deserializer.php +5 -4
  19. lib/Zend/Amf/Parse/Amf3/Serializer.php +18 -13
  20. lib/Zend/Amf/Parse/Deserializer.php +3 -3
  21. lib/Zend/Amf/Parse/InputStream.php +3 -3
  22. lib/Zend/Amf/Parse/OutputStream.php +3 -3
  23. lib/Zend/Amf/Parse/Resource/MysqlResult.php +3 -3
  24. lib/Zend/Amf/Parse/Resource/MysqliResult.php +3 -3
  25. lib/Zend/Amf/Parse/Resource/Stream.php +3 -3
  26. lib/Zend/Amf/Parse/Serializer.php +11 -3
  27. lib/Zend/Amf/Parse/TypeLoader.php +3 -3
  28. lib/Zend/Amf/Request.php +3 -3
  29. lib/Zend/Amf/Request/Http.php +3 -3
  30. lib/Zend/Amf/Response.php +5 -5
  31. lib/Zend/Amf/Response/Http.php +27 -5
  32. lib/Zend/Amf/Server.php +169 -57
  33. lib/Zend/Amf/Server/Exception.php +3 -3
  34. lib/Zend/Amf/Util/BinaryStream.php +21 -9
  35. lib/Zend/Amf/Value/ByteArray.php +3 -3
  36. lib/Zend/Amf/Value/MessageBody.php +3 -3
  37. lib/Zend/Amf/Value/MessageHeader.php +3 -3
  38. lib/Zend/Amf/Value/Messaging/AbstractMessage.php +3 -3
  39. lib/Zend/Amf/Value/Messaging/AcknowledgeMessage.php +3 -3
  40. lib/Zend/Amf/Value/Messaging/ArrayCollection.php +4 -4
  41. lib/Zend/Amf/Value/Messaging/AsyncMessage.php +3 -3
  42. lib/Zend/Amf/Value/Messaging/CommandMessage.php +3 -3
  43. lib/Zend/Amf/Value/Messaging/ErrorMessage.php +3 -3
  44. lib/Zend/Amf/Value/Messaging/RemotingMessage.php +3 -3
  45. lib/Zend/Amf/Value/TraitsInfo.php +3 -3
  46. lib/Zend/Application.php +9 -5
  47. lib/Zend/Application/Bootstrap/Bootstrap.php +4 -4
  48. lib/Zend/Application/Bootstrap/BootstrapAbstract.php +8 -5
  49. lib/Zend/Application/Bootstrap/Bootstrapper.php +3 -3
  50. lib/Zend/Application/Bootstrap/Exception.php +3 -3
  51. lib/Zend/Application/Bootstrap/ResourceBootstrapper.php +3 -3
  52. lib/Zend/Application/Exception.php +3 -3
  53. lib/Zend/Application/Module/Autoloader.php +3 -3
  54. lib/Zend/Application/Module/Bootstrap.php +5 -5
  55. lib/Zend/Application/Resource/Cachemanager.php +5 -5
  56. lib/Zend/Application/Resource/Db.php +14 -11
  57. lib/Zend/Application/Resource/Dojo.php +3 -3
  58. lib/Zend/Application/Resource/Exception.php +3 -3
  59. lib/Zend/Application/Resource/Frontcontroller.php +22 -6
  60. lib/Zend/Application/Resource/Layout.php +3 -3
  61. lib/Zend/Application/Resource/Locale.php +33 -5
  62. lib/Zend/Application/Resource/Log.php +11 -6
  63. lib/Zend/Application/Resource/Mail.php +16 -15
  64. lib/Zend/Application/Resource/Modules.php +22 -5
  65. lib/Zend/Application/Resource/Multidb.php +5 -5
  66. lib/Zend/Application/Resource/Navigation.php +7 -6
  67. lib/Zend/Application/Resource/Resource.php +3 -3
  68. lib/Zend/Application/Resource/ResourceAbstract.php +3 -3
  69. lib/Zend/Application/Resource/Router.php +3 -3
  70. lib/Zend/Application/Resource/Session.php +4 -4
  71. lib/Zend/Application/Resource/Translate.php +3 -3
  72. lib/Zend/Application/Resource/Useragent.php +72 -72
  73. lib/Zend/Application/Resource/View.php +7 -5
  74. lib/Zend/Auth.php +3 -3
  75. lib/Zend/Auth/Adapter/DbTable.php +15 -15
  76. lib/Zend/Auth/Adapter/Digest.php +4 -4
  77. lib/Zend/Auth/Adapter/Exception.php +3 -3
  78. lib/Zend/Auth/Adapter/Http.php +4 -4
  79. lib/Zend/Auth/Adapter/Http/Resolver/Exception.php +3 -3
  80. lib/Zend/Auth/Adapter/Http/Resolver/File.php +3 -3
  81. lib/Zend/Auth/Adapter/Http/Resolver/Interface.php +3 -3
  82. lib/Zend/Auth/Adapter/InfoCard.php +3 -3
  83. lib/Zend/Auth/Adapter/Interface.php +3 -3
  84. lib/Zend/Auth/Adapter/Ldap.php +13 -7
  85. lib/Zend/Auth/Adapter/OpenId.php +3 -3
  86. lib/Zend/Auth/Exception.php +3 -3
  87. lib/Zend/Auth/Result.php +3 -3
  88. lib/Zend/Auth/Storage/Exception.php +3 -3
  89. lib/Zend/Auth/Storage/Interface.php +3 -3
  90. lib/Zend/Auth/Storage/NonPersistent.php +3 -3
  91. lib/Zend/Auth/Storage/Session.php +3 -3
  92. lib/Zend/Barcode.php +13 -13
  93. lib/Zend/Barcode/Exception.php +3 -3
  94. lib/Zend/Barcode/Object/Code128.php +39 -39
  95. lib/Zend/Barcode/Object/Code25.php +5 -5
  96. lib/Zend/Barcode/Object/Code25interleaved.php +3 -3
  97. lib/Zend/Barcode/Object/Code39.php +4 -4
  98. lib/Zend/Barcode/Object/Ean13.php +3 -3
  99. lib/Zend/Barcode/Object/Ean2.php +3 -3
  100. lib/Zend/Barcode/Object/Ean5.php +3 -3
  101. lib/Zend/Barcode/Object/Ean8.php +3 -3
  102. lib/Zend/Barcode/Object/Error.php +3 -3
  103. lib/Zend/Barcode/Object/Exception.php +3 -3
  104. lib/Zend/Barcode/Object/Identcode.php +3 -3
  105. lib/Zend/Barcode/Object/Itf14.php +3 -3
  106. lib/Zend/Barcode/Object/Leitcode.php +3 -3
  107. lib/Zend/Barcode/Object/ObjectAbstract.php +3 -3
  108. lib/Zend/Barcode/Object/Planet.php +3 -3
  109. lib/Zend/Barcode/Object/Postnet.php +3 -3
  110. lib/Zend/Barcode/Object/Royalmail.php +3 -3
  111. lib/Zend/Barcode/Object/Upca.php +3 -3
  112. lib/Zend/Barcode/Object/Upce.php +3 -3
  113. lib/Zend/Barcode/Renderer/Exception.php +3 -3
  114. lib/Zend/Barcode/Renderer/Image.php +3 -3
  115. lib/Zend/Barcode/Renderer/Pdf.php +3 -3
  116. lib/Zend/Barcode/Renderer/RendererAbstract.php +3 -3
  117. lib/Zend/Barcode/Renderer/Svg.php +2 -2
  118. lib/Zend/Cache.php +8 -8
  119. lib/Zend/Cache/Backend.php +29 -5
  120. lib/Zend/Cache/Backend/Apc.php +3 -3
  121. lib/Zend/Cache/Backend/BlackHole.php +5 -5
  122. lib/Zend/Cache/Backend/ExtendedInterface.php +3 -3
  123. lib/Zend/Cache/Backend/File.php +51 -26
  124. lib/Zend/Cache/Backend/Interface.php +3 -3
  125. lib/Zend/Cache/Backend/Libmemcached.php +3 -3
  126. lib/Zend/Cache/Backend/Memcached.php +3 -3
  127. lib/Zend/Cache/Backend/Sqlite.php +3 -4
  128. lib/Zend/Cache/Backend/Static.php +26 -25
  129. lib/Zend/Cache/Backend/Test.php +5 -5
  130. lib/Zend/Cache/Backend/TwoLevels.php +11 -11
  131. lib/Zend/Cache/Backend/WinCache.php +349 -0
  132. lib/Zend/Cache/Backend/Xcache.php +3 -3
  133. lib/Zend/Cache/Backend/ZendPlatform.php +3 -3
  134. lib/Zend/Cache/Backend/ZendServer.php +3 -3
  135. lib/Zend/Cache/Backend/ZendServer/Disk.php +3 -3
  136. lib/Zend/Cache/Backend/ZendServer/ShMem.php +3 -3
  137. lib/Zend/Cache/Core.php +41 -33
  138. lib/Zend/Cache/Exception.php +3 -3
  139. lib/Zend/Cache/Frontend/Capture.php +4 -4
  140. lib/Zend/Cache/Frontend/Class.php +11 -5
  141. lib/Zend/Cache/Frontend/File.php +9 -5
  142. lib/Zend/Cache/Frontend/Function.php +4 -5
  143. lib/Zend/Cache/Frontend/Output.php +5 -6
  144. lib/Zend/Cache/Frontend/Page.php +8 -6
  145. lib/Zend/Cache/Manager.php +3 -3
  146. lib/Zend/Captcha/Adapter.php +3 -3
  147. lib/Zend/Captcha/Base.php +3 -3
  148. lib/Zend/Captcha/Dumb.php +27 -4
  149. lib/Zend/Captcha/Exception.php +3 -3
  150. lib/Zend/Captcha/Figlet.php +3 -3
  151. lib/Zend/Captcha/Image.php +9 -5
  152. lib/Zend/Captcha/ReCaptcha.php +18 -4
  153. lib/Zend/Captcha/Word.php +25 -25
  154. lib/Zend/Cloud/AbstractFactory.php +8 -8
  155. lib/Zend/Cloud/DocumentService/Adapter.php +15 -15
  156. lib/Zend/Cloud/DocumentService/Adapter/AbstractAdapter.php +13 -13
  157. lib/Zend/Cloud/DocumentService/Adapter/SimpleDb.php +468 -468
  158. lib/Zend/Cloud/DocumentService/Adapter/SimpleDb/Query.php +10 -10
  159. lib/Zend/Cloud/DocumentService/Adapter/WindowsAzure.php +56 -56
  160. lib/Zend/Cloud/DocumentService/Adapter/WindowsAzure/Query.php +171 -171
  161. lib/Zend/Cloud/DocumentService/Document.php +248 -248
  162. lib/Zend/Cloud/DocumentService/DocumentSet.php +4 -4
  163. lib/Zend/Cloud/DocumentService/Exception.php +38 -38
  164. lib/Zend/Cloud/DocumentService/Factory.php +8 -8
  165. lib/Zend/Cloud/DocumentService/Query.php +191 -191
  166. lib/Zend/Cloud/DocumentService/QueryAdapter.php +102 -102
  167. lib/Zend/Cloud/Exception.php +53 -53
  168. lib/Zend/Cloud/Infrastructure/Adapter.php +167 -0
  169. lib/Zend/Cloud/Infrastructure/Adapter/AbstractAdapter.php +175 -0
  170. lib/Zend/Cloud/Infrastructure/Adapter/Ec2.php +496 -0
  171. lib/Zend/Cloud/Infrastructure/Adapter/Rackspace.php +483 -0
  172. lib/Zend/Cloud/Infrastructure/Exception.php +25 -0
  173. lib/Zend/Cloud/Infrastructure/Factory.php +65 -0
  174. lib/Zend/Cloud/Infrastructure/Image.php +176 -0
  175. lib/Zend/Cloud/Infrastructure/ImageList.php +218 -0
  176. lib/Zend/Cloud/Infrastructure/Instance.php +320 -0
  177. lib/Zend/Cloud/Infrastructure/InstanceList.php +219 -0
  178. lib/Zend/Cloud/OperationNotAvailableException.php +34 -34
  179. lib/Zend/Cloud/QueueService/Adapter.php +18 -18
  180. lib/Zend/Cloud/QueueService/Adapter/AbstractAdapter.php +8 -8
  181. lib/Zend/Cloud/QueueService/Adapter/Sqs.php +19 -19
  182. lib/Zend/Cloud/QueueService/Adapter/WindowsAzure.php +26 -26
  183. lib/Zend/Cloud/QueueService/Adapter/ZendQueue.php +29 -29
  184. lib/Zend/Cloud/QueueService/Exception.php +37 -37
  185. lib/Zend/Cloud/QueueService/Factory.php +7 -7
  186. lib/Zend/Cloud/QueueService/Message.php +60 -60
  187. lib/Zend/Cloud/QueueService/MessageSet.php +6 -6
  188. lib/Zend/Cloud/StorageService/Adapter.php +16 -16
  189. lib/Zend/Cloud/StorageService/Adapter/FileSystem.php +267 -267
  190. lib/Zend/Cloud/StorageService/Adapter/Nirvanix.php +399 -399
  191. lib/Zend/Cloud/StorageService/Adapter/Rackspace.php +332 -0
  192. lib/Zend/Cloud/StorageService/Adapter/S3.php +332 -327
  193. lib/Zend/Cloud/StorageService/Adapter/WindowsAzure.php +443 -443
  194. lib/Zend/Cloud/StorageService/Exception.php +38 -38
  195. lib/Zend/Cloud/StorageService/Factory.php +9 -9
  196. lib/Zend/CodeGenerator/Abstract.php +3 -3
  197. lib/Zend/CodeGenerator/Exception.php +3 -3
  198. lib/Zend/CodeGenerator/Php/Abstract.php +3 -3
  199. lib/Zend/CodeGenerator/Php/Body.php +3 -3
  200. lib/Zend/CodeGenerator/Php/Class.php +109 -4
  201. lib/Zend/CodeGenerator/Php/Docblock.php +8 -4
  202. lib/Zend/CodeGenerator/Php/Docblock/Tag.php +10 -16
  203. lib/Zend/CodeGenerator/Php/Docblock/Tag/License.php +3 -3
  204. lib/Zend/CodeGenerator/Php/Docblock/Tag/Param.php +4 -4
  205. lib/Zend/CodeGenerator/Php/Docblock/Tag/Return.php +3 -3
  206. lib/Zend/CodeGenerator/Php/Exception.php +3 -3
  207. lib/Zend/CodeGenerator/Php/File.php +9 -6
  208. lib/Zend/CodeGenerator/Php/Member/Abstract.php +3 -3
  209. lib/Zend/CodeGenerator/Php/Member/Container.php +3 -3
  210. lib/Zend/CodeGenerator/Php/Method.php +6 -4
  211. lib/Zend/CodeGenerator/Php/Parameter.php +3 -3
  212. lib/Zend/CodeGenerator/Php/Parameter/DefaultValue.php +3 -3
  213. lib/Zend/CodeGenerator/Php/Property.php +3 -3
  214. lib/Zend/CodeGenerator/Php/Property/DefaultValue.php +3 -3
  215. lib/Zend/Config.php +3 -3
  216. lib/Zend/Config/Exception.php +3 -3
  217. lib/Zend/Config/Ini.php +11 -10
  218. lib/Zend/Config/Json.php +4 -2
  219. lib/Zend/Config/Writer.php +3 -3
  220. lib/Zend/Config/Writer/Array.php +3 -3
  221. lib/Zend/Config/Writer/FileAbstract.php +3 -3
  222. lib/Zend/Config/Writer/Ini.php +8 -8
  223. lib/Zend/Config/Writer/Json.php +1 -1
  224. lib/Zend/Config/Writer/Xml.php +3 -3
  225. lib/Zend/Config/Writer/Yaml.php +2 -2
  226. lib/Zend/Config/Xml.php +16 -6
  227. lib/Zend/Config/Yaml.php +60 -27
  228. lib/Zend/Console/Getopt.php +3 -3
  229. lib/Zend/Console/Getopt/Exception.php +3 -3
  230. lib/Zend/Controller/Action.php +121 -11
  231. lib/Zend/Controller/Action/Exception.php +3 -3
  232. lib/Zend/Controller/Action/Helper/Abstract.php +11 -9
  233. lib/Zend/Controller/Action/Helper/ActionStack.php +3 -3
  234. lib/Zend/Controller/Action/Helper/AjaxContext.php +7 -4
  235. lib/Zend/Controller/Action/Helper/AutoComplete/Abstract.php +3 -3
  236. lib/Zend/Controller/Action/Helper/AutoCompleteDojo.php +3 -3
  237. lib/Zend/Controller/Action/Helper/AutoCompleteScriptaculous.php +3 -3
  238. lib/Zend/Controller/Action/Helper/Cache.php +17 -7
  239. lib/Zend/Controller/Action/Helper/ContextSwitch.php +4 -4
  240. lib/Zend/Controller/Action/Helper/FlashMessenger.php +76 -29
  241. lib/Zend/Controller/Action/Helper/Json.php +15 -12
  242. lib/Zend/Controller/Action/Helper/Redirector.php +9 -9
  243. lib/Zend/Controller/Action/Helper/Url.php +3 -3
  244. lib/Zend/Controller/Action/Helper/ViewRenderer.php +6 -3
  245. lib/Zend/Controller/Action/HelperBroker.php +3 -3
  246. lib/Zend/Controller/Action/HelperBroker/PriorityStack.php +3 -3
  247. lib/Zend/Controller/Action/Interface.php +3 -3
  248. lib/Zend/Controller/Dispatcher/Abstract.php +3 -3
  249. lib/Zend/Controller/Dispatcher/Exception.php +3 -3
  250. lib/Zend/Controller/Dispatcher/Interface.php +3 -3
  251. lib/Zend/Controller/Dispatcher/Standard.php +18 -5
  252. lib/Zend/Controller/Exception.php +3 -3
  253. lib/Zend/Controller/Front.php +3 -3
  254. lib/Zend/Controller/Plugin/Abstract.php +3 -3
  255. lib/Zend/Controller/Plugin/ActionStack.php +3 -3
  256. lib/Zend/Controller/Plugin/Broker.php +11 -9
  257. lib/Zend/Controller/Plugin/ErrorHandler.php +16 -5
  258. lib/Zend/Controller/Plugin/PutHandler.php +3 -3
  259. lib/Zend/Controller/Request/Abstract.php +4 -4
  260. lib/Zend/Controller/Request/Apache404.php +4 -4
  261. lib/Zend/Controller/Request/Exception.php +3 -3
  262. lib/Zend/Controller/Request/Http.php +27 -21
  263. lib/Zend/Controller/Request/HttpTestCase.php +2 -2
  264. lib/Zend/Controller/Request/Simple.php +3 -3
  265. lib/Zend/Controller/Response/Abstract.php +6 -4
  266. lib/Zend/Controller/Response/Cli.php +3 -3
  267. lib/Zend/Controller/Response/Exception.php +3 -3
  268. lib/Zend/Controller/Response/Http.php +2 -2
  269. lib/Zend/Controller/Response/HttpTestCase.php +2 -2
  270. lib/Zend/Controller/Router/Abstract.php +8 -3
  271. lib/Zend/Controller/Router/Exception.php +3 -3
  272. lib/Zend/Controller/Router/Interface.php +3 -3
  273. lib/Zend/Controller/Router/Rewrite.php +11 -6
  274. lib/Zend/Controller/Router/Route.php +8 -5
  275. lib/Zend/Controller/Router/Route/Abstract.php +8 -3
  276. lib/Zend/Controller/Router/Route/Chain.php +57 -14
  277. lib/Zend/Controller/Router/Route/Hostname.php +3 -4
  278. lib/Zend/Controller/Router/Route/Interface.php +3 -3
  279. lib/Zend/Controller/Router/Route/Module.php +10 -15
  280. lib/Zend/Controller/Router/Route/Regex.php +4 -4
  281. lib/Zend/Controller/Router/Route/Static.php +5 -5
  282. lib/Zend/Crypt.php +3 -3
  283. lib/Zend/Crypt/DiffieHellman.php +3 -3
  284. lib/Zend/Crypt/DiffieHellman/Exception.php +3 -3
  285. lib/Zend/Crypt/Exception.php +3 -3
  286. lib/Zend/Crypt/Hmac.php +3 -3
  287. lib/Zend/Crypt/Hmac/Exception.php +3 -3
  288. lib/Zend/Crypt/Math.php +3 -3
  289. lib/Zend/Crypt/Math/BigInteger.php +3 -3
  290. lib/Zend/Crypt/Math/BigInteger/Bcmath.php +3 -3
  291. lib/Zend/Crypt/Math/BigInteger/Exception.php +3 -3
  292. lib/Zend/Crypt/Math/BigInteger/Gmp.php +3 -3
  293. lib/Zend/Crypt/Math/BigInteger/Interface.php +3 -3
  294. lib/Zend/Crypt/Math/Exception.php +3 -3
  295. lib/Zend/Crypt/Rsa.php +18 -4
  296. lib/Zend/Crypt/Rsa/Exception.php +2 -2
  297. lib/Zend/Crypt/Rsa/Key.php +3 -3
  298. lib/Zend/Crypt/Rsa/Key/Private.php +3 -3
  299. lib/Zend/Crypt/Rsa/Key/Public.php +3 -3
  300. lib/Zend/Currency.php +16 -8
  301. lib/Zend/Currency/CurrencyInterface.php +3 -3
  302. lib/Zend/Currency/Exception.php +3 -3
  303. lib/Zend/Date.php +25 -24
  304. lib/Zend/Date/Cities.php +3 -3
  305. lib/Zend/Date/DateObject.php +10 -3
  306. lib/Zend/Date/Exception.php +3 -3
  307. lib/Zend/Db.php +16 -3
  308. lib/Zend/Db/Adapter/Abstract.php +7 -4
  309. lib/Zend/Db/Adapter/Db2.php +4 -4
  310. lib/Zend/Db/Adapter/Db2/Exception.php +4 -4
  311. lib/Zend/Db/Adapter/Exception.php +3 -3
  312. lib/Zend/Db/Adapter/Mysqli.php +11 -4
  313. lib/Zend/Db/Adapter/Mysqli/Exception.php +3 -3
  314. lib/Zend/Db/Adapter/Oracle.php +6 -5
  315. lib/Zend/Db/Adapter/Oracle/Exception.php +3 -3
  316. lib/Zend/Db/Adapter/Pdo/Abstract.php +3 -3
  317. lib/Zend/Db/Adapter/Pdo/Ibm.php +3 -3
  318. lib/Zend/Db/Adapter/Pdo/Ibm/Db2.php +3 -3
  319. lib/Zend/Db/Adapter/Pdo/Ibm/Ids.php +3 -3
  320. lib/Zend/Db/Adapter/Pdo/Mssql.php +3 -3
  321. lib/Zend/Db/Adapter/Pdo/Mysql.php +16 -3
  322. lib/Zend/Db/Adapter/Pdo/Oci.php +3 -3
  323. lib/Zend/Db/Adapter/Pdo/Pgsql.php +3 -3
  324. lib/Zend/Db/Adapter/Pdo/Sqlite.php +3 -3
  325. lib/Zend/Db/Adapter/Sqlsrv.php +16 -11
  326. lib/Zend/Db/Adapter/Sqlsrv/Exception.php +3 -3
  327. lib/Zend/Db/Exception.php +3 -3
  328. lib/Zend/Db/Expr.php +3 -3
  329. lib/Zend/Db/Profiler.php +8 -6
  330. lib/Zend/Db/Profiler/Exception.php +3 -3
  331. lib/Zend/Db/Profiler/Firebug.php +3 -3
  332. lib/Zend/Db/Profiler/Query.php +3 -3
  333. lib/Zend/Db/Select.php +16 -11
  334. lib/Zend/Db/Select/Exception.php +3 -3
  335. lib/Zend/Db/Statement.php +25 -22
  336. lib/Zend/Db/Statement/Db2.php +4 -4
  337. lib/Zend/Db/Statement/Db2/Exception.php +3 -3
  338. lib/Zend/Db/Statement/Exception.php +3 -3
  339. lib/Zend/Db/Statement/Interface.php +3 -3
  340. lib/Zend/Db/Statement/Mysqli.php +3 -3
  341. lib/Zend/Db/Statement/Mysqli/Exception.php +3 -3
  342. lib/Zend/Db/Statement/Oracle.php +5 -5
  343. lib/Zend/Db/Statement/Oracle/Exception.php +3 -3
  344. lib/Zend/Db/Statement/Pdo.php +3 -3
  345. lib/Zend/Db/Statement/Pdo/Ibm.php +3 -3
  346. lib/Zend/Db/Statement/Pdo/Oci.php +3 -3
  347. lib/Zend/Db/Statement/Sqlsrv.php +9 -9
  348. lib/Zend/Db/Statement/Sqlsrv/Exception.php +3 -3
  349. lib/Zend/Db/Table.php +3 -3
  350. lib/Zend/Db/Table/Abstract.php +133 -29
  351. lib/Zend/Db/Table/Definition.php +3 -3
  352. lib/Zend/Db/Table/Exception.php +3 -3
  353. lib/Zend/Db/Table/Row.php +3 -3
  354. lib/Zend/Db/Table/Row/Abstract.php +16 -35
  355. lib/Zend/Db/Table/Row/Exception.php +3 -3
  356. lib/Zend/Db/Table/Rowset.php +3 -3
  357. lib/Zend/Db/Table/Rowset/Abstract.php +7 -7
  358. lib/Zend/Db/Table/Rowset/Exception.php +3 -3
  359. lib/Zend/Db/Table/Select.php +3 -3
  360. lib/Zend/Db/Table/Select/Exception.php +3 -3
  361. lib/Zend/Debug.php +9 -4
  362. lib/Zend/Dojo.php +3 -3
  363. lib/Zend/Dojo/BuildLayer.php +3 -3
  364. lib/Zend/Dojo/Data.php +3 -3
  365. lib/Zend/Dojo/Exception.php +3 -3
  366. lib/Zend/Dojo/Form.php +3 -3
  367. lib/Zend/Dojo/Form/Decorator/AccordionContainer.php +3 -3
  368. lib/Zend/Dojo/Form/Decorator/AccordionPane.php +3 -3
  369. lib/Zend/Dojo/Form/Decorator/BorderContainer.php +3 -3
  370. lib/Zend/Dojo/Form/Decorator/ContentPane.php +3 -3
  371. lib/Zend/Dojo/Form/Decorator/DijitContainer.php +3 -3
  372. lib/Zend/Dojo/Form/Decorator/DijitElement.php +3 -3
  373. lib/Zend/Dojo/Form/Decorator/DijitForm.php +8 -3
  374. lib/Zend/Dojo/Form/Decorator/SplitContainer.php +3 -3
  375. lib/Zend/Dojo/Form/Decorator/StackContainer.php +3 -3
  376. lib/Zend/Dojo/Form/Decorator/TabContainer.php +3 -3
  377. lib/Zend/Dojo/Form/DisplayGroup.php +3 -3
  378. lib/Zend/Dojo/Form/Element/Button.php +3 -3
  379. lib/Zend/Dojo/Form/Element/CheckBox.php +3 -3
  380. lib/Zend/Dojo/Form/Element/ComboBox.php +3 -3
  381. lib/Zend/Dojo/Form/Element/CurrencyTextBox.php +3 -3
  382. lib/Zend/Dojo/Form/Element/DateTextBox.php +3 -3
  383. lib/Zend/Dojo/Form/Element/Dijit.php +3 -3
  384. lib/Zend/Dojo/Form/Element/DijitMulti.php +3 -3
  385. lib/Zend/Dojo/Form/Element/Editor.php +104 -6
  386. lib/Zend/Dojo/Form/Element/FilteringSelect.php +3 -3
  387. lib/Zend/Dojo/Form/Element/HorizontalSlider.php +3 -3
  388. lib/Zend/Dojo/Form/Element/NumberSpinner.php +7 -7
  389. lib/Zend/Dojo/Form/Element/NumberTextBox.php +3 -3
  390. lib/Zend/Dojo/Form/Element/PasswordTextBox.php +3 -3
  391. lib/Zend/Dojo/Form/Element/RadioButton.php +3 -3
  392. lib/Zend/Dojo/Form/Element/SimpleTextarea.php +3 -3
  393. lib/Zend/Dojo/Form/Element/Slider.php +3 -3
  394. lib/Zend/Dojo/Form/Element/SubmitButton.php +3 -3
  395. lib/Zend/Dojo/Form/Element/TextBox.php +3 -3
  396. lib/Zend/Dojo/Form/Element/Textarea.php +3 -3
  397. lib/Zend/Dojo/Form/Element/TimeTextBox.php +3 -3
  398. lib/Zend/Dojo/Form/Element/ValidationTextBox.php +5 -3
  399. lib/Zend/Dojo/Form/Element/VerticalSlider.php +3 -3
  400. lib/Zend/Dojo/Form/SubForm.php +3 -3
  401. lib/Zend/Dojo/View/Exception.php +3 -3
  402. lib/Zend/Dojo/View/Helper/AccordionContainer.php +3 -3
  403. lib/Zend/Dojo/View/Helper/AccordionPane.php +3 -3
  404. lib/Zend/Dojo/View/Helper/BorderContainer.php +3 -3
  405. lib/Zend/Dojo/View/Helper/Button.php +3 -3
  406. lib/Zend/Dojo/View/Helper/CheckBox.php +3 -3
  407. lib/Zend/Dojo/View/Helper/ComboBox.php +7 -3
  408. lib/Zend/Dojo/View/Helper/ContentPane.php +3 -3
  409. lib/Zend/Dojo/View/Helper/CurrencyTextBox.php +3 -3
  410. lib/Zend/Dojo/View/Helper/CustomDijit.php +3 -3
  411. lib/Zend/Dojo/View/Helper/DateTextBox.php +3 -3
  412. lib/Zend/Dojo/View/Helper/Dijit.php +3 -3
  413. lib/Zend/Dojo/View/Helper/DijitContainer.php +3 -3
  414. lib/Zend/Dojo/View/Helper/Dojo.php +3 -3
  415. lib/Zend/Dojo/View/Helper/Dojo/Container.php +10 -10
  416. lib/Zend/Dojo/View/Helper/Editor.php +23 -11
  417. lib/Zend/Dojo/View/Helper/FilteringSelect.php +3 -3
  418. lib/Zend/Dojo/View/Helper/Form.php +3 -7
  419. lib/Zend/Dojo/View/Helper/HorizontalSlider.php +3 -3
  420. lib/Zend/Dojo/View/Helper/NumberSpinner.php +3 -3
  421. lib/Zend/Dojo/View/Helper/NumberTextBox.php +3 -3
  422. lib/Zend/Dojo/View/Helper/PasswordTextBox.php +3 -3
  423. lib/Zend/Dojo/View/Helper/RadioButton.php +3 -3
  424. lib/Zend/Dojo/View/Helper/SimpleTextarea.php +4 -5
  425. lib/Zend/Dojo/View/Helper/Slider.php +4 -4
  426. lib/Zend/Dojo/View/Helper/SplitContainer.php +3 -3
  427. lib/Zend/Dojo/View/Helper/StackContainer.php +3 -3
  428. lib/Zend/Dojo/View/Helper/SubmitButton.php +3 -3
  429. lib/Zend/Dojo/View/Helper/TabContainer.php +3 -3
  430. lib/Zend/Dojo/View/Helper/TextBox.php +3 -3
  431. lib/Zend/Dojo/View/Helper/Textarea.php +3 -4
  432. lib/Zend/Dojo/View/Helper/TimeTextBox.php +3 -3
  433. lib/Zend/Dojo/View/Helper/ValidationTextBox.php +3 -3
  434. lib/Zend/Dojo/View/Helper/VerticalSlider.php +3 -3
  435. lib/Zend/Dom/Exception.php +3 -3
  436. lib/Zend/Dom/Query.php +21 -7
  437. lib/Zend/Dom/Query/Css2Xpath.php +13 -13
  438. lib/Zend/Dom/Query/Result.php +3 -3
  439. lib/Zend/EventManager/Event.php +225 -0
  440. lib/Zend/EventManager/EventCollection.php +109 -0
  441. lib/Zend/EventManager/EventDescription.php +108 -0
  442. lib/Zend/EventManager/EventManager.php +551 -0
  443. lib/Zend/EventManager/EventManagerAware.php +40 -0
  444. lib/Zend/EventManager/Exception.php +31 -0
  445. lib/Zend/EventManager/Exception/InvalidArgumentException.php +42 -0
  446. lib/Zend/EventManager/Filter.php +78 -0
  447. lib/Zend/EventManager/Filter/FilterIterator.php +92 -0
lib/Zend/Acl.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Acl
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Acl.php 23358 2010-11-18 16:19:31Z ralph $
20
  */
21
 
22
 
@@ -53,7 +53,7 @@
53
  /**
54
  * @category Zend
55
  * @package Zend_Acl
56
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
57
  * @license http://framework.zend.com/license/new-bsd New BSD License
58
  */
59
  class Zend_Acl
@@ -140,7 +140,7 @@ class Zend_Acl
140
  * will have the least priority, and the last parent added will have the
141
  * highest priority.
142
  *
143
- * @param Zend_Acl_Role_Interface $role
144
  * @param Zend_Acl_Role_Interface|string|array $parents
145
  * @uses Zend_Acl_Role_Registry::add()
146
  * @return Zend_Acl Provides a fluent interface
@@ -655,7 +655,7 @@ class Zend_Acl
655
  }
656
  unset($rTarget);
657
  }
658
-
659
  // normalize privileges to array
660
  if (null === $privileges) {
661
  $privileges = array();
@@ -726,7 +726,7 @@ class Zend_Acl
726
  }
727
  continue;
728
  }
729
-
730
  if (isset($rules['allPrivileges']['type']) &&
731
  $type === $rules['allPrivileges']['type'])
732
  {
@@ -750,7 +750,7 @@ class Zend_Acl
750
  * since null (all resources) was passed to this setRule() call, we need
751
  * clean up all the rules for the global allResources, as well as the indivually
752
  * set resources (per privilege as well)
753
- */
754
  foreach (array_merge(array(null), $allResources) as $resource) {
755
  $rules =& $this->_getRules($resource, $role, true);
756
  if (null === $rules) {
@@ -769,7 +769,7 @@ class Zend_Acl
769
  }
770
  continue;
771
  }
772
-
773
  if (isset($rules['allPrivileges']['type']) && $type === $rules['allPrivileges']['type']) {
774
  unset($rules['allPrivileges']);
775
  }
@@ -1218,6 +1218,11 @@ class Zend_Acl
1218
  }
1219
 
1220
  /**
 
 
 
 
 
1221
  * @return array of registered roles
1222
  */
1223
  public function getRoles()
@@ -1232,6 +1237,6 @@ class Zend_Acl
1232
  {
1233
  return array_keys($this->_resources);
1234
  }
1235
-
1236
  }
1237
-
14
  *
15
  * @category Zend
16
  * @package Zend_Acl
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Acl.php 24771 2012-05-07 01:13:06Z adamlundrigan $
20
  */
21
 
22
 
53
  /**
54
  * @category Zend
55
  * @package Zend_Acl
56
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
57
  * @license http://framework.zend.com/license/new-bsd New BSD License
58
  */
59
  class Zend_Acl
140
  * will have the least priority, and the last parent added will have the
141
  * highest priority.
142
  *
143
+ * @param Zend_Acl_Role_Interface|string $role
144
  * @param Zend_Acl_Role_Interface|string|array $parents
145
  * @uses Zend_Acl_Role_Registry::add()
146
  * @return Zend_Acl Provides a fluent interface
655
  }
656
  unset($rTarget);
657
  }
658
+
659
  // normalize privileges to array
660
  if (null === $privileges) {
661
  $privileges = array();
726
  }
727
  continue;
728
  }
729
+
730
  if (isset($rules['allPrivileges']['type']) &&
731
  $type === $rules['allPrivileges']['type'])
732
  {
750
  * since null (all resources) was passed to this setRule() call, we need
751
  * clean up all the rules for the global allResources, as well as the indivually
752
  * set resources (per privilege as well)
753
+ */
754
  foreach (array_merge(array(null), $allResources) as $resource) {
755
  $rules =& $this->_getRules($resource, $role, true);
756
  if (null === $rules) {
769
  }
770
  continue;
771
  }
772
+
773
  if (isset($rules['allPrivileges']['type']) && $type === $rules['allPrivileges']['type']) {
774
  unset($rules['allPrivileges']);
775
  }
1218
  }
1219
 
1220
  /**
1221
+ * Returns an array of registered roles.
1222
+ *
1223
+ * Note that this method does not return instances of registered roles,
1224
+ * but only the role identifiers.
1225
+ *
1226
  * @return array of registered roles
1227
  */
1228
  public function getRoles()
1237
  {
1238
  return array_keys($this->_resources);
1239
  }
1240
+
1241
  }
1242
+
lib/Zend/Acl/Assert/Interface.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Acl
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
 
@@ -41,7 +41,7 @@
41
  /**
42
  * @category Zend
43
  * @package Zend_Acl
44
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
45
  * @license http://framework.zend.com/license/new-bsd New BSD License
46
  */
47
  interface Zend_Acl_Assert_Interface
14
  *
15
  * @category Zend
16
  * @package Zend_Acl
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
 
41
  /**
42
  * @category Zend
43
  * @package Zend_Acl
44
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
45
  * @license http://framework.zend.com/license/new-bsd New BSD License
46
  */
47
  interface Zend_Acl_Assert_Interface
lib/Zend/Acl/Exception.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Acl
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
 
@@ -29,7 +29,7 @@
29
  /**
30
  * @category Zend
31
  * @package Zend_Acl
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Acl_Exception extends Zend_Exception
14
  *
15
  * @category Zend
16
  * @package Zend_Acl
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
 
29
  /**
30
  * @category Zend
31
  * @package Zend_Acl
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Acl_Exception extends Zend_Exception
lib/Zend/Acl/Resource.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Acl
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Resource.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
 
@@ -29,7 +29,7 @@
29
  /**
30
  * @category Zend
31
  * @package Zend_Acl
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Acl_Resource implements Zend_Acl_Resource_Interface
14
  *
15
  * @category Zend
16
  * @package Zend_Acl
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Resource.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
 
29
  /**
30
  * @category Zend
31
  * @package Zend_Acl
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Acl_Resource implements Zend_Acl_Resource_Interface
lib/Zend/Acl/Resource/Interface.php CHANGED
@@ -14,16 +14,16 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Acl
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_Acl
26
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  interface Zend_Acl_Resource_Interface
14
  *
15
  * @category Zend
16
  * @package Zend_Acl
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_Acl
26
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  interface Zend_Acl_Resource_Interface
lib/Zend/Acl/Role.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Acl
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Role.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
 
@@ -29,7 +29,7 @@
29
  /**
30
  * @category Zend
31
  * @package Zend_Acl
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Acl_Role implements Zend_Acl_Role_Interface
@@ -44,7 +44,7 @@ class Zend_Acl_Role implements Zend_Acl_Role_Interface
44
  /**
45
  * Sets the Role identifier
46
  *
47
- * @param string $id
48
  * @return void
49
  */
50
  public function __construct($roleId)
14
  *
15
  * @category Zend
16
  * @package Zend_Acl
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Role.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
 
29
  /**
30
  * @category Zend
31
  * @package Zend_Acl
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Acl_Role implements Zend_Acl_Role_Interface
44
  /**
45
  * Sets the Role identifier
46
  *
47
+ * @param string $roleId
48
  * @return void
49
  */
50
  public function __construct($roleId)
lib/Zend/Acl/Role/Interface.php CHANGED
@@ -14,16 +14,16 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Acl
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_Acl
26
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  interface Zend_Acl_Role_Interface
14
  *
15
  * @category Zend
16
  * @package Zend_Acl
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_Acl
26
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  interface Zend_Acl_Role_Interface
lib/Zend/Acl/Role/Registry.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Acl
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Registry.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
 
@@ -29,7 +29,7 @@
29
  /**
30
  * @category Zend
31
  * @package Zend_Acl
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Acl_Role_Registry
14
  *
15
  * @category Zend
16
  * @package Zend_Acl
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Registry.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
 
29
  /**
30
  * @category Zend
31
  * @package Zend_Acl
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Acl_Role_Registry
lib/Zend/Acl/Role/Registry/Exception.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Acl
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
 
@@ -29,7 +29,7 @@
29
  /**
30
  * @category Zend
31
  * @package Zend_Acl
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Acl_Role_Registry_Exception extends Zend_Acl_Exception
14
  *
15
  * @category Zend
16
  * @package Zend_Acl
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
 
29
  /**
30
  * @category Zend
31
  * @package Zend_Acl
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Acl_Role_Registry_Exception extends Zend_Acl_Exception
lib/Zend/Amf/Adobe/Auth.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Amf
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Auth.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /** @see Zend_Amf_Auth_Abstract */
@@ -33,7 +33,7 @@
33
  *
34
  * @package Zend_Amf
35
  * @subpackage Adobe
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Amf_Adobe_Auth extends Zend_Amf_Auth_Abstract
14
  *
15
  * @category Zend
16
  * @package Zend_Amf
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Auth.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /** @see Zend_Amf_Auth_Abstract */
33
  *
34
  * @package Zend_Amf
35
  * @subpackage Adobe
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Amf_Adobe_Auth extends Zend_Amf_Auth_Abstract
lib/Zend/Amf/Adobe/DbInspector.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Amf
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: DbInspector.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /**
@@ -24,7 +24,7 @@
24
  *
25
  * @package Zend_Amf
26
  * @subpackage Adobe
27
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
  class Zend_Amf_Adobe_DbInspector
14
  *
15
  * @category Zend
16
  * @package Zend_Amf
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: DbInspector.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /**
24
  *
25
  * @package Zend_Amf
26
  * @subpackage Adobe
27
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
  class Zend_Amf_Adobe_DbInspector
lib/Zend/Amf/Adobe/Introspector.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Amf
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Introspector.php 23316 2010-11-10 16:37:40Z matthew $
20
  */
21
 
22
  /** @see Zend_Amf_Parse_TypeLoader */
@@ -33,7 +33,7 @@
33
  *
34
  * @package Zend_Amf
35
  * @subpackage Adobe
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Amf_Adobe_Introspector
14
  *
15
  * @category Zend
16
  * @package Zend_Amf
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Introspector.php 25024 2012-07-30 15:08:15Z rob $
20
  */
21
 
22
  /** @see Zend_Amf_Parse_TypeLoader */
33
  *
34
  * @package Zend_Amf
35
  * @subpackage Adobe
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Amf_Adobe_Introspector
lib/Zend/Amf/Auth/Abstract.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Amf
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /** @see Zend_Auth_Adapter_Interface */
@@ -27,7 +27,7 @@
27
  *
28
  * @package Zend_Amf
29
  * @subpackage Auth
30
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  abstract class Zend_Amf_Auth_Abstract implements Zend_Auth_Adapter_Interface
14
  *
15
  * @category Zend
16
  * @package Zend_Amf
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /** @see Zend_Auth_Adapter_Interface */
27
  *
28
  * @package Zend_Amf
29
  * @subpackage Auth
30
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  abstract class Zend_Amf_Auth_Abstract implements Zend_Auth_Adapter_Interface
lib/Zend/Amf/Constants.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Amf
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Constants.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /**
@@ -24,7 +24,7 @@
24
  * deserialization to detect the AMF marker and encoding types.
25
  *
26
  * @package Zend_Amf
27
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
  final class Zend_Amf_Constants
14
  *
15
  * @category Zend
16
  * @package Zend_Amf
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Constants.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /**
24
  * deserialization to detect the AMF marker and encoding types.
25
  *
26
  * @package Zend_Amf
27
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
  final class Zend_Amf_Constants
lib/Zend/Amf/Exception.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Amf
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /**
@@ -26,7 +26,7 @@
26
 
27
  /**
28
  * @package Zend_Amf
29
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  class Zend_Amf_Exception extends Zend_Exception
14
  *
15
  * @category Zend
16
  * @package Zend_Amf
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /**
26
 
27
  /**
28
  * @package Zend_Amf
29
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  class Zend_Amf_Exception extends Zend_Exception
lib/Zend/Amf/Parse/Amf0/Deserializer.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse_Amf0
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Deserializer.php 21209 2010-02-27 10:37:15Z yoshida@zend.co.jp $
21
  */
22
 
23
  /** Zend_Amf_Constants */
@@ -33,7 +33,7 @@
33
  * @todo Class could be implemented as Factory Class with each data type it's own class
34
  * @package Zend_Amf
35
  * @subpackage Parse_Amf0
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Amf_Parse_Amf0_Deserializer extends Zend_Amf_Parse_Deserializer
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse_Amf0
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Deserializer.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Amf_Constants */
33
  * @todo Class could be implemented as Factory Class with each data type it's own class
34
  * @package Zend_Amf
35
  * @subpackage Parse_Amf0
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Amf_Parse_Amf0_Deserializer extends Zend_Amf_Parse_Deserializer
lib/Zend/Amf/Parse/Amf0/Serializer.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse_Amf0
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Serializer.php 21968 2010-04-22 03:53:34Z matthew $
21
  */
22
 
23
  /** Zend_Amf_Constants */
@@ -32,7 +32,7 @@
32
  * @uses Zend_Amf_Parse_Serializer
33
  * @package Zend_Amf
34
  * @subpackage Parse_Amf0
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Amf_Parse_Amf0_Serializer extends Zend_Amf_Parse_Serializer
@@ -63,8 +63,8 @@ class Zend_Amf_Parse_Amf0_Serializer extends Zend_Amf_Parse_Serializer
63
  */
64
  public function writeTypeMarker(&$data, $markerType = null, $dataByVal = false)
65
  {
66
- // Workaround for PHP5 with E_STRICT enabled complaining about "Only
67
- // variables should be passed by reference"
68
  if ((null === $data) && ($dataByVal !== false)) {
69
  $data = &$dataByVal;
70
  }
@@ -127,7 +127,7 @@ class Zend_Amf_Parse_Amf0_Serializer extends Zend_Amf_Parse_Serializer
127
  case (is_bool($data)):
128
  $markerType = Zend_Amf_Constants::AMF0_BOOLEAN;
129
  break;
130
- case (is_string($data) && (strlen($data) > 65536)):
131
  $markerType = Zend_Amf_Constants::AMF0_LONGSTRING;
132
  break;
133
  case (is_string($data)):
@@ -187,23 +187,23 @@ class Zend_Amf_Parse_Amf0_Serializer extends Zend_Amf_Parse_Serializer
187
  * Check if the given object is in the reference table, write the reference if it exists,
188
  * otherwise add the object to the reference table
189
  *
190
- * @param mixed $object object reference to check for reference
191
- * @param $markerType AMF type of the object to write
192
- * @param mixed $objectByVal object to check for reference
193
  * @return Boolean true, if the reference was written, false otherwise
194
  */
195
- protected function writeObjectReference(&$object, $markerType, $objectByVal = false)
196
  {
197
- // Workaround for PHP5 with E_STRICT enabled complaining about "Only
198
  // variables should be passed by reference"
199
  if ((null === $object) && ($objectByVal !== false)) {
200
  $object = &$objectByVal;
201
  }
202
 
203
- if ($markerType == Zend_Amf_Constants::AMF0_OBJECT
204
- || $markerType == Zend_Amf_Constants::AMF0_MIXEDARRAY
205
- || $markerType == Zend_Amf_Constants::AMF0_ARRAY
206
- || $markerType == Zend_Amf_Constants::AMF0_TYPEDOBJECT
207
  ) {
208
  $ref = array_search($object, $this->_referenceObjects, true);
209
  //handle object reference
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse_Amf0
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Serializer.php 25179 2012-12-22 21:29:30Z rob $
21
  */
22
 
23
  /** Zend_Amf_Constants */
32
  * @uses Zend_Amf_Parse_Serializer
33
  * @package Zend_Amf
34
  * @subpackage Parse_Amf0
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Amf_Parse_Amf0_Serializer extends Zend_Amf_Parse_Serializer
63
  */
64
  public function writeTypeMarker(&$data, $markerType = null, $dataByVal = false)
65
  {
66
+ // Workaround for PHP5 with E_STRICT enabled complaining about "Only
67
+ // variables should be passed by reference"
68
  if ((null === $data) && ($dataByVal !== false)) {
69
  $data = &$dataByVal;
70
  }
127
  case (is_bool($data)):
128
  $markerType = Zend_Amf_Constants::AMF0_BOOLEAN;
129
  break;
130
+ case (is_string($data) && (($this->_mbStringFunctionsOverloaded ? mb_strlen($data, '8bit') : strlen($data)) > 65536)):
131
  $markerType = Zend_Amf_Constants::AMF0_LONGSTRING;
132
  break;
133
  case (is_string($data)):
187
  * Check if the given object is in the reference table, write the reference if it exists,
188
  * otherwise add the object to the reference table
189
  *
190
+ * @param mixed $object object reference to check for reference
191
+ * @param string $markerType AMF type of the object to write
192
+ * @param mixed $objectByVal object to check for reference
193
  * @return Boolean true, if the reference was written, false otherwise
194
  */
195
+ protected function writeObjectReference(&$object, $markerType, $objectByVal = false)
196
  {
197
+ // Workaround for PHP5 with E_STRICT enabled complaining about "Only
198
  // variables should be passed by reference"
199
  if ((null === $object) && ($objectByVal !== false)) {
200
  $object = &$objectByVal;
201
  }
202
 
203
+ if ($markerType == Zend_Amf_Constants::AMF0_OBJECT
204
+ || $markerType == Zend_Amf_Constants::AMF0_MIXEDARRAY
205
+ || $markerType == Zend_Amf_Constants::AMF0_ARRAY
206
+ || $markerType == Zend_Amf_Constants::AMF0_TYPEDOBJECT
207
  ) {
208
  $ref = array_search($object, $this->_referenceObjects, true);
209
  //handle object reference
lib/Zend/Amf/Parse/Amf3/Deserializer.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse_Amf3
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Deserializer.php 21968 2010-04-22 03:53:34Z matthew $
21
  */
22
 
23
  /** Zend_Amf_Parse_Deserializer */
@@ -34,7 +34,7 @@
34
  * @todo Class could be implemented as Factory Class with each data type it's own class.
35
  * @package Zend_Amf
36
  * @subpackage Parse_Amf3
37
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Amf_Parse_Amf3_Deserializer extends Zend_Amf_Parse_Deserializer
@@ -225,7 +225,7 @@ class Zend_Amf_Parse_Amf3_Deserializer extends Zend_Amf_Parse_Deserializer
225
  $timestamp = floor($this->_stream->readDouble() / 1000);
226
 
227
  #require_once 'Zend/Date.php';
228
- $dateTime = new Zend_Date((int) $timestamp);
229
  $this->_referenceObjects[] = $dateTime;
230
  return $dateTime;
231
  }
@@ -385,6 +385,7 @@ class Zend_Amf_Parse_Amf3_Deserializer extends Zend_Amf_Parse_Deserializer
385
  }
386
 
387
  // Add properties back to the return object.
 
388
  foreach($properties as $key=>$value) {
389
  if($key) {
390
  $returnObject->$key = $value;
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse_Amf3
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Deserializer.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Amf_Parse_Deserializer */
34
  * @todo Class could be implemented as Factory Class with each data type it's own class.
35
  * @package Zend_Amf
36
  * @subpackage Parse_Amf3
37
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Amf_Parse_Amf3_Deserializer extends Zend_Amf_Parse_Deserializer
225
  $timestamp = floor($this->_stream->readDouble() / 1000);
226
 
227
  #require_once 'Zend/Date.php';
228
+ $dateTime = new Zend_Date($timestamp);
229
  $this->_referenceObjects[] = $dateTime;
230
  return $dateTime;
231
  }
385
  }
386
 
387
  // Add properties back to the return object.
388
+ if (!is_array($properties)) $properties = array();
389
  foreach($properties as $key=>$value) {
390
  if($key) {
391
  $returnObject->$key = $value;
lib/Zend/Amf/Parse/Amf3/Serializer.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse_Amf3
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Serializer.php 22101 2010-05-04 20:07:13Z matthew $
21
  */
22
 
23
  /** Zend_Amf_Constants */
@@ -35,7 +35,7 @@
35
  *
36
  * @package Zend_Amf
37
  * @subpackage Parse_Amf3
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
@@ -45,7 +45,7 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
45
  * @var string
46
  */
47
  protected $_strEmpty = '';
48
-
49
  /**
50
  * An array of reference objects per amf body
51
  * @var array
@@ -78,7 +78,7 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
78
  */
79
  public function writeTypeMarker(&$data, $markerType = null, $dataByVal = false)
80
  {
81
- // Workaround for PHP5 with E_STRICT enabled complaining about "Only
82
  // variables should be passed by reference"
83
  if ((null === $data) && ($dataByVal !== false)) {
84
  $data = &$dataByVal;
@@ -215,7 +215,7 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
215
  * @return Zend_Amf_Parse_Amf3_Serializer
216
  */
217
  protected function writeBinaryString(&$string){
218
- $ref = strlen($string) << 1 | 0x01;
219
  $this->writeInteger($ref);
220
  $this->_stream->writeBytes($string);
221
 
@@ -230,15 +230,17 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
230
  */
231
  public function writeString(&$string)
232
  {
233
- $len = strlen($string);
234
  if(!$len){
235
  $this->writeInteger(0x01);
236
  return $this;
237
  }
238
 
239
- $ref = array_search($string, $this->_referenceStrings, true);
240
- if($ref === false){
241
- $this->_referenceStrings[] = $string;
 
 
242
  $this->writeBinaryString($string);
243
  } else {
244
  $ref <<= 1;
@@ -380,13 +382,16 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
380
  */
381
  protected function writeObjectReference(&$object, $objectByVal = false)
382
  {
383
- // Workaround for PHP5 with E_STRICT enabled complaining about "Only
384
  // variables should be passed by reference"
385
  if ((null === $object) && ($objectByVal !== false)) {
386
  $object = &$objectByVal;
387
  }
388
 
389
- $ref = array_search($object, $this->_referenceObjects,true);
 
 
 
390
 
391
  // quickly handle object references
392
  if ($ref !== false){
@@ -394,7 +399,7 @@ class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
394
  $this->writeInteger($ref);
395
  return true;
396
  }
397
- $this->_referenceObjects[] = $object;
398
  return false;
399
  }
400
 
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse_Amf3
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Serializer.php 25179 2012-12-22 21:29:30Z rob $
21
  */
22
 
23
  /** Zend_Amf_Constants */
35
  *
36
  * @package Zend_Amf
37
  * @subpackage Parse_Amf3
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Amf_Parse_Amf3_Serializer extends Zend_Amf_Parse_Serializer
45
  * @var string
46
  */
47
  protected $_strEmpty = '';
48
+
49
  /**
50
  * An array of reference objects per amf body
51
  * @var array
78
  */
79
  public function writeTypeMarker(&$data, $markerType = null, $dataByVal = false)
80
  {
81
+ // Workaround for PHP5 with E_STRICT enabled complaining about "Only
82
  // variables should be passed by reference"
83
  if ((null === $data) && ($dataByVal !== false)) {
84
  $data = &$dataByVal;
215
  * @return Zend_Amf_Parse_Amf3_Serializer
216
  */
217
  protected function writeBinaryString(&$string){
218
+ $ref = ($this->_mbStringFunctionsOverloaded ? mb_strlen($string, '8bit') : strlen($string)) << 1 | 0x01;
219
  $this->writeInteger($ref);
220
  $this->_stream->writeBytes($string);
221
 
230
  */
231
  public function writeString(&$string)
232
  {
233
+ $len = $this->_mbStringFunctionsOverloaded ? mb_strlen($string, '8bit') : strlen($string);
234
  if(!$len){
235
  $this->writeInteger(0x01);
236
  return $this;
237
  }
238
 
239
+ $ref = array_key_exists($string, $this->_referenceStrings)
240
+ ? $this->_referenceStrings[$string]
241
+ : false;
242
+ if ($ref === false){
243
+ $this->_referenceStrings[$string] = count($this->_referenceStrings);
244
  $this->writeBinaryString($string);
245
  } else {
246
  $ref <<= 1;
382
  */
383
  protected function writeObjectReference(&$object, $objectByVal = false)
384
  {
385
+ // Workaround for PHP5 with E_STRICT enabled complaining about "Only
386
  // variables should be passed by reference"
387
  if ((null === $object) && ($objectByVal !== false)) {
388
  $object = &$objectByVal;
389
  }
390
 
391
+ $hash = spl_object_hash($object);
392
+ $ref = array_key_exists($hash, $this->_referenceObjects)
393
+ ? $this->_referenceObjects[$hash]
394
+ : false;
395
 
396
  // quickly handle object references
397
  if ($ref !== false){
399
  $this->writeInteger($ref);
400
  return true;
401
  }
402
+ $this->_referenceObjects[$hash] = count($this->_referenceObjects);
403
  return false;
404
  }
405
 
lib/Zend/Amf/Parse/Deserializer.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Deserializer.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -30,7 +30,7 @@
30
  * @see http://opensource.adobe.com/svn/opensource/blazeds/trunk/modules/core/src/java/flex/messaging/io/amf/
31
  * @package Zend_Amf
32
  * @subpackage Parse
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  abstract class Zend_Amf_Parse_Deserializer
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Deserializer.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
30
  * @see http://opensource.adobe.com/svn/opensource/blazeds/trunk/modules/core/src/java/flex/messaging/io/amf/
31
  * @package Zend_Amf
32
  * @subpackage Parse
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  abstract class Zend_Amf_Parse_Deserializer
lib/Zend/Amf/Parse/InputStream.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: InputStream.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Amf_Util_BinaryStream */
@@ -31,7 +31,7 @@
31
  *
32
  * @package Zend_Amf
33
  * @subpackage Parse
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Amf_Parse_InputStream extends Zend_Amf_Util_BinaryStream
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: InputStream.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Amf_Util_BinaryStream */
31
  *
32
  * @package Zend_Amf
33
  * @subpackage Parse
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Amf_Parse_InputStream extends Zend_Amf_Util_BinaryStream
lib/Zend/Amf/Parse/OutputStream.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: OutputStream.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Amf_Util_BinaryStream */
@@ -32,7 +32,7 @@
32
  * @uses Zend_Amf_Util_BinaryStream
33
  * @package Zend_Amf
34
  * @subpackage Parse
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Amf_Parse_OutputStream extends Zend_Amf_Util_BinaryStream
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: OutputStream.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Amf_Util_BinaryStream */
32
  * @uses Zend_Amf_Util_BinaryStream
33
  * @package Zend_Amf
34
  * @subpackage Parse
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Amf_Parse_OutputStream extends Zend_Amf_Util_BinaryStream
lib/Zend/Amf/Parse/Resource/MysqlResult.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: MysqlResult.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -26,7 +26,7 @@
26
  *
27
  * @package Zend_Amf
28
  * @subpackage Parse
29
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  class Zend_Amf_Parse_Resource_MysqlResult
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: MysqlResult.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
26
  *
27
  * @package Zend_Amf
28
  * @subpackage Parse
29
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  class Zend_Amf_Parse_Resource_MysqlResult
lib/Zend/Amf/Parse/Resource/MysqliResult.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: MysqliResult.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -26,7 +26,7 @@
26
  *
27
  * @package Zend_Amf
28
  * @subpackage Parse
29
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  class Zend_Amf_Parse_Resource_MysqliResult
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: MysqliResult.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
26
  *
27
  * @package Zend_Amf
28
  * @subpackage Parse
29
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  class Zend_Amf_Parse_Resource_MysqliResult
lib/Zend/Amf/Parse/Resource/Stream.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Stream.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -25,7 +25,7 @@
25
  *
26
  * @package Zend_Amf
27
  * @subpackage Parse
28
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
29
  * @license http://framework.zend.com/license/new-bsd New BSD License
30
  */
31
  class Zend_Amf_Parse_Resource_Stream
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Stream.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
25
  *
26
  * @package Zend_Amf
27
  * @subpackage Parse
28
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
29
  * @license http://framework.zend.com/license/new-bsd New BSD License
30
  */
31
  class Zend_Amf_Parse_Resource_Stream
lib/Zend/Amf/Parse/Serializer.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Serializer.php 21968 2010-04-22 03:53:34Z matthew $
21
  */
22
 
23
  /**
@@ -25,7 +25,7 @@
25
  *
26
  * @package Zend_Amf
27
  * @subpackage Parse
28
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
29
  * @license http://framework.zend.com/license/new-bsd New BSD License
30
  */
31
  abstract class Zend_Amf_Parse_Serializer
@@ -37,6 +37,13 @@ abstract class Zend_Amf_Parse_Serializer
37
  */
38
  protected $_stream;
39
 
 
 
 
 
 
 
 
40
  /**
41
  * Constructor
42
  *
@@ -46,6 +53,7 @@ abstract class Zend_Amf_Parse_Serializer
46
  public function __construct(Zend_Amf_Parse_OutputStream $stream)
47
  {
48
  $this->_stream = $stream;
 
49
  }
50
 
51
  /**
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Serializer.php 25179 2012-12-22 21:29:30Z rob $
21
  */
22
 
23
  /**
25
  *
26
  * @package Zend_Amf
27
  * @subpackage Parse
28
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
29
  * @license http://framework.zend.com/license/new-bsd New BSD License
30
  */
31
  abstract class Zend_Amf_Parse_Serializer
37
  */
38
  protected $_stream;
39
 
40
+ /**
41
+ * str* functions overloaded using mbstring.func_overload
42
+ *
43
+ * @var bool
44
+ */
45
+ protected $mbStringFunctionsOverloaded;
46
+
47
  /**
48
  * Constructor
49
  *
53
  public function __construct(Zend_Amf_Parse_OutputStream $stream)
54
  {
55
  $this->_stream = $stream;
56
+ $this->_mbStringFunctionsOverloaded = function_exists('mb_strlen') && (ini_get('mbstring.func_overload') !== '') && ((int)ini_get('mbstring.func_overload') & 2);
57
  }
58
 
59
  /**
lib/Zend/Amf/Parse/TypeLoader.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: TypeLoader.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -47,7 +47,7 @@
47
  * @todo PHP 5.3 can drastically change this class w/ namespace and the new call_user_func w/ namespace
48
  * @package Zend_Amf
49
  * @subpackage Parse
50
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
51
  * @license http://framework.zend.com/license/new-bsd New BSD License
52
  */
53
  final class Zend_Amf_Parse_TypeLoader
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Parse
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: TypeLoader.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
47
  * @todo PHP 5.3 can drastically change this class w/ namespace and the new call_user_func w/ namespace
48
  * @package Zend_Amf
49
  * @subpackage Parse
50
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
51
  * @license http://framework.zend.com/license/new-bsd New BSD License
52
  */
53
  final class Zend_Amf_Parse_TypeLoader
lib/Zend/Amf/Request.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Amf
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Request.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /** @see Zend_Amf_Parse_InputStream */
@@ -40,7 +40,7 @@
40
  *
41
  * @todo Currently not checking if the object needs to be Type Mapped to a server object.
42
  * @package Zend_Amf
43
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
44
  * @license http://framework.zend.com/license/new-bsd New BSD License
45
  */
46
  class Zend_Amf_Request
14
  *
15
  * @category Zend
16
  * @package Zend_Amf
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Request.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /** @see Zend_Amf_Parse_InputStream */
40
  *
41
  * @todo Currently not checking if the object needs to be Type Mapped to a server object.
42
  * @package Zend_Amf
43
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
44
  * @license http://framework.zend.com/license/new-bsd New BSD License
45
  */
46
  class Zend_Amf_Request
lib/Zend/Amf/Request/Http.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Request
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Http.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** @see Zend_Amf_Request */
@@ -32,7 +32,7 @@
32
  *
33
  * @package Zend_Amf
34
  * @subpackage Request
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Amf_Request_Http extends Zend_Amf_Request
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Request
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Http.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** @see Zend_Amf_Request */
32
  *
33
  * @package Zend_Amf
34
  * @subpackage Request
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Amf_Request_Http extends Zend_Amf_Request
lib/Zend/Amf/Response.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Amf
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Response.php 21968 2010-04-22 03:53:34Z matthew $
20
  */
21
 
22
  /** @see Zend_Amf_Constants */
@@ -32,7 +32,7 @@
32
  * Handles converting the PHP object ready for response back into AMF
33
  *
34
  * @package Zend_Amf
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Amf_Response
@@ -95,7 +95,7 @@ class Zend_Amf_Response
95
  $stream->writeByte($header->mustRead);
96
  $stream->writeLong(Zend_Amf_Constants::UNKNOWN_CONTENT_LENGTH);
97
  if (is_object($header->data)) {
98
- // Workaround for PHP5 with E_STRICT enabled complaining about
99
  // "Only variables should be passed by reference"
100
  $placeholder = null;
101
  $serializer->writeTypeMarker($placeholder, null, $header->data);
@@ -115,7 +115,7 @@ class Zend_Amf_Response
115
  $bodyData = $body->getData();
116
  $markerType = ($this->_objectEncoding == Zend_Amf_Constants::AMF0_OBJECT_ENCODING) ? null : Zend_Amf_Constants::AMF0_AMF3;
117
  if (is_object($bodyData)) {
118
- // Workaround for PHP5 with E_STRICT enabled complaining about
119
  // "Only variables should be passed by reference"
120
  $placeholder = null;
121
  $serializer->writeTypeMarker($placeholder, $markerType, $bodyData);
14
  *
15
  * @category Zend
16
  * @package Zend_Amf
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Response.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /** @see Zend_Amf_Constants */
32
  * Handles converting the PHP object ready for response back into AMF
33
  *
34
  * @package Zend_Amf
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Amf_Response
95
  $stream->writeByte($header->mustRead);
96
  $stream->writeLong(Zend_Amf_Constants::UNKNOWN_CONTENT_LENGTH);
97
  if (is_object($header->data)) {
98
+ // Workaround for PHP5 with E_STRICT enabled complaining about
99
  // "Only variables should be passed by reference"
100
  $placeholder = null;
101
  $serializer->writeTypeMarker($placeholder, null, $header->data);
115
  $bodyData = $body->getData();
116
  $markerType = ($this->_objectEncoding == Zend_Amf_Constants::AMF0_OBJECT_ENCODING) ? null : Zend_Amf_Constants::AMF0_AMF3;
117
  if (is_object($bodyData)) {
118
+ // Workaround for PHP5 with E_STRICT enabled complaining about
119
  // "Only variables should be passed by reference"
120
  $placeholder = null;
121
  $serializer->writeTypeMarker($placeholder, $markerType, $bodyData);
lib/Zend/Amf/Response/Http.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Response
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Http.php 22096 2010-05-04 15:37:23Z wadearnold $
21
  */
22
 
23
  /** Zend_Amf_Response */
@@ -28,7 +28,7 @@
28
  *
29
  * @package Zend_Amf
30
  * @subpackage Response
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Amf_Response_Http extends Zend_Amf_Response
@@ -41,11 +41,33 @@ class Zend_Amf_Response_Http extends Zend_Amf_Response
41
  public function getResponse()
42
  {
43
  if (!headers_sent()) {
44
- header('Cache-Control: no-cache, must-revalidate');
 
 
 
 
 
 
45
  header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
46
- header('Pragma: no-cache');
47
  header('Content-Type: application/x-amf');
48
  }
49
  return parent::getResponse();
50
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Response
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Http.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Amf_Response */
28
  *
29
  * @package Zend_Amf
30
  * @subpackage Response
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Amf_Response_Http extends Zend_Amf_Response
41
  public function getResponse()
42
  {
43
  if (!headers_sent()) {
44
+ if ($this->isIeOverSsl()) {
45
+ header('Cache-Control: cache, must-revalidate');
46
+ header('Pragma: public');
47
+ } else {
48
+ header('Cache-Control: no-cache, must-revalidate');
49
+ header('Pragma: no-cache');
50
+ }
51
  header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
 
52
  header('Content-Type: application/x-amf');
53
  }
54
  return parent::getResponse();
55
  }
56
+
57
+ protected function isIeOverSsl()
58
+ {
59
+ $ssl = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : false;
60
+ if (!$ssl || ($ssl == 'off')) {
61
+ // IIS reports "off", whereas other browsers simply don't populate
62
+ return false;
63
+ }
64
+
65
+ $ua = $_SERVER['HTTP_USER_AGENT'];
66
+ if (!preg_match('/; MSIE \d+\.\d+;/', $ua)) {
67
+ // Not MicroSoft Internet Explorer
68
+ return false;
69
+ }
70
+
71
+ return true;
72
+ }
73
  }
lib/Zend/Amf/Server.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Amf
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Server.php 23256 2010-10-26 12:51:54Z alexander $
20
  */
21
 
22
  /** @see Zend_Server_Interface */
@@ -52,7 +52,7 @@
52
  * @todo Make the reflection methods cache and autoload.
53
  * @package Zend_Amf
54
  * @subpackage Server
55
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
56
  * @license http://framework.zend.com/license/new-bsd New BSD License
57
  */
58
  class Zend_Amf_Server implements Zend_Server_Interface
@@ -142,12 +142,18 @@ class Zend_Amf_Server implements Zend_Server_Interface
142
  /**
143
  * Set authentication adapter
144
  *
 
 
 
145
  * @param Zend_Amf_Auth_Abstract $auth
146
  * @return Zend_Amf_Server
147
  */
148
  public function setAuth(Zend_Amf_Auth_Abstract $auth)
149
  {
150
  $this->_auth = $auth;
 
 
 
151
  return $this;
152
  }
153
  /**
@@ -317,6 +323,7 @@ class Zend_Amf_Server implements Zend_Server_Interface
317
  throw new Zend_Amf_Server_Exception('Class "' . $className . '" does not exist: '.$e->getMessage(), 0, $e);
318
  }
319
  // Add the new loaded class to the server.
 
320
  $this->setClass($className, $source);
321
  }
322
 
@@ -334,6 +341,8 @@ class Zend_Amf_Server implements Zend_Server_Interface
334
  $params = array_merge($params, $argv);
335
  }
336
 
 
 
337
  if ($info instanceof Zend_Server_Reflection_Function) {
338
  $func = $info->getName();
339
  $this->_checkAcl(null, $func);
@@ -494,66 +503,60 @@ class Zend_Amf_Server implements Zend_Server_Interface
494
  // set response encoding
495
  $response->setObjectEncoding($objectEncoding);
496
 
497
- $responseBody = $request->getAmfBodies();
498
-
499
- $handleAuth = false;
500
- if ($this->_auth) {
501
- $headers = $request->getAmfHeaders();
502
- if (isset($headers[Zend_Amf_Constants::CREDENTIALS_HEADER]) &&
503
- isset($headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->userid)) {
504
- $handleAuth = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
505
  }
506
  }
507
 
508
  // Iterate through each of the service calls in the AMF request
509
- foreach($responseBody as $body)
510
  {
 
 
 
 
 
 
 
511
  try {
512
- if ($handleAuth) {
513
- if ($this->_handleAuth(
514
- $headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->userid,
515
- $headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->password)) {
516
- // use RequestPersistentHeader to clear credentials
517
- $response->addAmfHeader(
518
- new Zend_Amf_Value_MessageHeader(
519
- Zend_Amf_Constants::PERSISTENT_HEADER,
520
- false,
521
- new Zend_Amf_Value_MessageHeader(
522
- Zend_Amf_Constants::CREDENTIALS_HEADER,
523
- false, null)));
524
- $handleAuth = false;
525
- }
526
- }
527
-
528
- if ($objectEncoding == Zend_Amf_Constants::AMF0_OBJECT_ENCODING) {
529
- // AMF0 Object Encoding
530
- $targetURI = $body->getTargetURI();
531
- $message = '';
532
-
533
- // Split the target string into its values.
534
- $source = substr($targetURI, 0, strrpos($targetURI, '.'));
535
-
536
- if ($source) {
537
- // Break off method name from namespace into source
538
- $method = substr(strrchr($targetURI, '.'), 1);
539
- $return = $this->_dispatch($method, $body->getData(), $source);
540
- } else {
541
- // Just have a method name.
542
- $return = $this->_dispatch($targetURI, $body->getData());
543
- }
544
- } else {
545
- // AMF3 read message type
546
- $message = $body->getData();
547
- if ($message instanceof Zend_Amf_Value_Messaging_CommandMessage) {
548
- // async call with command message
549
- $return = $this->_loadCommandMessage($message);
550
- } elseif ($message instanceof Zend_Amf_Value_Messaging_RemotingMessage) {
551
- #require_once 'Zend/Amf/Value/Messaging/AcknowledgeMessage.php';
552
- $return = new Zend_Amf_Value_Messaging_AcknowledgeMessage($message);
553
- $return->body = $this->_dispatch($message->operation, $message->body, $message->source);
554
- } else {
555
- // Amf3 message sent with netConnection
556
  $targetURI = $body->getTargetURI();
 
557
 
558
  // Split the target string into its values.
559
  $source = substr($targetURI, 0, strrpos($targetURI, '.'));
@@ -566,7 +569,35 @@ class Zend_Amf_Server implements Zend_Server_Interface
566
  // Just have a method name.
567
  $return = $this->_dispatch($targetURI, $body->getData());
568
  }
569
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
570
  }
571
  $responseType = Zend_AMF_Constants::RESULT_METHOD;
572
  } catch (Exception $e) {
@@ -933,4 +964,85 @@ class Zend_Amf_Server implements Zend_Server_Interface
933
  {
934
  return array_keys($this->_table);
935
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
936
  }
14
  *
15
  * @category Zend
16
  * @package Zend_Amf
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Server.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /** @see Zend_Server_Interface */
52
  * @todo Make the reflection methods cache and autoload.
53
  * @package Zend_Amf
54
  * @subpackage Server
55
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
56
  * @license http://framework.zend.com/license/new-bsd New BSD License
57
  */
58
  class Zend_Amf_Server implements Zend_Server_Interface
142
  /**
143
  * Set authentication adapter
144
  *
145
+ * If the authentication adapter implements a "getAcl()" method, populate
146
+ * the ACL of this instance with it (if none exists already).
147
+ *
148
  * @param Zend_Amf_Auth_Abstract $auth
149
  * @return Zend_Amf_Server
150
  */
151
  public function setAuth(Zend_Amf_Auth_Abstract $auth)
152
  {
153
  $this->_auth = $auth;
154
+ if ((null === $this->getAcl()) && method_exists($auth, 'getAcl')) {
155
+ $this->setAcl($auth->getAcl());
156
+ }
157
  return $this;
158
  }
159
  /**
323
  throw new Zend_Amf_Server_Exception('Class "' . $className . '" does not exist: '.$e->getMessage(), 0, $e);
324
  }
325
  // Add the new loaded class to the server.
326
+ #require_once 'Zend/Amf/Server/Exception.php';
327
  $this->setClass($className, $source);
328
  }
329
 
341
  $params = array_merge($params, $argv);
342
  }
343
 
344
+ $params = $this->_castParameters($info, $params);
345
+
346
  if ($info instanceof Zend_Server_Reflection_Function) {
347
  $func = $info->getName();
348
  $this->_checkAcl(null, $func);
503
  // set response encoding
504
  $response->setObjectEncoding($objectEncoding);
505
 
506
+ // Authenticate, if we have credential headers
507
+ $error = false;
508
+ $headers = $request->getAmfHeaders();
509
+ if (isset($headers[Zend_Amf_Constants::CREDENTIALS_HEADER])
510
+ && isset($headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->userid)
511
+ && isset($headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->password)
512
+ ) {
513
+ try {
514
+ if ($this->_handleAuth(
515
+ $headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->userid,
516
+ $headers[Zend_Amf_Constants::CREDENTIALS_HEADER]->password
517
+ )) {
518
+ // use RequestPersistentHeader to clear credentials
519
+ $response->addAmfHeader(
520
+ new Zend_Amf_Value_MessageHeader(
521
+ Zend_Amf_Constants::PERSISTENT_HEADER,
522
+ false,
523
+ new Zend_Amf_Value_MessageHeader(
524
+ Zend_Amf_Constants::CREDENTIALS_HEADER,
525
+ false, null
526
+ )
527
+ )
528
+ );
529
+ }
530
+ } catch (Exception $e) {
531
+ // Error during authentication; report it
532
+ $error = $this->_errorMessage(
533
+ $objectEncoding,
534
+ '',
535
+ $e->getMessage(),
536
+ $e->getTraceAsString(),
537
+ $e->getCode(),
538
+ $e->getLine()
539
+ );
540
+ $responseType = Zend_AMF_Constants::STATUS_METHOD;
541
  }
542
  }
543
 
544
  // Iterate through each of the service calls in the AMF request
545
+ foreach($request->getAmfBodies() as $body)
546
  {
547
+ if ($error) {
548
+ // Error during authentication; just report it and be done
549
+ $responseURI = $body->getResponseURI() . $responseType;
550
+ $newBody = new Zend_Amf_Value_MessageBody($responseURI, null, $error);
551
+ $response->addAmfBody($newBody);
552
+ continue;
553
+ }
554
  try {
555
+ switch ($objectEncoding) {
556
+ case Zend_Amf_Constants::AMF0_OBJECT_ENCODING:
557
+ // AMF0 Object Encoding
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
558
  $targetURI = $body->getTargetURI();
559
+ $message = '';
560
 
561
  // Split the target string into its values.
562
  $source = substr($targetURI, 0, strrpos($targetURI, '.'));
569
  // Just have a method name.
570
  $return = $this->_dispatch($targetURI, $body->getData());
571
  }
572
+ break;
573
+ case Zend_Amf_Constants::AMF3_OBJECT_ENCODING:
574
+ default:
575
+ // AMF3 read message type
576
+ $message = $body->getData();
577
+ if ($message instanceof Zend_Amf_Value_Messaging_CommandMessage) {
578
+ // async call with command message
579
+ $return = $this->_loadCommandMessage($message);
580
+ } elseif ($message instanceof Zend_Amf_Value_Messaging_RemotingMessage) {
581
+ #require_once 'Zend/Amf/Value/Messaging/AcknowledgeMessage.php';
582
+ $return = new Zend_Amf_Value_Messaging_AcknowledgeMessage($message);
583
+ $return->body = $this->_dispatch($message->operation, $message->body, $message->source);
584
+ } else {
585
+ // Amf3 message sent with netConnection
586
+ $targetURI = $body->getTargetURI();
587
+
588
+ // Split the target string into its values.
589
+ $source = substr($targetURI, 0, strrpos($targetURI, '.'));
590
+
591
+ if ($source) {
592
+ // Break off method name from namespace into source
593
+ $method = substr(strrchr($targetURI, '.'), 1);
594
+ $return = $this->_dispatch($method, $body->getData(), $source);
595
+ } else {
596
+ // Just have a method name.
597
+ $return = $this->_dispatch($targetURI, $body->getData());
598
+ }
599
+ }
600
+ break;
601
  }
602
  $responseType = Zend_AMF_Constants::RESULT_METHOD;
603
  } catch (Exception $e) {
964
  {
965
  return array_keys($this->_table);
966
  }
967
+
968
+ /**
969
+ * Cast parameters
970
+ *
971
+ * Takes the provided parameters from the request, and attempts to cast them
972
+ * to objects, if the prototype defines any as explicit object types
973
+ *
974
+ * @param Reflection $reflectionMethod
975
+ * @param array $params
976
+ * @return array
977
+ */
978
+ protected function _castParameters($reflectionMethod, array $params)
979
+ {
980
+ $prototypes = $reflectionMethod->getPrototypes();
981
+ $nonObjectTypes = array(
982
+ 'null',
983
+ 'mixed',
984
+ 'void',
985
+ 'unknown',
986
+ 'bool',
987
+ 'boolean',
988
+ 'number',
989
+ 'int',
990
+ 'integer',
991
+ 'double',
992
+ 'float',
993
+ 'string',
994
+ 'array',
995
+ 'object',
996
+ 'stdclass',
997
+ );
998
+ $types = array();
999
+ foreach ($prototypes as $prototype) {
1000
+ foreach ($prototype->getParameters() as $parameter) {
1001
+ $type = $parameter->getType();
1002
+ if (in_array(strtolower($type), $nonObjectTypes)) {
1003
+ continue;
1004
+ }
1005
+ $position = $parameter->getPosition();
1006
+ $types[$position] = $type;
1007
+ }
1008
+ }
1009
+
1010
+ if (empty($types)) {
1011
+ return $params;
1012
+ }
1013
+
1014
+ foreach ($params as $position => $value) {
1015
+ if (!isset($types[$position])) {
1016
+ // No specific type to cast to? done
1017
+ continue;
1018
+ }
1019
+
1020
+ $type = $types[$position];
1021
+
1022
+ if (!class_exists($type)) {
1023
+ // Not a class, apparently. done
1024
+ continue;
1025
+ }
1026
+
1027
+ if ($value instanceof $type) {
1028
+ // Already of the right type? done
1029
+ continue;
1030
+ }
1031
+
1032
+ if (!is_array($value) && !is_object($value)) {
1033
+ // Can't cast scalars to objects easily; done
1034
+ continue;
1035
+ }
1036
+
1037
+ // Create instance, and loop through value to set
1038
+ $object = new $type;
1039
+ foreach ($value as $property => $defined) {
1040
+ $object->{$property} = $defined;
1041
+ }
1042
+
1043
+ $params[$position] = $object;
1044
+ }
1045
+
1046
+ return $params;
1047
+ }
1048
  }
lib/Zend/Amf/Server/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Server
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Amf_Exception */
@@ -29,7 +29,7 @@
29
  * @category Zend
30
  * @package Zend_Amf
31
  * @subpackage Server
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Amf_Server_Exception extends Zend_Amf_Exception
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Server
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Amf_Exception */
29
  * @category Zend
30
  * @package Zend_Amf
31
  * @subpackage Server
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Amf_Server_Exception extends Zend_Amf_Exception
lib/Zend/Amf/Util/BinaryStream.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Util
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: BinaryStream.php 22101 2010-05-04 20:07:13Z matthew $
21
  */
22
 
23
  /**
@@ -25,7 +25,7 @@
25
  *
26
  * @package Zend_Amf
27
  * @subpackage Util
28
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
29
  * @license http://framework.zend.com/license/new-bsd New BSD License
30
  */
31
  class Zend_Amf_Util_BinaryStream
@@ -50,6 +50,11 @@ class Zend_Amf_Util_BinaryStream
50
  */
51
  protected $_needle;
52
 
 
 
 
 
 
53
  /**
54
  * Constructor
55
  *
@@ -69,7 +74,8 @@ class Zend_Amf_Util_BinaryStream
69
 
70
  $this->_stream = $stream;
71
  $this->_needle = 0;
72
- $this->_streamLength = strlen($stream);
 
73
  $this->_bigEndian = (pack('l', 1) === "\x00\x00\x00\x01");
74
  }
75
 
@@ -97,7 +103,7 @@ class Zend_Amf_Util_BinaryStream
97
  #require_once 'Zend/Amf/Exception.php';
98
  throw new Zend_Amf_Exception('Buffer underrun at needle position: ' . $this->_needle . ' while requesting length: ' . $length);
99
  }
100
- $bytes = substr($this->_stream, $this->_needle, $length);
101
  $this->_needle+= $length;
102
  return $bytes;
103
  }
@@ -120,12 +126,18 @@ class Zend_Amf_Util_BinaryStream
120
  * Reads a signed byte
121
  *
122
  * @return int Value is in the range of -128 to 127.
 
123
  */
124
  public function readByte()
125
  {
126
  if (($this->_needle + 1) > $this->_streamLength) {
127
  #require_once 'Zend/Amf/Exception.php';
128
- throw new Zend_Amf_Exception('Buffer underrun at needle position: ' . $this->_needle . ' while requesting length: ' . $length);
 
 
 
 
 
129
  }
130
 
131
  return ord($this->_stream{$this->_needle++});
@@ -184,7 +196,7 @@ class Zend_Amf_Util_BinaryStream
184
  */
185
  public function writeUtf($stream)
186
  {
187
- $this->writeInt(strlen($stream));
188
  $this->_stream.= $stream;
189
  return $this;
190
  }
@@ -209,7 +221,7 @@ class Zend_Amf_Util_BinaryStream
209
  */
210
  public function writeLongUtf($stream)
211
  {
212
- $this->writeLong(strlen($stream));
213
  $this->_stream.= $stream;
214
  }
215
 
@@ -255,7 +267,7 @@ class Zend_Amf_Util_BinaryStream
255
  */
256
  public function readDouble()
257
  {
258
- $bytes = substr($this->_stream, $this->_needle, 8);
259
  $this->_needle+= 8;
260
 
261
  if (!$this->_bigEndian) {
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Util
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: BinaryStream.php 25241 2013-01-22 11:07:36Z frosch $
21
  */
22
 
23
  /**
25
  *
26
  * @package Zend_Amf
27
  * @subpackage Util
28
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
29
  * @license http://framework.zend.com/license/new-bsd New BSD License
30
  */
31
  class Zend_Amf_Util_BinaryStream
50
  */
51
  protected $_needle;
52
 
53
+ /**
54
+ * @var bool str* functions overloaded using mbstring.func_overload?
55
+ */
56
+ protected $_mbStringFunctionsOverloaded;
57
+
58
  /**
59
  * Constructor
60
  *
74
 
75
  $this->_stream = $stream;
76
  $this->_needle = 0;
77
+ $this->_mbStringFunctionsOverloaded = function_exists('mb_strlen') && (ini_get('mbstring.func_overload') !== '') && ((int)ini_get('mbstring.func_overload') & 2);
78
+ $this->_streamLength = $this->_mbStringFunctionsOverloaded ? mb_strlen($stream, '8bit') : strlen($stream);
79
  $this->_bigEndian = (pack('l', 1) === "\x00\x00\x00\x01");
80
  }
81
 
103
  #require_once 'Zend/Amf/Exception.php';
104
  throw new Zend_Amf_Exception('Buffer underrun at needle position: ' . $this->_needle . ' while requesting length: ' . $length);
105
  }
106
+ $bytes = $this->_mbStringFunctionsOverloaded ? mb_substr($this->_stream, $this->_needle, $length, '8bit') : substr($this->_stream, $this->_needle, $length);
107
  $this->_needle+= $length;
108
  return $bytes;
109
  }
126
  * Reads a signed byte
127
  *
128
  * @return int Value is in the range of -128 to 127.
129
+ * @throws Zend_Amf_Exception
130
  */
131
  public function readByte()
132
  {
133
  if (($this->_needle + 1) > $this->_streamLength) {
134
  #require_once 'Zend/Amf/Exception.php';
135
+ throw new Zend_Amf_Exception(
136
+ 'Buffer underrun at needle position: '
137
+ . $this->_needle
138
+ . ' while requesting length: '
139
+ . $this->_streamLength
140
+ );
141
  }
142
 
143
  return ord($this->_stream{$this->_needle++});
196
  */
197
  public function writeUtf($stream)
198
  {
199
+ $this->writeInt($this->_mbStringFunctionsOverloaded ? mb_strlen($stream, '8bit') : strlen($stream));
200
  $this->_stream.= $stream;
201
  return $this;
202
  }
221
  */
222
  public function writeLongUtf($stream)
223
  {
224
+ $this->writeLong($this->_mbStringFunctionsOverloaded ? mb_strlen($stream, '8bit') : strlen($stream));
225
  $this->_stream.= $stream;
226
  }
227
 
267
  */
268
  public function readDouble()
269
  {
270
+ $bytes = $this->_mbStringFunctionsOverloaded ? mb_substr($this->_stream, $this->_needle, 8, '8bit') : substr($this->_stream, $this->_needle, 8);
271
  $this->_needle+= 8;
272
 
273
  if (!$this->_bigEndian) {
lib/Zend/Amf/Value/ByteArray.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Value
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: ByteArray.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -25,7 +25,7 @@
25
  *
26
  * @package Zend_Amf
27
  * @subpackage Value
28
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
29
  * @license http://framework.zend.com/license/new-bsd New BSD License
30
  */
31
  class Zend_Amf_Value_ByteArray
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Value
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: ByteArray.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
25
  *
26
  * @package Zend_Amf
27
  * @subpackage Value
28
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
29
  * @license http://framework.zend.com/license/new-bsd New BSD License
30
  */
31
  class Zend_Amf_Value_ByteArray
lib/Zend/Amf/Value/MessageBody.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Value
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: MessageBody.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -33,7 +33,7 @@
33
  *
34
  * @package Zend_Amf
35
  * @subpackage Value
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Amf_Value_MessageBody
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Value
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: MessageBody.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
33
  *
34
  * @package Zend_Amf
35
  * @subpackage Value
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Amf_Value_MessageBody
lib/Zend/Amf/Value/MessageHeader.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Value
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: MessageHeader.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -28,7 +28,7 @@
28
  *
29
  * @package Zend_Amf
30
  * @subpackage Value
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Amf_Value_MessageHeader
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Value
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: MessageHeader.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
28
  *
29
  * @package Zend_Amf
30
  * @subpackage Value
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Amf_Value_MessageHeader
lib/Zend/Amf/Value/Messaging/AbstractMessage.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Value
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: AbstractMessage.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -26,7 +26,7 @@
26
  *
27
  * @package Zend_Amf
28
  * @subpackage Value
29
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  class Zend_Amf_Value_Messaging_AbstractMessage
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Value
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: AbstractMessage.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
26
  *
27
  * @package Zend_Amf
28
  * @subpackage Value
29
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  class Zend_Amf_Value_Messaging_AbstractMessage
lib/Zend/Amf/Value/Messaging/AcknowledgeMessage.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Value
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: AcknowledgeMessage.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Amf_Value_Messaging_AsyncMessage */
@@ -32,7 +32,7 @@
32
  *
33
  * @package Zend_Amf
34
  * @subpackage Value
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Amf_Value_Messaging_AcknowledgeMessage extends Zend_Amf_Value_Messaging_AsyncMessage
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Value
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: AcknowledgeMessage.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Amf_Value_Messaging_AsyncMessage */
32
  *
33
  * @package Zend_Amf
34
  * @subpackage Value
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Amf_Value_Messaging_AcknowledgeMessage extends Zend_Amf_Value_Messaging_AsyncMessage
lib/Zend/Amf/Value/Messaging/ArrayCollection.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Value
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: ArrayCollection.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -27,9 +27,9 @@
27
  *
28
  * @package Zend_Amf
29
  * @subpackage Value
30
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
- class Zend_Amf_Value_Messaging_ArrayCollection
34
  {
35
  }
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Value
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: ArrayCollection.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
27
  *
28
  * @package Zend_Amf
29
  * @subpackage Value
30
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
+ class Zend_Amf_Value_Messaging_ArrayCollection extends ArrayObject
34
  {
35
  }
lib/Zend/Amf/Value/Messaging/AsyncMessage.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Value
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: AsyncMessage.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -30,7 +30,7 @@
30
  *
31
  * @package Zend_Amf
32
  * @subpackage Value
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Amf_Value_Messaging_AsyncMessage extends Zend_Amf_Value_Messaging_AbstractMessage
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Value
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: AsyncMessage.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
30
  *
31
  * @package Zend_Amf
32
  * @subpackage Value
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Amf_Value_Messaging_AsyncMessage extends Zend_Amf_Value_Messaging_AbstractMessage
lib/Zend/Amf/Value/Messaging/CommandMessage.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Value
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: CommandMessage.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -36,7 +36,7 @@
36
  *
37
  * @package Zend_Amf
38
  * @subpackage Value
39
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
40
  * @license http://framework.zend.com/license/new-bsd New BSD License
41
  */
42
  class Zend_Amf_Value_Messaging_CommandMessage extends Zend_Amf_Value_Messaging_AsyncMessage
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Value
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: CommandMessage.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
36
  *
37
  * @package Zend_Amf
38
  * @subpackage Value
39
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
40
  * @license http://framework.zend.com/license/new-bsd New BSD License
41
  */
42
  class Zend_Amf_Value_Messaging_CommandMessage extends Zend_Amf_Value_Messaging_AsyncMessage
lib/Zend/Amf/Value/Messaging/ErrorMessage.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Value
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: ErrorMessage.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** @see Zend_Amf_Value_Messaging_AcknowledgeMessage */
@@ -30,7 +30,7 @@
30
  *
31
  * @package Zend_Amf
32
  * @subpackage Value
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Amf_Value_Messaging_ErrorMessage extends Zend_Amf_Value_Messaging_AcknowledgeMessage
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Value
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: ErrorMessage.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** @see Zend_Amf_Value_Messaging_AcknowledgeMessage */
30
  *
31
  * @package Zend_Amf
32
  * @subpackage Value
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Amf_Value_Messaging_ErrorMessage extends Zend_Amf_Value_Messaging_AcknowledgeMessage
lib/Zend/Amf/Value/Messaging/RemotingMessage.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Value
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: RemotingMessage.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Amf_Value_Messaging_AbstractMessage */
@@ -31,7 +31,7 @@
31
  *
32
  * @package Zend_Amf
33
  * @subpackage Value
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Amf_Value_Messaging_RemotingMessage extends Zend_Amf_Value_Messaging_AbstractMessage
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Value
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: RemotingMessage.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Amf_Value_Messaging_AbstractMessage */
31
  *
32
  * @package Zend_Amf
33
  * @subpackage Value
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Amf_Value_Messaging_RemotingMessage extends Zend_Amf_Value_Messaging_AbstractMessage
lib/Zend/Amf/Value/TraitsInfo.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Value
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: TraitsInfo.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -25,7 +25,7 @@
25
  *
26
  * @package Zend_Amf
27
  * @subpackage Value
28
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
29
  * @license http://framework.zend.com/license/new-bsd New BSD License
30
  */
31
  class Zend_Amf_Value_TraitsInfo
15
  * @category Zend
16
  * @package Zend_Amf
17
  * @subpackage Value
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: TraitsInfo.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
25
  *
26
  * @package Zend_Amf
27
  * @subpackage Value
28
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
29
  * @license http://framework.zend.com/license/new-bsd New BSD License
30
  */
31
  class Zend_Amf_Value_TraitsInfo
lib/Zend/Application.php CHANGED
@@ -14,15 +14,15 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Application
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Application.php 23163 2010-10-19 16:30:26Z matthew $
20
  */
21
 
22
  /**
23
  * @category Zend
24
  * @package Zend_Application
25
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
26
  * @license http://framework.zend.com/license/new-bsd New BSD License
27
  */
28
  class Zend_Application
@@ -376,9 +376,12 @@ class Zend_Application
376
  protected function _loadConfig($file)
377
  {
378
  $environment = $this->getEnvironment();
379
- $suffix = strtolower(pathinfo($file, PATHINFO_EXTENSION));
 
 
 
380
 
381
- switch ($suffix) {
382
  case 'ini':
383
  $config = new Zend_Config_Ini($file, $environment);
384
  break;
@@ -392,6 +395,7 @@ class Zend_Application
392
  break;
393
 
394
  case 'yaml':
 
395
  $config = new Zend_Config_Yaml($file, $environment);
396
  break;
397
 
14
  *
15
  * @category Zend
16
  * @package Zend_Application
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Application.php 25024 2012-07-30 15:08:15Z rob $
20
  */
21
 
22
  /**
23
  * @category Zend
24
  * @package Zend_Application
25
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
26
  * @license http://framework.zend.com/license/new-bsd New BSD License
27
  */
28
  class Zend_Application
376
  protected function _loadConfig($file)
377
  {
378
  $environment = $this->getEnvironment();
379
+ $suffix = pathinfo($file, PATHINFO_EXTENSION);
380
+ $suffix = ($suffix === 'dist')
381
+ ? pathinfo(basename($file, ".$suffix"), PATHINFO_EXTENSION)
382
+ : $suffix;
383
 
384
+ switch (strtolower($suffix)) {
385
  case 'ini':
386
  $config = new Zend_Config_Ini($file, $environment);
387
  break;
395
  break;
396
 
397
  case 'yaml':
398
+ case 'yml':
399
  $config = new Zend_Config_Yaml($file, $environment);
400
  break;
401
 
lib/Zend/Application/Bootstrap/Bootstrap.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Bootstrap
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Bootstrap.php 20885 2010-02-03 19:33:59Z matthew $
21
  */
22
 
23
  /**
@@ -29,7 +29,7 @@
29
  * @category Zend
30
  * @package Zend_Application
31
  * @subpackage Bootstrap
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Application_Bootstrap_Bootstrap
@@ -120,7 +120,7 @@ class Zend_Application_Bootstrap_Bootstrap
120
  public function getResourceLoader()
121
  {
122
  if ((null === $this->_resourceLoader)
123
- && (false !== ($namespace = $this->getAppNamespace()))
124
  ) {
125
  $r = new ReflectionClass($this);
126
  $path = $r->getFileName();
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Bootstrap
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Bootstrap.php 25073 2012-11-06 19:31:53Z rob $
21
  */
22
 
23
  /**
29
  * @category Zend
30
  * @package Zend_Application
31
  * @subpackage Bootstrap
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Application_Bootstrap_Bootstrap
120
  public function getResourceLoader()
121
  {
122
  if ((null === $this->_resourceLoader)
123
+ && (false != ($namespace = $this->getAppNamespace()))
124
  ) {
125
  $r = new ReflectionClass($this);
126
  $path = $r->getFileName();
lib/Zend/Application/Bootstrap/BootstrapAbstract.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Bootstrap
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: BootstrapAbstract.php 23278 2010-10-30 12:50:21Z ramon $
21
  */
22
 
23
  /**
@@ -28,7 +28,7 @@
28
  * @category Zend
29
  * @package Zend_Application
30
  * @subpackage Bootstrap
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  abstract class Zend_Application_Bootstrap_BootstrapAbstract
@@ -352,7 +352,9 @@ abstract class Zend_Application_Bootstrap_BootstrapAbstract
352
  continue;
353
  }
354
 
355
- if (class_exists($plugin)) { //@SEE ZF-7550
 
 
356
  $spec = (array) $spec;
357
  $spec['bootstrap'] = $this;
358
  $instance = new $plugin($spec);
@@ -414,7 +416,8 @@ abstract class Zend_Application_Bootstrap_BootstrapAbstract
414
  {
415
  if ($this->_pluginLoader === null) {
416
  $options = array(
417
- 'Zend_Application_Resource' => 'Zend/Application/Resource'
 
418
  );
419
 
420
  $this->_pluginLoader = new Zend_Loader_PluginLoader($options);
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Bootstrap
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: BootstrapAbstract.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
28
  * @category Zend
29
  * @package Zend_Application
30
  * @subpackage Bootstrap
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  abstract class Zend_Application_Bootstrap_BootstrapAbstract
352
  continue;
353
  }
354
 
355
+ if (class_exists($plugin)
356
+ && is_subclass_of($plugin, 'Zend_Application_Resource_Resource')
357
+ ) { //@SEE ZF-7550
358
  $spec = (array) $spec;
359
  $spec['bootstrap'] = $this;
360
  $instance = new $plugin($spec);
416
  {
417
  if ($this->_pluginLoader === null) {
418
  $options = array(
419
+ 'Zend_Application_Resource' => 'Zend/Application/Resource',
420
+ 'ZendX_Application_Resource' => 'ZendX/Application/Resource'
421
  );
422
 
423
  $this->_pluginLoader = new Zend_Loader_PluginLoader($options);
lib/Zend/Application/Bootstrap/Bootstrapper.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Bootstrap
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Bootstrapper.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -26,7 +26,7 @@
26
  * @category Zend
27
  * @package Zend_Application
28
  * @subpackage Bootstrap
29
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  interface Zend_Application_Bootstrap_Bootstrapper
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Bootstrap
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Bootstrapper.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
26
  * @category Zend
27
  * @package Zend_Application
28
  * @subpackage Bootstrap
29
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  interface Zend_Application_Bootstrap_Bootstrapper
lib/Zend/Application/Bootstrap/Exception.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Application
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /**
@@ -30,7 +30,7 @@
30
  * @category Zend
31
  * @package Zend_Application
32
  * @uses Zend_Application_Exception
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Application_Bootstrap_Exception extends Zend_Application_Exception
14
  *
15
  * @category Zend
16
  * @package Zend_Application
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /**
30
  * @category Zend
31
  * @package Zend_Application
32
  * @uses Zend_Application_Exception
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Application_Bootstrap_Exception extends Zend_Application_Exception
lib/Zend/Application/Bootstrap/ResourceBootstrapper.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Bootstrap
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: ResourceBootstrapper.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -26,7 +26,7 @@
26
  * @category Zend
27
  * @package Zend_Application
28
  * @subpackage Bootstrap
29
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  interface Zend_Application_Bootstrap_ResourceBootstrapper
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Bootstrap
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: ResourceBootstrapper.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
26
  * @category Zend
27
  * @package Zend_Application
28
  * @subpackage Bootstrap
29
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  interface Zend_Application_Bootstrap_ResourceBootstrapper
lib/Zend/Application/Exception.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Application
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /**
@@ -30,7 +30,7 @@
30
  * @uses Zend_Exception
31
  * @category Zend
32
  * @package Zend_Application
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Application_Exception extends Zend_Exception
14
  *
15
  * @category Zend
16
  * @package Zend_Application
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Exception.php 25024 2012-07-30 15:08:15Z rob $
20
  */
21
 
22
  /**
30
  * @uses Zend_Exception
31
  * @category Zend
32
  * @package Zend_Application
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Application_Exception extends Zend_Exception
lib/Zend/Application/Module/Autoloader.php CHANGED
@@ -15,8 +15,8 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Module
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
- * @version $Id: Autoloader.php 20250 2010-01-12 22:15:20Z dasprid $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
@@ -30,7 +30,7 @@
30
  * @category Zend
31
  * @package Zend_Application
32
  * @subpackage Module
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Application_Module_Autoloader extends Zend_Loader_Autoloader_Resource
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Module
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
+ * @version $Id: Autoloader.php 24593 2012-01-05 20:35:02Z matthew $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
30
  * @category Zend
31
  * @package Zend_Application
32
  * @subpackage Module
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Application_Module_Autoloader extends Zend_Loader_Autoloader_Resource
lib/Zend/Application/Module/Bootstrap.php CHANGED
@@ -15,8 +15,8 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Module
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
- * @version $Id: Bootstrap.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
@@ -33,7 +33,7 @@
33
  * @category Zend
34
  * @package Zend_Application
35
  * @subpackage Module
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  abstract class Zend_Application_Module_Bootstrap
@@ -97,9 +97,9 @@ abstract class Zend_Application_Module_Bootstrap
97
  /**
98
  * Get default application namespace
99
  *
100
- * Proxies to {@link getModuleName()}, and returns the current module
101
  * name
102
- *
103
  * @return string
104
  */
105
  public function getAppNamespace()
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Module
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
+ * @version $Id: Bootstrap.php 25024 2012-07-30 15:08:15Z rob $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
33
  * @category Zend
34
  * @package Zend_Application
35
  * @subpackage Module
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  abstract class Zend_Application_Module_Bootstrap
97
  /**
98
  * Get default application namespace
99
  *
100
+ * Proxies to {@link getModuleName()}, and returns the current module
101
  * name
102
+ *
103
  * @return string
104
  */
105
  public function getAppNamespace()
lib/Zend/Application/Resource/Cachemanager.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Cachemanager.php 20785 2010-01-31 09:43:03Z mikaelkael $
21
  */
22
 
23
  #require_once 'Zend/Application/Resource/ResourceAbstract.php';
@@ -28,7 +28,7 @@
28
  * @category Zend
29
  * @package Zend_Application
30
  * @subpackage Resource
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Application_Resource_Cachemanager extends Zend_Application_Resource_ResourceAbstract
@@ -57,7 +57,7 @@ class Zend_Application_Resource_Cachemanager extends Zend_Application_Resource_R
57
  {
58
  if (null === $this->_manager) {
59
  $this->_manager = new Zend_Cache_Manager;
60
-
61
  $options = $this->getOptions();
62
  foreach ($options as $key => $value) {
63
  if ($this->_manager->hasCacheTemplate($key)) {
@@ -67,7 +67,7 @@ class Zend_Application_Resource_Cachemanager extends Zend_Application_Resource_R
67
  }
68
  }
69
  }
70
-
71
  return $this->_manager;
72
  }
73
  }
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Cachemanager.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  #require_once 'Zend/Application/Resource/ResourceAbstract.php';
28
  * @category Zend
29
  * @package Zend_Application
30
  * @subpackage Resource
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Application_Resource_Cachemanager extends Zend_Application_Resource_ResourceAbstract
57
  {
58
  if (null === $this->_manager) {
59
  $this->_manager = new Zend_Cache_Manager;
60
+
61
  $options = $this->getOptions();
62
  foreach ($options as $key => $value) {
63
  if ($this->_manager->hasCacheTemplate($key)) {
67
  }
68
  }
69
  }
70
+
71
  return $this->_manager;
72
  }
73
  }
lib/Zend/Application/Resource/Db.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Db.php 22544 2010-07-10 15:01:37Z freak $
21
  */
22
 
23
  /**
@@ -32,7 +32,7 @@
32
  * @category Zend
33
  * @package Zend_Application
34
  * @subpackage Resource
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Application_Resource_Db extends Zend_Application_Resource_ResourceAbstract
@@ -45,7 +45,7 @@ class Zend_Application_Resource_Db extends Zend_Application_Resource_ResourceAbs
45
  protected $_adapter = null;
46
 
47
  /**
48
- * @var Zend_Db_Adapter_Interface
49
  */
50
  protected $_db;
51
 
@@ -66,7 +66,7 @@ class Zend_Application_Resource_Db extends Zend_Application_Resource_ResourceAbs
66
  /**
67
  * Set the adapter
68
  *
69
- * @param $adapter string
70
  * @return Zend_Application_Resource_Db
71
  */
72
  public function setAdapter($adapter)
@@ -88,7 +88,7 @@ class Zend_Application_Resource_Db extends Zend_Application_Resource_ResourceAbs
88
  /**
89
  * Set the adapter params
90
  *
91
- * @param $adapter string
92
  * @return Zend_Application_Resource_Db
93
  */
94
  public function setParams(array $params)
@@ -132,7 +132,7 @@ class Zend_Application_Resource_Db extends Zend_Application_Resource_ResourceAbs
132
  /**
133
  * Retrieve initialized DB connection
134
  *
135
- * @return null|Zend_Db_Adapter_Interface
136
  */
137
  public function getDbAdapter()
138
  {
@@ -140,6 +140,12 @@ class Zend_Application_Resource_Db extends Zend_Application_Resource_ResourceAbs
140
  && (null !== ($adapter = $this->getAdapter()))
141
  ) {
142
  $this->_db = Zend_Db::factory($adapter, $this->getParams());
 
 
 
 
 
 
143
  }
144
  return $this->_db;
145
  }
@@ -152,16 +158,13 @@ class Zend_Application_Resource_Db extends Zend_Application_Resource_ResourceAbs
152
  public function init()
153
  {
154
  if (null !== ($db = $this->getDbAdapter())) {
155
- if ($this->isDefaultTableAdapter()) {
156
- Zend_Db_Table::setDefaultAdapter($db);
157
- }
158
  return $db;
159
  }
160
  }
161
 
162
  /**
163
  * Set the default metadata cache
164
- *
165
  * @param string|Zend_Cache_Core $cache
166
  * @return Zend_Application_Resource_Db
167
  */
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Db.php 25123 2012-11-14 18:27:44Z matthew $
21
  */
22
 
23
  /**
32
  * @category Zend
33
  * @package Zend_Application
34
  * @subpackage Resource
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Application_Resource_Db extends Zend_Application_Resource_ResourceAbstract
45
  protected $_adapter = null;
46
 
47
  /**
48
+ * @var Zend_Db_Adapter_Abstract
49
  */
50
  protected $_db;
51
 
66
  /**
67
  * Set the adapter
68
  *
69
+ * @param string $adapter
70
  * @return Zend_Application_Resource_Db
71
  */
72
  public function setAdapter($adapter)
88
  /**
89
  * Set the adapter params
90
  *
91
+ * @param string $adapter
92
  * @return Zend_Application_Resource_Db
93
  */
94
  public function setParams(array $params)
132
  /**
133
  * Retrieve initialized DB connection
134
  *
135
+ * @return null|Zend_Db_Adapter_Abstract
136
  */
137
  public function getDbAdapter()
138
  {
140
  && (null !== ($adapter = $this->getAdapter()))
141
  ) {
142
  $this->_db = Zend_Db::factory($adapter, $this->getParams());
143
+
144
+ if ($this->_db instanceof Zend_Db_Adapter_Abstract
145
+ && $this->isDefaultTableAdapter()
146
+ ) {
147
+ Zend_Db_Table::setDefaultAdapter($this->_db);
148
+ }
149
  }
150
  return $this->_db;
151
  }
158
  public function init()
159
  {
160
  if (null !== ($db = $this->getDbAdapter())) {
 
 
 
161
  return $db;
162
  }
163
  }
164
 
165
  /**
166
  * Set the default metadata cache
167
+ *
168
  * @param string|Zend_Cache_Core $cache
169
  * @return Zend_Application_Resource_Db
170
  */
lib/Zend/Application/Resource/Dojo.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Dojo.php 21318 2010-03-04 13:20:01Z freak $
21
  */
22
 
23
  /**
@@ -33,7 +33,7 @@
33
  * @category Zend
34
  * @package Zend_Application
35
  * @subpackage Resource
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Application_Resource_Dojo
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Dojo.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
33
  * @category Zend
34
  * @package Zend_Application
35
  * @subpackage Resource
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Application_Resource_Dojo
lib/Zend/Application/Resource/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 22609 2010-07-17 08:47:59Z torio $
21
  */
22
 
23
  /**
@@ -32,7 +32,7 @@
32
  * @category Zend
33
  * @package Zend_Application
34
  * @subpackage Resource
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Application_Resource_Exception extends Zend_Application_Exception
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
32
  * @category Zend
33
  * @package Zend_Application
34
  * @subpackage Resource
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Application_Resource_Exception extends Zend_Application_Exception
lib/Zend/Application/Resource/Frontcontroller.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Frontcontroller.php 23378 2010-11-18 21:48:27Z bittarman $
21
  */
22
 
23
  /**
@@ -32,7 +32,7 @@
32
  * @category Zend
33
  * @package Zend_Application
34
  * @subpackage Resource
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Application_Resource_Frontcontroller extends Zend_Application_Resource_ResourceAbstract
@@ -101,9 +101,9 @@ class Zend_Application_Resource_Frontcontroller extends Zend_Application_Resourc
101
 
102
  case 'plugins':
103
  foreach ((array) $value as $pluginClass) {
104
- $stackIndex = null;
105
- if(is_array($pluginClass)) {
106
- $pluginClass = array_change_key_case($pluginClass, CASE_LOWER);
107
  if(isset($pluginClass['class']))
108
  {
109
  if(isset($pluginClass['stackindex'])) {
@@ -135,6 +135,22 @@ class Zend_Application_Resource_Frontcontroller extends Zend_Application_Resourc
135
  }
136
  break;
137
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  default:
139
  $front->setParam($key, $value);
140
  break;
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Frontcontroller.php 24798 2012-05-12 19:17:41Z adamlundrigan $
21
  */
22
 
23
  /**
32
  * @category Zend
33
  * @package Zend_Application
34
  * @subpackage Resource
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Application_Resource_Frontcontroller extends Zend_Application_Resource_ResourceAbstract
101
 
102
  case 'plugins':
103
  foreach ((array) $value as $pluginClass) {
104
+ $stackIndex = null;
105
+ if(is_array($pluginClass)) {
106
+ $pluginClass = array_change_key_case($pluginClass, CASE_LOWER);
107
  if(isset($pluginClass['class']))
108
  {
109
  if(isset($pluginClass['stackindex'])) {
135
  }
136
  break;
137
 
138
+ case 'dispatcher':
139
+ if(!isset($value['class'])) {
140
+ #require_once 'Zend/Application/Exception.php';
141
+ throw new Zend_Application_Exception('You must specify both ');
142
+ }
143
+ if (!isset($value['params'])) {
144
+ $value['params'] = array();
145
+ }
146
+
147
+ $dispatchClass = $value['class'];
148
+ if(!class_exists($dispatchClass)) {
149
+ #require_once 'Zend/Application/Exception.php';
150
+ throw new Zend_Application_Exception('Dispatcher class not found!');
151
+ }
152
+ $front->setDispatcher(new $dispatchClass((array)$value['params']));
153
+ break;
154
  default:
155
  $front->setParam($key, $value);
156
  break;
lib/Zend/Application/Resource/Layout.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Layout.php 20814 2010-02-01 20:13:08Z freak $
21
  */
22
 
23
  /**
@@ -33,7 +33,7 @@
33
  * @category Zend
34
  * @package Zend_Application
35
  * @subpackage Resource
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Application_Resource_Layout
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Layout.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
33
  * @category Zend
34
  * @package Zend_Application
35
  * @subpackage Resource
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Application_Resource_Layout
lib/Zend/Application/Resource/Locale.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Locale.php 20814 2010-02-01 20:13:08Z freak $
21
  */
22
 
23
  /**
@@ -33,7 +33,7 @@
33
  * @category Zend
34
  * @package Zend_Application
35
  * @subpackage Resource
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Application_Resource_Locale
@@ -56,7 +56,6 @@ class Zend_Application_Resource_Locale
56
  return $this->getLocale();
57
  }
58
 
59
-
60
  /**
61
  * Retrieve locale object
62
  *
@@ -66,7 +65,8 @@ class Zend_Application_Resource_Locale
66
  {
67
  if (null === $this->_locale) {
68
  $options = $this->getOptions();
69
- if(!isset($options['default'])) {
 
70
  $this->_locale = new Zend_Locale();
71
  } elseif(!isset($options['force']) ||
72
  (bool) $options['force'] == false)
@@ -86,4 +86,32 @@ class Zend_Application_Resource_Locale
86
 
87
  return $this->_locale;
88
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  }
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Locale.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
33
  * @category Zend
34
  * @package Zend_Application
35
  * @subpackage Resource
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Application_Resource_Locale
56
  return $this->getLocale();
57
  }
58
 
 
59
  /**
60
  * Retrieve locale object
61
  *
65
  {
66
  if (null === $this->_locale) {
67
  $options = $this->getOptions();
68
+
69
+ if (!isset($options['default'])) {
70
  $this->_locale = new Zend_Locale();
71
  } elseif(!isset($options['force']) ||
72
  (bool) $options['force'] == false)
86
 
87
  return $this->_locale;
88
  }
89
+
90
+ /**
91
+ * Set the cache
92
+ *
93
+ * @param string|Zend_Cache_Core $cache
94
+ * @return Zend_Application_Resource_Locale
95
+ */
96
+ public function setCache($cache)
97
+ {
98
+ if (is_string($cache)) {
99
+ $bootstrap = $this->getBootstrap();
100
+ if ($bootstrap instanceof Zend_Application_Bootstrap_ResourceBootstrapper
101
+ && $bootstrap->hasPluginResource('CacheManager')
102
+ ) {
103
+ $cacheManager = $bootstrap->bootstrap('CacheManager')
104
+ ->getResource('CacheManager');
105
+ if (null !== $cacheManager && $cacheManager->hasCache($cache)) {
106
+ $cache = $cacheManager->getCache($cache);
107
+ }
108
+ }
109
+ }
110
+
111
+ if ($cache instanceof Zend_Cache_Core) {
112
+ Zend_Locale::setCache($cache);
113
+ }
114
+
115
+ return $this;
116
+ }
117
  }
lib/Zend/Application/Resource/Log.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Log.php 20814 2010-02-01 20:13:08Z freak $
21
  */
22
 
23
  /**
@@ -27,13 +27,13 @@
27
 
28
 
29
  /**
30
- * Resource for initializing the locale
31
  *
32
  * @uses Zend_Application_Resource_ResourceAbstract
33
  * @category Zend
34
  * @package Zend_Application
35
  * @subpackage Resource
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Application_Resource_Log
@@ -56,8 +56,8 @@ class Zend_Application_Resource_Log
56
 
57
  /**
58
  * Attach logger
59
- *
60
- * @param Zend_Log $log
61
  * @return Zend_Application_Resource_Log
62
  */
63
  public function setLog(Zend_Log $log)
@@ -66,6 +66,11 @@ class Zend_Application_Resource_Log
66
  return $this;
67
  }
68
 
 
 
 
 
 
69
  public function getLog()
70
  {
71
  if (null === $this->_log) {
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Log.php 24607 2012-01-16 16:45:49Z xerkus $
21
  */
22
 
23
  /**
27
 
28
 
29
  /**
30
+ * Resource for initializing logger
31
  *
32
  * @uses Zend_Application_Resource_ResourceAbstract
33
  * @category Zend
34
  * @package Zend_Application
35
  * @subpackage Resource
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Application_Resource_Log
56
 
57
  /**
58
  * Attach logger
59
+ *
60
+ * @param Zend_Log $log
61
  * @return Zend_Application_Resource_Log
62
  */
63
  public function setLog(Zend_Log $log)
66
  return $this;
67
  }
68
 
69
+ /**
70
+ * Retrieve logger object
71
+ *
72
+ * @return Zend_Log
73
+ */
74
  public function getLog()
75
  {
76
  if (null === $this->_log) {
lib/Zend/Application/Resource/Mail.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Mail.php 21015 2010-02-11 01:56:02Z freak $
21
  */
22
 
23
  /**
@@ -32,7 +32,7 @@
32
  * @category Zend
33
  * @package Zend_Application
34
  * @subpackage Resource
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Application_Resource_Mail extends Zend_Application_Resource_ResourceAbstract
@@ -46,7 +46,7 @@ class Zend_Application_Resource_Mail extends Zend_Application_Resource_ResourceA
46
  public function init() {
47
  return $this->getMail();
48
  }
49
-
50
  /**
51
  *
52
  * @return Zend_Mail_Transport_Abstract|null
@@ -56,7 +56,7 @@ class Zend_Application_Resource_Mail extends Zend_Application_Resource_ResourceA
56
  if (null === $this->_transport) {
57
  $options = $this->getOptions();
58
  foreach($options as $key => $option) {
59
- $options[strtolower($key)] = $option;
60
  }
61
  $this->setOptions($options);
62
 
@@ -73,14 +73,14 @@ class Zend_Application_Resource_Mail extends Zend_Application_Resource_ResourceA
73
  Zend_Mail::setDefaultTransport($this->_transport);
74
  }
75
  }
76
-
77
  $this->_setDefaults('from');
78
  $this->_setDefaults('replyTo');
79
  }
80
 
81
  return $this->_transport;
82
  }
83
-
84
  protected function _setDefaults($type) {
85
  $key = strtolower('default' . $type);
86
  $options = $this->getOptions();
@@ -99,13 +99,13 @@ class Zend_Application_Resource_Mail extends Zend_Application_Resource_ResourceA
99
  }
100
  }
101
  }
102
-
103
  protected function _setupTransport($options)
104
  {
105
- if(!isset($options['type'])) {
106
- $options['type'] = 'sendmail';
107
- }
108
-
109
  $transportName = $options['type'];
110
  if(!Zend_Loader_Autoloader::autoload($transportName))
111
  {
@@ -122,9 +122,10 @@ class Zend_Application_Resource_Mail extends Zend_Application_Resource_ResourceA
122
  }
123
  }
124
  }
125
-
126
  unset($options['type']);
127
-
 
128
  switch($transportName) {
129
  case 'Zend_Mail_Transport_Smtp':
130
  if(!isset($options['host'])) {
@@ -132,7 +133,7 @@ class Zend_Application_Resource_Mail extends Zend_Application_Resource_ResourceA
132
  'A host is necessary for smtp transport,'
133
  .' but none was given');
134
  }
135
-
136
  $transport = new $transportName($options['host'], $options);
137
  break;
138
  case 'Zend_Mail_Transport_Sendmail':
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Mail.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
32
  * @category Zend
33
  * @package Zend_Application
34
  * @subpackage Resource
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Application_Resource_Mail extends Zend_Application_Resource_ResourceAbstract
46
  public function init() {
47
  return $this->getMail();
48
  }
49
+
50
  /**
51
  *
52
  * @return Zend_Mail_Transport_Abstract|null
56
  if (null === $this->_transport) {
57
  $options = $this->getOptions();
58
  foreach($options as $key => $option) {
59
+ $options[strtolower($key)] = $option;
60
  }
61
  $this->setOptions($options);
62
 
73
  Zend_Mail::setDefaultTransport($this->_transport);
74
  }
75
  }
76
+
77
  $this->_setDefaults('from');
78
  $this->_setDefaults('replyTo');
79
  }
80
 
81
  return $this->_transport;
82
  }
83
+
84
  protected function _setDefaults($type) {
85
  $key = strtolower('default' . $type);
86
  $options = $this->getOptions();
99
  }
100
  }
101
  }
102
+
103
  protected function _setupTransport($options)
104
  {
105
+ if(!isset($options['type'])) {
106
+ $options['type'] = 'sendmail';
107
+ }
108
+
109
  $transportName = $options['type'];
110
  if(!Zend_Loader_Autoloader::autoload($transportName))
111
  {
122
  }
123
  }
124
  }
125
+
126
  unset($options['type']);
127
+ unset($options['register']); //@see ZF-11022
128
+
129
  switch($transportName) {
130
  case 'Zend_Mail_Transport_Smtp':
131
  if(!isset($options['host'])) {
133
  'A host is necessary for smtp transport,'
134
  .' but none was given');
135
  }
136
+
137
  $transport = new $transportName($options['host'], $options);
138
  break;
139
  case 'Zend_Mail_Transport_Sendmail':
lib/Zend/Application/Resource/Modules.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Modules.php 20814 2010-02-01 20:13:08Z freak $
21
  */
22
 
23
  /**
@@ -32,7 +32,7 @@
32
  * @category Zend
33
  * @package Zend_Application
34
  * @subpackage Resource
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Application_Resource_Modules extends Zend_Application_Resource_ResourceAbstract
@@ -62,6 +62,7 @@ class Zend_Application_Resource_Modules extends Zend_Application_Resource_Resour
62
  */
63
  public function init()
64
  {
 
65
  $bootstrap = $this->getBootstrap();
66
  $bootstrap->bootstrap('FrontController');
67
  $front = $bootstrap->getResource('FrontController');
@@ -103,12 +104,28 @@ class Zend_Application_Resource_Modules extends Zend_Application_Resource_Resour
103
  continue;
104
  }
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  $moduleBootstrap = new $bootstrapClass($bootstrap);
107
  $moduleBootstrap->bootstrap();
108
- $this->_bootstraps[$module] = $moduleBootstrap;
109
  }
110
 
111
- return $this->_bootstraps;
112
  }
113
 
114
  /**
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Modules.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
32
  * @category Zend
33
  * @package Zend_Application
34
  * @subpackage Resource
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Application_Resource_Modules extends Zend_Application_Resource_ResourceAbstract
62
  */
63
  public function init()
64
  {
65
+ $bootstraps = array();
66
  $bootstrap = $this->getBootstrap();
67
  $bootstrap->bootstrap('FrontController');
68
  $front = $bootstrap->getResource('FrontController');
104
  continue;
105
  }
106
 
107
+ $bootstraps[$module] = $bootstrapClass;
108
+ }
109
+
110
+ return $this->_bootstraps = $this->bootstrapBootstraps($bootstraps);
111
+ }
112
+
113
+ /*
114
+ * Bootstraps the bootstraps found. Allows for easy extension.
115
+ * @param array $bootstraps Array containing the bootstraps to instantiate
116
+ */
117
+ protected function bootstrapBootstraps($bootstraps)
118
+ {
119
+ $bootstrap = $this->getBootstrap();
120
+ $out = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
121
+
122
+ foreach($bootstraps as $module => $bootstrapClass) {
123
  $moduleBootstrap = new $bootstrapClass($bootstrap);
124
  $moduleBootstrap->bootstrap();
125
+ $out[$module] = $moduleBootstrap;
126
  }
127
 
128
+ return $out;
129
  }
130
 
131
  /**
lib/Zend/Application/Resource/Multidb.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Multidb.php 22546 2010-07-10 15:18:12Z freak $
21
  */
22
 
23
  #require_once 'Zend/Application/Resource/ResourceAbstract.php';
@@ -51,7 +51,7 @@
51
  * @category Zend
52
  * @package Zend_Application
53
  * @subpackage Resource
54
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
55
  * @license http://framework.zend.com/license/new-bsd New BSD License
56
  */
57
  class Zend_Application_Resource_Multidb extends Zend_Application_Resource_ResourceAbstract
@@ -85,7 +85,7 @@ class Zend_Application_Resource_Multidb extends Zend_Application_Resource_Resour
85
  }
86
 
87
  foreach ($options as $id => $params) {
88
- $adapter = $params['adapter'];
89
  $default = (int) (
90
  isset($params['isDefaultTableAdapter']) && $params['isDefaultTableAdapter']
91
  || isset($params['default']) && $params['default']
@@ -178,7 +178,7 @@ class Zend_Application_Resource_Multidb extends Zend_Application_Resource_Resour
178
 
179
  /**
180
  * Set the default metadata cache
181
- *
182
  * @param string|Zend_Cache_Core $cache
183
  * @return Zend_Application_Resource_Multidb
184
  */
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Multidb.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  #require_once 'Zend/Application/Resource/ResourceAbstract.php';
51
  * @category Zend
52
  * @package Zend_Application
53
  * @subpackage Resource
54
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
55
  * @license http://framework.zend.com/license/new-bsd New BSD License
56
  */
57
  class Zend_Application_Resource_Multidb extends Zend_Application_Resource_ResourceAbstract
85
  }
86
 
87
  foreach ($options as $id => $params) {
88
+ $adapter = $params['adapter'];
89
  $default = (int) (
90
  isset($params['isDefaultTableAdapter']) && $params['isDefaultTableAdapter']
91
  || isset($params['default']) && $params['default']
178
 
179
  /**
180
  * Set the default metadata cache
181
+ *
182
  * @param string|Zend_Cache_Core $cache
183
  * @return Zend_Application_Resource_Multidb
184
  */
lib/Zend/Application/Resource/Navigation.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Navigation.php 22882 2010-08-22 14:00:16Z freak $
21
  */
22
 
23
  /**
@@ -33,7 +33,7 @@
33
  * @category Zend
34
  * @package Zend_Application
35
  * @subpackage Resource
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @author Dolf Schimmel
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
@@ -56,12 +56,13 @@ class Zend_Application_Resource_Navigation
56
  {
57
  if (!$this->_container) {
58
  $options = $this->getOptions();
59
- $pages = isset($options['pages']) ? $options['pages'] : array();
60
- $this->_container = new Zend_Navigation($pages);
61
-
62
  if(isset($options['defaultPageType'])) {
63
  Zend_Navigation_Page::setDefaultPageType($options['defaultPageType']);
64
  }
 
 
 
65
  }
66
 
67
  $this->store();
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Navigation.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
33
  * @category Zend
34
  * @package Zend_Application
35
  * @subpackage Resource
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @author Dolf Schimmel
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
56
  {
57
  if (!$this->_container) {
58
  $options = $this->getOptions();
59
+
 
 
60
  if(isset($options['defaultPageType'])) {
61
  Zend_Navigation_Page::setDefaultPageType($options['defaultPageType']);
62
  }
63
+
64
+ $pages = isset($options['pages']) ? $options['pages'] : array();
65
+ $this->_container = new Zend_Navigation($pages);
66
  }
67
 
68
  $this->store();
lib/Zend/Application/Resource/Resource.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Resource.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -26,7 +26,7 @@
26
  * @category Zend
27
  * @package Zend_Application
28
  * @subpackage Resource
29
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  interface Zend_Application_Resource_Resource
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Resource.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
26
  * @category Zend
27
  * @package Zend_Application
28
  * @subpackage Resource
29
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  interface Zend_Application_Resource_Resource
lib/Zend/Application/Resource/ResourceAbstract.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: ResourceAbstract.php 23384 2010-11-19 00:00:29Z ramon $
21
  */
22
 
23
  /**
@@ -32,7 +32,7 @@
32
  * @category Zend
33
  * @package Zend_Application
34
  * @subpackage Resource
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  abstract class Zend_Application_Resource_ResourceAbstract implements Zend_Application_Resource_Resource
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: ResourceAbstract.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
32
  * @category Zend
33
  * @package Zend_Application
34
  * @subpackage Resource
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  abstract class Zend_Application_Resource_ResourceAbstract implements Zend_Application_Resource_Resource
lib/Zend/Application/Resource/Router.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Router.php 20814 2010-02-01 20:13:08Z freak $
21
  */
22
 
23
  /**
@@ -33,7 +33,7 @@
33
  * @category Zend
34
  * @package Zend_Application
35
  * @subpackage Resource
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Application_Resource_Router
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Router.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
33
  * @category Zend
34
  * @package Zend_Application
35
  * @subpackage Resource
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Application_Resource_Router
lib/Zend/Application/Resource/Session.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Session.php 20814 2010-02-01 20:13:08Z freak $
21
  */
22
 
23
  /**
@@ -33,7 +33,7 @@
33
  * @category Zend
34
  * @package Zend_Application
35
  * @subpackage Resource
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Application_Resource_Session extends Zend_Application_Resource_ResourceAbstract
@@ -50,7 +50,7 @@ class Zend_Application_Resource_Session extends Zend_Application_Resource_Resour
50
  *
51
  * @param array|string|Zend_Session_SaveHandler_Interface $saveHandler
52
  * @return Zend_Application_Resource_Session
53
- * @throws Zend_Application_Resource_Exception When $saveHandler is no valid save handler
54
  */
55
  public function setSaveHandler($saveHandler)
56
  {
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Session.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
33
  * @category Zend
34
  * @package Zend_Application
35
  * @subpackage Resource
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Application_Resource_Session extends Zend_Application_Resource_ResourceAbstract
50
  *
51
  * @param array|string|Zend_Session_SaveHandler_Interface $saveHandler
52
  * @return Zend_Application_Resource_Session
53
+ * @throws Zend_Application_Resource_Exception When $saveHandler is not a valid save handler
54
  */
55
  public function setSaveHandler($saveHandler)
56
  {
lib/Zend/Application/Resource/Translate.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Translate.php 22968 2010-09-18 19:50:02Z intiilapa $
21
  */
22
 
23
  /**
@@ -33,7 +33,7 @@
33
  * @category Zend
34
  * @package Zend_Application
35
  * @subpackage Resource
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Application_Resource_Translate extends Zend_Application_Resource_ResourceAbstract
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Translate.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
33
  * @category Zend
34
  * @package Zend_Application
35
  * @subpackage Resource
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Application_Resource_Translate extends Zend_Application_Resource_ResourceAbstract
lib/Zend/Application/Resource/Useragent.php CHANGED
@@ -1,72 +1,72 @@
1
- <?php
2
- /**
3
- * Zend Framework
4
- *
5
- * LICENSE
6
- *
7
- * This source file is subject to the new BSD license that is bundled
8
- * with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://framework.zend.com/license/new-bsd
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@zend.com so we can send you a copy immediately.
14
- *
15
- * @category Zend
16
- * @package Zend_Application
17
- * @subpackage Resource
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
- * @license http://framework.zend.com/license/new-bsd New BSD License
20
- */
21
-
22
- /**
23
- * @category Zend
24
- * @package Zend_Application
25
- * @subpackage Resource
26
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
27
- * @license http://framework.zend.com/license/new-bsd New BSD License
28
- */
29
- class Zend_Application_Resource_UserAgent extends Zend_Application_Resource_ResourceAbstract
30
- {
31
- /**
32
- * @var Zend_Http_UserAgent
33
- */
34
- protected $_userAgent;
35
-
36
- /**
37
- * Intialize resource
38
- *
39
- * @return Zend_Http_UserAgent
40
- */
41
- public function init()
42
- {
43
- $userAgent = $this->getUserAgent();
44
-
45
- // Optionally seed the UserAgent view helper
46
- $bootstrap = $this->getBootstrap();
47
- if ($bootstrap->hasResource('view') || $bootstrap->hasPluginResource('view')) {
48
- $bootstrap->bootstrap('view');
49
- $view = $bootstrap->getResource('view');
50
- if (null !== $view) {
51
- $view->userAgent($userAgent);
52
- }
53
- }
54
-
55
- return $userAgent;
56
- }
57
-
58
- /**
59
- * Get UserAgent instance
60
- *
61
- * @return Zend_Http_UserAgent
62
- */
63
- public function getUserAgent()
64
- {
65
- if (null === $this->_userAgent) {
66
- $options = $this->getOptions();
67
- $this->_userAgent = new Zend_Http_UserAgent($options);
68
- }
69
-
70
- return $this->_userAgent;
71
- }
72
- }
1
+ <?php
2
+ /**
3
+ * Zend Framework
4
+ *
5
+ * LICENSE
6
+ *
7
+ * This source file is subject to the new BSD license that is bundled
8
+ * with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://framework.zend.com/license/new-bsd
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@zend.com so we can send you a copy immediately.
14
+ *
15
+ * @category Zend
16
+ * @package Zend_Application
17
+ * @subpackage Resource
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
+ * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ */
21
+
22
+ /**
23
+ * @category Zend
24
+ * @package Zend_Application
25
+ * @subpackage Resource
26
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27
+ * @license http://framework.zend.com/license/new-bsd New BSD License
28
+ */
29
+ class Zend_Application_Resource_UserAgent extends Zend_Application_Resource_ResourceAbstract
30
+ {
31
+ /**
32
+ * @var Zend_Http_UserAgent
33
+ */
34
+ protected $_userAgent;
35
+
36
+ /**
37
+ * Intialize resource
38
+ *
39
+ * @return Zend_Http_UserAgent
40
+ */
41
+ public function init()
42
+ {
43
+ $userAgent = $this->getUserAgent();
44
+
45
+ // Optionally seed the UserAgent view helper
46
+ $bootstrap = $this->getBootstrap();
47
+ if ($bootstrap->hasResource('view') || $bootstrap->hasPluginResource('view')) {
48
+ $bootstrap->bootstrap('view');
49
+ $view = $bootstrap->getResource('view');
50
+ if (null !== $view) {
51
+ $view->userAgent($userAgent);
52
+ }
53
+ }
54
+
55
+ return $userAgent;
56
+ }
57
+
58
+ /**
59
+ * Get UserAgent instance
60
+ *
61
+ * @return Zend_Http_UserAgent
62
+ */
63
+ public function getUserAgent()
64
+ {
65
+ if (null === $this->_userAgent) {
66
+ $options = $this->getOptions();
67
+ $this->_userAgent = new Zend_Http_UserAgent($options);
68
+ }
69
+
70
+ return $this->_userAgent;
71
+ }
72
+ }
lib/Zend/Application/Resource/View.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: View.php 22965 2010-09-18 17:45:51Z intiilapa $
21
  */
22
 
23
  /**
@@ -33,7 +33,7 @@
33
  * @category Zend
34
  * @package Zend_Application
35
  * @subpackage Resource
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Application_Resource_View extends Zend_Application_Resource_ResourceAbstract
@@ -52,9 +52,8 @@ class Zend_Application_Resource_View extends Zend_Application_Resource_ResourceA
52
  {
53
  $view = $this->getView();
54
 
55
- $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
56
  $viewRenderer->setView($view);
57
- Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
58
  return $view;
59
  }
60
 
@@ -78,6 +77,9 @@ class Zend_Application_Resource_View extends Zend_Application_Resource_ResourceA
78
  if (isset($options['contentType'])) {
79
  $this->_view->headMeta()->appendHttpEquiv('Content-Type', $options['contentType']);
80
  }
 
 
 
81
  }
82
  return $this->_view;
83
  }
15
  * @category Zend
16
  * @package Zend_Application
17
  * @subpackage Resource
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: View.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
33
  * @category Zend
34
  * @package Zend_Application
35
  * @subpackage Resource
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Application_Resource_View extends Zend_Application_Resource_ResourceAbstract
52
  {
53
  $view = $this->getView();
54
 
55
+ $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
56
  $viewRenderer->setView($view);
 
57
  return $view;
58
  }
59
 
77
  if (isset($options['contentType'])) {
78
  $this->_view->headMeta()->appendHttpEquiv('Content-Type', $options['contentType']);
79
  }
80
+ if (isset($options['assign']) && is_array($options['assign'])) {
81
+ $this->_view->assign($options['assign']);
82
+ }
83
  }
84
  return $this->_view;
85
  }
lib/Zend/Auth.php CHANGED
@@ -14,16 +14,16 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Auth
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Auth.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_Auth
26
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  class Zend_Auth
14
  *
15
  * @category Zend
16
  * @package Zend_Auth
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Auth.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_Auth
26
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  class Zend_Auth
lib/Zend/Auth/Adapter/DbTable.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: DbTable.php 22613 2010-07-17 13:43:22Z dragonbe $
21
  */
22
 
23
 
@@ -41,7 +41,7 @@
41
  * @category Zend
42
  * @package Zend_Auth
43
  * @subpackage Adapter
44
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
45
  * @license http://framework.zend.com/license/new-bsd New BSD License
46
  */
47
  class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
@@ -114,12 +114,12 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
114
  * @var array
115
  */
116
  protected $_resultRow = null;
117
-
118
  /**
119
- * $_ambiguityIdentity - Flag to indicate same Identity can be used with
120
  * different credentials. Default is FALSE and need to be set to true to
121
  * allow ambiguity usage.
122
- *
123
  * @var boolean
124
  */
125
  protected $_ambiguityIdentity = false;
@@ -159,7 +159,7 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
159
  /**
160
  * _setDbAdapter() - set the database adapter to be used for quering
161
  *
162
- * @param Zend_Db_Adapter_Abstract
163
  * @throws Zend_Auth_Adapter_Exception
164
  * @return Zend_Auth_Adapter_DbTable
165
  */
@@ -178,7 +178,7 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
178
  throw new Zend_Auth_Adapter_Exception('No database adapter present');
179
  }
180
  }
181
-
182
  return $this;
183
  }
184
 
@@ -265,12 +265,12 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
265
  $this->_credential = $credential;
266
  return $this;
267
  }
268
-
269
  /**
270
  * setAmbiguityIdentity() - sets a flag for usage of identical identities
271
  * with unique credentials. It accepts integers (0, 1) or boolean (true,
272
  * false) parameters. Default is false.
273
- *
274
  * @param int|bool $flag
275
  * @return Zend_Auth_Adapter_DbTable
276
  */
@@ -284,9 +284,9 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
284
  return $this;
285
  }
286
  /**
287
- * getAmbiguityIdentity() - returns TRUE for usage of multiple identical
288
  * identies with different credentials, FALSE if not used.
289
- *
290
  * @return bool
291
  */
292
  public function getAmbiguityIdentity()
@@ -367,7 +367,7 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
367
  $this->_authenticateSetup();
368
  $dbSelect = $this->_authenticateCreateSelect();
369
  $resultIdentities = $this->_authenticateQuerySelect($dbSelect);
370
-
371
  if ( ($authResult = $this->_authenticateValidateResultSet($resultIdentities)) instanceof Zend_Auth_Result) {
372
  return $authResult;
373
  }
@@ -382,7 +382,7 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
382
  }
383
  $resultIdentities = $validIdentities;
384
  }
385
-
386
  $authResult = $this->_authenticateValidateResult(array_shift($resultIdentities));
387
  return $authResult;
388
  }
@@ -477,7 +477,7 @@ class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
477
  $origDbFetchMode = $this->_zendDb->getFetchMode();
478
  $this->_zendDb->setFetchMode(Zend_DB::FETCH_ASSOC);
479
  }
480
- $resultIdentities = $this->_zendDb->fetchAll($dbSelect->__toString());
481
  if (isset($origDbFetchMode)) {
482
  $this->_zendDb->setFetchMode($origDbFetchMode);
483
  unset($origDbFetchMode);
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: DbTable.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
41
  * @category Zend
42
  * @package Zend_Auth
43
  * @subpackage Adapter
44
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
45
  * @license http://framework.zend.com/license/new-bsd New BSD License
46
  */
47
  class Zend_Auth_Adapter_DbTable implements Zend_Auth_Adapter_Interface
114
  * @var array
115
  */
116
  protected $_resultRow = null;
117
+
118
  /**
119
+ * $_ambiguityIdentity - Flag to indicate same Identity can be used with
120
  * different credentials. Default is FALSE and need to be set to true to
121
  * allow ambiguity usage.
122
+ *
123
  * @var boolean
124
  */
125
  protected $_ambiguityIdentity = false;
159
  /**
160
  * _setDbAdapter() - set the database adapter to be used for quering
161
  *
162
+ * @param Zend_Db_Adapter_Abstract
163
  * @throws Zend_Auth_Adapter_Exception
164
  * @return Zend_Auth_Adapter_DbTable
165
  */
178
  throw new Zend_Auth_Adapter_Exception('No database adapter present');
179
  }
180
  }
181
+
182
  return $this;
183
  }
184
 
265
  $this->_credential = $credential;
266
  return $this;
267
  }
268
+
269
  /**
270
  * setAmbiguityIdentity() - sets a flag for usage of identical identities
271
  * with unique credentials. It accepts integers (0, 1) or boolean (true,
272
  * false) parameters. Default is false.
273
+ *
274
  * @param int|bool $flag
275
  * @return Zend_Auth_Adapter_DbTable
276
  */
284
  return $this;
285
  }
286
  /**
287
+ * getAmbiguityIdentity() - returns TRUE for usage of multiple identical
288
  * identies with different credentials, FALSE if not used.
289
+ *
290
  * @return bool
291
  */
292
  public function getAmbiguityIdentity()
367
  $this->_authenticateSetup();
368
  $dbSelect = $this->_authenticateCreateSelect();
369
  $resultIdentities = $this->_authenticateQuerySelect($dbSelect);
370
+
371
  if ( ($authResult = $this->_authenticateValidateResultSet($resultIdentities)) instanceof Zend_Auth_Result) {
372
  return $authResult;
373
  }
382
  }
383
  $resultIdentities = $validIdentities;
384
  }
385
+
386
  $authResult = $this->_authenticateValidateResult(array_shift($resultIdentities));
387
  return $authResult;
388
  }
477
  $origDbFetchMode = $this->_zendDb->getFetchMode();
478
  $this->_zendDb->setFetchMode(Zend_DB::FETCH_ASSOC);
479
  }
480
+ $resultIdentities = $this->_zendDb->fetchAll($dbSelect);
481
  if (isset($origDbFetchMode)) {
482
  $this->_zendDb->setFetchMode($origDbFetchMode);
483
  unset($origDbFetchMode);
lib/Zend/Auth/Adapter/Digest.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Digest.php 23088 2010-10-11 19:53:24Z padraic $
21
  */
22
 
23
 
@@ -31,7 +31,7 @@
31
  * @category Zend
32
  * @package Zend_Auth
33
  * @subpackage Adapter
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Auth_Adapter_Digest implements Zend_Auth_Adapter_Interface
@@ -227,7 +227,7 @@ class Zend_Auth_Adapter_Digest implements Zend_Auth_Adapter_Interface
227
  $result['messages'][] = "Username '$this->_username' and realm '$this->_realm' combination not found";
228
  return new Zend_Auth_Result($result['code'], $result['identity'], $result['messages']);
229
  }
230
-
231
  /**
232
  * Securely compare two strings for equality while avoided C level memcmp()
233
  * optimisations capable of leaking timing information useful to an attacker
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Digest.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
31
  * @category Zend
32
  * @package Zend_Auth
33
  * @subpackage Adapter
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Auth_Adapter_Digest implements Zend_Auth_Adapter_Interface
227
  $result['messages'][] = "Username '$this->_username' and realm '$this->_realm' combination not found";
228
  return new Zend_Auth_Result($result['code'], $result['identity'], $result['messages']);
229
  }
230
+
231
  /**
232
  * Securely compare two strings for equality while avoided C level memcmp()
233
  * optimisations capable of leaking timing information useful to an attacker
lib/Zend/Auth/Adapter/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -31,7 +31,7 @@
31
  * @category Zend
32
  * @package Zend_Auth
33
  * @subpackage Adapter
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Auth_Adapter_Exception extends Zend_Auth_Exception
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
31
  * @category Zend
32
  * @package Zend_Auth
33
  * @subpackage Adapter
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Auth_Adapter_Exception extends Zend_Auth_Exception
lib/Zend/Auth/Adapter/Http.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Zend_Auth_Adapter_Http
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Http.php 23088 2010-10-11 19:53:24Z padraic $
21
  */
22
 
23
 
@@ -35,7 +35,7 @@
35
  * @category Zend
36
  * @package Zend_Auth
37
  * @subpackage Zend_Auth_Adapter_Http
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  * @todo Support auth-int
41
  * @todo Track nonces, nonce-count, opaque for replay protection and stale support
@@ -844,7 +844,7 @@ class Zend_Auth_Adapter_Http implements Zend_Auth_Adapter_Interface
844
 
845
  return $data;
846
  }
847
-
848
  /**
849
  * Securely compare two strings for equality while avoided C level memcmp()
850
  * optimisations capable of leaking timing information useful to an attacker
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Zend_Auth_Adapter_Http
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Http.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
35
  * @category Zend
36
  * @package Zend_Auth
37
  * @subpackage Zend_Auth_Adapter_Http
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  * @todo Support auth-int
41
  * @todo Track nonces, nonce-count, opaque for replay protection and stale support
844
 
845
  return $data;
846
  }
847
+
848
  /**
849
  * Securely compare two strings for equality while avoided C level memcmp()
850
  * optimisations capable of leaking timing information useful to an attacker
lib/Zend/Auth/Adapter/Http/Resolver/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Zend_Auth_Adapter_Http
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -33,7 +33,7 @@
33
  * @category Zend
34
  * @package Zend_Auth
35
  * @subpackage Zend_Auth_Adapter_Http
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Auth_Adapter_Http_Resolver_Exception extends Zend_Auth_Exception
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Zend_Auth_Adapter_Http
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
33
  * @category Zend
34
  * @package Zend_Auth
35
  * @subpackage Zend_Auth_Adapter_Http
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Auth_Adapter_Http_Resolver_Exception extends Zend_Auth_Exception
lib/Zend/Auth/Adapter/Http/Resolver/File.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Zend_Auth_Adapter_Http
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: File.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -33,7 +33,7 @@
33
  * @category Zend
34
  * @package Zend_Auth
35
  * @subpackage Zend_Auth_Adapter_Http
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Auth_Adapter_Http_Resolver_File implements Zend_Auth_Adapter_Http_Resolver_Interface
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Zend_Auth_Adapter_Http
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: File.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
33
  * @category Zend
34
  * @package Zend_Auth
35
  * @subpackage Zend_Auth_Adapter_Http
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Auth_Adapter_Http_Resolver_File implements Zend_Auth_Adapter_Http_Resolver_Interface
lib/Zend/Auth/Adapter/Http/Resolver/Interface.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Zend_Auth_Adapter_Http
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -30,7 +30,7 @@
30
  * @category Zend
31
  * @package Zend_Auth
32
  * @subpackage Zend_Auth_Adapter_Http
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  interface Zend_Auth_Adapter_Http_Resolver_Interface
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Zend_Auth_Adapter_Http
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
30
  * @category Zend
31
  * @package Zend_Auth
32
  * @subpackage Zend_Auth_Adapter_Http
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  interface Zend_Auth_Adapter_Http_Resolver_Interface
lib/Zend/Auth/Adapter/InfoCard.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Zend_Auth_Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: InfoCard.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -42,7 +42,7 @@
42
  * @category Zend
43
  * @package Zend_Auth
44
  * @subpackage Zend_Auth_Adapter
45
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
46
  * @license http://framework.zend.com/license/new-bsd New BSD License
47
  */
48
  class Zend_Auth_Adapter_InfoCard implements Zend_Auth_Adapter_Interface
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Zend_Auth_Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: InfoCard.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
42
  * @category Zend
43
  * @package Zend_Auth
44
  * @subpackage Zend_Auth_Adapter
45
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
46
  * @license http://framework.zend.com/license/new-bsd New BSD License
47
  */
48
  class Zend_Auth_Adapter_InfoCard implements Zend_Auth_Adapter_Interface
lib/Zend/Auth/Adapter/Interface.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Zend_Auth_Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -31,7 +31,7 @@
31
  * @category Zend
32
  * @package Zend_Auth
33
  * @subpackage Zend_Auth_Adapter
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  interface Zend_Auth_Adapter_Interface
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Zend_Auth_Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
31
  * @category Zend
32
  * @package Zend_Auth
33
  * @subpackage Zend_Auth_Adapter
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  interface Zend_Auth_Adapter_Interface
lib/Zend/Auth/Adapter/Ldap.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Zend_Auth_Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Ldap.php 21319 2010-03-04 16:02:16Z sgehrig $
21
  */
22
 
23
  /**
@@ -29,7 +29,7 @@
29
  * @category Zend
30
  * @package Zend_Auth
31
  * @subpackage Zend_Auth_Adapter
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
@@ -335,8 +335,8 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
335
  $messages[1] = '';
336
  $messages[] = "$canonicalName authentication successful";
337
  if ($requireRebind === true) {
338
- // rebinding with authenticated user
339
- $ldap->bind($dn, $password);
340
  }
341
  return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $canonicalName, $messages);
342
  } else {
@@ -371,7 +371,11 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
371
  } else {
372
  $line = $zle->getLine();
373
  $messages[] = $zle->getFile() . "($line): " . $zle->getMessage();
374
- $messages[] = str_replace($password, '*****', $zle->getTraceAsString());
 
 
 
 
375
  $messages[0] = 'An unexpected failure occurred';
376
  }
377
  $messages[1] = $zle->getMessage();
@@ -488,7 +492,9 @@ class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
488
 
489
  $returnObject = new stdClass();
490
 
491
- $omitAttribs = array_map('strtolower', $omitAttribs);
 
 
492
 
493
  $entry = $this->getLdap()->getEntry($this->_authenticatedDn, $returnAttribs, true);
494
  foreach ($entry as $attr => $value) {
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Zend_Auth_Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Ldap.php 24618 2012-02-03 08:32:06Z sgehrig $
21
  */
22
 
23
  /**
29
  * @category Zend
30
  * @package Zend_Auth
31
  * @subpackage Zend_Auth_Adapter
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Auth_Adapter_Ldap implements Zend_Auth_Adapter_Interface
335
  $messages[1] = '';
336
  $messages[] = "$canonicalName authentication successful";
337
  if ($requireRebind === true) {
338
+ // rebinding with authenticated user
339
+ $ldap->bind($dn, $password);
340
  }
341
  return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $canonicalName, $messages);
342
  } else {
371
  } else {
372
  $line = $zle->getLine();
373
  $messages[] = $zle->getFile() . "($line): " . $zle->getMessage();
374
+ $messages[] = preg_replace(
375
+ '/\b'.preg_quote(substr($password, 0, 15), '/').'\b/',
376
+ '*****',
377
+ $zle->getTraceAsString()
378
+ );
379
  $messages[0] = 'An unexpected failure occurred';
380
  }
381
  $messages[1] = $zle->getMessage();
492
 
493
  $returnObject = new stdClass();
494
 
495
+ $returnAttribs = array_map('strtolower', $returnAttribs);
496
+ $omitAttribs = array_map('strtolower', $omitAttribs);
497
+ $returnAttribs = array_diff($returnAttribs, $omitAttribs);
498
 
499
  $entry = $this->getLdap()->getEntry($this->_authenticatedDn, $returnAttribs, true);
500
  foreach ($entry as $attr => $value) {
lib/Zend/Auth/Adapter/OpenId.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Zend_Auth_Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: OpenId.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -40,7 +40,7 @@
40
  * @category Zend
41
  * @package Zend_Auth
42
  * @subpackage Zend_Auth_Adapter
43
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
44
  * @license http://framework.zend.com/license/new-bsd New BSD License
45
  */
46
  class Zend_Auth_Adapter_OpenId implements Zend_Auth_Adapter_Interface
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Zend_Auth_Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: OpenId.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
40
  * @category Zend
41
  * @package Zend_Auth
42
  * @subpackage Zend_Auth_Adapter
43
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
44
  * @license http://framework.zend.com/license/new-bsd New BSD License
45
  */
46
  class Zend_Auth_Adapter_OpenId implements Zend_Auth_Adapter_Interface
lib/Zend/Auth/Exception.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Auth
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
 
@@ -29,7 +29,7 @@
29
  /**
30
  * @category Zend
31
  * @package Zend_Auth
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Auth_Exception extends Zend_Exception
14
  *
15
  * @category Zend
16
  * @package Zend_Auth
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
 
29
  /**
30
  * @category Zend
31
  * @package Zend_Auth
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Auth_Exception extends Zend_Exception
lib/Zend/Auth/Result.php CHANGED
@@ -14,16 +14,16 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Auth
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Result.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_Auth
26
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  class Zend_Auth_Result
14
  *
15
  * @category Zend
16
  * @package Zend_Auth
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Result.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_Auth
26
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  class Zend_Auth_Result
lib/Zend/Auth/Storage/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Storage
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -31,7 +31,7 @@
31
  * @category Zend
32
  * @package Zend_Auth
33
  * @subpackage Storage
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Auth_Storage_Exception extends Zend_Auth_Exception
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Storage
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
31
  * @category Zend
32
  * @package Zend_Auth
33
  * @subpackage Storage
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Auth_Storage_Exception extends Zend_Auth_Exception
lib/Zend/Auth/Storage/Interface.php CHANGED
@@ -15,16 +15,16 @@
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Storage
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_Auth
26
  * @subpackage Storage
27
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
  interface Zend_Auth_Storage_Interface
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Storage
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_Auth
26
  * @subpackage Storage
27
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
  interface Zend_Auth_Storage_Interface
lib/Zend/Auth/Storage/NonPersistent.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Storage
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: NonPersistent.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -37,7 +37,7 @@
37
  * @category Zend
38
  * @package Zend_Auth
39
  * @subpackage Storage
40
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
41
  * @license http://framework.zend.com/license/new-bsd New BSD License
42
  */
43
  class Zend_Auth_Storage_NonPersistent implements Zend_Auth_Storage_Interface
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Storage
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: NonPersistent.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
37
  * @category Zend
38
  * @package Zend_Auth
39
  * @subpackage Storage
40
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
41
  * @license http://framework.zend.com/license/new-bsd New BSD License
42
  */
43
  class Zend_Auth_Storage_NonPersistent implements Zend_Auth_Storage_Interface
lib/Zend/Auth/Storage/Session.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Storage
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Session.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -37,7 +37,7 @@
37
  * @category Zend
38
  * @package Zend_Auth
39
  * @subpackage Storage
40
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
41
  * @license http://framework.zend.com/license/new-bsd New BSD License
42
  */
43
  class Zend_Auth_Storage_Session implements Zend_Auth_Storage_Interface
15
  * @category Zend
16
  * @package Zend_Auth
17
  * @subpackage Storage
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Session.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
37
  * @category Zend
38
  * @package Zend_Auth
39
  * @subpackage Storage
40
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
41
  * @license http://framework.zend.com/license/new-bsd New BSD License
42
  */
43
  class Zend_Auth_Storage_Session implements Zend_Auth_Storage_Interface
lib/Zend/Barcode.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Barcode
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Barcode.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /**
@@ -24,7 +24,7 @@
24
  *
25
  * @category Zend
26
  * @package Zend_Barcode
27
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
  class Zend_Barcode
@@ -55,10 +55,10 @@ class Zend_Barcode
55
  * @throws Zend_Barcode_Exception
56
  */
57
  public static function factory(
58
- $barcode,
59
- $renderer = 'image',
60
- $barcodeConfig = array(),
61
- $rendererConfig = array(),
62
  $automaticRenderError = true
63
  ) {
64
  /*
@@ -313,9 +313,9 @@ class Zend_Barcode
313
  * @param array | Zend_Config $rendererConfig
314
  */
315
  public static function render(
316
- $barcode,
317
- $renderer,
318
- $barcodeConfig = array(),
319
  $rendererConfig = array()
320
  ) {
321
  self::factory($barcode, $renderer, $barcodeConfig, $rendererConfig)->render();
@@ -331,9 +331,9 @@ class Zend_Barcode
331
  * @return mixed
332
  */
333
  public static function draw(
334
- $barcode,
335
- $renderer,
336
- $barcodeConfig = array(),
337
  $rendererConfig = array()
338
  ) {
339
  return self::factory($barcode, $renderer, $barcodeConfig, $rendererConfig)->draw();
14
  *
15
  * @category Zend
16
  * @package Zend_Barcode
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Barcode.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /**
24
  *
25
  * @category Zend
26
  * @package Zend_Barcode
27
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
  class Zend_Barcode
55
  * @throws Zend_Barcode_Exception
56
  */
57
  public static function factory(
58
+ $barcode,
59
+ $renderer = 'image',
60
+ $barcodeConfig = array(),
61
+ $rendererConfig = array(),
62
  $automaticRenderError = true
63
  ) {
64
  /*
313
  * @param array | Zend_Config $rendererConfig
314
  */
315
  public static function render(
316
+ $barcode,
317
+ $renderer,
318
+ $barcodeConfig = array(),
319
  $rendererConfig = array()
320
  ) {
321
  self::factory($barcode, $renderer, $barcodeConfig, $rendererConfig)->render();
331
  * @return mixed
332
  */
333
  public static function draw(
334
+ $barcode,
335
+ $renderer,
336
+ $barcodeConfig = array(),
337
  $rendererConfig = array()
338
  ) {
339
  return self::factory($barcode, $renderer, $barcodeConfig, $rendererConfig)->draw();
lib/Zend/Barcode/Exception.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Barcode
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Exception.php 22999 2010-09-23 19:43:14Z mikaelkael $
20
  */
21
  /**
22
  * Zend_Exception
@@ -28,7 +28,7 @@
28
  *
29
  * @category Zend
30
  * @package Zend_Barcode
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Barcode_Exception extends Zend_Exception
14
  *
15
  * @category Zend
16
  * @package Zend_Barcode
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
  /**
22
  * Zend_Exception
28
  *
29
  * @category Zend
30
  * @package Zend_Barcode
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Barcode_Exception extends Zend_Exception
lib/Zend/Barcode/Object/Code128.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  * @version $Id: Code25.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
@@ -35,7 +35,7 @@
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Code128 extends Zend_Barcode_Object_ObjectAbstract
@@ -48,9 +48,9 @@ class Zend_Barcode_Object_Code128 extends Zend_Barcode_Object_ObjectAbstract
48
  protected $_withChecksum = true;
49
 
50
  /**
51
- * @var array
52
- */
53
- protected $_convertedText = array();
54
 
55
  protected $_codingMap = array(
56
  0 => "11011001100", 1 => "11001101100", 2 => "11001100110",
@@ -192,7 +192,7 @@ class Zend_Barcode_Object_Code128 extends Zend_Barcode_Object_ObjectAbstract
192
  $characterLength = 11 * $this->_barThinWidth * $this->_factor;
193
  $convertedChars = count($this->_convertToBarcodeChars($this->getText()));
194
  if ($this->_withChecksum) {
195
- $convertedChars++;
196
  }
197
  $encodedData = $convertedChars * $characterLength;
198
  // ...except the STOP character (13)
@@ -220,7 +220,7 @@ class Zend_Barcode_Object_Code128 extends Zend_Barcode_Object_ObjectAbstract
220
  $convertedChars = $this->_convertToBarcodeChars($this->getText());
221
 
222
  if ($this->_withChecksum) {
223
- $convertedChars[] = $this->getChecksum($this->getText());
224
  }
225
 
226
  // STOP CHARACTER
@@ -229,7 +229,7 @@ class Zend_Barcode_Object_Code128 extends Zend_Barcode_Object_ObjectAbstract
229
  foreach ($convertedChars as $barcodeChar) {
230
  $barcodePattern = $this->_codingMap[$barcodeChar];
231
  foreach (str_split($barcodePattern) as $c) {
232
- $barcodeTable[] = array($c, 1, 0, 1);
233
  }
234
  }
235
  return $barcodeTable;
@@ -238,24 +238,24 @@ class Zend_Barcode_Object_Code128 extends Zend_Barcode_Object_ObjectAbstract
238
  /**
239
  * Checks if the next $length chars of $string starting at $pos are numeric.
240
  * Returns false if the end of the string is reached.
241
- * @param $string String to search
242
- * @param $pos Starting position
243
- * @param $length Length to search
244
  * @return bool
245
  */
246
  protected static function _isDigit($string, $pos, $length = 2)
247
  {
248
- if ($pos + $length > strlen($string)) {
249
- return false;
250
- }
251
 
252
- for ($i = $pos; $i < $pos + $length; $i++) {
253
- if (!is_numeric($string[$i])) {
254
- return false;
255
- }
256
- }
257
- return true;
258
- }
259
 
260
  /**
261
  * Convert string to barcode string
@@ -263,14 +263,14 @@ class Zend_Barcode_Object_Code128 extends Zend_Barcode_Object_ObjectAbstract
263
  */
264
  protected function _convertToBarcodeChars($string)
265
  {
266
- $string = (string) $string;
267
- if (!strlen($string)) {
268
- return array();
269
- }
270
 
271
- if (isset($this->_convertedText[md5($string)])) {
272
- return $this->_convertedText[md5($string)];
273
- }
274
 
275
  $currentCharset = null;
276
  $sum = 0;
@@ -363,17 +363,17 @@ class Zend_Barcode_Object_Code128 extends Zend_Barcode_Object_ObjectAbstract
363
  */
364
  public function getChecksum($text)
365
  {
366
- $tableOfChars = $this->_convertToBarcodeChars($text);
367
 
368
- $sum = $tableOfChars[0];
369
- unset($tableOfChars[0]);
370
 
371
- $k = 1;
372
- foreach ($tableOfChars as $char) {
373
- $sum += ($k++) * $char;
374
- }
375
 
376
- $checksum = $sum % 103;
377
 
378
  return $checksum;
379
  }
@@ -385,7 +385,7 @@ class Zend_Barcode_Object_Code128 extends Zend_Barcode_Object_ObjectAbstract
385
  */
386
  protected function _validateText($value, $options = array())
387
  {
388
- // @TODO: add code128 validator
389
- return true;
390
  }
391
- }
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  * @version $Id: Code25.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Code128 extends Zend_Barcode_Object_ObjectAbstract
48
  protected $_withChecksum = true;
49
 
50
  /**
51
+ * @var array
52
+ */
53
+ protected $_convertedText = array();
54
 
55
  protected $_codingMap = array(
56
  0 => "11011001100", 1 => "11001101100", 2 => "11001100110",
192
  $characterLength = 11 * $this->_barThinWidth * $this->_factor;
193
  $convertedChars = count($this->_convertToBarcodeChars($this->getText()));
194
  if ($this->_withChecksum) {
195
+ $convertedChars++;
196
  }
197
  $encodedData = $convertedChars * $characterLength;
198
  // ...except the STOP character (13)
220
  $convertedChars = $this->_convertToBarcodeChars($this->getText());
221
 
222
  if ($this->_withChecksum) {
223
+ $convertedChars[] = $this->getChecksum($this->getText());
224
  }
225
 
226
  // STOP CHARACTER
229
  foreach ($convertedChars as $barcodeChar) {
230
  $barcodePattern = $this->_codingMap[$barcodeChar];
231
  foreach (str_split($barcodePattern) as $c) {
232
+ $barcodeTable[] = array($c, $this->_barThinWidth, 0, 1);
233
  }
234
  }
235
  return $barcodeTable;
238
  /**
239
  * Checks if the next $length chars of $string starting at $pos are numeric.
240
  * Returns false if the end of the string is reached.
241
+ * @param string $string String to search
242
+ * @param int $pos Starting position
243
+ * @param int $length Length to search
244
  * @return bool
245
  */
246
  protected static function _isDigit($string, $pos, $length = 2)
247
  {
248
+ if ($pos + $length > strlen($string)) {
249
+ return false;
250
+ }
251
 
252
+ for ($i = $pos; $i < $pos + $length; $i++) {
253
+ if (!is_numeric($string[$i])) {
254
+ return false;
255
+ }
256
+ }
257
+ return true;
258
+ }
259
 
260
  /**
261
  * Convert string to barcode string
263
  */
264
  protected function _convertToBarcodeChars($string)
265
  {
266
+ $string = (string) $string;
267
+ if (!strlen($string)) {
268
+ return array();
269
+ }
270
 
271
+ if (isset($this->_convertedText[md5($string)])) {
272
+ return $this->_convertedText[md5($string)];
273
+ }
274
 
275
  $currentCharset = null;
276
  $sum = 0;
363
  */
364
  public function getChecksum($text)
365
  {
366
+ $tableOfChars = $this->_convertToBarcodeChars($text);
367
 
368
+ $sum = $tableOfChars[0];
369
+ unset($tableOfChars[0]);
370
 
371
+ $k = 1;
372
+ foreach ($tableOfChars as $char) {
373
+ $sum += ($k++) * $char;
374
+ }
375
 
376
+ $checksum = $sum % 103;
377
 
378
  return $checksum;
379
  }
385
  */
386
  protected function _validateText($value, $options = array())
387
  {
388
+ // @TODO: add code128 validator
389
+ return true;
390
  }
391
+ }
lib/Zend/Barcode/Object/Code25.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Code25.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -35,7 +35,7 @@
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Code25 extends Zend_Barcode_Object_ObjectAbstract
@@ -97,7 +97,7 @@ class Zend_Barcode_Object_Code25 extends Zend_Barcode_Object_ObjectAbstract
97
  $barcodeTable[] = array(1 , $this->_barThickWidth , 0 , 1);
98
  $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , 1);
99
  $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , 1);
100
- $barcodeTable[] = array(0 , 1);
101
 
102
  $text = str_split($this->getText());
103
  foreach ($text as $char) {
@@ -106,7 +106,7 @@ class Zend_Barcode_Object_Code25 extends Zend_Barcode_Object_ObjectAbstract
106
  /* visible, width, top, length */
107
  $width = $c ? $this->_barThickWidth : $this->_barThinWidth;
108
  $barcodeTable[] = array(1 , $width , 0 , 1);
109
- $barcodeTable[] = array(0 , 1);
110
  }
111
  }
112
 
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Code25.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Code25 extends Zend_Barcode_Object_ObjectAbstract
97
  $barcodeTable[] = array(1 , $this->_barThickWidth , 0 , 1);
98
  $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , 1);
99
  $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , 1);
100
+ $barcodeTable[] = array(0 , $this->_barThinWidth);
101
 
102
  $text = str_split($this->getText());
103
  foreach ($text as $char) {
106
  /* visible, width, top, length */
107
  $width = $c ? $this->_barThickWidth : $this->_barThinWidth;
108
  $barcodeTable[] = array(1 , $width , 0 , 1);
109
+ $barcodeTable[] = array(0 , $this->_barThinWidth);
110
  }
111
  }
112
 
lib/Zend/Barcode/Object/Code25interleaved.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Code25interleaved.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** @see Zend_Barcode_Object_Code25 */
@@ -31,7 +31,7 @@
31
  *
32
  * @category Zend
33
  * @package Zend_Barcode
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Barcode_Object_Code25interleaved extends Zend_Barcode_Object_Code25
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Code25interleaved.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** @see Zend_Barcode_Object_Code25 */
31
  *
32
  * @category Zend
33
  * @package Zend_Barcode
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Barcode_Object_Code25interleaved extends Zend_Barcode_Object_Code25
lib/Zend/Barcode/Object/Code39.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Code39.php 23398 2010-11-19 17:17:05Z mikaelkael $
21
  */
22
 
23
  /**
@@ -35,7 +35,7 @@
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Code39 extends Zend_Barcode_Object_ObjectAbstract
@@ -163,7 +163,7 @@ class Zend_Barcode_Object_Code39 extends Zend_Barcode_Object_ObjectAbstract
163
  $barcodeTable[] = array((int) $visible, $width, 0, 1);
164
  $visible = ! $visible;
165
  }
166
- $barcodeTable[] = array(0 , 1);
167
  }
168
  return $barcodeTable;
169
  }
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Code39.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Code39 extends Zend_Barcode_Object_ObjectAbstract
163
  $barcodeTable[] = array((int) $visible, $width, 0, 1);
164
  $visible = ! $visible;
165
  }
166
+ $barcodeTable[] = array(0 , $this->_barThinWidth);
167
  }
168
  return $barcodeTable;
169
  }
lib/Zend/Barcode/Object/Ean13.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Ean13.php 22999 2010-09-23 19:43:14Z mikaelkael $
21
  */
22
 
23
  /**
@@ -35,7 +35,7 @@
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Ean13 extends Zend_Barcode_Object_ObjectAbstract
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Ean13.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Ean13 extends Zend_Barcode_Object_ObjectAbstract
lib/Zend/Barcode/Object/Ean2.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Ean2.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -35,7 +35,7 @@
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Ean2 extends Zend_Barcode_Object_Ean5
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Ean2.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Ean2 extends Zend_Barcode_Object_Ean5
lib/Zend/Barcode/Object/Ean5.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Ean5.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -35,7 +35,7 @@
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Ean5 extends Zend_Barcode_Object_Ean13
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Ean5.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Ean5 extends Zend_Barcode_Object_Ean13
lib/Zend/Barcode/Object/Ean8.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Ean8.php 21667 2010-03-28 17:45:14Z mikaelkael $
21
  */
22
 
23
  /**
@@ -35,7 +35,7 @@
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Ean8 extends Zend_Barcode_Object_Ean13
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Ean8.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Ean8 extends Zend_Barcode_Object_Ean13
lib/Zend/Barcode/Object/Error.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Error.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** @see Zend_Barcode_Object_ObjectAbstract */
@@ -28,7 +28,7 @@
28
  *
29
  * @category Zend
30
  * @package Zend_Barcode
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Barcode_Object_Error extends Zend_Barcode_Object_ObjectAbstract
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Error.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** @see Zend_Barcode_Object_ObjectAbstract */
28
  *
29
  * @category Zend
30
  * @package Zend_Barcode
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Barcode_Object_Error extends Zend_Barcode_Object_ObjectAbstract
lib/Zend/Barcode/Object/Exception.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Barcode
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /** @see Zend_Barcode_Exception */
@@ -27,7 +27,7 @@
27
  *
28
  * @category Zend
29
  * @package Zend_Barcode
30
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Barcode_Object_Exception extends Zend_Barcode_Exception
14
  *
15
  * @category Zend
16
  * @package Zend_Barcode
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /** @see Zend_Barcode_Exception */
27
  *
28
  * @category Zend
29
  * @package Zend_Barcode
30
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Barcode_Object_Exception extends Zend_Barcode_Exception
lib/Zend/Barcode/Object/Identcode.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Identcode.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -35,7 +35,7 @@
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Identcode extends Zend_Barcode_Object_Code25interleaved
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Identcode.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Identcode extends Zend_Barcode_Object_Code25interleaved
lib/Zend/Barcode/Object/Itf14.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Itf14.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** @see Zend_Barcode_Object_Code25interleaved */
@@ -31,7 +31,7 @@
31
  *
32
  * @category Zend
33
  * @package Zend_Barcode
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Barcode_Object_Itf14 extends Zend_Barcode_Object_Code25interleaved
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Itf14.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** @see Zend_Barcode_Object_Code25interleaved */
31
  *
32
  * @category Zend
33
  * @package Zend_Barcode
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Barcode_Object_Itf14 extends Zend_Barcode_Object_Code25interleaved
lib/Zend/Barcode/Object/Leitcode.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Leitcode.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -35,7 +35,7 @@
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Leitcode extends Zend_Barcode_Object_Identcode
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Leitcode.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Leitcode extends Zend_Barcode_Object_Identcode
lib/Zend/Barcode/Object/ObjectAbstract.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: ObjectAbstract.php 23400 2010-11-19 17:18:31Z mikaelkael $
21
  */
22
 
23
  /**
@@ -25,7 +25,7 @@
25
  *
26
  * @category Zend
27
  * @package Zend_Barcode
28
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
29
  * @license http://framework.zend.com/license/new-bsd New BSD License
30
  */
31
  abstract class Zend_Barcode_Object_ObjectAbstract
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: ObjectAbstract.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
25
  *
26
  * @category Zend
27
  * @package Zend_Barcode
28
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
29
  * @license http://framework.zend.com/license/new-bsd New BSD License
30
  */
31
  abstract class Zend_Barcode_Object_ObjectAbstract
lib/Zend/Barcode/Object/Planet.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Planet.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -35,7 +35,7 @@
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Planet extends Zend_Barcode_Object_Postnet
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Planet.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Planet extends Zend_Barcode_Object_Postnet
lib/Zend/Barcode/Object/Postnet.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Postnet.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -35,7 +35,7 @@
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Postnet extends Zend_Barcode_Object_ObjectAbstract
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Postnet.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Postnet extends Zend_Barcode_Object_ObjectAbstract
lib/Zend/Barcode/Object/Royalmail.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Royalmail.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -35,7 +35,7 @@
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Royalmail extends Zend_Barcode_Object_ObjectAbstract
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Royalmail.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Royalmail extends Zend_Barcode_Object_ObjectAbstract
lib/Zend/Barcode/Object/Upca.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Upca.php 21667 2010-03-28 17:45:14Z mikaelkael $
21
  */
22
 
23
  /**
@@ -35,7 +35,7 @@
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Upca extends Zend_Barcode_Object_Ean13
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Upca.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Upca extends Zend_Barcode_Object_Ean13
lib/Zend/Barcode/Object/Upce.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Upce.php 21667 2010-03-28 17:45:14Z mikaelkael $
21
  */
22
 
23
  /**
@@ -35,7 +35,7 @@
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Upce extends Zend_Barcode_Object_Ean13
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Object
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Upce.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
35
  *
36
  * @category Zend
37
  * @package Zend_Barcode
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Barcode_Object_Upce extends Zend_Barcode_Object_Ean13
lib/Zend/Barcode/Renderer/Exception.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Barcode
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /** @see Zend_Barcode_Exception */
@@ -27,7 +27,7 @@
27
  *
28
  * @category Zend
29
  * @package Zend_Barcode
30
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Barcode_Renderer_Exception extends Zend_Barcode_Exception
14
  *
15
  * @category Zend
16
  * @package Zend_Barcode
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /** @see Zend_Barcode_Exception */
27
  *
28
  * @category Zend
29
  * @package Zend_Barcode
30
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Barcode_Renderer_Exception extends Zend_Barcode_Exception
lib/Zend/Barcode/Renderer/Image.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Renderer
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Image.php 22999 2010-09-23 19:43:14Z mikaelkael $
21
  */
22
 
23
  /** @see Zend_Barcode_Renderer_RendererAbstract*/
@@ -28,7 +28,7 @@
28
  *
29
  * @category Zend
30
  * @package Zend_Barcode
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Barcode_Renderer_Image extends Zend_Barcode_Renderer_RendererAbstract
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Renderer
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Image.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** @see Zend_Barcode_Renderer_RendererAbstract*/
28
  *
29
  * @category Zend
30
  * @package Zend_Barcode
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Barcode_Renderer_Image extends Zend_Barcode_Renderer_RendererAbstract
lib/Zend/Barcode/Renderer/Pdf.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Renderer
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Pdf.php 22418 2010-06-11 16:27:22Z mikaelkael $
21
  */
22
 
23
  /** @see Zend_Barcode_Renderer_RendererAbstract */
@@ -37,7 +37,7 @@
37
  *
38
  * @category Zend
39
  * @package Zend_Barcode
40
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
41
  * @license http://framework.zend.com/license/new-bsd New BSD License
42
  */
43
  class Zend_Barcode_Renderer_Pdf extends Zend_Barcode_Renderer_RendererAbstract
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Renderer
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Pdf.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** @see Zend_Barcode_Renderer_RendererAbstract */
37
  *
38
  * @category Zend
39
  * @package Zend_Barcode
40
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
41
  * @license http://framework.zend.com/license/new-bsd New BSD License
42
  */
43
  class Zend_Barcode_Renderer_Pdf extends Zend_Barcode_Renderer_RendererAbstract
lib/Zend/Barcode/Renderer/RendererAbstract.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Renderer
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: RendererAbstract.php 22999 2010-09-23 19:43:14Z mikaelkael $
21
  */
22
 
23
  /**
@@ -25,7 +25,7 @@
25
  *
26
  * @category Zend
27
  * @package Zend_Barcode
28
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
29
  * @license http://framework.zend.com/license/new-bsd New BSD License
30
  */
31
  abstract class Zend_Barcode_Renderer_RendererAbstract
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Renderer
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: RendererAbstract.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
25
  *
26
  * @category Zend
27
  * @package Zend_Barcode
28
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
29
  * @license http://framework.zend.com/license/new-bsd New BSD License
30
  */
31
  abstract class Zend_Barcode_Renderer_RendererAbstract
lib/Zend/Barcode/Renderer/Svg.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Renderer
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  * @version $Id: Image.php 20366 2010-01-18 03:56:52Z ralph $
21
  */
@@ -28,7 +28,7 @@
28
  *
29
  * @category Zend
30
  * @package Zend_Barcode
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Barcode_Renderer_Svg extends Zend_Barcode_Renderer_RendererAbstract
15
  * @category Zend
16
  * @package Zend_Barcode
17
  * @subpackage Renderer
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  * @version $Id: Image.php 20366 2010-01-18 03:56:52Z ralph $
21
  */
28
  *
29
  * @category Zend
30
  * @package Zend_Barcode
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Barcode_Renderer_Svg extends Zend_Barcode_Renderer_RendererAbstract
lib/Zend/Cache.php CHANGED
@@ -14,15 +14,15 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Cache
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Cache.php 23154 2010-10-18 17:41:06Z mabe $
20
  */
21
 
22
 
23
  /**
24
  * @package Zend_Cache
25
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
26
  * @license http://framework.zend.com/license/new-bsd New BSD License
27
  */
28
  abstract class Zend_Cache
@@ -41,14 +41,14 @@ abstract class Zend_Cache
41
  * @var array
42
  */
43
  public static $standardBackends = array('File', 'Sqlite', 'Memcached', 'Libmemcached', 'Apc', 'ZendPlatform',
44
- 'Xcache', 'TwoLevels', 'ZendServer_Disk', 'ZendServer_ShMem');
45
 
46
  /**
47
  * Standard backends which implement the ExtendedInterface
48
  *
49
  * @var array
50
  */
51
- public static $standardExtendedBackends = array('File', 'Apc', 'TwoLevels', 'Memcached', 'Libmemcached', 'Sqlite');
52
 
53
  /**
54
  * Only for backward compatibility (may be removed in next major release)
@@ -64,7 +64,7 @@ abstract class Zend_Cache
64
  * @var array
65
  * @deprecated
66
  */
67
- public static $availableBackends = array('File', 'Sqlite', 'Memcached', 'Libmemcached', 'Apc', 'ZendPlatform', 'Xcache', 'TwoLevels');
68
 
69
  /**
70
  * Consts for clean() method
@@ -133,7 +133,7 @@ abstract class Zend_Cache
133
  #require_once str_replace('_', DIRECTORY_SEPARATOR, $backendClass) . '.php';
134
  } else {
135
  // we use a custom backend
136
- if (!preg_match('~^[\w]+$~D', $backend)) {
137
  Zend_Cache::throwException("Invalid backend name [$backend]");
138
  }
139
  if (!$customBackendNaming) {
@@ -175,7 +175,7 @@ abstract class Zend_Cache
175
  #require_once str_replace('_', DIRECTORY_SEPARATOR, $frontendClass) . '.php';
176
  } else {
177
  // we use a custom frontend
178
- if (!preg_match('~^[\w]+$~D', $frontend)) {
179
  Zend_Cache::throwException("Invalid frontend name [$frontend]");
180
  }
181
  if (!$customFrontendNaming) {
14
  *
15
  * @category Zend
16
  * @package Zend_Cache
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Cache.php 24656 2012-02-26 06:02:53Z adamlundrigan $
20
  */
21
 
22
 
23
  /**
24
  * @package Zend_Cache
25
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
26
  * @license http://framework.zend.com/license/new-bsd New BSD License
27
  */
28
  abstract class Zend_Cache
41
  * @var array
42
  */
43
  public static $standardBackends = array('File', 'Sqlite', 'Memcached', 'Libmemcached', 'Apc', 'ZendPlatform',
44
+ 'Xcache', 'TwoLevels', 'WinCache', 'ZendServer_Disk', 'ZendServer_ShMem');
45
 
46
  /**
47
  * Standard backends which implement the ExtendedInterface
48
  *
49
  * @var array
50
  */
51
+ public static $standardExtendedBackends = array('File', 'Apc', 'TwoLevels', 'Memcached', 'Libmemcached', 'Sqlite', 'WinCache');
52
 
53
  /**
54
  * Only for backward compatibility (may be removed in next major release)
64
  * @var array
65
  * @deprecated
66
  */
67
+ public static $availableBackends = array('File', 'Sqlite', 'Memcached', 'Libmemcached', 'Apc', 'ZendPlatform', 'Xcache', 'WinCache', 'TwoLevels');
68
 
69
  /**
70
  * Consts for clean() method
133
  #require_once str_replace('_', DIRECTORY_SEPARATOR, $backendClass) . '.php';
134
  } else {
135
  // we use a custom backend
136
+ if (!preg_match('~^[\w\\\\]+$~D', $backend)) {
137
  Zend_Cache::throwException("Invalid backend name [$backend]");
138
  }
139
  if (!$customBackendNaming) {
175
  #require_once str_replace('_', DIRECTORY_SEPARATOR, $frontendClass) . '.php';
176
  } else {
177
  // we use a custom frontend
178
+ if (!preg_match('~^[\w\\\\]+$~D', $frontend)) {
179
  Zend_Cache::throwException("Invalid frontend name [$frontend]");
180
  }
181
  if (!$customFrontendNaming) {
lib/Zend/Cache/Backend.php CHANGED
@@ -15,16 +15,16 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Backend.php 20880 2010-02-03 18:18:32Z matthew $
21
  */
22
 
23
 
24
  /**
25
  * @package Zend_Cache
26
  * @subpackage Zend_Cache_Backend
27
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
  class Zend_Cache_Backend
@@ -111,6 +111,28 @@ class Zend_Cache_Backend
111
  }
112
  }
113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  /**
115
  * Get the life time
116
  *
@@ -154,7 +176,7 @@ class Zend_Cache_Backend
154
  $tmpdir = array();
155
  foreach (array($_ENV, $_SERVER) as $tab) {
156
  foreach (array('TMPDIR', 'TEMP', 'TMP', 'windir', 'SystemRoot') as $key) {
157
- if (isset($tab[$key])) {
158
  if (($key == 'windir') or ($key == 'SystemRoot')) {
159
  $dir = realpath($tab[$key] . '\\temp');
160
  } else {
@@ -200,7 +222,7 @@ class Zend_Cache_Backend
200
  /**
201
  * Verify if the given temporary directory is readable and writable
202
  *
203
- * @param $dir temporary directory
204
  * @return boolean true if the directory is ok
205
  */
206
  protected function _isGoodTmpDir($dir)
@@ -237,7 +259,9 @@ class Zend_Cache_Backend
237
  // Create a default logger to the standard output stream
238
  #require_once 'Zend/Log.php';
239
  #require_once 'Zend/Log/Writer/Stream.php';
 
240
  $logger = new Zend_Log(new Zend_Log_Writer_Stream('php://output'));
 
241
  $this->_directives['logger'] = $logger;
242
  }
243
 
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Backend.php 24989 2012-06-21 07:24:13Z mabe $
21
  */
22
 
23
 
24
  /**
25
  * @package Zend_Cache
26
  * @subpackage Zend_Cache_Backend
27
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
  class Zend_Cache_Backend
111
  }
112
  }
113
 
114
+ /**
115
+ * Returns an option
116
+ *
117
+ * @param string $name Optional, the options name to return
118
+ * @throws Zend_Cache_Exceptions
119
+ * @return mixed
120
+ */
121
+ public function getOption($name)
122
+ {
123
+ $name = strtolower($name);
124
+
125
+ if (array_key_exists($name, $this->_options)) {
126
+ return $this->_options[$name];
127
+ }
128
+
129
+ if (array_key_exists($name, $this->_directives)) {
130
+ return $this->_directives[$name];
131
+ }
132
+
133
+ Zend_Cache::throwException("Incorrect option name : {$name}");
134
+ }
135
+
136
  /**
137
  * Get the life time
138
  *
176
  $tmpdir = array();
177
  foreach (array($_ENV, $_SERVER) as $tab) {
178
  foreach (array('TMPDIR', 'TEMP', 'TMP', 'windir', 'SystemRoot') as $key) {
179
+ if (isset($tab[$key]) && is_string($tab[$key])) {
180
  if (($key == 'windir') or ($key == 'SystemRoot')) {
181
  $dir = realpath($tab[$key] . '\\temp');
182
  } else {
222
  /**
223
  * Verify if the given temporary directory is readable and writable
224
  *
225
+ * @param string $dir temporary directory
226
  * @return boolean true if the directory is ok
227
  */
228
  protected function _isGoodTmpDir($dir)
259
  // Create a default logger to the standard output stream
260
  #require_once 'Zend/Log.php';
261
  #require_once 'Zend/Log/Writer/Stream.php';
262
+ #require_once 'Zend/Log/Filter/Priority.php';
263
  $logger = new Zend_Log(new Zend_Log_Writer_Stream('php://output'));
264
+ $logger->addFilter(new Zend_Log_Filter_Priority(Zend_Log::WARN, '<='));
265
  $this->_directives['logger'] = $logger;
266
  }
267
 
lib/Zend/Cache/Backend/Apc.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Apc.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -35,7 +35,7 @@
35
  /**
36
  * @package Zend_Cache
37
  * @subpackage Zend_Cache_Backend
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Apc.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
35
  /**
36
  * @package Zend_Cache
37
  * @subpackage Zend_Cache_Backend
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
lib/Zend/Cache/Backend/BlackHole.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: BlackHole.php 20785 2010-01-31 09:43:03Z mikaelkael $
21
  */
22
 
23
  /**
@@ -33,11 +33,11 @@
33
  /**
34
  * @package Zend_Cache
35
  * @subpackage Zend_Cache_Backend
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
- class Zend_Cache_Backend_BlackHole
40
- extends Zend_Cache_Backend
41
  implements Zend_Cache_Backend_ExtendedInterface
42
  {
43
  /**
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: BlackHole.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
33
  /**
34
  * @package Zend_Cache
35
  * @subpackage Zend_Cache_Backend
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
+ class Zend_Cache_Backend_BlackHole
40
+ extends Zend_Cache_Backend
41
  implements Zend_Cache_Backend_ExtendedInterface
42
  {
43
  /**
lib/Zend/Cache/Backend/ExtendedInterface.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: ExtendedInterface.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -28,7 +28,7 @@
28
  /**
29
  * @package Zend_Cache
30
  * @subpackage Zend_Cache_Backend
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  interface Zend_Cache_Backend_ExtendedInterface extends Zend_Cache_Backend_Interface
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: ExtendedInterface.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
28
  /**
29
  * @package Zend_Cache
30
  * @subpackage Zend_Cache_Backend
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  interface Zend_Cache_Backend_ExtendedInterface extends Zend_Cache_Backend_Interface
lib/Zend/Cache/Backend/File.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: File.php 21636 2010-03-24 17:10:23Z mabe $
21
  */
22
 
23
  /**
@@ -34,7 +34,7 @@
34
  /**
35
  * @package Zend_Cache
36
  * @subpackage Zend_Cache_Backend
37
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
@@ -71,7 +71,11 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
71
  * for you. Maybe, 1 or 2 is a good start.
72
  *
73
  * =====> (int) hashed_directory_umask :
74
- * - Umask for hashed directory structure
 
 
 
 
75
  *
76
  * =====> (string) file_name_prefix :
77
  * - prefix for cache files
@@ -79,7 +83,11 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
79
  * (like /tmp) can cause disasters when cleaning the cache
80
  *
81
  * =====> (int) cache_file_umask :
82
- * - Umask for cache files
 
 
 
 
83
  *
84
  * =====> (int) metatadatas_array_max_size :
85
  * - max size for the metadatas array (don't change this value unless you
@@ -93,9 +101,9 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
93
  'read_control' => true,
94
  'read_control_type' => 'crc32',
95
  'hashed_directory_level' => 0,
96
- 'hashed_directory_umask' => 0700,
97
  'file_name_prefix' => 'zend_cache',
98
- 'cache_file_umask' => 0600,
99
  'metadatas_array_max_size' => 100
100
  );
101
 
@@ -130,13 +138,29 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
130
  if ($this->_options['metadatas_array_max_size'] < 10) {
131
  Zend_Cache::throwException('Invalid metadatas_array_max_size, must be > 10');
132
  }
133
- if (isset($options['hashed_directory_umask']) && is_string($options['hashed_directory_umask'])) {
 
 
 
 
 
 
 
 
134
  // See #ZF-4422
135
- $this->_options['hashed_directory_umask'] = octdec($this->_options['hashed_directory_umask']);
136
  }
137
- if (isset($options['cache_file_umask']) && is_string($options['cache_file_umask'])) {
 
 
 
 
 
 
 
 
138
  // See #ZF-4422
139
- $this->_options['cache_file_umask'] = octdec($this->_options['cache_file_umask']);
140
  }
141
  }
142
 
@@ -151,10 +175,10 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
151
  public function setCacheDir($value, $trailingSeparator = true)
152
  {
153
  if (!is_dir($value)) {
154
- Zend_Cache::throwException('cache_dir must be a directory');
155
  }
156
  if (!is_writable($value)) {
157
- Zend_Cache::throwException('cache_dir is not writable');
158
  }
159
  if ($trailingSeparator) {
160
  // add a trailing DIRECTORY_SEPARATOR if necessary
@@ -268,14 +292,15 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
268
  * Clean some cache records
269
  *
270
  * Available modes are :
271
- * 'all' (default) => remove all cache entries ($tags is not used)
272
- * 'old' => remove too old cache entries ($tags is not used)
273
- * 'matchingTag' => remove cache entries matching all given tags
274
- * ($tags can be an array of strings or a single string)
275
- * 'notMatchingTag' => remove cache entries not matching one of the given tags
276
- * ($tags can be an array of strings or a single string)
277
- * 'matchingAnyTag' => remove cache entries matching any given tags
278
- * ($tags can be an array of strings or a single string)
 
279
  *
280
  * @param string $mode clean mode
281
  * @param tags array $tags array of tags
@@ -722,8 +747,8 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
722
  if ((is_dir($file)) and ($this->_options['hashed_directory_level']>0)) {
723
  // Recursive call
724
  $result = $this->_clean($file . DIRECTORY_SEPARATOR, $mode, $tags) && $result;
725
- if ($mode=='all') {
726
- // if mode=='all', we try to drop the structure too
727
  @rmdir($file);
728
  }
729
  }
@@ -918,8 +943,8 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
918
  $partsArray = $this->_path($id, true);
919
  foreach ($partsArray as $part) {
920
  if (!is_dir($part)) {
921
- @mkdir($part, $this->_options['hashed_directory_umask']);
922
- @chmod($part, $this->_options['hashed_directory_umask']); // see #ZF-320 (this line is required in some configurations)
923
  }
924
  }
925
  return true;
@@ -987,7 +1012,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
987
  }
988
  @fclose($f);
989
  }
990
- @chmod($file, $this->_options['cache_file_umask']);
991
  return $result;
992
  }
993
 
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: File.php 24844 2012-05-31 19:01:36Z rob $
21
  */
22
 
23
  /**
34
  /**
35
  * @package Zend_Cache
36
  * @subpackage Zend_Cache_Backend
37
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
71
  * for you. Maybe, 1 or 2 is a good start.
72
  *
73
  * =====> (int) hashed_directory_umask :
74
+ * - deprecated
75
+ * - Permissions for hashed directory structure
76
+ *
77
+ * =====> (int) hashed_directory_perm :
78
+ * - Permissions for hashed directory structure
79
  *
80
  * =====> (string) file_name_prefix :
81
  * - prefix for cache files
83
  * (like /tmp) can cause disasters when cleaning the cache
84
  *
85
  * =====> (int) cache_file_umask :
86
+ * - deprecated
87
+ * - Permissions for cache files
88
+ *
89
+ * =====> (int) cache_file_perm :
90
+ * - Permissions for cache files
91
  *
92
  * =====> (int) metatadatas_array_max_size :
93
  * - max size for the metadatas array (don't change this value unless you
101
  'read_control' => true,
102
  'read_control_type' => 'crc32',
103
  'hashed_directory_level' => 0,
104
+ 'hashed_directory_perm' => 0700,
105
  'file_name_prefix' => 'zend_cache',
106
+ 'cache_file_perm' => 0600,
107
  'metadatas_array_max_size' => 100
108
  );
109
 
138
  if ($this->_options['metadatas_array_max_size'] < 10) {
139
  Zend_Cache::throwException('Invalid metadatas_array_max_size, must be > 10');
140
  }
141
+
142
+ if (isset($options['hashed_directory_umask'])) {
143
+ // See #ZF-12047
144
+ trigger_error("'hashed_directory_umask' is deprecated -> please use 'hashed_directory_perm' instead", E_USER_NOTICE);
145
+ if (!isset($options['hashed_directory_perm'])) {
146
+ $options['hashed_directory_perm'] = $options['hashed_directory_umask'];
147
+ }
148
+ }
149
+ if (isset($options['hashed_directory_perm']) && is_string($options['hashed_directory_perm'])) {
150
  // See #ZF-4422
151
+ $this->_options['hashed_directory_perm'] = octdec($this->_options['hashed_directory_perm']);
152
  }
153
+
154
+ if (isset($options['cache_file_umask'])) {
155
+ // See #ZF-12047
156
+ trigger_error("'cache_file_umask' is deprecated -> please use 'cache_file_perm' instead", E_USER_NOTICE);
157
+ if (!isset($options['cache_file_perm'])) {
158
+ $options['cache_file_perm'] = $options['cache_file_umask'];
159
+ }
160
+ }
161
+ if (isset($options['cache_file_perm']) && is_string($options['cache_file_perm'])) {
162
  // See #ZF-4422
163
+ $this->_options['cache_file_perm'] = octdec($this->_options['cache_file_perm']);
164
  }
165
  }
166
 
175
  public function setCacheDir($value, $trailingSeparator = true)
176
  {
177
  if (!is_dir($value)) {
178
+ Zend_Cache::throwException(sprintf('cache_dir "%s" must be a directory', $value));
179
  }
180
  if (!is_writable($value)) {
181
+ Zend_Cache::throwException(sprintf('cache_dir "%s" is not writable', $value));
182
  }
183
  if ($trailingSeparator) {
184
  // add a trailing DIRECTORY_SEPARATOR if necessary
292
  * Clean some cache records
293
  *
294
  * Available modes are :
295
+ *
296
+ * Zend_Cache::CLEANING_MODE_ALL (default) => remove all cache entries ($tags is not used)
297
+ * Zend_Cache::CLEANING_MODE_OLD => remove too old cache entries ($tags is not used)
298
+ * Zend_Cache::CLEANING_MODE_MATCHING_TAG => remove cache entries matching all given tags
299
+ * ($tags can be an array of strings or a single string)
300
+ * Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags}
301
+ * ($tags can be an array of strings or a single string)
302
+ * Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags
303
+ * ($tags can be an array of strings or a single string)
304
  *
305
  * @param string $mode clean mode
306
  * @param tags array $tags array of tags
747
  if ((is_dir($file)) and ($this->_options['hashed_directory_level']>0)) {
748
  // Recursive call
749
  $result = $this->_clean($file . DIRECTORY_SEPARATOR, $mode, $tags) && $result;
750
+ if ($mode == Zend_Cache::CLEANING_MODE_ALL) {
751
+ // we try to drop the structure too
752
  @rmdir($file);
753
  }
754
  }
943
  $partsArray = $this->_path($id, true);
944
  foreach ($partsArray as $part) {
945
  if (!is_dir($part)) {
946
+ @mkdir($part, $this->_options['hashed_directory_perm']);
947
+ @chmod($part, $this->_options['hashed_directory_perm']); // see #ZF-320 (this line is required in some configurations)
948
  }
949
  }
950
  return true;
1012
  }
1013
  @fclose($f);
1014
  }
1015
+ @chmod($file, $this->_options['cache_file_perm']);
1016
  return $result;
1017
  }
1018
 
lib/Zend/Cache/Backend/Interface.php CHANGED
@@ -15,16 +15,16 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
24
  /**
25
  * @package Zend_Cache
26
  * @subpackage Zend_Cache_Backend
27
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
  interface Zend_Cache_Backend_Interface
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
24
  /**
25
  * @package Zend_Cache
26
  * @subpackage Zend_Cache_Backend
27
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
  interface Zend_Cache_Backend_Interface
lib/Zend/Cache/Backend/Libmemcached.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Libmemcached.php 23220 2010-10-22 10:24:14Z mabe $
21
  */
22
 
23
 
@@ -35,7 +35,7 @@
35
  /**
36
  * @package Zend_Cache
37
  * @subpackage Zend_Cache_Backend
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Cache_Backend_Libmemcached extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Libmemcached.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
35
  /**
36
  * @package Zend_Cache
37
  * @subpackage Zend_Cache_Backend
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Cache_Backend_Libmemcached extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
lib/Zend/Cache/Backend/Memcached.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Memcached.php 22207 2010-05-20 16:47:16Z mabe $
21
  */
22
 
23
 
@@ -35,7 +35,7 @@
35
  /**
36
  * @package Zend_Cache
37
  * @subpackage Zend_Cache_Backend
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Cache_Backend_Memcached extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Memcached.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
35
  /**
36
  * @package Zend_Cache
37
  * @subpackage Zend_Cache_Backend
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Cache_Backend_Memcached extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
lib/Zend/Cache/Backend/Sqlite.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Sqlite.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -34,7 +34,7 @@
34
  /**
35
  * @package Zend_Cache
36
  * @subpackage Zend_Cache_Backend
37
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Cache_Backend_Sqlite extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
@@ -530,7 +530,6 @@ class Zend_Cache_Backend_Sqlite extends Zend_Cache_Backend implements Zend_Cache
530
  $rand = rand(1, $this->_options['automatic_vacuum_factor']);
531
  if ($rand == 1) {
532
  $this->_query('VACUUM');
533
- @sqlite_close($this->_getConnection());
534
  }
535
  }
536
  }
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Sqlite.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
34
  /**
35
  * @package Zend_Cache
36
  * @subpackage Zend_Cache_Backend
37
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Cache_Backend_Sqlite extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
530
  $rand = rand(1, $this->_options['automatic_vacuum_factor']);
531
  if ($rand == 1) {
532
  $this->_query('VACUUM');
 
533
  }
534
  }
535
  }
lib/Zend/Cache/Backend/Static.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Static.php 22950 2010-09-16 19:33:00Z mabe $
21
  */
22
 
23
  /**
@@ -33,7 +33,7 @@
33
  /**
34
  * @package Zend_Cache
35
  * @subpackage Zend_Cache_Backend
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Cache_Backend_Static
@@ -99,17 +99,13 @@ class Zend_Cache_Backend_Static
99
  */
100
  public function getOption($name)
101
  {
 
 
102
  if ($name == 'tag_cache') {
103
  return $this->getInnerCache();
104
- } else {
105
- if (in_array($name, $this->_options)) {
106
- return $this->_options[$name];
107
- }
108
- if ($name == 'lifetime') {
109
- return parent::getLifetime();
110
- }
111
- return null;
112
  }
 
 
113
  }
114
 
115
  /**
@@ -123,7 +119,7 @@ class Zend_Cache_Backend_Static
123
  */
124
  public function load($id, $doNotTestCacheValidity = false)
125
  {
126
- if (empty($id)) {
127
  $id = $this->_detectId();
128
  } else {
129
  $id = $this->_decodeId($id);
@@ -136,7 +132,7 @@ class Zend_Cache_Backend_Static
136
  }
137
 
138
  $fileName = basename($id);
139
- if (empty($fileName)) {
140
  $fileName = $this->_options['index_filename'];
141
  }
142
  $pathName = $this->_options['public_dir'] . dirname($id);
@@ -163,7 +159,7 @@ class Zend_Cache_Backend_Static
163
  }
164
 
165
  $fileName = basename($id);
166
- if (empty($fileName)) {
167
  $fileName = $this->_options['index_filename'];
168
  }
169
  if ($this->_tagged === null && $tagged = $this->getInnerCache()->load(self::INNER_CACHE_NAME)) {
@@ -211,14 +207,14 @@ class Zend_Cache_Backend_Static
211
  }
212
 
213
  clearstatcache();
214
- if ($id === null || strlen($id) == 0) {
215
  $id = $this->_detectId();
216
  } else {
217
  $id = $this->_decodeId($id);
218
  }
219
 
220
  $fileName = basename($id);
221
- if (empty($fileName)) {
222
  $fileName = $this->_options['index_filename'];
223
  }
224
 
@@ -308,7 +304,7 @@ class Zend_Cache_Backend_Static
308
  } else {
309
  $extension = $this->_options['file_extension'];
310
  }
311
- if (empty($fileName)) {
312
  $fileName = $this->_options['index_filename'];
313
  }
314
  $pathName = $this->_options['public_dir'] . dirname($id);
@@ -333,7 +329,7 @@ class Zend_Cache_Backend_Static
333
  Zend_Cache::throwException('Invalid cache id: does not match expected public_dir path');
334
  }
335
  $fileName = basename($id);
336
- if (empty($fileName)) {
337
  $fileName = $this->_options['index_filename'];
338
  }
339
  $pathName = $this->_options['public_dir'] . dirname($id);
@@ -343,14 +339,16 @@ class Zend_Cache_Backend_Static
343
  if (!is_writable($directory)) {
344
  return false;
345
  }
346
- foreach (new DirectoryIterator($directory) as $file) {
347
- if (true === $file->isFile()) {
348
- if (false === unlink($file->getPathName())) {
349
- return false;
 
 
350
  }
351
  }
352
  }
353
- rmdir(dirname($path));
354
  }
355
  if (file_exists($file)) {
356
  if (!is_writable($file)) {
@@ -538,7 +536,7 @@ class Zend_Cache_Backend_Static
538
  * Detect an octal string and return its octal value for file permission ops
539
  * otherwise return the non-string (assumed octal or decimal int already)
540
  *
541
- * @param $val The potential octal in need of conversion
542
  * @return int
543
  */
544
  protected function _octdec($val)
@@ -551,9 +549,12 @@ class Zend_Cache_Backend_Static
551
 
552
  /**
553
  * Decode a request URI from the provided ID
 
 
 
554
  */
555
  protected function _decodeId($id)
556
  {
557
- return pack('H*', $id);;
558
  }
559
  }
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Static.php 24989 2012-06-21 07:24:13Z mabe $
21
  */
22
 
23
  /**
33
  /**
34
  * @package Zend_Cache
35
  * @subpackage Zend_Cache_Backend
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Cache_Backend_Static
99
  */
100
  public function getOption($name)
101
  {
102
+ $name = strtolower($name);
103
+
104
  if ($name == 'tag_cache') {
105
  return $this->getInnerCache();
 
 
 
 
 
 
 
 
106
  }
107
+
108
+ return parent::getOption($name);
109
  }
110
 
111
  /**
119
  */
120
  public function load($id, $doNotTestCacheValidity = false)
121
  {
122
+ if (($id = (string)$id) === '') {
123
  $id = $this->_detectId();
124
  } else {
125
  $id = $this->_decodeId($id);
132
  }
133
 
134
  $fileName = basename($id);
135
+ if ($fileName === '') {
136
  $fileName = $this->_options['index_filename'];
137
  }
138
  $pathName = $this->_options['public_dir'] . dirname($id);
159
  }
160
 
161
  $fileName = basename($id);
162
+ if ($fileName === '') {
163
  $fileName = $this->_options['index_filename'];
164
  }
165
  if ($this->_tagged === null && $tagged = $this->getInnerCache()->load(self::INNER_CACHE_NAME)) {
207
  }
208
 
209
  clearstatcache();
210
+ if (($id = (string)$id) === '') {
211
  $id = $this->_detectId();
212
  } else {
213
  $id = $this->_decodeId($id);
214
  }
215
 
216
  $fileName = basename($id);
217
+ if ($fileName === '') {
218
  $fileName = $this->_options['index_filename'];
219
  }
220
 
304
  } else {
305
  $extension = $this->_options['file_extension'];
306
  }
307
+ if ($fileName === '') {
308
  $fileName = $this->_options['index_filename'];
309
  }
310
  $pathName = $this->_options['public_dir'] . dirname($id);
329
  Zend_Cache::throwException('Invalid cache id: does not match expected public_dir path');
330
  }
331
  $fileName = basename($id);
332
+ if ($fileName === '') {
333
  $fileName = $this->_options['index_filename'];
334
  }
335
  $pathName = $this->_options['public_dir'] . dirname($id);
339
  if (!is_writable($directory)) {
340
  return false;
341
  }
342
+ if (is_dir($directory)) {
343
+ foreach (new DirectoryIterator($directory) as $file) {
344
+ if (true === $file->isFile()) {
345
+ if (false === unlink($file->getPathName())) {
346
+ return false;
347
+ }
348
  }
349
  }
350
  }
351
+ rmdir($directory);
352
  }
353
  if (file_exists($file)) {
354
  if (!is_writable($file)) {
536
  * Detect an octal string and return its octal value for file permission ops
537
  * otherwise return the non-string (assumed octal or decimal int already)
538
  *
539
+ * @param string $val The potential octal in need of conversion
540
  * @return int
541
  */
542
  protected function _octdec($val)
549
 
550
  /**
551
  * Decode a request URI from the provided ID
552
+ *
553
+ * @param string $id
554
+ * @return string
555
  */
556
  protected function _decodeId($id)
557
  {
558
+ return pack('H*', $id);
559
  }
560
  }
lib/Zend/Cache/Backend/Test.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Test.php 23051 2010-10-07 17:01:21Z mabe $
21
  */
22
 
23
 
@@ -34,7 +34,7 @@
34
  /**
35
  * @package Zend_Cache
36
  * @subpackage Zend_Cache_Backend
37
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Cache_Backend_Test extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
@@ -164,7 +164,7 @@ class Zend_Cache_Backend_Test extends Zend_Cache_Backend implements Zend_Cache_B
164
  public function save($data, $id, $tags = array(), $specificLifetime = false)
165
  {
166
  $this->_addLog('save', array($data, $id, $tags));
167
- if ($id=='false') {
168
  return false;
169
  }
170
  return true;
@@ -182,7 +182,7 @@ class Zend_Cache_Backend_Test extends Zend_Cache_Backend implements Zend_Cache_B
182
  public function remove($id)
183
  {
184
  $this->_addLog('remove', array($id));
185
- if ($id=='false') {
186
  return false;
187
  }
188
  return true;
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Test.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
34
  /**
35
  * @package Zend_Cache
36
  * @subpackage Zend_Cache_Backend
37
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Cache_Backend_Test extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
164
  public function save($data, $id, $tags = array(), $specificLifetime = false)
165
  {
166
  $this->_addLog('save', array($data, $id, $tags));
167
+ if (substr($id,-5)=='false') {
168
  return false;
169
  }
170
  return true;
182
  public function remove($id)
183
  {
184
  $this->_addLog('remove', array($id));
185
+ if (substr($id,-5)=='false') {
186
  return false;
187
  }
188
  return true;
lib/Zend/Cache/Backend/TwoLevels.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: TwoLevels.php 22736 2010-07-30 16:25:54Z andyfowler $
21
  */
22
 
23
 
@@ -35,7 +35,7 @@
35
  /**
36
  * @package Zend_Cache
37
  * @subpackage Zend_Cache_Backend
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
 
@@ -383,7 +383,6 @@ class Zend_Cache_Backend_TwoLevels extends Zend_Cache_Backend implements Zend_Ca
383
  return $this->_slowBackend->getIdsMatchingAnyTags($tags);
384
  }
385
 
386
-
387
  /**
388
  * Return the filling percentage of the backend storage
389
  *
@@ -481,18 +480,19 @@ class Zend_Cache_Backend_TwoLevels extends Zend_Cache_Backend implements Zend_Ca
481
  */
482
  private function _getFastLifetime($lifetime, $priority, $maxLifetime = null)
483
  {
484
- if ($lifetime === null) {
485
- // if lifetime is null, we have an infinite lifetime
486
  // we need to use arbitrary lifetimes
487
  $fastLifetime = (int) (2592000 / (11 - $priority));
488
  } else {
489
- $fastLifetime = (int) ($lifetime / (11 - $priority));
 
490
  }
491
- if (($maxLifetime !== null) && ($maxLifetime >= 0)) {
492
- if ($fastLifetime > $maxLifetime) {
493
- return $maxLifetime;
494
- }
495
  }
 
496
  return $fastLifetime;
497
  }
498
 
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: TwoLevels.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
35
  /**
36
  * @package Zend_Cache
37
  * @subpackage Zend_Cache_Backend
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
 
383
  return $this->_slowBackend->getIdsMatchingAnyTags($tags);
384
  }
385
 
 
386
  /**
387
  * Return the filling percentage of the backend storage
388
  *
480
  */
481
  private function _getFastLifetime($lifetime, $priority, $maxLifetime = null)
482
  {
483
+ if ($lifetime <= 0) {
484
+ // if no lifetime, we have an infinite lifetime
485
  // we need to use arbitrary lifetimes
486
  $fastLifetime = (int) (2592000 / (11 - $priority));
487
  } else {
488
+ // prevent computed infinite lifetime (0) by ceil
489
+ $fastLifetime = (int) ceil($lifetime / (11 - $priority));
490
  }
491
+
492
+ if ($maxLifetime >= 0 && $fastLifetime > $maxLifetime) {
493
+ return $maxLifetime;
 
494
  }
495
+
496
  return $fastLifetime;
497
  }
498
 
lib/Zend/Cache/Backend/WinCache.php ADDED
@@ -0,0 +1,349 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zend Framework
4
+ *
5
+ * LICENSE
6
+ *
7
+ * This source file is subject to the new BSD license that is bundled
8
+ * with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://framework.zend.com/license/new-bsd
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@zend.com so we can send you a copy immediately.
14
+ *
15
+ * @category Zend
16
+ * @package Zend_Cache
17
+ * @subpackage Zend_Cache_Backend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
+ * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id$
21
+ */
22
+
23
+
24
+ /**
25
+ * @see Zend_Cache_Backend_Interface
26
+ */
27
+ #require_once 'Zend/Cache/Backend/ExtendedInterface.php';
28
+
29
+ /**
30
+ * @see Zend_Cache_Backend
31
+ */
32
+ #require_once 'Zend/Cache/Backend.php';
33
+
34
+
35
+ /**
36
+ * @package Zend_Cache
37
+ * @subpackage Zend_Cache_Backend
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
+ * @license http://framework.zend.com/license/new-bsd New BSD License
40
+ */
41
+ class Zend_Cache_Backend_WinCache extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
42
+ {
43
+ /**
44
+ * Log message
45
+ */
46
+ const TAGS_UNSUPPORTED_BY_CLEAN_OF_WINCACHE_BACKEND = 'Zend_Cache_Backend_WinCache::clean() : tags are unsupported by the WinCache backend';
47
+ const TAGS_UNSUPPORTED_BY_SAVE_OF_WINCACHE_BACKEND = 'Zend_Cache_Backend_WinCache::save() : tags are unsupported by the WinCache backend';
48
+
49
+ /**
50
+ * Constructor
51
+ *
52
+ * @param array $options associative array of options
53
+ * @throws Zend_Cache_Exception
54
+ * @return void
55
+ */
56
+ public function __construct(array $options = array())
57
+ {
58
+ if (!extension_loaded('wincache')) {
59
+ Zend_Cache::throwException('The wincache extension must be loaded for using this backend !');
60
+ }
61
+ parent::__construct($options);
62
+ }
63
+
64
+ /**
65
+ * Test if a cache is available for the given id and (if yes) return it (false else)
66
+ *
67
+ * WARNING $doNotTestCacheValidity=true is unsupported by the WinCache backend
68
+ *
69
+ * @param string $id cache id
70
+ * @param boolean $doNotTestCacheValidity if set to true, the cache validity won't be tested
71
+ * @return string cached datas (or false)
72
+ */
73
+ public function load($id, $doNotTestCacheValidity = false)
74
+ {
75
+ $tmp = wincache_ucache_get($id);
76
+ if (is_array($tmp)) {
77
+ return $tmp[0];
78
+ }
79
+ return false;
80
+ }
81
+
82
+ /**
83
+ * Test if a cache is available or not (for the given id)
84
+ *
85
+ * @param string $id cache id
86
+ * @return mixed false (a cache is not available) or "last modified" timestamp (int) of the available cache record
87
+ */
88
+ public function test($id)
89
+ {
90
+ $tmp = wincache_ucache_get($id);
91
+ if (is_array($tmp)) {
92
+ return $tmp[1];
93
+ }
94
+ return false;
95
+ }
96
+
97
+ /**
98
+ * Save some string datas into a cache record
99
+ *
100
+ * Note : $data is always "string" (serialization is done by the
101
+ * core not by the backend)
102
+ *
103
+ * @param string $data datas to cache
104
+ * @param string $id cache id
105
+ * @param array $tags array of strings, the cache record will be tagged by each string entry
106
+ * @param int $specificLifetime if != false, set a specific lifetime for this cache record (null => infinite lifetime)
107
+ * @return boolean true if no problem
108
+ */
109
+ public function save($data, $id, $tags = array(), $specificLifetime = false)
110
+ {
111
+ $lifetime = $this->getLifetime($specificLifetime);
112
+ $result = wincache_ucache_set($id, array($data, time(), $lifetime), $lifetime);
113
+ if (count($tags) > 0) {
114
+ $this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_WINCACHE_BACKEND);
115
+ }
116
+ return $result;
117
+ }
118
+
119
+ /**
120
+ * Remove a cache record
121
+ *
122
+ * @param string $id cache id
123
+ * @return boolean true if no problem
124
+ */
125
+ public function remove($id)
126
+ {
127
+ return wincache_ucache_delete($id);
128
+ }
129
+
130
+ /**
131
+ * Clean some cache records
132
+ *
133
+ * Available modes are :
134
+ * 'all' (default) => remove all cache entries ($tags is not used)
135
+ * 'old' => unsupported
136
+ * 'matchingTag' => unsupported
137
+ * 'notMatchingTag' => unsupported
138
+ * 'matchingAnyTag' => unsupported
139
+ *
140
+ * @param string $mode clean mode
141
+ * @param array $tags array of tags
142
+ * @throws Zend_Cache_Exception
143
+ * @return boolean true if no problem
144
+ */
145
+ public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())
146
+ {
147
+ switch ($mode) {
148
+ case Zend_Cache::CLEANING_MODE_ALL:
149
+ return wincache_ucache_clear();
150
+ break;
151
+ case Zend_Cache::CLEANING_MODE_OLD:
152
+ $this->_log("Zend_Cache_Backend_WinCache::clean() : CLEANING_MODE_OLD is unsupported by the WinCache backend");
153
+ break;
154
+ case Zend_Cache::CLEANING_MODE_MATCHING_TAG:
155
+ case Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG:
156
+ case Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG:
157
+ $this->_log(self::TAGS_UNSUPPORTED_BY_CLEAN_OF_WINCACHE_BACKEND);
158
+ break;
159
+ default:
160
+ Zend_Cache::throwException('Invalid mode for clean() method');
161
+ break;
162
+ }
163
+ }
164
+
165
+ /**
166
+ * Return true if the automatic cleaning is available for the backend
167
+ *
168
+ * DEPRECATED : use getCapabilities() instead
169
+ *
170
+ * @deprecated
171
+ * @return boolean
172
+ */
173
+ public function isAutomaticCleaningAvailable()
174
+ {
175
+ return false;
176
+ }
177
+
178
+ /**
179
+ * Return the filling percentage of the backend storage
180
+ *
181
+ * @throws Zend_Cache_Exception
182
+ * @return int integer between 0 and 100
183
+ */
184
+ public function getFillingPercentage()
185
+ {
186
+ $mem = wincache_ucache_meminfo();
187
+ $memSize = $mem['memory_total'];
188
+ $memUsed = $memSize - $mem['memory_free'];
189
+ if ($memSize == 0) {
190
+ Zend_Cache::throwException('can\'t get WinCache memory size');
191
+ }
192
+ if ($memUsed > $memSize) {
193
+ return 100;
194
+ }
195
+ return ((int) (100. * ($memUsed / $memSize)));
196
+ }
197
+
198
+ /**
199
+ * Return an array of stored tags
200
+ *
201
+ * @return array array of stored tags (string)
202
+ */
203
+ public function getTags()
204
+ {
205
+ $this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_WINCACHE_BACKEND);
206
+ return array();
207
+ }
208
+
209
+ /**
210
+ * Return an array of stored cache ids which match given tags
211
+ *
212
+ * In case of multiple tags, a logical AND is made between tags
213
+ *
214
+ * @param array $tags array of tags
215
+ * @return array array of matching cache ids (string)
216
+ */
217
+ public function getIdsMatchingTags($tags = array())
218
+ {
219
+ $this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_WINCACHE_BACKEND);
220
+ return array();
221
+ }
222
+
223
+ /**
224
+ * Return an array of stored cache ids which don't match given tags
225
+ *
226
+ * In case of multiple tags, a logical OR is made between tags
227
+ *
228
+ * @param array $tags array of tags
229
+ * @return array array of not matching cache ids (string)
230
+ */
231
+ public function getIdsNotMatchingTags($tags = array())
232
+ {
233
+ $this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_WINCACHE_BACKEND);
234
+ return array();
235
+ }
236
+
237
+ /**
238
+ * Return an array of stored cache ids which match any given tags
239
+ *
240
+ * In case of multiple tags, a logical AND is made between tags
241
+ *
242
+ * @param array $tags array of tags
243
+ * @return array array of any matching cache ids (string)
244
+ */
245
+ public function getIdsMatchingAnyTags($tags = array())
246
+ {
247
+ $this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_WINCACHE_BACKEND);
248
+ return array();
249
+ }
250
+
251
+ /**
252
+ * Return an array of stored cache ids
253
+ *
254
+ * @return array array of stored cache ids (string)
255
+ */
256
+ public function getIds()
257
+ {
258
+ $res = array();
259
+ $array = wincache_ucache_info();
260
+ $records = $array['ucache_entries'];
261
+ foreach ($records as $record) {
262
+ $res[] = $record['key_name'];
263
+ }
264
+ return $res;
265
+ }
266
+
267
+ /**
268
+ * Return an array of metadatas for the given cache id
269
+ *
270
+ * The array must include these keys :
271
+ * - expire : the expire timestamp
272
+ * - tags : a string array of tags
273
+ * - mtime : timestamp of last modification time
274
+ *
275
+ * @param string $id cache id
276
+ * @return array array of metadatas (false if the cache id is not found)
277
+ */
278
+ public function getMetadatas($id)
279
+ {
280
+ $tmp = wincache_ucache_get($id);
281
+ if (is_array($tmp)) {
282
+ $data = $tmp[0];
283
+ $mtime = $tmp[1];
284
+ if (!isset($tmp[2])) {
285
+ return false;
286
+ }
287
+ $lifetime = $tmp[2];
288
+ return array(
289
+ 'expire' => $mtime + $lifetime,
290
+ 'tags' => array(),
291
+ 'mtime' => $mtime
292
+ );
293
+ }
294
+ return false;
295
+ }
296
+
297
+ /**
298
+ * Give (if possible) an extra lifetime to the given cache id
299
+ *
300
+ * @param string $id cache id
301
+ * @param int $extraLifetime
302
+ * @return boolean true if ok
303
+ */
304
+ public function touch($id, $extraLifetime)
305
+ {
306
+ $tmp = wincache_ucache_get($id);
307
+ if (is_array($tmp)) {
308
+ $data = $tmp[0];
309
+ $mtime = $tmp[1];
310
+ if (!isset($tmp[2])) {
311
+ return false;
312
+ }
313
+ $lifetime = $tmp[2];
314
+ $newLifetime = $lifetime - (time() - $mtime) + $extraLifetime;
315
+ if ($newLifetime <=0) {
316
+ return false;
317
+ }
318
+ return wincache_ucache_set($id, array($data, time(), $newLifetime), $newLifetime);
319
+ }
320
+ return false;
321
+ }
322
+
323
+ /**
324
+ * Return an associative array of capabilities (booleans) of the backend
325
+ *
326
+ * The array must include these keys :
327
+ * - automatic_cleaning (is automating cleaning necessary)
328
+ * - tags (are tags supported)
329
+ * - expired_read (is it possible to read expired cache records
330
+ * (for doNotTestCacheValidity option for example))
331
+ * - priority does the backend deal with priority when saving
332
+ * - infinite_lifetime (is infinite lifetime can work with this backend)
333
+ * - get_list (is it possible to get the list of cache ids and the complete list of tags)
334
+ *
335
+ * @return array associative of with capabilities
336
+ */
337
+ public function getCapabilities()
338
+ {
339
+ return array(
340
+ 'automatic_cleaning' => false,
341
+ 'tags' => false,
342
+ 'expired_read' => false,
343
+ 'priority' => false,
344
+ 'infinite_lifetime' => false,
345
+ 'get_list' => true
346
+ );
347
+ }
348
+
349
+ }
lib/Zend/Cache/Backend/Xcache.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Xcache.php 23345 2010-11-15 16:31:14Z mabe $
21
  */
22
 
23
 
@@ -35,7 +35,7 @@
35
  /**
36
  * @package Zend_Cache
37
  * @subpackage Zend_Cache_Backend
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Cache_Backend_Xcache extends Zend_Cache_Backend implements Zend_Cache_Backend_Interface
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Xcache.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
35
  /**
36
  * @package Zend_Cache
37
  * @subpackage Zend_Cache_Backend
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Cache_Backend_Xcache extends Zend_Cache_Backend implements Zend_Cache_Backend_Interface
lib/Zend/Cache/Backend/ZendPlatform.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: ZendPlatform.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -36,7 +36,7 @@
36
  *
37
  * @package Zend_Cache
38
  * @subpackage Zend_Cache_Backend
39
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
40
  * @license http://framework.zend.com/license/new-bsd New BSD License
41
  */
42
  class Zend_Cache_Backend_ZendPlatform extends Zend_Cache_Backend implements Zend_Cache_Backend_Interface
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: ZendPlatform.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
36
  *
37
  * @package Zend_Cache
38
  * @subpackage Zend_Cache_Backend
39
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
40
  * @license http://framework.zend.com/license/new-bsd New BSD License
41
  */
42
  class Zend_Cache_Backend_ZendPlatform extends Zend_Cache_Backend implements Zend_Cache_Backend_Interface
lib/Zend/Cache/Backend/ZendServer.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: ZendServer.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -31,7 +31,7 @@
31
  /**
32
  * @package Zend_Cache
33
  * @subpackage Zend_Cache_Backend
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  abstract class Zend_Cache_Backend_ZendServer extends Zend_Cache_Backend implements Zend_Cache_Backend_Interface
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: ZendServer.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
31
  /**
32
  * @package Zend_Cache
33
  * @subpackage Zend_Cache_Backend
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  abstract class Zend_Cache_Backend_ZendServer extends Zend_Cache_Backend implements Zend_Cache_Backend_Interface
lib/Zend/Cache/Backend/ZendServer/Disk.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Disk.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -31,7 +31,7 @@
31
  /**
32
  * @package Zend_Cache
33
  * @subpackage Zend_Cache_Backend
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Cache_Backend_ZendServer_Disk extends Zend_Cache_Backend_ZendServer implements Zend_Cache_Backend_Interface
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Disk.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
31
  /**
32
  * @package Zend_Cache
33
  * @subpackage Zend_Cache_Backend
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Cache_Backend_ZendServer_Disk extends Zend_Cache_Backend_ZendServer implements Zend_Cache_Backend_Interface
lib/Zend/Cache/Backend/ZendServer/ShMem.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: ShMem.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -31,7 +31,7 @@
31
  /**
32
  * @package Zend_Cache
33
  * @subpackage Zend_Cache_Backend
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Cache_Backend_ZendServer_ShMem extends Zend_Cache_Backend_ZendServer implements Zend_Cache_Backend_Interface
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Backend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: ShMem.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
31
  /**
32
  * @package Zend_Cache
33
  * @subpackage Zend_Cache_Backend
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Cache_Backend_ZendServer_ShMem extends Zend_Cache_Backend_ZendServer implements Zend_Cache_Backend_Interface
lib/Zend/Cache/Core.php CHANGED
@@ -14,15 +14,15 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Cache
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Core.php 22651 2010-07-21 04:19:44Z ramon $
20
  */
21
 
22
 
23
  /**
24
  * @package Zend_Cache
25
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
26
  * @license http://framework.zend.com/license/new-bsd New BSD License
27
  */
28
  class Zend_Cache_Core
@@ -211,7 +211,7 @@ class Zend_Cache_Core
211
  public function setOption($name, $value)
212
  {
213
  if (!is_string($name)) {
214
- Zend_Cache::throwException("Incorrect option name : $name");
215
  }
216
  $name = strtolower($name);
217
  if (array_key_exists($name, $this->_options)) {
@@ -235,17 +235,18 @@ class Zend_Cache_Core
235
  */
236
  public function getOption($name)
237
  {
238
- if (is_string($name)) {
239
- $name = strtolower($name);
240
- if (array_key_exists($name, $this->_options)) {
241
- // This is a Core option
242
- return $this->_options[$name];
243
- }
244
- if (array_key_exists($name, $this->_specificOptions)) {
245
- // This a specic option of this frontend
246
- return $this->_specificOptions[$name];
247
- }
248
  }
 
 
 
 
 
 
249
  Zend_Cache::throwException("Incorrect option name : $name");
250
  }
251
 
@@ -300,6 +301,8 @@ class Zend_Cache_Core
300
  $id = $this->_id($id); // cache id may need prefix
301
  $this->_lastId = $id;
302
  self::_validateIdOrTag($id);
 
 
303
  $data = $this->_backend->load($id, $doNotTestCacheValidity);
304
  if ($data===false) {
305
  // no cache available
@@ -326,6 +329,8 @@ class Zend_Cache_Core
326
  $id = $this->_id($id); // cache id may need prefix
327
  self::_validateIdOrTag($id);
328
  $this->_lastId = $id;
 
 
329
  return $this->_backend->test($id);
330
  }
331
 
@@ -360,27 +365,22 @@ class Zend_Cache_Core
360
  Zend_Cache::throwException("Datas must be string or set automatic_serialization = true");
361
  }
362
  }
 
363
  // automatic cleaning
364
  if ($this->_options['automatic_cleaning_factor'] > 0) {
365
  $rand = rand(1, $this->_options['automatic_cleaning_factor']);
366
  if ($rand==1) {
367
- if ($this->_extendedBackend) {
368
- // New way
369
- if ($this->_backendCapabilities['automatic_cleaning']) {
370
- $this->clean(Zend_Cache::CLEANING_MODE_OLD);
371
- } else {
372
- $this->_log('Zend_Cache_Core::save() / automatic cleaning is not available/necessary with this backend');
373
- }
374
  } else {
375
- // Deprecated way (will be removed in next major version)
376
- if (method_exists($this->_backend, 'isAutomaticCleaningAvailable') && ($this->_backend->isAutomaticCleaningAvailable())) {
377
- $this->clean(Zend_Cache::CLEANING_MODE_OLD);
378
- } else {
379
- $this->_log('Zend_Cache_Core::save() / automatic cleaning is not available/necessary with this backend');
380
- }
381
  }
382
  }
383
  }
 
 
384
  if ($this->_options['ignore_user_abort']) {
385
  $abort = ignore_user_abort(true);
386
  }
@@ -392,22 +392,23 @@ class Zend_Cache_Core
392
  if ($this->_options['ignore_user_abort']) {
393
  ignore_user_abort($abort);
394
  }
 
395
  if (!$result) {
396
  // maybe the cache is corrupted, so we remove it !
397
- if ($this->_options['logging']) {
398
- $this->_log("Zend_Cache_Core::save() : impossible to save cache (id=$id)");
399
- }
400
- $this->remove($id);
401
  return false;
402
  }
 
403
  if ($this->_options['write_control']) {
404
  $data2 = $this->_backend->load($id, true);
405
  if ($data!=$data2) {
406
- $this->_log('Zend_Cache_Core::save() / write_control : written and read data do not match');
407
  $this->_backend->remove($id);
408
  return false;
409
  }
410
  }
 
411
  return true;
412
  }
413
 
@@ -424,6 +425,8 @@ class Zend_Cache_Core
424
  }
425
  $id = $this->_id($id); // cache id may need prefix
426
  self::_validateIdOrTag($id);
 
 
427
  return $this->_backend->remove($id);
428
  }
429
 
@@ -458,6 +461,7 @@ class Zend_Cache_Core
458
  Zend_Cache::throwException('Invalid cleaning mode');
459
  }
460
  self::_validateTagsArray($tags);
 
461
  return $this->_backend->clean($mode, $tags);
462
  }
463
 
@@ -649,6 +653,8 @@ class Zend_Cache_Core
649
  Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF);
650
  }
651
  $id = $this->_id($id); // cache id may need prefix
 
 
652
  return $this->_backend->touch($id, $extraLifetime);
653
  }
654
 
@@ -713,9 +719,11 @@ class Zend_Cache_Core
713
  }
714
 
715
  // Create a default logger to the standard output stream
716
- #require_once 'Zend/Log/Writer/Stream.php';
717
  #require_once 'Zend/Log.php';
 
 
718
  $logger = new Zend_Log(new Zend_Log_Writer_Stream('php://output'));
 
719
  $this->_options['logger'] = $logger;
720
  }
721
 
14
  *
15
  * @category Zend
16
  * @package Zend_Cache
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Core.php 24989 2012-06-21 07:24:13Z mabe $
20
  */
21
 
22
 
23
  /**
24
  * @package Zend_Cache
25
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
26
  * @license http://framework.zend.com/license/new-bsd New BSD License
27
  */
28
  class Zend_Cache_Core
211
  public function setOption($name, $value)
212
  {
213
  if (!is_string($name)) {
214
+ Zend_Cache::throwException("Incorrect option name!");
215
  }
216
  $name = strtolower($name);
217
  if (array_key_exists($name, $this->_options)) {
235
  */
236
  public function getOption($name)
237
  {
238
+ $name = strtolower($name);
239
+
240
+ if (array_key_exists($name, $this->_options)) {
241
+ // This is a Core option
242
+ return $this->_options[$name];
 
 
 
 
 
243
  }
244
+
245
+ if (array_key_exists($name, $this->_specificOptions)) {
246
+ // This a specic option of this frontend
247
+ return $this->_specificOptions[$name];
248
+ }
249
+
250
  Zend_Cache::throwException("Incorrect option name : $name");
251
  }
252
 
301
  $id = $this->_id($id); // cache id may need prefix
302
  $this->_lastId = $id;
303
  self::_validateIdOrTag($id);
304
+
305
+ $this->_log("Zend_Cache_Core: load item '{$id}'", 7);
306
  $data = $this->_backend->load($id, $doNotTestCacheValidity);
307
  if ($data===false) {
308
  // no cache available
329
  $id = $this->_id($id); // cache id may need prefix
330
  self::_validateIdOrTag($id);
331
  $this->_lastId = $id;
332
+
333
+ $this->_log("Zend_Cache_Core: test item '{$id}'", 7);
334
  return $this->_backend->test($id);
335
  }
336
 
365
  Zend_Cache::throwException("Datas must be string or set automatic_serialization = true");
366
  }
367
  }
368
+
369
  // automatic cleaning
370
  if ($this->_options['automatic_cleaning_factor'] > 0) {
371
  $rand = rand(1, $this->_options['automatic_cleaning_factor']);
372
  if ($rand==1) {
373
+ // new way || deprecated way
374
+ if ($this->_extendedBackend || method_exists($this->_backend, 'isAutomaticCleaningAvailable')) {
375
+ $this->_log("Zend_Cache_Core::save(): automatic cleaning running", 7);
376
+ $this->clean(Zend_Cache::CLEANING_MODE_OLD);
 
 
 
377
  } else {
378
+ $this->_log("Zend_Cache_Core::save(): automatic cleaning is not available/necessary with current backend", 4);
 
 
 
 
 
379
  }
380
  }
381
  }
382
+
383
+ $this->_log("Zend_Cache_Core: save item '{$id}'", 7);
384
  if ($this->_options['ignore_user_abort']) {
385
  $abort = ignore_user_abort(true);
386
  }
392
  if ($this->_options['ignore_user_abort']) {
393
  ignore_user_abort($abort);
394
  }
395
+
396
  if (!$result) {
397
  // maybe the cache is corrupted, so we remove it !
398
+ $this->_log("Zend_Cache_Core::save(): failed to save item '{$id}' -> removing it", 4);
399
+ $this->_backend->remove($id);
 
 
400
  return false;
401
  }
402
+
403
  if ($this->_options['write_control']) {
404
  $data2 = $this->_backend->load($id, true);
405
  if ($data!=$data2) {
406
+ $this->_log("Zend_Cache_Core::save(): write control of item '{$id}' failed -> removing it", 4);
407
  $this->_backend->remove($id);
408
  return false;
409
  }
410
  }
411
+
412
  return true;
413
  }
414
 
425
  }
426
  $id = $this->_id($id); // cache id may need prefix
427
  self::_validateIdOrTag($id);
428
+
429
+ $this->_log("Zend_Cache_Core: remove item '{$id}'", 7);
430
  return $this->_backend->remove($id);
431
  }
432
 
461
  Zend_Cache::throwException('Invalid cleaning mode');
462
  }
463
  self::_validateTagsArray($tags);
464
+
465
  return $this->_backend->clean($mode, $tags);
466
  }
467
 
653
  Zend_Cache::throwException(self::BACKEND_NOT_IMPLEMENTS_EXTENDED_IF);
654
  }
655
  $id = $this->_id($id); // cache id may need prefix
656
+
657
+ $this->_log("Zend_Cache_Core: touch item '{$id}'", 7);
658
  return $this->_backend->touch($id, $extraLifetime);
659
  }
660
 
719
  }
720
 
721
  // Create a default logger to the standard output stream
 
722
  #require_once 'Zend/Log.php';
723
+ #require_once 'Zend/Log/Writer/Stream.php';
724
+ #require_once 'Zend/Log/Filter/Priority.php';
725
  $logger = new Zend_Log(new Zend_Log_Writer_Stream('php://output'));
726
+ $logger->addFilter(new Zend_Log_Filter_Priority(Zend_Log::WARN, '<='));
727
  $this->_options['logger'] = $logger;
728
  }
729
 
lib/Zend/Cache/Exception.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Cache
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /**
@@ -26,7 +26,7 @@
26
 
27
  /**
28
  * @package Zend_Cache
29
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  class Zend_Cache_Exception extends Zend_Exception {}
14
  *
15
  * @category Zend
16
  * @package Zend_Cache
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /**
26
 
27
  /**
28
  * @package Zend_Cache
29
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  class Zend_Cache_Exception extends Zend_Exception {}
lib/Zend/Cache/Frontend/Capture.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Frontend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Capture.php 22662 2010-07-24 17:37:36Z mabe $
21
  */
22
 
23
 
@@ -30,7 +30,7 @@
30
  /**
31
  * @package Zend_Cache
32
  * @subpackage Zend_Cache_Frontend
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Cache_Frontend_Capture extends Zend_Cache_Core
@@ -46,7 +46,7 @@ class Zend_Cache_Frontend_Capture extends Zend_Cache_Core
46
  * @var array
47
  */
48
  protected $_tags = array();
49
-
50
  protected $_extension = null;
51
 
52
  /**
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Frontend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Capture.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
30
  /**
31
  * @package Zend_Cache
32
  * @subpackage Zend_Cache_Frontend
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Cache_Frontend_Capture extends Zend_Cache_Core
46
  * @var array
47
  */
48
  protected $_tags = array();
49
+
50
  protected $_extension = null;
51
 
52
  /**
lib/Zend/Cache/Frontend/Class.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Frontend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Class.php 23051 2010-10-07 17:01:21Z mabe $
21
  */
22
 
23
  /**
@@ -29,7 +29,7 @@
29
  /**
30
  * @package Zend_Cache
31
  * @subpackage Zend_Cache_Frontend
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Cache_Frontend_Class extends Zend_Cache_Core
@@ -200,13 +200,19 @@ class Zend_Cache_Frontend_Class extends Zend_Cache_Core
200
  */
201
  public function __call($name, $parameters)
202
  {
 
 
 
 
 
 
203
  $cacheBool1 = $this->_specificOptions['cache_by_default'];
204
  $cacheBool2 = in_array($name, $this->_specificOptions['cached_methods']);
205
  $cacheBool3 = in_array($name, $this->_specificOptions['non_cached_methods']);
206
  $cache = (($cacheBool1 || $cacheBool2) && (!$cacheBool3));
207
  if (!$cache) {
208
  // We do not have not cache
209
- return call_user_func_array(array($this->_cachedEntity, $name), $parameters);
210
  }
211
 
212
  $id = $this->_makeId($name, $parameters);
@@ -220,7 +226,7 @@ class Zend_Cache_Frontend_Class extends Zend_Cache_Core
220
  ob_implicit_flush(false);
221
 
222
  try {
223
- $return = call_user_func_array(array($this->_cachedEntity, $name), $parameters);
224
  $output = ob_get_clean();
225
  $data = array($output, $return);
226
  $this->save($data, $id, $this->_tags, $this->_specificLifetime, $this->_priority);
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Frontend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Class.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
29
  /**
30
  * @package Zend_Cache
31
  * @subpackage Zend_Cache_Frontend
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Cache_Frontend_Class extends Zend_Cache_Core
200
  */
201
  public function __call($name, $parameters)
202
  {
203
+ $callback = array($this->_cachedEntity, $name);
204
+
205
+ if (!is_callable($callback, false)) {
206
+ Zend_Cache::throwException('Invalid callback');
207
+ }
208
+
209
  $cacheBool1 = $this->_specificOptions['cache_by_default'];
210
  $cacheBool2 = in_array($name, $this->_specificOptions['cached_methods']);
211
  $cacheBool3 = in_array($name, $this->_specificOptions['non_cached_methods']);
212
  $cache = (($cacheBool1 || $cacheBool2) && (!$cacheBool3));
213
  if (!$cache) {
214
  // We do not have not cache
215
+ return call_user_func_array($callback, $parameters);
216
  }
217
 
218
  $id = $this->_makeId($name, $parameters);
226
  ob_implicit_flush(false);
227
 
228
  try {
229
+ $return = call_user_func_array($callback, $parameters);
230
  $output = ob_get_clean();
231
  $data = array($output, $return);
232
  $this->save($data, $id, $this->_tags, $this->_specificLifetime, $this->_priority);
lib/Zend/Cache/Frontend/File.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Frontend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: File.php 23330 2010-11-14 20:08:09Z mabe $
21
  */
22
 
23
 
@@ -30,7 +30,7 @@
30
  /**
31
  * @package Zend_Cache
32
  * @subpackage Zend_Cache_Frontend
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Cache_Frontend_File extends Zend_Cache_Core
@@ -110,7 +110,11 @@ class Zend_Cache_Frontend_File extends Zend_Cache_Core
110
  clearstatcache();
111
  $i = 0;
112
  foreach ($masterFiles as $masterFile) {
113
- $mtime = @filemtime($masterFile);
 
 
 
 
114
 
115
  if (!$this->_specificOptions['ignore_missing_master_files'] && !$mtime) {
116
  Zend_Cache::throwException('Unable to read master_file : ' . $masterFile);
@@ -119,7 +123,7 @@ class Zend_Cache_Frontend_File extends Zend_Cache_Core
119
  $this->_masterFile_mtimes[$i] = $mtime;
120
  $this->_specificOptions['master_files'][$i] = $masterFile;
121
  if ($i === 0) { // to keep a compatibility
122
- $this->_specificOptions['master_files'] = $masterFile;
123
  }
124
 
125
  $i++;
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Frontend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: File.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
30
  /**
31
  * @package Zend_Cache
32
  * @subpackage Zend_Cache_Frontend
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Cache_Frontend_File extends Zend_Cache_Core
110
  clearstatcache();
111
  $i = 0;
112
  foreach ($masterFiles as $masterFile) {
113
+ if (file_exists($masterFile)) {
114
+ $mtime = filemtime($masterFile);
115
+ } else {
116
+ $mtime = false;
117
+ }
118
 
119
  if (!$this->_specificOptions['ignore_missing_master_files'] && !$mtime) {
120
  Zend_Cache::throwException('Unable to read master_file : ' . $masterFile);
123
  $this->_masterFile_mtimes[$i] = $mtime;
124
  $this->_specificOptions['master_files'][$i] = $masterFile;
125
  if ($i === 0) { // to keep a compatibility
126
+ $this->_specificOptions['master_file'] = $masterFile;
127
  }
128
 
129
  $i++;
lib/Zend/Cache/Frontend/Function.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Frontend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Function.php 22648 2010-07-20 14:43:27Z mabe $
21
  */
22
 
23
 
@@ -30,7 +30,7 @@
30
  /**
31
  * @package Zend_Cache
32
  * @subpackage Zend_Cache_Frontend
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Cache_Frontend_Function extends Zend_Cache_Core
@@ -104,8 +104,7 @@ class Zend_Cache_Frontend_Function extends Zend_Cache_Core
104
  ob_start();
105
  ob_implicit_flush(false);
106
  $return = call_user_func_array($callback, $parameters);
107
- $output = ob_get_contents();
108
- ob_end_clean();
109
  $data = array($output, $return);
110
  $this->save($data, $id, $tags, $specificLifetime, $priority);
111
  }
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Frontend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Function.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
30
  /**
31
  * @package Zend_Cache
32
  * @subpackage Zend_Cache_Frontend
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Cache_Frontend_Function extends Zend_Cache_Core
104
  ob_start();
105
  ob_implicit_flush(false);
106
  $return = call_user_func_array($callback, $parameters);
107
+ $output = ob_get_clean();
 
108
  $data = array($output, $return);
109
  $this->save($data, $id, $tags, $specificLifetime, $priority);
110
  }
lib/Zend/Cache/Frontend/Output.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Frontend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Output.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -30,7 +30,7 @@
30
  /**
31
  * @package Zend_Cache
32
  * @subpackage Zend_Cache_Frontend
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Cache_Frontend_Output extends Zend_Cache_Core
@@ -55,7 +55,7 @@ class Zend_Cache_Frontend_Output extends Zend_Cache_Core
55
  *
56
  * @param string $id Cache id
57
  * @param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested
58
- * @param boolean $echoData If set to true, datas are sent to the browser if the cache is hit (simpy returned else)
59
  * @return mixed True if the cache is hit (false else) with $echoData=true (default) ; string else (datas)
60
  */
61
  public function start($id, $doNotTestCacheValidity = false, $echoData = true)
@@ -88,8 +88,7 @@ class Zend_Cache_Frontend_Output extends Zend_Cache_Core
88
  public function end($tags = array(), $specificLifetime = false, $forcedDatas = null, $echoData = true, $priority = 8)
89
  {
90
  if ($forcedDatas === null) {
91
- $data = ob_get_contents();
92
- ob_end_clean();
93
  } else {
94
  $data =& $forcedDatas;
95
  }
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Frontend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Output.php 24800 2012-05-13 11:59:32Z mabe $
21
  */
22
 
23
 
30
  /**
31
  * @package Zend_Cache
32
  * @subpackage Zend_Cache_Frontend
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Cache_Frontend_Output extends Zend_Cache_Core
55
  *
56
  * @param string $id Cache id
57
  * @param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested
58
+ * @param boolean $echoData If set to true, datas are sent to the browser if the cache is hit (simply returned else)
59
  * @return mixed True if the cache is hit (false else) with $echoData=true (default) ; string else (datas)
60
  */
61
  public function start($id, $doNotTestCacheValidity = false, $echoData = true)
88
  public function end($tags = array(), $specificLifetime = false, $forcedDatas = null, $echoData = true, $priority = 8)
89
  {
90
  if ($forcedDatas === null) {
91
+ $data = ob_get_clean();
 
92
  } else {
93
  $data =& $forcedDatas;
94
  }
lib/Zend/Cache/Frontend/Page.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Frontend
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Page.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -30,7 +30,7 @@
30
  /**
31
  * @package Zend_Cache
32
  * @subpackage Zend_Cache_Frontend
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Cache_Frontend_Page extends Zend_Cache_Core
@@ -243,9 +243,11 @@ class Zend_Cache_Frontend_Page extends Zend_Cache_Core
243
  {
244
  $this->_cancel = false;
245
  $lastMatchingRegexp = null;
246
- foreach ($this->_specificOptions['regexps'] as $regexp => $conf) {
247
- if (preg_match("`$regexp`", $_SERVER['REQUEST_URI'])) {
248
- $lastMatchingRegexp = $regexp;
 
 
249
  }
250
  }
251
  $this->_activeOptions = $this->_specificOptions['default_options'];
15
  * @category Zend
16
  * @package Zend_Cache
17
  * @subpackage Zend_Cache_Frontend
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Page.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
30
  /**
31
  * @package Zend_Cache
32
  * @subpackage Zend_Cache_Frontend
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Cache_Frontend_Page extends Zend_Cache_Core
243
  {
244
  $this->_cancel = false;
245
  $lastMatchingRegexp = null;
246
+ if (isset($_SERVER['REQUEST_URI'])) {
247
+ foreach ($this->_specificOptions['regexps'] as $regexp => $conf) {
248
+ if (preg_match("`$regexp`", $_SERVER['REQUEST_URI'])) {
249
+ $lastMatchingRegexp = $regexp;
250
+ }
251
  }
252
  }
253
  $this->_activeOptions = $this->_specificOptions['default_options'];
lib/Zend/Cache/Manager.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Cache
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Manager.php 22727 2010-07-30 12:36:00Z mabe $
20
  */
21
 
22
  /** @see Zend_Cache_Exception */
@@ -28,7 +28,7 @@
28
  /**
29
  * @category Zend
30
  * @package Zend_Cache
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Cache_Manager
14
  *
15
  * @category Zend
16
  * @package Zend_Cache
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Manager.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /** @see Zend_Cache_Exception */
28
  /**
29
  * @category Zend
30
  * @package Zend_Cache
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Cache_Manager
lib/Zend/Captcha/Adapter.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Captcha
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -30,9 +30,9 @@
30
  * @category Zend
31
  * @package Zend_Captcha
32
  * @subpackage Adapter
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
- * @version $Id: Adapter.php 20096 2010-01-06 02:05:09Z bkarwin $
36
  */
37
  interface Zend_Captcha_Adapter extends Zend_Validate_Interface
38
  {
15
  * @category Zend
16
  * @package Zend_Captcha
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
30
  * @category Zend
31
  * @package Zend_Captcha
32
  * @subpackage Adapter
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
+ * @version $Id: Adapter.php 24593 2012-01-05 20:35:02Z matthew $
36
  */
37
  interface Zend_Captcha_Adapter extends Zend_Validate_Interface
38
  {
lib/Zend/Captcha/Base.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Captcha
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -33,9 +33,9 @@
33
  * @category Zend
34
  * @package Zend_Captcha
35
  * @subpackage Adapter
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
- * @version $Id: Base.php 20096 2010-01-06 02:05:09Z bkarwin $
39
  */
40
  abstract class Zend_Captcha_Base extends Zend_Validate_Abstract implements Zend_Captcha_Adapter
41
  {
15
  * @category Zend
16
  * @package Zend_Captcha
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
33
  * @category Zend
34
  * @package Zend_Captcha
35
  * @subpackage Adapter
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
+ * @version $Id: Base.php 24593 2012-01-05 20:35:02Z matthew $
39
  */
40
  abstract class Zend_Captcha_Base extends Zend_Validate_Abstract implements Zend_Captcha_Adapter
41
  {
lib/Zend/Captcha/Dumb.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Captcha
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -30,12 +30,35 @@
30
  * @category Zend
31
  * @package Zend_Captcha
32
  * @subpackage Adapter
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
- * @version $Id: Dumb.php 20096 2010-01-06 02:05:09Z bkarwin $
36
  */
37
  class Zend_Captcha_Dumb extends Zend_Captcha_Word
38
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  /**
40
  * Render the captcha
41
  *
@@ -45,7 +68,7 @@ class Zend_Captcha_Dumb extends Zend_Captcha_Word
45
  */
46
  public function render(Zend_View_Interface $view = null, $element = null)
47
  {
48
- return 'Please type this word backwards: <b>'
49
  . strrev($this->getWord())
50
  . '</b>';
51
  }
15
  * @category Zend
16
  * @package Zend_Captcha
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
30
  * @category Zend
31
  * @package Zend_Captcha
32
  * @subpackage Adapter
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
+ * @version $Id: Dumb.php 24747 2012-05-05 00:21:56Z adamlundrigan $
36
  */
37
  class Zend_Captcha_Dumb extends Zend_Captcha_Word
38
  {
39
+ /**
40
+ * CAPTCHA label
41
+ * @type string
42
+ */
43
+ protected $_label = 'Please type this word backwards';
44
+
45
+ /**
46
+ * Set the label for the CAPTCHA
47
+ * @param string $label
48
+ */
49
+ public function setLabel($label)
50
+ {
51
+ $this->_label = $label;
52
+ }
53
+
54
+ /**
55
+ * Retrieve the label for the CAPTCHA
56
+ * @return string
57
+ */
58
+ public function getLabel()
59
+ {
60
+ return $this->_label;
61
+ }
62
  /**
63
  * Render the captcha
64
  *
68
  */
69
  public function render(Zend_View_Interface $view = null, $element = null)
70
  {
71
+ return $this->getLabel() . ': <b>'
72
  . strrev($this->getWord())
73
  . '</b>';
74
  }
lib/Zend/Captcha/Exception.php CHANGED
@@ -14,8 +14,8 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Captcha
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -29,7 +29,7 @@
29
  *
30
  * @category Zend
31
  * @package Zend_Captcha
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Captcha_Exception extends Zend_Exception
14
  *
15
  * @category Zend
16
  * @package Zend_Captcha
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
29
  *
30
  * @category Zend
31
  * @package Zend_Captcha
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Captcha_Exception extends Zend_Exception
lib/Zend/Captcha/Figlet.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Captcha
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -33,9 +33,9 @@
33
  * @category Zend
34
  * @package Zend_Captcha
35
  * @subpackage Adapter
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
- * @version $Id: Figlet.php 20096 2010-01-06 02:05:09Z bkarwin $
39
  */
40
  class Zend_Captcha_Figlet extends Zend_Captcha_Word
41
  {
15
  * @category Zend
16
  * @package Zend_Captcha
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
33
  * @category Zend
34
  * @package Zend_Captcha
35
  * @subpackage Adapter
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
+ * @version $Id: Figlet.php 24593 2012-01-05 20:35:02Z matthew $
39
  */
40
  class Zend_Captcha_Figlet extends Zend_Captcha_Word
41
  {
lib/Zend/Captcha/Image.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Captcha
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Image.php 22589 2010-07-16 20:51:51Z mikaelkael $
21
  */
22
 
23
  /** @see Zend_Captcha_Word */
@@ -31,7 +31,7 @@
31
  * @category Zend
32
  * @package Zend_Captcha
33
  * @subpackage Adapter
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Captcha_Image extends Zend_Captcha_Word
@@ -580,7 +580,7 @@ class Zend_Captcha_Image extends Zend_Captcha_Word
580
  $suffixLength = strlen($this->_suffix);
581
  foreach (new DirectoryIterator($imgdir) as $file) {
582
  if (!$file->isDot() && !$file->isDir()) {
583
- if ($file->getMTime() < $expire) {
584
  // only deletes files ending with $this->_suffix
585
  if (substr($file->getFilename(), -($suffixLength)) == $this->_suffix) {
586
  unlink($file->getPathname());
@@ -599,7 +599,11 @@ class Zend_Captcha_Image extends Zend_Captcha_Word
599
  */
600
  public function render(Zend_View_Interface $view = null, $element = null)
601
  {
 
 
 
 
602
  return '<img width="' . $this->getWidth() . '" height="' . $this->getHeight() . '" alt="' . $this->getImgAlt()
603
- . '" src="' . $this->getImgUrl() . $this->getId() . $this->getSuffix() . '" />';
604
  }
605
  }
15
  * @category Zend
16
  * @package Zend_Captcha
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Image.php 24821 2012-05-29 14:54:50Z adamlundrigan $
21
  */
22
 
23
  /** @see Zend_Captcha_Word */
31
  * @category Zend
32
  * @package Zend_Captcha
33
  * @subpackage Adapter
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Captcha_Image extends Zend_Captcha_Word
580
  $suffixLength = strlen($this->_suffix);
581
  foreach (new DirectoryIterator($imgdir) as $file) {
582
  if (!$file->isDot() && !$file->isDir()) {
583
+ if (file_exists($file->getPathname()) && $file->getMTime() < $expire) {
584
  // only deletes files ending with $this->_suffix
585
  if (substr($file->getFilename(), -($suffixLength)) == $this->_suffix) {
586
  unlink($file->getPathname());
599
  */
600
  public function render(Zend_View_Interface $view = null, $element = null)
601
  {
602
+ $endTag = ' />';
603
+ if (($view instanceof Zend_View_Abstract) && !$view->doctype()->isXhtml()) {
604
+ $endTag = '>';
605
+ }
606
  return '<img width="' . $this->getWidth() . '" height="' . $this->getHeight() . '" alt="' . $this->getImgAlt()
607
+ . '" src="' . $this->getImgUrl() . $this->getId() . $this->getSuffix() . '"' . $endTag;
608
  }
609
  }
lib/Zend/Captcha/ReCaptcha.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Captcha
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -35,9 +35,9 @@
35
  * @category Zend
36
  * @package Zend_Captcha
37
  * @subpackage Adapter
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
- * @version $Id: ReCaptcha.php 20096 2010-01-06 02:05:09Z bkarwin $
41
  */
42
  class Zend_Captcha_ReCaptcha extends Zend_Captcha_Base
43
  {
@@ -261,6 +261,20 @@ class Zend_Captcha_ReCaptcha extends Zend_Captcha_Base
261
  */
262
  public function render(Zend_View_Interface $view = null, $element = null)
263
  {
264
- return $this->getService()->getHTML();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
265
  }
266
  }
15
  * @category Zend
16
  * @package Zend_Captcha
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
35
  * @category Zend
36
  * @package Zend_Captcha
37
  * @subpackage Adapter
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
+ * @version $Id: ReCaptcha.php 24593 2012-01-05 20:35:02Z matthew $
41
  */
42
  class Zend_Captcha_ReCaptcha extends Zend_Captcha_Base
43
  {
261
  */
262
  public function render(Zend_View_Interface $view = null, $element = null)
263
  {
264
+ $name = null;
265
+ if ($element instanceof Zend_Form_Element) {
266
+ $name = $element->getBelongsTo();
267
+ }
268
+ return $this->getService()->getHTML($name);
269
+ }
270
+
271
+ /**
272
+ * Get captcha decorator
273
+ *
274
+ * @return string
275
+ */
276
+ public function getDecorator()
277
+ {
278
+ return "Captcha_ReCaptcha";
279
  }
280
  }
lib/Zend/Captcha/Word.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Captcha
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -30,9 +30,9 @@
30
  * @category Zend
31
  * @package Zend_Captcha
32
  * @subpackage Adapter
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
- * @version $Id: Word.php 21793 2010-04-08 00:51:31Z stas $
36
  */
37
  abstract class Zend_Captcha_Word extends Zend_Captcha_Base
38
  {
@@ -93,10 +93,10 @@ abstract class Zend_Captcha_Word extends Zend_Captcha_Base
93
  * @var integer
94
  */
95
  protected $_timeout = 300;
96
-
97
  /**
98
  * Should generate() keep session or create a new one?
99
- *
100
  * @var boolean
101
  */
102
  protected $_keepSession = false;
@@ -131,7 +131,7 @@ abstract class Zend_Captcha_Word extends Zend_Captcha_Base
131
  *
132
  * @return string
133
  */
134
- public function getSessionClass()
135
  {
136
  return $this->_sessionClass;
137
  }
@@ -217,21 +217,21 @@ abstract class Zend_Captcha_Word extends Zend_Captcha_Base
217
  return $this->_timeout;
218
  }
219
 
220
- /**
221
- * Sets if session should be preserved on generate()
222
- *
223
- * @param $keepSession Should session be kept on generate()?
224
- * @return Zend_Captcha_Word
225
- */
226
- public function setKeepSession($keepSession)
227
- {
228
- $this->_keepSession = $keepSession;
229
- return $this;
230
- }
231
 
232
  /**
233
  * Numbers should be included in the pattern?
234
- *
235
  * @return bool
236
  */
237
  public function getUseNumbers()
@@ -239,10 +239,10 @@ abstract class Zend_Captcha_Word extends Zend_Captcha_Base
239
  return $this->_useNumbers;
240
  }
241
 
242
- /**
243
- * Set if numbers should be included in the pattern
244
- *
245
- * @param $_useNumbers numbers should be included in the pattern?
246
  * @return Zend_Captcha_Word
247
  */
248
  public function setUseNumbers($_useNumbers)
@@ -250,8 +250,8 @@ abstract class Zend_Captcha_Word extends Zend_Captcha_Base
250
  $this->_useNumbers = $_useNumbers;
251
  return $this;
252
  }
253
-
254
- /**
255
  * Get session object
256
  *
257
  * @return Zend_Session_Namespace
@@ -348,7 +348,7 @@ abstract class Zend_Captcha_Word extends Zend_Captcha_Base
348
  public function generate()
349
  {
350
  if(!$this->_keepSession) {
351
- $this->_session = null;
352
  }
353
  $id = $this->_generateRandomId();
354
  $this->_setId($id);
15
  * @category Zend
16
  * @package Zend_Captcha
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
30
  * @category Zend
31
  * @package Zend_Captcha
32
  * @subpackage Adapter
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
+ * @version $Id: Word.php 24593 2012-01-05 20:35:02Z matthew $
36
  */
37
  abstract class Zend_Captcha_Word extends Zend_Captcha_Base
38
  {
93
  * @var integer
94
  */
95
  protected $_timeout = 300;
96
+
97
  /**
98
  * Should generate() keep session or create a new one?
99
+ *
100
  * @var boolean
101
  */
102
  protected $_keepSession = false;
131
  *
132
  * @return string
133
  */
134
+ public function getSessionClass()
135
  {
136
  return $this->_sessionClass;
137
  }
217
  return $this->_timeout;
218
  }
219
 
220
+ /**
221
+ * Sets if session should be preserved on generate()
222
+ *
223
+ * @param bool $keepSession Should session be kept on generate()?
224
+ * @return Zend_Captcha_Word
225
+ */
226
+ public function setKeepSession($keepSession)
227
+ {
228
+ $this->_keepSession = $keepSession;
229
+ return $this;
230
+ }
231
 
232
  /**
233
  * Numbers should be included in the pattern?
234
+ *
235
  * @return bool
236
  */
237
  public function getUseNumbers()
239
  return $this->_useNumbers;
240
  }
241
 
242
+ /**
243
+ * Set if numbers should be included in the pattern
244
+ *
245
+ * @param bool $_useNumbers numbers should be included in the pattern?
246
  * @return Zend_Captcha_Word
247
  */
248
  public function setUseNumbers($_useNumbers)
250
  $this->_useNumbers = $_useNumbers;
251
  return $this;
252
  }
253
+
254
+ /**
255
  * Get session object
256
  *
257
  * @return Zend_Session_Namespace
348
  public function generate()
349
  {
350
  if(!$this->_keepSession) {
351
+ $this->_session = null;
352
  }
353
  $id = $this->_generateRandomId();
354
  $this->_setId($id);
lib/Zend/Cloud/AbstractFactory.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Cloud
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
@@ -23,29 +23,29 @@
23
  *
24
  * @category Zend
25
  * @package Zend_Cloud
26
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  class Zend_Cloud_AbstractFactory
30
  {
31
  /**
32
  * Constructor
33
- *
34
  * @return void
35
  */
36
  private function __construct()
37
  {
38
  // private ctor - should not be used
39
  }
40
-
41
  /**
42
  * Get an individual adapter instance
43
- *
44
- * @param string $adapterOption
45
- * @param array|Zend_Config $options
46
  * @return null|Zend_Cloud_DocumentService_Adapter|Zend_Cloud_QueueService_Adapter|Zend_Cloud_StorageService_Adapter
47
  */
48
- protected static function _getAdapter($adapterOption, $options)
49
  {
50
  if ($options instanceof Zend_Config) {
51
  $options = $options->toArray();
14
  *
15
  * @category Zend
16
  * @package Zend_Cloud
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
23
  *
24
  * @category Zend
25
  * @package Zend_Cloud
26
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  class Zend_Cloud_AbstractFactory
30
  {
31
  /**
32
  * Constructor
33
+ *
34
  * @return void
35
  */
36
  private function __construct()
37
  {
38
  // private ctor - should not be used
39
  }
40
+
41
  /**
42
  * Get an individual adapter instance
43
+ *
44
+ * @param string $adapterOption
45
+ * @param array|Zend_Config $options
46
  * @return null|Zend_Cloud_DocumentService_Adapter|Zend_Cloud_QueueService_Adapter|Zend_Cloud_StorageService_Adapter
47
  */
48
+ protected static function _getAdapter($adapterOption, $options)
49
  {
50
  if ($options instanceof Zend_Config) {
51
  $options = $options->toArray();
lib/Zend/Cloud/DocumentService/Adapter.php CHANGED
@@ -13,7 +13,7 @@
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage DocumentService
16
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
@@ -31,7 +31,7 @@
31
  * @category Zend
32
  * @package Zend_Cloud
33
  * @subpackage DocumentService
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  interface Zend_Cloud_DocumentService_Adapter
@@ -67,9 +67,9 @@ interface Zend_Cloud_DocumentService_Adapter
67
 
68
  /**
69
  * List all documents in a collection
70
- *
71
- * @param string $collectionName
72
- * @param null|array $options
73
  * @return Zend_Cloud_DocumentService_DocumentSet
74
  */
75
  public function listDocuments($collectionName, array $options = null);
@@ -87,7 +87,7 @@ interface Zend_Cloud_DocumentService_Adapter
87
  /**
88
  * Replace document
89
  * The new document replaces the existing document with the same ID.
90
- *
91
  * @param string $collectionName Collection name
92
  * @param Zend_Cloud_DocumentService_Document $document
93
  * @param array $options
@@ -96,8 +96,8 @@ interface Zend_Cloud_DocumentService_Adapter
96
 
97
  /**
98
  * Update document
99
- * The fields of the existing documents will be updated.
100
- * Fields not specified in the set will be left as-is.
101
  *
102
  * @param string $collectionName
103
  * @param mixed|Zend_Cloud_DocumentService_Document $documentID Document ID, adapter-dependent, or document containing updates
@@ -106,7 +106,7 @@ interface Zend_Cloud_DocumentService_Adapter
106
  * @return boolean
107
  */
108
  public function updateDocument($collectionName, $documentID, $fieldset = null, $options = null);
109
-
110
  /**
111
  * Delete document
112
  *
@@ -119,16 +119,16 @@ interface Zend_Cloud_DocumentService_Adapter
119
 
120
  /**
121
  * Fetch single document by ID
122
- *
123
  * Will return false if the document does not exist
124
- *
125
  * @param string $collectionName Collection name
126
  * @param mixed $documentID Document ID, adapter-dependent
127
  * @param array $options
128
  * @return Zend_Cloud_DocumentService_Document
129
  */
130
  public function fetchDocument($collectionName, $documentID, $options = null);
131
-
132
  /**
133
  * Query for documents stored in the document service. If a string is passed in
134
  * $query, the query string will be passed directly to the service.
@@ -139,15 +139,15 @@ interface Zend_Cloud_DocumentService_Adapter
139
  * @return array Array of field sets
140
  */
141
  public function query($collectionName, $query, $options = null);
142
-
143
  /**
144
  * Create query statement
145
- *
146
  * @param string $fields
147
  * @return Zend_Cloud_DocumentService_Query
148
  */
149
  public function select($fields = null);
150
-
151
  /**
152
  * Get the concrete service client
153
  */
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage DocumentService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
31
  * @category Zend
32
  * @package Zend_Cloud
33
  * @subpackage DocumentService
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  interface Zend_Cloud_DocumentService_Adapter
67
 
68
  /**
69
  * List all documents in a collection
70
+ *
71
+ * @param string $collectionName
72
+ * @param null|array $options
73
  * @return Zend_Cloud_DocumentService_DocumentSet
74
  */
75
  public function listDocuments($collectionName, array $options = null);
87
  /**
88
  * Replace document
89
  * The new document replaces the existing document with the same ID.
90
+ *
91
  * @param string $collectionName Collection name
92
  * @param Zend_Cloud_DocumentService_Document $document
93
  * @param array $options
96
 
97
  /**
98
  * Update document
99
+ * The fields of the existing documents will be updated.
100
+ * Fields not specified in the set will be left as-is.
101
  *
102
  * @param string $collectionName
103
  * @param mixed|Zend_Cloud_DocumentService_Document $documentID Document ID, adapter-dependent, or document containing updates
106
  * @return boolean
107
  */
108
  public function updateDocument($collectionName, $documentID, $fieldset = null, $options = null);
109
+
110
  /**
111
  * Delete document
112
  *
119
 
120
  /**
121
  * Fetch single document by ID
122
+ *
123
  * Will return false if the document does not exist
124
+ *
125
  * @param string $collectionName Collection name
126
  * @param mixed $documentID Document ID, adapter-dependent
127
  * @param array $options
128
  * @return Zend_Cloud_DocumentService_Document
129
  */
130
  public function fetchDocument($collectionName, $documentID, $options = null);
131
+
132
  /**
133
  * Query for documents stored in the document service. If a string is passed in
134
  * $query, the query string will be passed directly to the service.
139
  * @return array Array of field sets
140
  */
141
  public function query($collectionName, $query, $options = null);
142
+
143
  /**
144
  * Create query statement
145
+ *
146
  * @param string $fields
147
  * @return Zend_Cloud_DocumentService_Query
148
  */
149
  public function select($fields = null);
150
+
151
  /**
152
  * Get the concrete service client
153
  */
lib/Zend/Cloud/DocumentService/Adapter/AbstractAdapter.php CHANGED
@@ -13,7 +13,7 @@
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage DocumentService
16
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
@@ -33,10 +33,10 @@
33
  * @category Zend
34
  * @package Zend_Cloud
35
  * @subpackage DocumentService
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
- abstract class Zend_Cloud_DocumentService_Adapter_AbstractAdapter
40
  implements Zend_Cloud_DocumentService_Adapter
41
  {
42
  const DOCUMENT_CLASS = 'document_class';
@@ -57,15 +57,15 @@ abstract class Zend_Cloud_DocumentService_Adapter_AbstractAdapter
57
 
58
  /**
59
  * Class to utilize for new query objects
60
- *
61
  * @var string
62
  */
63
  protected $_queryClass = 'Zend_Cloud_DocumentService_Query';
64
 
65
  /**
66
  * Set the class for document objects
67
- *
68
- * @param string $class
69
  * @return Zend_Cloud_DocumentService_Adapter_AbstractAdapter
70
  */
71
  public function setDocumentClass($class)
@@ -76,7 +76,7 @@ abstract class Zend_Cloud_DocumentService_Adapter_AbstractAdapter
76
 
77
  /**
78
  * Get the class for document objects
79
- *
80
  * @return string
81
  */
82
  public function getDocumentClass()
@@ -86,8 +86,8 @@ abstract class Zend_Cloud_DocumentService_Adapter_AbstractAdapter
86
 
87
  /**
88
  * Set the class for document set objects
89
- *
90
- * @param string $class
91
  * @return Zend_Cloud_DocumentService_Adapter_AbstractAdapter
92
  */
93
  public function setDocumentSetClass($class)
@@ -98,7 +98,7 @@ abstract class Zend_Cloud_DocumentService_Adapter_AbstractAdapter
98
 
99
  /**
100
  * Get the class for document set objects
101
- *
102
  * @return string
103
  */
104
  public function getDocumentSetClass()
@@ -108,8 +108,8 @@ abstract class Zend_Cloud_DocumentService_Adapter_AbstractAdapter
108
 
109
  /**
110
  * Set the query class for query objects
111
- *
112
- * @param string $class
113
  * @return Zend_Cloud_DocumentService_Adapter_AbstractAdapter
114
  */
115
  public function setQueryClass($class)
@@ -120,7 +120,7 @@ abstract class Zend_Cloud_DocumentService_Adapter_AbstractAdapter
120
 
121
  /**
122
  * Get the class for query objects
123
- *
124
  * @return string
125
  */
126
  public function getQueryClass()
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage DocumentService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
33
  * @category Zend
34
  * @package Zend_Cloud
35
  * @subpackage DocumentService
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
+ abstract class Zend_Cloud_DocumentService_Adapter_AbstractAdapter
40
  implements Zend_Cloud_DocumentService_Adapter
41
  {
42
  const DOCUMENT_CLASS = 'document_class';
57
 
58
  /**
59
  * Class to utilize for new query objects
60
+ *
61
  * @var string
62
  */
63
  protected $_queryClass = 'Zend_Cloud_DocumentService_Query';
64
 
65
  /**
66
  * Set the class for document objects
67
+ *
68
+ * @param string $class
69
  * @return Zend_Cloud_DocumentService_Adapter_AbstractAdapter
70
  */
71
  public function setDocumentClass($class)
76
 
77
  /**
78
  * Get the class for document objects
79
+ *
80
  * @return string
81
  */
82
  public function getDocumentClass()
86
 
87
  /**
88
  * Set the class for document set objects
89
+ *
90
+ * @param string $class
91
  * @return Zend_Cloud_DocumentService_Adapter_AbstractAdapter
92
  */
93
  public function setDocumentSetClass($class)
98
 
99
  /**
100
  * Get the class for document set objects
101
+ *
102
  * @return string
103
  */
104
  public function getDocumentSetClass()
108
 
109
  /**
110
  * Set the query class for query objects
111
+ *
112
+ * @param string $class
113
  * @return Zend_Cloud_DocumentService_Adapter_AbstractAdapter
114
  */
115
  public function setQueryClass($class)
120
 
121
  /**
122
  * Get the class for query objects
123
+ *
124
  * @return string
125
  */
126
  public function getQueryClass()
lib/Zend/Cloud/DocumentService/Adapter/SimpleDb.php CHANGED
@@ -1,468 +1,468 @@
1
- <?php
2
- /**
3
- * LICENSE
4
- *
5
- * This source file is subject to the new BSD license that is bundled
6
- * with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://framework.zend.com/license/new-bsd
9
- * If you did not receive a copy of the license and are unable to
10
- * obtain it through the world-wide-web, please send an email
11
- * to license@zend.com so we can send you a copy immediately.
12
- *
13
- * @category Zend
14
- * @package Zend_Cloud
15
- * @subpackage DocumentService
16
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
17
- * @license http://framework.zend.com/license/new-bsd New BSD License
18
- */
19
-
20
- #require_once 'Zend/Cloud/DocumentService/Adapter/AbstractAdapter.php';
21
- #require_once 'Zend/Cloud/DocumentService/Adapter/SimpleDb/Query.php';
22
- #require_once 'Zend/Cloud/DocumentService/Exception.php';
23
- #require_once 'Zend/Service/Amazon/SimpleDb.php';
24
- #require_once 'Zend/Service/Amazon/SimpleDb/Attribute.php';
25
-
26
- /**
27
- * SimpleDB adapter for document service.
28
- *
29
- * @category Zend
30
- * @package Zend_Cloud
31
- * @subpackage DocumentService
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
- * @license http://framework.zend.com/license/new-bsd New BSD License
34
- */
35
- class Zend_Cloud_DocumentService_Adapter_SimpleDb
36
- extends Zend_Cloud_DocumentService_Adapter_AbstractAdapter
37
- {
38
- /*
39
- * Options array keys for the SimpleDB adapter.
40
- */
41
- const AWS_ACCESS_KEY = 'aws_accesskey';
42
- const AWS_SECRET_KEY = 'aws_secretkey';
43
-
44
- const ITEM_NAME = 'ItemName';
45
-
46
- const MERGE_OPTION = "merge";
47
- const RETURN_DOCUMENTS = "return_documents";
48
-
49
- const DEFAULT_QUERY_CLASS = 'Zend_Cloud_DocumentService_Adapter_SimpleDb_Query';
50
-
51
-
52
- /**
53
- * SQS service instance.
54
- * @var Zend_Service_Amazon_SimpleDb
55
- */
56
- protected $_simpleDb;
57
-
58
- /**
59
- * Class to utilize for new query objects
60
- * @var string
61
- */
62
- protected $_queryClass = 'Zend_Cloud_DocumentService_Adapter_SimpleDb_Query';
63
-
64
- /**
65
- * Constructor
66
- *
67
- * @param array|Zend_Config $options
68
- * @return void
69
- */
70
- public function __construct($options = array())
71
- {
72
- if ($options instanceof Zend_Config) {
73
- $options = $options->toArray();
74
- }
75
-
76
- if (!is_array($options)) {
77
- throw new Zend_Cloud_DocumentService_Exception('Invalid options provided to constructor');
78
- }
79
-
80
- $this->_simpleDb = new Zend_Service_Amazon_SimpleDb(
81
- $options[self::AWS_ACCESS_KEY], $options[self::AWS_SECRET_KEY]
82
- );
83
-
84
- if (isset($options[self::HTTP_ADAPTER])) {
85
- $this->_sqs->getHttpClient()->setAdapter($options[self::HTTP_ADAPTER]);
86
- }
87
-
88
- if (isset($options[self::DOCUMENT_CLASS])) {
89
- $this->setDocumentClass($options[self::DOCUMENT_CLASS]);
90
- }
91
-
92
- if (isset($options[self::DOCUMENTSET_CLASS])) {
93
- $this->setDocumentSetClass($options[self::DOCUMENTSET_CLASS]);
94
- }
95
-
96
- if (isset($options[self::QUERY_CLASS])) {
97
- $this->setQueryClass($options[self::QUERY_CLASS]);
98
- }
99
- }
100
-
101
- /**
102
- * Create collection.
103
- *
104
- * @param string $name
105
- * @param array $options
106
- * @return void
107
- */
108
- public function createCollection($name, $options = null)
109
- {
110
- try {
111
- $this->_simpleDb->createDomain($name);
112
- } catch(Zend_Service_Amazon_Exception $e) {
113
- throw new Zend_Cloud_DocumentService_Exception('Error on domain creation: '.$e->getMessage(), $e->getCode(), $e);
114
- }
115
- }
116
-
117
- /**
118
- * Delete collection.
119
- *
120
- * @param string $name
121
- * @param array $options
122
- * @return void
123
- */
124
- public function deleteCollection($name, $options = null)
125
- {
126
- try {
127
- $this->_simpleDb->deleteDomain($name);
128
- } catch(Zend_Service_Amazon_Exception $e) {
129
- throw new Zend_Cloud_DocumentService_Exception('Error on collection deletion: '.$e->getMessage(), $e->getCode(), $e);
130
- }
131
- }
132
-
133
- /**
134
- * List collections.
135
- *
136
- * @param array $options
137
- * @return array
138
- */
139
- public function listCollections($options = null)
140
- {
141
- try {
142
- // TODO package this in Pages
143
- $domains = $this->_simpleDb->listDomains()->getData();
144
- } catch(Zend_Service_Amazon_Exception $e) {
145
- throw new Zend_Cloud_DocumentService_Exception('Error on collection deletion: '.$e->getMessage(), $e->getCode(), $e);
146
- }
147
-
148
- return $domains;
149
- }
150
-
151
- /**
152
- * List documents
153
- *
154
- * Returns a key/value array of document names to document objects.
155
- *
156
- * @param string $collectionName Name of collection for which to list documents
157
- * @param array|null $options
158
- * @return Zend_Cloud_DocumentService_DocumentSet
159
- */
160
- public function listDocuments($collectionName, array $options = null)
161
- {
162
- $query = $this->select('*')->from($collectionName);
163
- $items = $this->query($collectionName, $query, $options);
164
- return $items;
165
- }
166
-
167
- /**
168
- * Insert document
169
- *
170
- * @param string $collectionName Collection into which to insert document
171
- * @param array|Zend_Cloud_DocumentService_Document $document
172
- * @param array $options
173
- * @return void
174
- */
175
- public function insertDocument($collectionName, $document, $options = null)
176
- {
177
- if (is_array($document)) {
178
- $document = $this->_getDocumentFromArray($document);
179
- }
180
-
181
- if (!$document instanceof Zend_Cloud_DocumentService_Document) {
182
- throw new Zend_Cloud_DocumentService_Exception('Invalid document supplied');
183
- }
184
-
185
- try {
186
- $this->_simpleDb->putAttributes(
187
- $collectionName,
188
- $document->getID(),
189
- $this->_makeAttributes($document->getID(), $document->getFields())
190
- );
191
- } catch(Zend_Service_Amazon_Exception $e) {
192
- throw new Zend_Cloud_DocumentService_Exception('Error on document insertion: '.$e->getMessage(), $e->getCode(), $e);
193
- }
194
- }
195
-
196
- /**
197
- * Replace an existing document with a new version
198
- *
199
- * @param string $collectionName
200
- * @param array|Zend_Cloud_DocumentService_Document $document
201
- * @param array $options
202
- * @return void
203
- */
204
- public function replaceDocument($collectionName, $document, $options = null)
205
- {
206
- if (is_array($document)) {
207
- $document = $this->_getDocumentFromArray($document);
208
- }
209
-
210
- if (!$document instanceof Zend_Cloud_DocumentService_Document) {
211
- throw new Zend_Cloud_DocumentService_Exception('Invalid document supplied');
212
- }
213
-
214
- // Delete document first, then insert. PutAttributes always keeps any
215
- // fields not referenced in the payload, but present in the document
216
- $documentId = $document->getId();
217
- $fields = $document->getFields();
218
- $docClass = get_class($document);
219
- $this->deleteDocument($collectionName, $document, $options);
220
-
221
- $document = new $docClass($fields, $documentId);
222
- $this->insertDocument($collectionName, $document);
223
- }
224
-
225
- /**
226
- * Update document. The new document replaces the existing document.
227
- *
228
- * Option 'merge' specifies to add all attributes (if true) or
229
- * specific attributes ("attr" => true) instead of replacing them.
230
- * By default, attributes are replaced.
231
- *
232
- * @param string $collectionName
233
- * @param mixed|Zend_Cloud_DocumentService_Document $documentId Document ID, adapter-dependent
234
- * @param array|Zend_Cloud_DocumentService_Document $fieldset Set of fields to update
235
- * @param array $options
236
- * @return boolean
237
- */
238
- public function updateDocument($collectionName, $documentId, $fieldset = null, $options = null)
239
- {
240
- if (null === $fieldset && $documentId instanceof Zend_Cloud_DocumentService_Document) {
241
- $fieldset = $documentId->getFields();
242
- if (empty($documentId)) {
243
- $documentId = $documentId->getId();
244
- }
245
- } elseif ($fieldset instanceof Zend_Cloud_DocumentService_Document) {
246
- if (empty($documentId)) {
247
- $documentId = $fieldset->getId();
248
- }
249
- $fieldset = $fieldset->getFields();
250
- }
251
-
252
- $replace = array();
253
- if (empty($options[self::MERGE_OPTION])) {
254
- // no merge option - we replace all
255
- foreach ($fieldset as $key => $value) {
256
- $replace[$key] = true;
257
- }
258
- } elseif (is_array($options[self::MERGE_OPTION])) {
259
- foreach ($fieldset as $key => $value) {
260
- if (empty($options[self::MERGE_OPTION][$key])) {
261
- // if there's merge key, we add it, otherwise we replace it
262
- $replace[$key] = true;
263
- }
264
- }
265
- } // otherwise $replace is empty - all is merged
266
-
267
- try {
268
- $this->_simpleDb->putAttributes(
269
- $collectionName,
270
- $documentId,
271
- $this->_makeAttributes($documentId, $fieldset),
272
- $replace
273
- );
274
- } catch(Zend_Service_Amazon_Exception $e) {
275
- throw new Zend_Cloud_DocumentService_Exception('Error on document update: '.$e->getMessage(), $e->getCode(), $e);
276
- }
277
- return true;
278
- }
279
-
280
- /**
281
- * Delete document.
282
- *
283
- * @param string $collectionName Collection from which to delete document
284
- * @param mixed $document Document ID or Document object.
285
- * @param array $options
286
- * @return boolean
287
- */
288
- public function deleteDocument($collectionName, $document, $options = null)
289
- {
290
- if ($document instanceof Zend_Cloud_DocumentService_Document) {
291
- $document = $document->getId();
292
- }
293
- try {
294
- $this->_simpleDb->deleteAttributes($collectionName, $document);
295
- } catch(Zend_Service_Amazon_Exception $e) {
296
- throw new Zend_Cloud_DocumentService_Exception('Error on document deletion: '.$e->getMessage(), $e->getCode(), $e);
297
- }
298
- return true;
299
- }
300
-
301
- /**
302
- * Fetch single document by ID
303
- *
304
- * @param string $collectionName Collection name
305
- * @param mixed $documentId Document ID, adapter-dependent
306
- * @param array $options
307
- * @return Zend_Cloud_DocumentService_Document
308
- */
309
- public function fetchDocument($collectionName, $documentId, $options = null)
310
- {
311
- try {
312
- $attributes = $this->_simpleDb->getAttributes($collectionName, $documentId);
313
- if ($attributes == false || count($attributes) == 0) {
314
- return false;
315
- }
316
- return $this->_resolveAttributes($attributes, true);
317
- } catch(Zend_Service_Amazon_Exception $e) {
318
- throw new Zend_Cloud_DocumentService_Exception('Error on fetching document: '.$e->getMessage(), $e->getCode(), $e);
319
- }
320
- }
321
-
322
- /**
323
- * Query for documents stored in the document service. If a string is passed in
324
- * $query, the query string will be passed directly to the service.
325
- *
326
- * @param string $collectionName Collection name
327
- * @param string $query
328
- * @param array $options
329
- * @return array Zend_Cloud_DocumentService_DocumentSet
330
- */
331
- public function query($collectionName, $query, $options = null)
332
- {
333
- $returnDocs = isset($options[self::RETURN_DOCUMENTS])
334
- ? (bool) $options[self::RETURN_DOCUMENTS]
335
- : true;
336
-
337
- try {
338
- if ($query instanceof Zend_Cloud_DocumentService_Adapter_SimpleDb_Query) {
339
- $query = $query->assemble($collectionName);
340
- }
341
- $result = $this->_simpleDb->select($query);
342
- } catch(Zend_Service_Amazon_Exception $e) {
343
- throw new Zend_Cloud_DocumentService_Exception('Error on document query: '.$e->getMessage(), $e->getCode(), $e);
344
- }
345
-
346
- return $this->_getDocumentSetFromResultSet($result, $returnDocs);
347
- }
348
-
349
- /**
350
- * Create query statement
351
- *
352
- * @param string $fields
353
- * @return Zend_Cloud_DocumentService_Adapter_SimpleDb_Query
354
- */
355
- public function select($fields = null)
356
- {
357
- $queryClass = $this->getQueryClass();
358
- if (!class_exists($queryClass)) {
359
- #require_once 'Zend/Loader.php';
360
- Zend_Loader::loadClass($queryClass);
361
- }
362
-
363
- $query = new $queryClass($this);
364
- $defaultClass = self::DEFAULT_QUERY_CLASS;
365
- if (!$query instanceof $defaultClass) {
366
- throw new Zend_Cloud_DocumentService_Exception('Query class must extend ' . self::DEFAULT_QUERY_CLASS);
367
- }
368
-
369
- $query->select($fields);
370
- return $query;
371
- }
372
-
373
- /**
374
- * Get the concrete service client
375
- *
376
- * @return Zend_Service_Amazon_SimpleDb
377
- */
378
- public function getClient()
379
- {
380
- return $this->_simpleDb;
381
- }
382
-
383
- /**
384
- * Convert array of key-value pairs to array of Amazon attributes
385
- *
386
- * @param string $name
387
- * @param array $attributes
388
- * @return array
389
- */
390
- protected function _makeAttributes($name, $attributes)
391
- {
392
- $result = array();
393
- foreach ($attributes as $key => $attr) {
394
- $result[] = new Zend_Service_Amazon_SimpleDb_Attribute($name, $key, $attr);
395
- }
396
- return $result;
397
- }
398
-
399
- /**
400
- * Convert array of Amazon attributes to array of key-value pairs
401
- *
402
- * @param array $attributes
403
- * @return array
404
- */
405
- protected function _resolveAttributes($attributes, $returnDocument = false)
406
- {
407
- $result = array();
408
- foreach ($attributes as $attr) {
409
- $value = $attr->getValues();
410
- if (count($value) == 0) {
411
- $value = null;
412
- } elseif (count($value) == 1) {
413
- $value = $value[0];
414
- }
415
- $result[$attr->getName()] = $value;
416
- }
417
-
418
- // Return as document object?
419
- if ($returnDocument) {
420
- $documentClass = $this->getDocumentClass();
421
- return new $documentClass($result, $attr->getItemName());
422
- }
423
-
424
- return $result;
425
- }
426
-
427
- /**
428
- * Create suitable document from array of fields
429
- *
430
- * @param array $document
431
- * @return Zend_Cloud_DocumentService_Document
432
- */
433
- protected function _getDocumentFromArray($document)
434
- {
435
- if (!isset($document[Zend_Cloud_DocumentService_Document::KEY_FIELD])) {
436
- if (isset($document[self::ITEM_NAME])) {
437
- $key = $document[self::ITEM_NAME];
438
- unset($document[self::ITEM_NAME]);
439
- } else {
440
- throw new Zend_Cloud_DocumentService_Exception('Fields array should contain the key field '.Zend_Cloud_DocumentService_Document::KEY_FIELD);
441
- }
442
- } else {
443
- $key = $document[Zend_Cloud_DocumentService_Document::KEY_FIELD];
444
- unset($document[Zend_Cloud_DocumentService_Document::KEY_FIELD]);
445
- }
446
-
447
- $documentClass = $this->getDocumentClass();
448
- return new $documentClass($document, $key);
449
- }
450
-
451
- /**
452
- * Create a DocumentSet from a SimpleDb resultset
453
- *
454
- * @param Zend_Service_Amazon_SimpleDb_Page $resultSet
455
- * @param bool $returnDocs
456
- * @return Zend_Cloud_DocumentService_DocumentSet
457
- */
458
- protected function _getDocumentSetFromResultSet(Zend_Service_Amazon_SimpleDb_Page $resultSet, $returnDocs = true)
459
- {
460
- $docs = array();
461
- foreach ($resultSet->getData() as $item) {
462
- $docs[] = $this->_resolveAttributes($item, $returnDocs);
463
- }
464
-
465
- $setClass = $this->getDocumentSetClass();
466
- return new $setClass($docs);
467
- }
468
- }
1
+ <?php
2
+ /**
3
+ * LICENSE
4
+ *
5
+ * This source file is subject to the new BSD license that is bundled
6
+ * with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://framework.zend.com/license/new-bsd
9
+ * If you did not receive a copy of the license and are unable to
10
+ * obtain it through the world-wide-web, please send an email
11
+ * to license@zend.com so we can send you a copy immediately.
12
+ *
13
+ * @category Zend
14
+ * @package Zend_Cloud
15
+ * @subpackage DocumentService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
+ * @license http://framework.zend.com/license/new-bsd New BSD License
18
+ */
19
+
20
+ #require_once 'Zend/Cloud/DocumentService/Adapter/AbstractAdapter.php';
21
+ #require_once 'Zend/Cloud/DocumentService/Adapter/SimpleDb/Query.php';
22
+ #require_once 'Zend/Cloud/DocumentService/Exception.php';
23
+ #require_once 'Zend/Service/Amazon/SimpleDb.php';
24
+ #require_once 'Zend/Service/Amazon/SimpleDb/Attribute.php';
25
+
26
+ /**
27
+ * SimpleDB adapter for document service.
28
+ *
29
+ * @category Zend
30
+ * @package Zend_Cloud
31
+ * @subpackage DocumentService
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
+ * @license http://framework.zend.com/license/new-bsd New BSD License
34
+ */
35
+ class Zend_Cloud_DocumentService_Adapter_SimpleDb
36
+ extends Zend_Cloud_DocumentService_Adapter_AbstractAdapter
37
+ {
38
+ /*
39
+ * Options array keys for the SimpleDB adapter.
40
+ */
41
+ const AWS_ACCESS_KEY = 'aws_accesskey';
42
+ const AWS_SECRET_KEY = 'aws_secretkey';
43
+
44
+ const ITEM_NAME = 'ItemName';
45
+
46
+ const MERGE_OPTION = "merge";
47
+ const RETURN_DOCUMENTS = "return_documents";
48
+
49
+ const DEFAULT_QUERY_CLASS = 'Zend_Cloud_DocumentService_Adapter_SimpleDb_Query';
50
+
51
+
52
+ /**
53
+ * SQS service instance.
54
+ * @var Zend_Service_Amazon_SimpleDb
55
+ */
56
+ protected $_simpleDb;
57
+
58
+ /**
59
+ * Class to utilize for new query objects
60
+ * @var string
61
+ */
62
+ protected $_queryClass = 'Zend_Cloud_DocumentService_Adapter_SimpleDb_Query';
63
+
64
+ /**
65
+ * Constructor
66
+ *
67
+ * @param array|Zend_Config $options
68
+ * @return void
69
+ */
70
+ public function __construct($options = array())
71
+ {
72
+ if ($options instanceof Zend_Config) {
73
+ $options = $options->toArray();
74
+ }
75
+
76
+ if (!is_array($options)) {
77
+ throw new Zend_Cloud_DocumentService_Exception('Invalid options provided to constructor');
78
+ }
79
+
80
+ $this->_simpleDb = new Zend_Service_Amazon_SimpleDb(
81
+ $options[self::AWS_ACCESS_KEY], $options[self::AWS_SECRET_KEY]
82
+ );
83
+
84
+ if (isset($options[self::HTTP_ADAPTER])) {
85
+ $this->_simpleDb->getHttpClient()->setAdapter($options[self::HTTP_ADAPTER]);
86
+ }
87
+
88
+ if (isset($options[self::DOCUMENT_CLASS])) {
89
+ $this->setDocumentClass($options[self::DOCUMENT_CLASS]);
90
+ }
91
+
92
+ if (isset($options[self::DOCUMENTSET_CLASS])) {
93
+ $this->setDocumentSetClass($options[self::DOCUMENTSET_CLASS]);
94
+ }
95
+
96
+ if (isset($options[self::QUERY_CLASS])) {
97
+ $this->setQueryClass($options[self::QUERY_CLASS]);
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Create collection.
103
+ *
104
+ * @param string $name
105
+ * @param array $options
106
+ * @return void
107
+ */
108
+ public function createCollection($name, $options = null)
109
+ {
110
+ try {
111
+ $this->_simpleDb->createDomain($name);
112
+ } catch(Zend_Service_Amazon_Exception $e) {
113
+ throw new Zend_Cloud_DocumentService_Exception('Error on domain creation: '.$e->getMessage(), $e->getCode(), $e);
114
+ }
115
+ }
116
+
117
+ /**
118
+ * Delete collection.
119
+ *
120
+ * @param string $name
121
+ * @param array $options
122
+ * @return void
123
+ */
124
+ public function deleteCollection($name, $options = null)
125
+ {
126
+ try {
127
+ $this->_simpleDb->deleteDomain($name);
128
+ } catch(Zend_Service_Amazon_Exception $e) {
129
+ throw new Zend_Cloud_DocumentService_Exception('Error on collection deletion: '.$e->getMessage(), $e->getCode(), $e);
130
+ }
131
+ }
132
+
133
+ /**
134
+ * List collections.
135
+ *
136
+ * @param array $options
137
+ * @return array
138
+ */
139
+ public function listCollections($options = null)
140
+ {
141
+ try {
142
+ // TODO package this in Pages
143
+ $domains = $this->_simpleDb->listDomains()->getData();
144
+ } catch(Zend_Service_Amazon_Exception $e) {
145
+ throw new Zend_Cloud_DocumentService_Exception('Error on collection deletion: '.$e->getMessage(), $e->getCode(), $e);
146
+ }
147
+
148
+ return $domains;
149
+ }
150
+
151
+ /**
152
+ * List documents
153
+ *
154
+ * Returns a key/value array of document names to document objects.
155
+ *
156
+ * @param string $collectionName Name of collection for which to list documents
157
+ * @param array|null $options
158
+ * @return Zend_Cloud_DocumentService_DocumentSet
159
+ */
160
+ public function listDocuments($collectionName, array $options = null)
161
+ {
162
+ $query = $this->select('*')->from($collectionName);
163
+ $items = $this->query($collectionName, $query, $options);
164
+ return $items;
165
+ }
166
+
167
+ /**
168
+ * Insert document
169
+ *
170
+ * @param string $collectionName Collection into which to insert document
171
+ * @param array|Zend_Cloud_DocumentService_Document $document
172
+ * @param array $options
173
+ * @return void
174
+ */
175
+ public function insertDocument($collectionName, $document, $options = null)
176
+ {
177
+ if (is_array($document)) {
178
+ $document = $this->_getDocumentFromArray($document);
179
+ }
180
+
181
+ if (!$document instanceof Zend_Cloud_DocumentService_Document) {
182
+ throw new Zend_Cloud_DocumentService_Exception('Invalid document supplied');
183
+ }
184
+
185
+ try {
186
+ $this->_simpleDb->putAttributes(
187
+ $collectionName,
188
+ $document->getID(),
189
+ $this->_makeAttributes($document->getID(), $document->getFields())
190
+ );
191
+ } catch(Zend_Service_Amazon_Exception $e) {
192
+ throw new Zend_Cloud_DocumentService_Exception('Error on document insertion: '.$e->getMessage(), $e->getCode(), $e);
193
+ }
194
+ }
195
+
196
+ /**
197
+ * Replace an existing document with a new version
198
+ *
199
+ * @param string $collectionName
200
+ * @param array|Zend_Cloud_DocumentService_Document $document
201
+ * @param array $options
202
+ * @return void
203
+ */
204
+ public function replaceDocument($collectionName, $document, $options = null)
205
+ {
206
+ if (is_array($document)) {
207
+ $document = $this->_getDocumentFromArray($document);
208
+ }
209
+
210
+ if (!$document instanceof Zend_Cloud_DocumentService_Document) {
211
+ throw new Zend_Cloud_DocumentService_Exception('Invalid document supplied');
212
+ }
213
+
214
+ // Delete document first, then insert. PutAttributes always keeps any
215
+ // fields not referenced in the payload, but present in the document
216
+ $documentId = $document->getId();
217
+ $fields = $document->getFields();
218
+ $docClass = get_class($document);
219
+ $this->deleteDocument($collectionName, $document, $options);
220
+
221
+ $document = new $docClass($fields, $documentId);
222
+ $this->insertDocument($collectionName, $document);
223
+ }
224
+
225
+ /**
226
+ * Update document. The new document replaces the existing document.
227
+ *
228
+ * Option 'merge' specifies to add all attributes (if true) or
229
+ * specific attributes ("attr" => true) instead of replacing them.
230
+ * By default, attributes are replaced.
231
+ *
232
+ * @param string $collectionName
233
+ * @param mixed|Zend_Cloud_DocumentService_Document $documentId Document ID, adapter-dependent
234
+ * @param array|Zend_Cloud_DocumentService_Document $fieldset Set of fields to update
235
+ * @param array $options
236
+ * @return boolean
237
+ */
238
+ public function updateDocument($collectionName, $documentId, $fieldset = null, $options = null)
239
+ {
240
+ if (null === $fieldset && $documentId instanceof Zend_Cloud_DocumentService_Document) {
241
+ $fieldset = $documentId->getFields();
242
+ if (empty($documentId)) {
243
+ $documentId = $documentId->getId();
244
+ }
245
+ } elseif ($fieldset instanceof Zend_Cloud_DocumentService_Document) {
246
+ if (empty($documentId)) {
247
+ $documentId = $fieldset->getId();
248
+ }
249
+ $fieldset = $fieldset->getFields();
250
+ }
251
+
252
+ $replace = array();
253
+ if (empty($options[self::MERGE_OPTION])) {
254
+ // no merge option - we replace all
255
+ foreach ($fieldset as $key => $value) {
256
+ $replace[$key] = true;
257
+ }
258
+ } elseif (is_array($options[self::MERGE_OPTION])) {
259
+ foreach ($fieldset as $key => $value) {
260
+ if (empty($options[self::MERGE_OPTION][$key])) {
261
+ // if there's merge key, we add it, otherwise we replace it
262
+ $replace[$key] = true;
263
+ }
264
+ }
265
+ } // otherwise $replace is empty - all is merged
266
+
267
+ try {
268
+ $this->_simpleDb->putAttributes(
269
+ $collectionName,
270
+ $documentId,
271
+ $this->_makeAttributes($documentId, $fieldset),
272
+ $replace
273
+ );
274
+ } catch(Zend_Service_Amazon_Exception $e) {
275
+ throw new Zend_Cloud_DocumentService_Exception('Error on document update: '.$e->getMessage(), $e->getCode(), $e);
276
+ }
277
+ return true;
278
+ }
279
+
280
+ /**
281
+ * Delete document.
282
+ *
283
+ * @param string $collectionName Collection from which to delete document
284
+ * @param mixed $document Document ID or Document object.
285
+ * @param array $options
286
+ * @return boolean
287
+ */
288
+ public function deleteDocument($collectionName, $document, $options = null)
289
+ {
290
+ if ($document instanceof Zend_Cloud_DocumentService_Document) {
291
+ $document = $document->getId();
292
+ }
293
+ try {
294
+ $this->_simpleDb->deleteAttributes($collectionName, $document);
295
+ } catch(Zend_Service_Amazon_Exception $e) {
296
+ throw new Zend_Cloud_DocumentService_Exception('Error on document deletion: '.$e->getMessage(), $e->getCode(), $e);
297
+ }
298
+ return true;
299
+ }
300
+
301
+ /**
302
+ * Fetch single document by ID
303
+ *
304
+ * @param string $collectionName Collection name
305
+ * @param mixed $documentId Document ID, adapter-dependent
306
+ * @param array $options
307
+ * @return Zend_Cloud_DocumentService_Document
308
+ */
309
+ public function fetchDocument($collectionName, $documentId, $options = null)
310
+ {
311
+ try {
312
+ $attributes = $this->_simpleDb->getAttributes($collectionName, $documentId);
313
+ if ($attributes == false || count($attributes) == 0) {
314
+ return false;
315
+ }
316
+ return $this->_resolveAttributes($attributes, true);
317
+ } catch(Zend_Service_Amazon_Exception $e) {
318
+ throw new Zend_Cloud_DocumentService_Exception('Error on fetching document: '.$e->getMessage(), $e->getCode(), $e);
319
+ }
320
+ }
321
+
322
+ /**
323
+ * Query for documents stored in the document service. If a string is passed in
324
+ * $query, the query string will be passed directly to the service.
325
+ *
326
+ * @param string $collectionName Collection name
327
+ * @param string $query
328
+ * @param array $options
329
+ * @return array Zend_Cloud_DocumentService_DocumentSet
330
+ */
331
+ public function query($collectionName, $query, $options = null)
332
+ {
333
+ $returnDocs = isset($options[self::RETURN_DOCUMENTS])
334
+ ? (bool) $options[self::RETURN_DOCUMENTS]
335
+ : true;
336
+
337
+ try {
338
+ if ($query instanceof Zend_Cloud_DocumentService_Adapter_SimpleDb_Query) {
339
+ $query = $query->assemble($collectionName);
340
+ }
341
+ $result = $this->_simpleDb->select($query);
342
+ } catch(Zend_Service_Amazon_Exception $e) {
343
+ throw new Zend_Cloud_DocumentService_Exception('Error on document query: '.$e->getMessage(), $e->getCode(), $e);
344
+ }
345
+
346
+ return $this->_getDocumentSetFromResultSet($result, $returnDocs);
347
+ }
348
+
349
+ /**
350
+ * Create query statement
351
+ *
352
+ * @param string $fields
353
+ * @return Zend_Cloud_DocumentService_Adapter_SimpleDb_Query
354
+ */
355
+ public function select($fields = null)
356
+ {
357
+ $queryClass = $this->getQueryClass();
358
+ if (!class_exists($queryClass)) {
359
+ #require_once 'Zend/Loader.php';
360
+ Zend_Loader::loadClass($queryClass);
361
+ }
362
+
363
+ $query = new $queryClass($this);
364
+ $defaultClass = self::DEFAULT_QUERY_CLASS;
365
+ if (!$query instanceof $defaultClass) {
366
+ throw new Zend_Cloud_DocumentService_Exception('Query class must extend ' . self::DEFAULT_QUERY_CLASS);
367
+ }
368
+
369
+ $query->select($fields);
370
+ return $query;
371
+ }
372
+
373
+ /**
374
+ * Get the concrete service client
375
+ *
376
+ * @return Zend_Service_Amazon_SimpleDb
377
+ */
378
+ public function getClient()
379
+ {
380
+ return $this->_simpleDb;
381
+ }
382
+
383
+ /**
384
+ * Convert array of key-value pairs to array of Amazon attributes
385
+ *
386
+ * @param string $name
387
+ * @param array $attributes
388
+ * @return array
389
+ */
390
+ protected function _makeAttributes($name, $attributes)
391
+ {
392
+ $result = array();
393
+ foreach ($attributes as $key => $attr) {
394
+ $result[] = new Zend_Service_Amazon_SimpleDb_Attribute($name, $key, $attr);
395
+ }
396
+ return $result;
397
+ }
398
+
399
+ /**
400
+ * Convert array of Amazon attributes to array of key-value pairs
401
+ *
402
+ * @param array $attributes
403
+ * @return array
404
+ */
405
+ protected function _resolveAttributes($attributes, $returnDocument = false)
406
+ {
407
+ $result = array();
408
+ foreach ($attributes as $attr) {
409
+ $value = $attr->getValues();
410
+ if (count($value) == 0) {
411
+ $value = null;
412
+ } elseif (count($value) == 1) {
413
+ $value = $value[0];
414
+ }
415
+ $result[$attr->getName()] = $value;
416
+ }
417
+
418
+ // Return as document object?
419
+ if ($returnDocument) {
420
+ $documentClass = $this->getDocumentClass();
421
+ return new $documentClass($result, $attr->getItemName());
422
+ }
423
+
424
+ return $result;
425
+ }
426
+
427
+ /**
428
+ * Create suitable document from array of fields
429
+ *
430
+ * @param array $document
431
+ * @return Zend_Cloud_DocumentService_Document
432
+ */
433
+ protected function _getDocumentFromArray($document)
434
+ {
435
+ if (!isset($document[Zend_Cloud_DocumentService_Document::KEY_FIELD])) {
436
+ if (isset($document[self::ITEM_NAME])) {
437
+ $key = $document[self::ITEM_NAME];
438
+ unset($document[self::ITEM_NAME]);
439
+ } else {
440
+ throw new Zend_Cloud_DocumentService_Exception('Fields array should contain the key field '.Zend_Cloud_DocumentService_Document::KEY_FIELD);
441
+ }
442
+ } else {
443
+ $key = $document[Zend_Cloud_DocumentService_Document::KEY_FIELD];
444
+ unset($document[Zend_Cloud_DocumentService_Document::KEY_FIELD]);
445
+ }
446
+
447
+ $documentClass = $this->getDocumentClass();
448
+ return new $documentClass($document, $key);
449
+ }
450
+
451
+ /**
452
+ * Create a DocumentSet from a SimpleDb resultset
453
+ *
454
+ * @param Zend_Service_Amazon_SimpleDb_Page $resultSet
455
+ * @param bool $returnDocs
456
+ * @return Zend_Cloud_DocumentService_DocumentSet
457
+ */
458
+ protected function _getDocumentSetFromResultSet(Zend_Service_Amazon_SimpleDb_Page $resultSet, $returnDocs = true)
459
+ {
460
+ $docs = array();
461
+ foreach ($resultSet->getData() as $item) {
462
+ $docs[] = $this->_resolveAttributes($item, $returnDocs);
463
+ }
464
+
465
+ $setClass = $this->getDocumentSetClass();
466
+ return new $setClass($docs);
467
+ }
468
+ }
lib/Zend/Cloud/DocumentService/Adapter/SimpleDb/Query.php CHANGED
@@ -13,7 +13,7 @@
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage DocumentService
16
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
@@ -23,13 +23,13 @@
23
  #require_once 'Zend/Cloud/DocumentService/Query.php';
24
 
25
  /**
26
- * Class implementing Query adapter for working with SimpleDb queries in a
27
  * structured way
28
  *
29
  * @category Zend
30
  * @package Zend_Cloud
31
  * @subpackage DocumentService
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Cloud_DocumentService_Adapter_SimpleDb_Query
@@ -42,8 +42,8 @@ class Zend_Cloud_DocumentService_Adapter_SimpleDb_Query
42
 
43
  /**
44
  * Constructor
45
- *
46
- * @param Zend_Cloud_DocumentService_Adapter_SimpleDb $adapter
47
  * @param null|string $collectionName
48
  * @return void
49
  */
@@ -57,7 +57,7 @@ class Zend_Cloud_DocumentService_Adapter_SimpleDb_Query
57
 
58
  /**
59
  * Get adapter
60
- *
61
  * @return Zend_Cloud_DocumentService_Adapter_SimpleDb
62
  */
63
  public function getAdapter()
@@ -67,7 +67,7 @@ class Zend_Cloud_DocumentService_Adapter_SimpleDb_Query
67
 
68
  /**
69
  * Assemble the query into a format the adapter can utilize
70
- *
71
  * @var string $collectionName Name of collection from which to select
72
  * @return string
73
  */
@@ -150,10 +150,10 @@ class Zend_Cloud_DocumentService_Adapter_SimpleDb_Query
150
 
151
  /**
152
  * Parse a where statement into service-specific language
153
- *
154
  * @todo Ensure this fulfills the entire SimpleDB query specification for WHERE
155
- * @param string $where
156
- * @param array $args
157
  * @return string
158
  */
159
  protected function _parseWhere($where, $args)
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage DocumentService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
23
  #require_once 'Zend/Cloud/DocumentService/Query.php';
24
 
25
  /**
26
+ * Class implementing Query adapter for working with SimpleDb queries in a
27
  * structured way
28
  *
29
  * @category Zend
30
  * @package Zend_Cloud
31
  * @subpackage DocumentService
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Cloud_DocumentService_Adapter_SimpleDb_Query
42
 
43
  /**
44
  * Constructor
45
+ *
46
+ * @param Zend_Cloud_DocumentService_Adapter_SimpleDb $adapter
47
  * @param null|string $collectionName
48
  * @return void
49
  */
57
 
58
  /**
59
  * Get adapter
60
+ *
61
  * @return Zend_Cloud_DocumentService_Adapter_SimpleDb
62
  */
63
  public function getAdapter()
67
 
68
  /**
69
  * Assemble the query into a format the adapter can utilize
70
+ *
71
  * @var string $collectionName Name of collection from which to select
72
  * @return string
73
  */
150
 
151
  /**
152
  * Parse a where statement into service-specific language
153
+ *
154
  * @todo Ensure this fulfills the entire SimpleDB query specification for WHERE
155
+ * @param string $where
156
+ * @param array $args
157
  * @return string
158
  */
159
  protected function _parseWhere($where, $args)
lib/Zend/Cloud/DocumentService/Adapter/WindowsAzure.php CHANGED
@@ -13,7 +13,7 @@
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage DocumentService
16
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
@@ -29,10 +29,10 @@
29
  * @category Zend
30
  * @package Zend_Cloud
31
  * @subpackage DocumentService
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
- class Zend_Cloud_DocumentService_Adapter_WindowsAzure
36
  extends Zend_Cloud_DocumentService_Adapter_AbstractAdapter
37
  {
38
  /*
@@ -50,20 +50,20 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
50
  const ROW_KEY = 'RowKey';
51
  const VERIFY_ETAG = "verify_etag";
52
  const TIMESTAMP_KEY = "Timestamp";
53
-
54
  const DEFAULT_HOST = Zend_Service_WindowsAzure_Storage::URL_CLOUD_TABLE;
55
  const DEFAULT_QUERY_CLASS = 'Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query';
56
 
57
  /**
58
  * Azure service instance.
59
- *
60
  * @var Zend_Service_WindowsAzure_Storage_Table
61
  */
62
  protected $_storageClient;
63
 
64
  /**
65
  * Class to utilize for new query objects
66
- *
67
  * @var string
68
  */
69
  protected $_queryClass = 'Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query';
@@ -76,11 +76,11 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
76
 
77
  /**
78
  * Constructor
79
- *
80
- * @param array $options
81
  * @return void
82
  */
83
- public function __construct($options = array())
84
  {
85
  if ($options instanceof Zend_Config) {
86
  $options = $options->toArray();
@@ -142,8 +142,8 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
142
 
143
  /**
144
  * Set the default partition key
145
- *
146
- * @param string $key
147
  * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure
148
  */
149
  public function setDefaultPartitionKey($key)
@@ -155,7 +155,7 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
155
 
156
  /**
157
  * Retrieve default partition key
158
- *
159
  * @return null|string
160
  */
161
  public function getDefaultPartitionKey()
@@ -170,7 +170,7 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
170
  * @param array $options
171
  * @return boolean
172
  */
173
- public function createCollection($name, $options = null)
174
  {
175
  if (!preg_match('/^[A-Za-z][A-Za-z0-9]{2,}$/', $name)) {
176
  throw new Zend_Cloud_DocumentService_Exception('Invalid collection name; Windows Azure collection names must consist of alphanumeric characters only, and be at least 3 characters long');
@@ -192,7 +192,7 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
192
  * @param array $options
193
  * @return boolean
194
  */
195
- public function deleteCollection($name, $options = null)
196
  {
197
  try {
198
  $this->_storageClient->deleteTable($name);
@@ -210,7 +210,7 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
210
  * @param array $options
211
  * @return array
212
  */
213
- public function listCollections($options = null)
214
  {
215
  try {
216
  $tables = $this->_storageClient->listTables();
@@ -228,7 +228,7 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
228
 
229
  /**
230
  * Create suitable document from array of fields
231
- *
232
  * @param array $document
233
  * @param null|string $collectionName Collection to which this document belongs
234
  * @return Zend_Cloud_DocumentService_Document
@@ -257,12 +257,12 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
257
  $documentClass = $this->getDocumentClass();
258
  return new $documentClass($document, $key);
259
  }
260
-
261
  /**
262
  * List all documents in a collection
263
- *
264
- * @param string $collectionName
265
- * @param null|array $options
266
  * @return Zend_Cloud_DocumentService_DocumentSet
267
  */
268
  public function listDocuments($collectionName, array $options = null)
@@ -282,19 +282,19 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
282
  {
283
  if (is_array($document)) {
284
  $document = $this->_getDocumentFromArray($document, $collectionName);
285
- }
286
-
287
  if (!$document instanceof Zend_Cloud_DocumentService_Document) {
288
  throw new Zend_Cloud_DocumentService_Exception('Invalid document supplied');
289
  }
290
-
291
  $key = $this->_validateDocumentId($document->getId(), $collectionName);
292
  $document->setId($key);
293
-
294
  $this->_validateCompositeKey($key);
295
  $this->_validateFields($document);
296
  try {
297
-
298
  $entity = new Zend_Service_WindowsAzure_Storage_DynamicTableEntity($key[0], $key[1]);
299
  $entity->setAzureValues($document->getFields(), true);
300
  $this->_storageClient->insertEntity($collectionName, $entity);
@@ -304,8 +304,8 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
304
  }
305
 
306
  /**
307
- * Replace document.
308
- *
309
  * The new document replaces the existing document.
310
  *
311
  * @param Zend_Cloud_DocumentService_Document $document
@@ -316,12 +316,12 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
316
  {
317
  if (is_array($document)) {
318
  $document = $this->_getDocumentFromArray($document, $collectionName);
319
- }
320
-
321
  if (!$document instanceof Zend_Cloud_DocumentService_Document) {
322
  throw new Zend_Cloud_DocumentService_Exception('Invalid document supplied');
323
  }
324
-
325
  $key = $this->_validateDocumentId($document->getId(), $collectionName);
326
  $this->_validateFields($document);
327
  try {
@@ -330,7 +330,7 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
330
  if (isset($options[self::VERIFY_ETAG])) {
331
  $entity->setEtag($options[self::VERIFY_ETAG]);
332
  }
333
-
334
  $this->_storageClient->updateEntity($collectionName, $entity, isset($options[self::VERIFY_ETAG]));
335
  } catch(Zend_Service_WindowsAzure_Exception $e) {
336
  throw new Zend_Cloud_DocumentService_Exception('Error on document replace: '.$e->getMessage(), $e->getCode(), $e);
@@ -338,8 +338,8 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
338
  }
339
 
340
  /**
341
- * Update document.
342
- *
343
  * The new document is merged the existing document.
344
  *
345
  * @param string $collectionName
@@ -375,13 +375,13 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
375
  if (isset($options[self::VERIFY_ETAG])) {
376
  $entity->setEtag($options[self::VERIFY_ETAG]);
377
  }
378
-
379
  $this->_storageClient->mergeEntity($collectionName, $entity, isset($options[self::VERIFY_ETAG]));
380
  } catch(Zend_Service_WindowsAzure_Exception $e) {
381
  throw new Zend_Cloud_DocumentService_Exception('Error on document update: '.$e->getMessage(), $e->getCode(), $e);
382
  }
383
  }
384
-
385
  /**
386
  * Delete document.
387
  *
@@ -412,7 +412,7 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
412
 
413
  /**
414
  * Fetch single document by ID
415
- *
416
  * @param string $collectionName Collection name
417
  * @param mixed $documentId Document ID, adapter-dependent
418
  * @param array $options
@@ -432,7 +432,7 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
432
  throw new Zend_Cloud_DocumentService_Exception('Error on document fetch: '.$e->getMessage(), $e->getCode(), $e);
433
  }
434
  }
435
-
436
  /**
437
  * Query for documents stored in the document service. If a string is passed in
438
  * $query, the query string will be passed directly to the service.
@@ -466,7 +466,7 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
466
  $setClass = $this->getDocumentSetClass();
467
  return new $setClass($resultSet);
468
  }
469
-
470
  /**
471
  * Create query statement
472
  *
@@ -487,9 +487,9 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
487
  }
488
 
489
  $query->select($fields);
490
- return $query;
491
  }
492
-
493
  /**
494
  * Get the concrete service client
495
  *
@@ -499,11 +499,11 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
499
  {
500
  return $this->_storageClient;
501
  }
502
-
503
  /**
504
  * Resolve table values to attributes
505
- *
506
- * @param Zend_Service_WindowsAzure_Storage_TableEntity $entity
507
  * @return array
508
  */
509
  protected function _resolveAttributes(Zend_Service_WindowsAzure_Storage_TableEntity $entity)
@@ -514,12 +514,12 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
514
  }
515
  return $result;
516
  }
517
-
518
 
519
  /**
520
  * Validate a partition or row key
521
- *
522
- * @param string $key
523
  * @return void
524
  * @throws Zend_Cloud_DocumentService_Exception
525
  */
@@ -532,8 +532,8 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
532
 
533
  /**
534
  * Validate a composite key
535
- *
536
- * @param array $key
537
  * @return throws Zend_Cloud_DocumentService_Exception
538
  */
539
  protected function _validateCompositeKey(array $key)
@@ -549,15 +549,15 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
549
  /**
550
  * Validate a document identifier
551
  *
552
- * If the identifier is an array containing a valid partition and row key,
553
  * returns it. If the identifier is a string:
554
- * - if a default partition key is present, it creates an identifier using
555
  * that and the provided document ID
556
  * - if a collection name is provided, it will use that for the partition key
557
  * - otherwise, it's invalid
558
- *
559
- * @param array|string $documentId
560
- * @param null|string $collectionName
561
  * @return array
562
  * @throws Zend_Cloud_DocumentService_Exception
563
  */
@@ -585,7 +585,7 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
585
  /**
586
  * Validate a document's fields for well-formedness
587
  *
588
- * Since Azure uses Atom, and fieldnames are included as part of XML
589
  * element tag names, the field names must be valid XML names.
590
  *
591
  * @param Zend_Cloud_DocumentService_Document|array $document
@@ -608,10 +608,10 @@ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
608
  /**
609
  * Validate an individual field name for well-formedness
610
  *
611
- * Since Azure uses Atom, and fieldnames are included as part of XML
612
  * element tag names, the field names must be valid XML names.
613
  *
614
- * While we could potentially normalize names, this could also lead to
615
  * conflict with other field names -- which we should avoid. As such,
616
  * invalid field names will raise an exception.
617
  *
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage DocumentService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
29
  * @category Zend
30
  * @package Zend_Cloud
31
  * @subpackage DocumentService
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
+ class Zend_Cloud_DocumentService_Adapter_WindowsAzure
36
  extends Zend_Cloud_DocumentService_Adapter_AbstractAdapter
37
  {
38
  /*
50
  const ROW_KEY = 'RowKey';
51
  const VERIFY_ETAG = "verify_etag";
52
  const TIMESTAMP_KEY = "Timestamp";
53
+
54
  const DEFAULT_HOST = Zend_Service_WindowsAzure_Storage::URL_CLOUD_TABLE;
55
  const DEFAULT_QUERY_CLASS = 'Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query';
56
 
57
  /**
58
  * Azure service instance.
59
+ *
60
  * @var Zend_Service_WindowsAzure_Storage_Table
61
  */
62
  protected $_storageClient;
63
 
64
  /**
65
  * Class to utilize for new query objects
66
+ *
67
  * @var string
68
  */
69
  protected $_queryClass = 'Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query';
76
 
77
  /**
78
  * Constructor
79
+ *
80
+ * @param array $options
81
  * @return void
82
  */
83
+ public function __construct($options = array())
84
  {
85
  if ($options instanceof Zend_Config) {
86
  $options = $options->toArray();
142
 
143
  /**
144
  * Set the default partition key
145
+ *
146
+ * @param string $key
147
  * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure
148
  */
149
  public function setDefaultPartitionKey($key)
155
 
156
  /**
157
  * Retrieve default partition key
158
+ *
159
  * @return null|string
160
  */
161
  public function getDefaultPartitionKey()
170
  * @param array $options
171
  * @return boolean
172
  */
173
+ public function createCollection($name, $options = null)
174
  {
175
  if (!preg_match('/^[A-Za-z][A-Za-z0-9]{2,}$/', $name)) {
176
  throw new Zend_Cloud_DocumentService_Exception('Invalid collection name; Windows Azure collection names must consist of alphanumeric characters only, and be at least 3 characters long');
192
  * @param array $options
193
  * @return boolean
194
  */
195
+ public function deleteCollection($name, $options = null)
196
  {
197
  try {
198
  $this->_storageClient->deleteTable($name);
210
  * @param array $options
211
  * @return array
212
  */
213
+ public function listCollections($options = null)
214
  {
215
  try {
216
  $tables = $this->_storageClient->listTables();
228
 
229
  /**
230
  * Create suitable document from array of fields
231
+ *
232
  * @param array $document
233
  * @param null|string $collectionName Collection to which this document belongs
234
  * @return Zend_Cloud_DocumentService_Document
257
  $documentClass = $this->getDocumentClass();
258
  return new $documentClass($document, $key);
259
  }
260
+
261
  /**
262
  * List all documents in a collection
263
+ *
264
+ * @param string $collectionName
265
+ * @param null|array $options
266
  * @return Zend_Cloud_DocumentService_DocumentSet
267
  */
268
  public function listDocuments($collectionName, array $options = null)
282
  {
283
  if (is_array($document)) {
284
  $document = $this->_getDocumentFromArray($document, $collectionName);
285
+ }
286
+
287
  if (!$document instanceof Zend_Cloud_DocumentService_Document) {
288
  throw new Zend_Cloud_DocumentService_Exception('Invalid document supplied');
289
  }
290
+
291
  $key = $this->_validateDocumentId($document->getId(), $collectionName);
292
  $document->setId($key);
293
+
294
  $this->_validateCompositeKey($key);
295
  $this->_validateFields($document);
296
  try {
297
+
298
  $entity = new Zend_Service_WindowsAzure_Storage_DynamicTableEntity($key[0], $key[1]);
299
  $entity->setAzureValues($document->getFields(), true);
300
  $this->_storageClient->insertEntity($collectionName, $entity);
304
  }
305
 
306
  /**
307
+ * Replace document.
308
+ *
309
  * The new document replaces the existing document.
310
  *
311
  * @param Zend_Cloud_DocumentService_Document $document
316
  {
317
  if (is_array($document)) {
318
  $document = $this->_getDocumentFromArray($document, $collectionName);
319
+ }
320
+
321
  if (!$document instanceof Zend_Cloud_DocumentService_Document) {
322
  throw new Zend_Cloud_DocumentService_Exception('Invalid document supplied');
323
  }
324
+
325
  $key = $this->_validateDocumentId($document->getId(), $collectionName);
326
  $this->_validateFields($document);
327
  try {
330
  if (isset($options[self::VERIFY_ETAG])) {
331
  $entity->setEtag($options[self::VERIFY_ETAG]);
332
  }
333
+
334
  $this->_storageClient->updateEntity($collectionName, $entity, isset($options[self::VERIFY_ETAG]));
335
  } catch(Zend_Service_WindowsAzure_Exception $e) {
336
  throw new Zend_Cloud_DocumentService_Exception('Error on document replace: '.$e->getMessage(), $e->getCode(), $e);
338
  }
339
 
340
  /**
341
+ * Update document.
342
+ *
343
  * The new document is merged the existing document.
344
  *
345
  * @param string $collectionName
375
  if (isset($options[self::VERIFY_ETAG])) {
376
  $entity->setEtag($options[self::VERIFY_ETAG]);
377
  }
378
+
379
  $this->_storageClient->mergeEntity($collectionName, $entity, isset($options[self::VERIFY_ETAG]));
380
  } catch(Zend_Service_WindowsAzure_Exception $e) {
381
  throw new Zend_Cloud_DocumentService_Exception('Error on document update: '.$e->getMessage(), $e->getCode(), $e);
382
  }
383
  }
384
+
385
  /**
386
  * Delete document.
387
  *
412
 
413
  /**
414
  * Fetch single document by ID
415
+ *
416
  * @param string $collectionName Collection name
417
  * @param mixed $documentId Document ID, adapter-dependent
418
  * @param array $options
432
  throw new Zend_Cloud_DocumentService_Exception('Error on document fetch: '.$e->getMessage(), $e->getCode(), $e);
433
  }
434
  }
435
+
436
  /**
437
  * Query for documents stored in the document service. If a string is passed in
438
  * $query, the query string will be passed directly to the service.
466
  $setClass = $this->getDocumentSetClass();
467
  return new $setClass($resultSet);
468
  }
469
+
470
  /**
471
  * Create query statement
472
  *
487
  }
488
 
489
  $query->select($fields);
490
+ return $query;
491
  }
492
+
493
  /**
494
  * Get the concrete service client
495
  *
499
  {
500
  return $this->_storageClient;
501
  }
502
+
503
  /**
504
  * Resolve table values to attributes
505
+ *
506
+ * @param Zend_Service_WindowsAzure_Storage_TableEntity $entity
507
  * @return array
508
  */
509
  protected function _resolveAttributes(Zend_Service_WindowsAzure_Storage_TableEntity $entity)
514
  }
515
  return $result;
516
  }
517
+
518
 
519
  /**
520
  * Validate a partition or row key
521
+ *
522
+ * @param string $key
523
  * @return void
524
  * @throws Zend_Cloud_DocumentService_Exception
525
  */
532
 
533
  /**
534
  * Validate a composite key
535
+ *
536
+ * @param array $key
537
  * @return throws Zend_Cloud_DocumentService_Exception
538
  */
539
  protected function _validateCompositeKey(array $key)
549
  /**
550
  * Validate a document identifier
551
  *
552
+ * If the identifier is an array containing a valid partition and row key,
553
  * returns it. If the identifier is a string:
554
+ * - if a default partition key is present, it creates an identifier using
555
  * that and the provided document ID
556
  * - if a collection name is provided, it will use that for the partition key
557
  * - otherwise, it's invalid
558
+ *
559
+ * @param array|string $documentId
560
+ * @param null|string $collectionName
561
  * @return array
562
  * @throws Zend_Cloud_DocumentService_Exception
563
  */
585
  /**
586
  * Validate a document's fields for well-formedness
587
  *
588
+ * Since Azure uses Atom, and fieldnames are included as part of XML
589
  * element tag names, the field names must be valid XML names.
590
  *
591
  * @param Zend_Cloud_DocumentService_Document|array $document
608
  /**
609
  * Validate an individual field name for well-formedness
610
  *
611
+ * Since Azure uses Atom, and fieldnames are included as part of XML
612
  * element tag names, the field names must be valid XML names.
613
  *
614
+ * While we could potentially normalize names, this could also lead to
615
  * conflict with other field names -- which we should avoid. As such,
616
  * invalid field names will raise an exception.
617
  *
lib/Zend/Cloud/DocumentService/Adapter/WindowsAzure/Query.php CHANGED
@@ -1,171 +1,171 @@
1
- <?php
2
- /**
3
- * LICENSE
4
- *
5
- * This source file is subject to the new BSD license that is bundled
6
- * with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://framework.zend.com/license/new-bsd
9
- * If you did not receive a copy of the license and are unable to
10
- * obtain it through the world-wide-web, please send an email
11
- * to license@zend.com so we can send you a copy immediately.
12
- *
13
- * @category Zend
14
- * @package Zend_Cloud
15
- * @subpackage DocumentService
16
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
17
- * @license http://framework.zend.com/license/new-bsd New BSD License
18
- */
19
-
20
- /*
21
- * @see Zend_Cloud_DocumentService_QueryAdapter
22
- */
23
- #require_once 'Zend/Cloud/DocumentService/QueryAdapter.php';
24
-
25
- /**
26
- * Class implementing Query adapter for working with Azure queries in a
27
- * structured way
28
- *
29
- * @todo Look into preventing a query injection attack.
30
- * @category Zend
31
- * @package Zend_Cloud
32
- * @subpackage DocumentService
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
- * @license http://framework.zend.com/license/new-bsd New BSD License
35
- */
36
- class Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query
37
- implements Zend_Cloud_DocumentService_QueryAdapter
38
- {
39
- /**
40
- * Azure concrete query
41
- *
42
- * @var Zend_Service_WindowsAzure_Storage_TableEntityQuery
43
- */
44
- protected $_azureSelect;
45
-
46
- /**
47
- * Constructor
48
- *
49
- * @param null|Zend_Service_WindowsAzure_Storage_TableEntityQuery $select Table select object
50
- * @return void
51
- */
52
- public function __construct($select = null)
53
- {
54
- if (!$select instanceof Zend_Service_WindowsAzure_Storage_TableEntityQuery) {
55
- #require_once 'Zend/Service/WindowsAzure/Storage/TableEntityQuery.php';
56
- $select = new Zend_Service_WindowsAzure_Storage_TableEntityQuery();
57
- }
58
- $this->_azureSelect = $select;
59
- }
60
-
61
- /**
62
- * SELECT clause (fields to be selected)
63
- *
64
- * Does nothing for Azure.
65
- *
66
- * @param string $select
67
- * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query
68
- */
69
- public function select($select)
70
- {
71
- return $this;
72
- }
73
-
74
- /**
75
- * FROM clause (table name)
76
- *
77
- * @param string $from
78
- * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query
79
- */
80
- public function from($from)
81
- {
82
- $this->_azureSelect->from($from);
83
- return $this;
84
- }
85
-
86
- /**
87
- * WHERE clause (conditions to be used)
88
- *
89
- * @param string $where
90
- * @param mixed $value Value or array of values to be inserted instead of ?
91
- * @param string $op Operation to use to join where clauses (AND/OR)
92
- * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query
93
- */
94
- public function where($where, $value = null, $op = 'and')
95
- {
96
- if (!empty($value) && !is_array($value)) {
97
- // fix buglet in Azure - numeric values are quoted unless passed as an array
98
- $value = array($value);
99
- }
100
- $this->_azureSelect->where($where, $value, $op);
101
- return $this;
102
- }
103
-
104
- /**
105
- * WHERE clause for item ID
106
- *
107
- * This one should be used when fetching specific rows since some adapters
108
- * have special syntax for primary keys
109
- *
110
- * @param array $value Row ID for the document (PartitionKey, RowKey)
111
- * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query
112
- */
113
- public function whereId($value)
114
- {
115
- if (!is_array($value)) {
116
- #require_once 'Zend/Cloud/DocumentService/Exception.php';
117
- throw new Zend_Cloud_DocumentService_Exception('Invalid document key');
118
- }
119
- $this->_azureSelect->wherePartitionKey($value[0])->whereRowKey($value[1]);
120
- return $this;
121
- }
122
-
123
- /**
124
- * LIMIT clause (how many rows to return)
125
- *
126
- * @param int $limit
127
- * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query
128
- */
129
- public function limit($limit)
130
- {
131
- $this->_azureSelect->top($limit);
132
- return $this;
133
- }
134
-
135
- /**
136
- * ORDER BY clause (sorting)
137
- *
138
- * @todo Azure service doesn't seem to support this yet; emulate?
139
- * @param string $sort Column to sort by
140
- * @param string $direction Direction - asc/desc
141
- * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query
142
- * @throws Zend_Cloud_OperationNotAvailableException
143
- */
144
- public function order($sort, $direction = 'asc')
145
- {
146
- #require_once 'Zend/Cloud/OperationNotAvailableException.php';
147
- throw new Zend_Cloud_OperationNotAvailableException('No support for sorting for Azure yet');
148
- }
149
-
150
- /**
151
- * Get Azure select query
152
- *
153
- * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
154
- */
155
- public function getAzureSelect()
156
- {
157
- return $this->_azureSelect;
158
- }
159
-
160
- /**
161
- * Assemble query
162
- *
163
- * Simply return the WindowsAzure table entity query object
164
- *
165
- * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
166
- */
167
- public function assemble()
168
- {
169
- return $this->getAzureSelect();
170
- }
171
- }
1
+ <?php
2
+ /**
3
+ * LICENSE
4
+ *
5
+ * This source file is subject to the new BSD license that is bundled
6
+ * with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://framework.zend.com/license/new-bsd
9
+ * If you did not receive a copy of the license and are unable to
10
+ * obtain it through the world-wide-web, please send an email
11
+ * to license@zend.com so we can send you a copy immediately.
12
+ *
13
+ * @category Zend
14
+ * @package Zend_Cloud
15
+ * @subpackage DocumentService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
+ * @license http://framework.zend.com/license/new-bsd New BSD License
18
+ */
19
+
20
+ /*
21
+ * @see Zend_Cloud_DocumentService_QueryAdapter
22
+ */
23
+ #require_once 'Zend/Cloud/DocumentService/QueryAdapter.php';
24
+
25
+ /**
26
+ * Class implementing Query adapter for working with Azure queries in a
27
+ * structured way
28
+ *
29
+ * @todo Look into preventing a query injection attack.
30
+ * @category Zend
31
+ * @package Zend_Cloud
32
+ * @subpackage DocumentService
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
+ * @license http://framework.zend.com/license/new-bsd New BSD License
35
+ */
36
+ class Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query
37
+ implements Zend_Cloud_DocumentService_QueryAdapter
38
+ {
39
+ /**
40
+ * Azure concrete query
41
+ *
42
+ * @var Zend_Service_WindowsAzure_Storage_TableEntityQuery
43
+ */
44
+ protected $_azureSelect;
45
+
46
+ /**
47
+ * Constructor
48
+ *
49
+ * @param null|Zend_Service_WindowsAzure_Storage_TableEntityQuery $select Table select object
50
+ * @return void
51
+ */
52
+ public function __construct($select = null)
53
+ {
54
+ if (!$select instanceof Zend_Service_WindowsAzure_Storage_TableEntityQuery) {
55
+ #require_once 'Zend/Service/WindowsAzure/Storage/TableEntityQuery.php';
56
+ $select = new Zend_Service_WindowsAzure_Storage_TableEntityQuery();
57
+ }
58
+ $this->_azureSelect = $select;
59
+ }
60
+
61
+ /**
62
+ * SELECT clause (fields to be selected)
63
+ *
64
+ * Does nothing for Azure.
65
+ *
66
+ * @param string $select
67
+ * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query
68
+ */
69
+ public function select($select)
70
+ {
71
+ return $this;
72
+ }
73
+
74
+ /**
75
+ * FROM clause (table name)
76
+ *
77
+ * @param string $from
78
+ * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query
79
+ */
80
+ public function from($from)
81
+ {
82
+ $this->_azureSelect->from($from);
83
+ return $this;
84
+ }
85
+
86
+ /**
87
+ * WHERE clause (conditions to be used)
88
+ *
89
+ * @param string $where
90
+ * @param mixed $value Value or array of values to be inserted instead of ?
91
+ * @param string $op Operation to use to join where clauses (AND/OR)
92
+ * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query
93
+ */
94
+ public function where($where, $value = null, $op = 'and')
95
+ {
96
+ if (!empty($value) && !is_array($value)) {
97
+ // fix buglet in Azure - numeric values are quoted unless passed as an array
98
+ $value = array($value);
99
+ }
100
+ $this->_azureSelect->where($where, $value, $op);
101
+ return $this;
102
+ }
103
+
104
+ /**
105
+ * WHERE clause for item ID
106
+ *
107
+ * This one should be used when fetching specific rows since some adapters
108
+ * have special syntax for primary keys
109
+ *
110
+ * @param array $value Row ID for the document (PartitionKey, RowKey)
111
+ * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query
112
+ */
113
+ public function whereId($value)
114
+ {
115
+ if (!is_array($value)) {
116
+ #require_once 'Zend/Cloud/DocumentService/Exception.php';
117
+ throw new Zend_Cloud_DocumentService_Exception('Invalid document key');
118
+ }
119
+ $this->_azureSelect->wherePartitionKey($value[0])->whereRowKey($value[1]);
120
+ return $this;
121
+ }
122
+
123
+ /**
124
+ * LIMIT clause (how many rows to return)
125
+ *
126
+ * @param int $limit
127
+ * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query
128
+ */
129
+ public function limit($limit)
130
+ {
131
+ $this->_azureSelect->top($limit);
132
+ return $this;
133
+ }
134
+
135
+ /**
136
+ * ORDER BY clause (sorting)
137
+ *
138
+ * @todo Azure service doesn't seem to support this yet; emulate?
139
+ * @param string $sort Column to sort by
140
+ * @param string $direction Direction - asc/desc
141
+ * @return Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query
142
+ * @throws Zend_Cloud_OperationNotAvailableException
143
+ */
144
+ public function order($sort, $direction = 'asc')
145
+ {
146
+ #require_once 'Zend/Cloud/OperationNotAvailableException.php';
147
+ throw new Zend_Cloud_OperationNotAvailableException('No support for sorting for Azure yet');
148
+ }
149
+
150
+ /**
151
+ * Get Azure select query
152
+ *
153
+ * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
154
+ */
155
+ public function getAzureSelect()
156
+ {
157
+ return $this->_azureSelect;
158
+ }
159
+
160
+ /**
161
+ * Assemble query
162
+ *
163
+ * Simply return the WindowsAzure table entity query object
164
+ *
165
+ * @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
166
+ */
167
+ public function assemble()
168
+ {
169
+ return $this->getAzureSelect();
170
+ }
171
+ }
lib/Zend/Cloud/DocumentService/Document.php CHANGED
@@ -1,248 +1,248 @@
1
- <?php
2
- /**
3
- * LICENSE
4
- *
5
- * This source file is subject to the new BSD license that is bundled
6
- * with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://framework.zend.com/license/new-bsd
9
- * If you did not receive a copy of the license and are unable to
10
- * obtain it through the world-wide-web, please send an email
11
- * to license@zend.com so we can send you a copy immediately.
12
- *
13
- * @category Zend
14
- * @package Zend_Cloud
15
- * @subpackage DocumentService
16
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
17
- * @license http://framework.zend.com/license/new-bsd New BSD License
18
- */
19
-
20
- /**
21
- * Class encapsulating documents. Fields are stored in a name/value
22
- * array. Data are represented as strings.
23
- *
24
- * TODO Can fields be large enough to warrant support for streams?
25
- *
26
- * @category Zend
27
- * @package Zend_Cloud
28
- * @subpackage DocumentService
29
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
30
- * @license http://framework.zend.com/license/new-bsd New BSD License
31
- */
32
- class Zend_Cloud_DocumentService_Document
33
- implements ArrayAccess, IteratorAggregate, Countable
34
- {
35
- /** key in document denoting identifier */
36
- const KEY_FIELD = '_id';
37
-
38
- /**
39
- * ID of this document.
40
- * @var mixed
41
- */
42
- protected $_id;
43
-
44
- /**
45
- * Name/value array of field names to values.
46
- * @var array
47
- */
48
- protected $_fields;
49
-
50
- /**
51
- * Construct an instance of Zend_Cloud_DocumentService_Document.
52
- *
53
- * If no identifier is provided, but a field matching KEY_FIELD is present,
54
- * then that field's value will be used as the document identifier.
55
- *
56
- * @param array $fields
57
- * @param mixed $id Document identifier
58
- * @return void
59
- */
60
- public function __construct($fields, $id = null)
61
- {
62
- if (!is_array($fields) && !$fields instanceof ArrayAccess) {
63
- #require_once 'Zend/Cloud/DocumentService/Exception.php';
64
- throw new Zend_Cloud_DocumentService_Exception('Fields must be an array or implement ArrayAccess');
65
- }
66
-
67
- if (isset($fields[self::KEY_FIELD])) {
68
- $id = $fields[self::KEY_FIELD];
69
- unset($fields[self::KEY_FIELD]);
70
- }
71
-
72
- $this->_fields = $fields;
73
- $this->setId($id);
74
- }
75
-
76
- /**
77
- * Set document identifier
78
- *
79
- * @param mixed $id
80
- * @return Zend_Cloud_DocumentService_Document
81
- */
82
- public function setId($id)
83
- {
84
- $this->_id = $id;
85
- return $this;
86
- }
87
-
88
- /**
89
- * Get ID name.
90
- *
91
- * @return string
92
- */
93
- public function getId()
94
- {
95
- return $this->_id;
96
- }
97
-
98
- /**
99
- * Get fields as array.
100
- *
101
- * @return array
102
- */
103
- public function getFields()
104
- {
105
- return $this->_fields;
106
- }
107
-
108
- /**
109
- * Get field by name.
110
- *
111
- * @param string $name
112
- * @return mixed
113
- */
114
- public function getField($name)
115
- {
116
- if (isset($this->_fields[$name])) {
117
- return $this->_fields[$name];
118
- }
119
- return null;
120
- }
121
-
122
- /**
123
- * Set field by name.
124
- *
125
- * @param string $name
126
- * @param mixed $value
127
- * @return Zend_Cloud_DocumentService_Document
128
- */
129
- public function setField($name, $value)
130
- {
131
- $this->_fields[$name] = $value;
132
- return $this;
133
- }
134
-
135
- /**
136
- * Overloading: get value
137
- *
138
- * @param string $name
139
- * @return mixed
140
- */
141
- public function __get($name)
142
- {
143
- return $this->getField($name);
144
- }
145
-
146
- /**
147
- * Overloading: set field
148
- *
149
- * @param string $name
150
- * @param mixed $value
151
- * @return void
152
- */
153
- public function __set($name, $value)
154
- {
155
- $this->setField($name, $value);
156
- }
157
-
158
- /**
159
- * ArrayAccess: does field exist?
160
- *
161
- * @param string $name
162
- * @return bool
163
- */
164
- public function offsetExists($name)
165
- {
166
- return isset($this->_fields[$name]);
167
- }
168
-
169
- /**
170
- * ArrayAccess: get field by name
171
- *
172
- * @param string $name
173
- * @return mixed
174
- */
175
- public function offsetGet($name)
176
- {
177
- return $this->getField($name);
178
- }
179
-
180
- /**
181
- * ArrayAccess: set field to value
182
- *
183
- * @param string $name
184
- * @param mixed $value
185
- * @return void
186
- */
187
- public function offsetSet($name, $value)
188
- {
189
- $this->setField($name, $value);
190
- }
191
-
192
- /**
193
- * ArrayAccess: remove field from document
194
- *
195
- * @param string $name
196
- * @return void
197
- */
198
- public function offsetUnset($name)
199
- {
200
- if ($this->offsetExists($name)) {
201
- unset($this->_fields[$name]);
202
- }
203
- }
204
-
205
- /**
206
- * Overloading: retrieve and set fields by name
207
- *
208
- * @param string $name
209
- * @param mixed $args
210
- * @return mixed
211
- */
212
- public function __call($name, $args)
213
- {
214
- $prefix = substr($name, 0, 3);
215
- if ($prefix == 'get') {
216
- // Get value
217
- $option = substr($name, 3);
218
- return $this->getField($option);
219
- } elseif ($prefix == 'set') {
220
- // set value
221
- $option = substr($name, 3);
222
- return $this->setField($option, $args[0]);
223
- }
224
-
225
- #require_once 'Zend/Cloud/OperationNotAvailableException.php';
226
- throw new Zend_Cloud_OperationNotAvailableException("Unknown operation $name");
227
- }
228
-
229
- /**
230
- * Countable: return count of fields in document
231
- *
232
- * @return int
233
- */
234
- public function count()
235
- {
236
- return count($this->_fields);
237
- }
238
-
239
- /**
240
- * IteratorAggregate: return iterator for iterating over fields
241
- *
242
- * @return Iterator
243
- */
244
- public function getIterator()
245
- {
246
- return new ArrayIterator($this->_fields);
247
- }
248
- }
1
+ <?php
2
+ /**
3
+ * LICENSE
4
+ *
5
+ * This source file is subject to the new BSD license that is bundled
6
+ * with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://framework.zend.com/license/new-bsd
9
+ * If you did not receive a copy of the license and are unable to
10
+ * obtain it through the world-wide-web, please send an email
11
+ * to license@zend.com so we can send you a copy immediately.
12
+ *
13
+ * @category Zend
14
+ * @package Zend_Cloud
15
+ * @subpackage DocumentService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
+ * @license http://framework.zend.com/license/new-bsd New BSD License
18
+ */
19
+
20
+ /**
21
+ * Class encapsulating documents. Fields are stored in a name/value
22
+ * array. Data are represented as strings.
23
+ *
24
+ * TODO Can fields be large enough to warrant support for streams?
25
+ *
26
+ * @category Zend
27
+ * @package Zend_Cloud
28
+ * @subpackage DocumentService
29
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30
+ * @license http://framework.zend.com/license/new-bsd New BSD License
31
+ */
32
+ class Zend_Cloud_DocumentService_Document
33
+ implements ArrayAccess, IteratorAggregate, Countable
34
+ {
35
+ /** key in document denoting identifier */
36
+ const KEY_FIELD = '_id';
37
+
38
+ /**
39
+ * ID of this document.
40
+ * @var mixed
41
+ */
42
+ protected $_id;
43
+
44
+ /**
45
+ * Name/value array of field names to values.
46
+ * @var array
47
+ */
48
+ protected $_fields;
49
+
50
+ /**
51
+ * Construct an instance of Zend_Cloud_DocumentService_Document.
52
+ *
53
+ * If no identifier is provided, but a field matching KEY_FIELD is present,
54
+ * then that field's value will be used as the document identifier.
55
+ *
56
+ * @param array $fields
57
+ * @param mixed $id Document identifier
58
+ * @return void
59
+ */
60
+ public function __construct($fields, $id = null)
61
+ {
62
+ if (!is_array($fields) && !$fields instanceof ArrayAccess) {
63
+ #require_once 'Zend/Cloud/DocumentService/Exception.php';
64
+ throw new Zend_Cloud_DocumentService_Exception('Fields must be an array or implement ArrayAccess');
65
+ }
66
+
67
+ if (isset($fields[self::KEY_FIELD])) {
68
+ $id = $fields[self::KEY_FIELD];
69
+ unset($fields[self::KEY_FIELD]);
70
+ }
71
+
72
+ $this->_fields = $fields;
73
+ $this->setId($id);
74
+ }
75
+
76
+ /**
77
+ * Set document identifier
78
+ *
79
+ * @param mixed $id
80
+ * @return Zend_Cloud_DocumentService_Document
81
+ */
82
+ public function setId($id)
83
+ {
84
+ $this->_id = $id;
85
+ return $this;
86
+ }
87
+
88
+ /**
89
+ * Get ID name.
90
+ *
91
+ * @return string
92
+ */
93
+ public function getId()
94
+ {
95
+ return $this->_id;
96
+ }
97
+
98
+ /**
99
+ * Get fields as array.
100
+ *
101
+ * @return array
102
+ */
103
+ public function getFields()
104
+ {
105
+ return $this->_fields;
106
+ }
107
+
108
+ /**
109
+ * Get field by name.
110
+ *
111
+ * @param string $name
112
+ * @return mixed
113
+ */
114
+ public function getField($name)
115
+ {
116
+ if (isset($this->_fields[$name])) {
117
+ return $this->_fields[$name];
118
+ }
119
+ return null;
120
+ }
121
+
122
+ /**
123
+ * Set field by name.
124
+ *
125
+ * @param string $name
126
+ * @param mixed $value
127
+ * @return Zend_Cloud_DocumentService_Document
128
+ */
129
+ public function setField($name, $value)
130
+ {
131
+ $this->_fields[$name] = $value;
132
+ return $this;
133
+ }
134
+
135
+ /**
136
+ * Overloading: get value
137
+ *
138
+ * @param string $name
139
+ * @return mixed
140
+ */
141
+ public function __get($name)
142
+ {
143
+ return $this->getField($name);
144
+ }
145
+
146
+ /**
147
+ * Overloading: set field
148
+ *
149
+ * @param string $name
150
+ * @param mixed $value
151
+ * @return void
152
+ */
153
+ public function __set($name, $value)
154
+ {
155
+ $this->setField($name, $value);
156
+ }
157
+
158
+ /**
159
+ * ArrayAccess: does field exist?
160
+ *
161
+ * @param string $name
162
+ * @return bool
163
+ */
164
+ public function offsetExists($name)
165
+ {
166
+ return isset($this->_fields[$name]);
167
+ }
168
+
169
+ /**
170
+ * ArrayAccess: get field by name
171
+ *
172
+ * @param string $name
173
+ * @return mixed
174
+ */
175
+ public function offsetGet($name)
176
+ {
177
+ return $this->getField($name);
178
+ }
179
+
180
+ /**
181
+ * ArrayAccess: set field to value
182
+ *
183
+ * @param string $name
184
+ * @param mixed $value
185
+ * @return void
186
+ */
187
+ public function offsetSet($name, $value)
188
+ {
189
+ $this->setField($name, $value);
190
+ }
191
+
192
+ /**
193
+ * ArrayAccess: remove field from document
194
+ *
195
+ * @param string $name
196
+ * @return void
197
+ */
198
+ public function offsetUnset($name)
199
+ {
200
+ if ($this->offsetExists($name)) {
201
+ unset($this->_fields[$name]);
202
+ }
203
+ }
204
+
205
+ /**
206
+ * Overloading: retrieve and set fields by name
207
+ *
208
+ * @param string $name
209
+ * @param mixed $args
210
+ * @return mixed
211
+ */
212
+ public function __call($name, $args)
213
+ {
214
+ $prefix = substr($name, 0, 3);
215
+ if ($prefix == 'get') {
216
+ // Get value
217
+ $option = substr($name, 3);
218
+ return $this->getField($option);
219
+ } elseif ($prefix == 'set') {
220
+ // set value
221
+ $option = substr($name, 3);
222
+ return $this->setField($option, $args[0]);
223
+ }
224
+
225
+ #require_once 'Zend/Cloud/OperationNotAvailableException.php';
226
+ throw new Zend_Cloud_OperationNotAvailableException("Unknown operation $name");
227
+ }
228
+
229
+ /**
230
+ * Countable: return count of fields in document
231
+ *
232
+ * @return int
233
+ */
234
+ public function count()
235
+ {
236
+ return count($this->_fields);
237
+ }
238
+
239
+ /**
240
+ * IteratorAggregate: return iterator for iterating over fields
241
+ *
242
+ * @return Iterator
243
+ */
244
+ public function getIterator()
245
+ {
246
+ return new ArrayIterator($this->_fields);
247
+ }
248
+ }
lib/Zend/Cloud/DocumentService/DocumentSet.php CHANGED
@@ -13,7 +13,7 @@
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage DocumentService
16
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
@@ -23,7 +23,7 @@
23
  * @category Zend
24
  * @package Zend_Cloud
25
  * @subpackage DocumentService
26
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  class Zend_Cloud_DocumentService_DocumentSet implements Countable, IteratorAggregate
@@ -48,7 +48,7 @@ class Zend_Cloud_DocumentService_DocumentSet implements Countable, IteratorAggre
48
 
49
  /**
50
  * Countable: number of documents in set
51
- *
52
  * @return int
53
  */
54
  public function count()
@@ -58,7 +58,7 @@ class Zend_Cloud_DocumentService_DocumentSet implements Countable, IteratorAggre
58
 
59
  /**
60
  * IteratorAggregate: retrieve iterator
61
- *
62
  * @return Traversable
63
  */
64
  public function getIterator()
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage DocumentService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
23
  * @category Zend
24
  * @package Zend_Cloud
25
  * @subpackage DocumentService
26
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  class Zend_Cloud_DocumentService_DocumentSet implements Countable, IteratorAggregate
48
 
49
  /**
50
  * Countable: number of documents in set
51
+ *
52
  * @return int
53
  */
54
  public function count()
58
 
59
  /**
60
  * IteratorAggregate: retrieve iterator
61
+ *
62
  * @return Traversable
63
  */
64
  public function getIterator()
lib/Zend/Cloud/DocumentService/Exception.php CHANGED
@@ -1,38 +1,38 @@
1
- <?php
2
- /**
3
- * Zend Framework
4
- *
5
- * LICENSE
6
- *
7
- * This source file is subject to the new BSD license that is bundled
8
- * with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://framework.zend.com/license/new-bsd
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@zend.com so we can send you a copy immediately.
14
- *
15
- * @category Zend
16
- * @package Zend_Cloud
17
- * @subpackage DocumentService
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
- * @license http://framework.zend.com/license/new-bsd New BSD License
20
- */
21
-
22
-
23
- /**
24
- * Zend_Cloud_Exception
25
- */
26
- #require_once 'Zend/Cloud/Exception.php';
27
-
28
-
29
- /**
30
- * @category Zend
31
- * @package Zend_Cloud
32
- * @subpackage DocumentService
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
- * @license http://framework.zend.com/license/new-bsd New BSD License
35
- */
36
- class Zend_Cloud_DocumentService_Exception extends Zend_Cloud_Exception
37
- {}
38
-
1
+ <?php
2
+ /**
3
+ * Zend Framework
4
+ *
5
+ * LICENSE
6
+ *
7
+ * This source file is subject to the new BSD license that is bundled
8
+ * with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://framework.zend.com/license/new-bsd
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@zend.com so we can send you a copy immediately.
14
+ *
15
+ * @category Zend
16
+ * @package Zend_Cloud
17
+ * @subpackage DocumentService
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
+ * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ */
21
+
22
+
23
+ /**
24
+ * Zend_Cloud_Exception
25
+ */
26
+ #require_once 'Zend/Cloud/Exception.php';
27
+
28
+
29
+ /**
30
+ * @category Zend
31
+ * @package Zend_Cloud
32
+ * @subpackage DocumentService
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
+ * @license http://framework.zend.com/license/new-bsd New BSD License
35
+ */
36
+ class Zend_Cloud_DocumentService_Exception extends Zend_Cloud_Exception
37
+ {}
38
+
lib/Zend/Cloud/DocumentService/Factory.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Cloud
17
  * @subpackage DocumentService
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -23,13 +23,13 @@
23
 
24
  /**
25
  * Class implementing working with Azure queries in a structured way
26
- *
27
  * TODO Look into preventing a query injection attack.
28
  *
29
  * @category Zend
30
  * @package Zend_Cloud
31
  * @subpackage DocumentService
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Cloud_DocumentService_Factory extends Zend_Cloud_AbstractFactory
@@ -43,21 +43,21 @@ class Zend_Cloud_DocumentService_Factory extends Zend_Cloud_AbstractFactory
43
 
44
  /**
45
  * Constructor
46
- *
47
  * @return void
48
  */
49
  private function __construct()
50
  {
51
  // private ctor - should not be used
52
  }
53
-
54
  /**
55
  * Retrieve an adapter instance
56
- *
57
- * @param array $options
58
  * @return void
59
  */
60
- public static function getAdapter($options = array())
61
  {
62
  $adapter = parent::_getAdapter(self::DOCUMENT_ADAPTER_KEY, $options);
63
  if (!$adapter) {
15
  * @category Zend
16
  * @package Zend_Cloud
17
  * @subpackage DocumentService
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
23
 
24
  /**
25
  * Class implementing working with Azure queries in a structured way
26
+ *
27
  * TODO Look into preventing a query injection attack.
28
  *
29
  * @category Zend
30
  * @package Zend_Cloud
31
  * @subpackage DocumentService
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Cloud_DocumentService_Factory extends Zend_Cloud_AbstractFactory
43
 
44
  /**
45
  * Constructor
46
+ *
47
  * @return void
48
  */
49
  private function __construct()
50
  {
51
  // private ctor - should not be used
52
  }
53
+
54
  /**
55
  * Retrieve an adapter instance
56
+ *
57
+ * @param array $options
58
  * @return void
59
  */
60
+ public static function getAdapter($options = array())
61
  {
62
  $adapter = parent::_getAdapter(self::DOCUMENT_ADAPTER_KEY, $options);
63
  if (!$adapter) {
lib/Zend/Cloud/DocumentService/Query.php CHANGED
@@ -1,191 +1,191 @@
1
- <?php
2
- /**
3
- * LICENSE
4
- *
5
- * This source file is subject to the new BSD license that is bundled
6
- * with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://framework.zend.com/license/new-bsd
9
- * If you did not receive a copy of the license and are unable to
10
- * obtain it through the world-wide-web, please send an email
11
- * to license@zend.com so we can send you a copy immediately.
12
- *
13
- * @category Zend
14
- * @package Zend_Cloud
15
- * @subpackage DocumentService
16
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
17
- * @license http://framework.zend.com/license/new-bsd New BSD License
18
- */
19
-
20
- #require_once 'Zend/Cloud/DocumentService/QueryAdapter.php';
21
-
22
- /**
23
- * Generic query object
24
- *
25
- * Aggregates operations in an array of clauses, where the first element
26
- * describes the clause type, and the next element describes the criteria.
27
- *
28
- * @category Zend
29
- * @package Zend_Cloud
30
- * @subpackage DocumentService
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
- * @license http://framework.zend.com/license/new-bsd New BSD License
33
- */
34
- class Zend_Cloud_DocumentService_Query
35
- implements Zend_Cloud_DocumentService_QueryAdapter
36
- {
37
- /**
38
- * Known query types
39
- */
40
- const QUERY_SELECT = 'select';
41
- const QUERY_FROM = 'from';
42
- const QUERY_WHERE = 'where';
43
- const QUERY_WHEREID = 'whereid'; // request element by ID
44
- const QUERY_LIMIT = 'limit';
45
- const QUERY_ORDER = 'order';
46
-
47
- /**
48
- * Clause list
49
- *
50
- * @var array
51
- */
52
- protected $_clauses = array();
53
-
54
- /**
55
- * Generic clause
56
- *
57
- * You can use any clause by doing $query->foo('bar')
58
- * but concrete adapters should be able to recognise it
59
- *
60
- * The call will be iterpreted as clause 'foo' with argument 'bar'
61
- *
62
- * @param string $name Clause/method name
63
- * @param mixed $args
64
- * @return Zend_Cloud_DocumentService_Query
65
- */
66
- public function __call($name, $args)
67
- {
68
- $this->_clauses[] = array(strtolower($name), $args);
69
- return $this;
70
- }
71
-
72
- /**
73
- * SELECT clause (fields to be selected)
74
- *
75
- * @param null|string|array $select
76
- * @return Zend_Cloud_DocumentService_Query
77
- */
78
- public function select($select)
79
- {
80
- if (empty($select)) {
81
- return $this;
82
- }
83
- if (!is_string($select) && !is_array($select)) {
84
- #require_once 'Zend/Cloud/DocumentService/Exception.php';
85
- throw new Zend_Cloud_DocumentService_Exception("SELECT argument must be a string or an array of strings");
86
- }
87
- $this->_clauses[] = array(self::QUERY_SELECT, $select);
88
- return $this;
89
- }
90
-
91
- /**
92
- * FROM clause
93
- *
94
- * @param string $name Field names
95
- * @return Zend_Cloud_DocumentService_Query
96
- */
97
- public function from($name)
98
- {
99
- if(!is_string($name)) {
100
- #require_once 'Zend/Cloud/DocumentService/Exception.php';
101
- throw new Zend_Cloud_DocumentService_Exception("FROM argument must be a string");
102
- }
103
- $this->_clauses[] = array(self::QUERY_FROM, $name);
104
- return $this;
105
- }
106
-
107
- /**
108
- * WHERE query
109
- *
110
- * @param string $cond Condition
111
- * @param array $args Arguments to substitute instead of ?'s in condition
112
- * @param string $op relation to other clauses - and/or
113
- * @return Zend_Cloud_DocumentService_Query
114
- */
115
- public function where($cond, $value = null, $op = 'and')
116
- {
117
- if (!is_string($cond)) {
118
- #require_once 'Zend/Cloud/DocumentService/Exception.php';
119
- throw new Zend_Cloud_DocumentService_Exception("WHERE argument must be a string");
120
- }
121
- $this->_clauses[] = array(self::QUERY_WHERE, array($cond, $value, $op));
122
- return $this;
123
- }
124
-
125
- /**
126
- * Select record or fields by ID
127
- *
128
- * @param string|int $value Identifier to select by
129
- * @return Zend_Cloud_DocumentService_Query
130
- */
131
- public function whereId($value)
132
- {
133
- if (!is_scalar($value)) {
134
- #require_once 'Zend/Cloud/DocumentService/Exception.php';
135
- throw new Zend_Cloud_DocumentService_Exception("WHEREID argument must be a scalar");
136
- }
137
- $this->_clauses[] = array(self::QUERY_WHEREID, $value);
138
- return $this;
139
- }
140
-
141
- /**
142
- * LIMIT clause (how many items to return)
143
- *
144
- * @param int $limit
145
- * @return Zend_Cloud_DocumentService_Query
146
- */
147
- public function limit($limit)
148
- {
149
- if ($limit != (int) $limit) {
150
- #require_once 'Zend/Cloud/DocumentService/Exception.php';
151
- throw new Zend_Cloud_DocumentService_Exception("LIMIT argument must be an integer");
152
- }
153
- $this->_clauses[] = array(self::QUERY_LIMIT, $limit);
154
- return $this;
155
- }
156
-
157
- /**
158
- * ORDER clause; field or fields to sort by, and direction to sort
159
- *
160
- * @param string|int|array $sort
161
- * @param string $direction
162
- * @return Zend_Cloud_DocumentService_Query
163
- */
164
- public function order($sort, $direction = 'asc')
165
- {
166
- $this->_clauses[] = array(self::QUERY_ORDER, array($sort, $direction));
167
- return $this;
168
- }
169
-
170
- /**
171
- * "Assemble" the query
172
- *
173
- * Simply returns the clauses present.
174
- *
175
- * @return array
176
- */
177
- public function assemble()
178
- {
179
- return $this->getClauses();
180
- }
181
-
182
- /**
183
- * Return query clauses as an array
184
- *
185
- * @return array Clauses in the query
186
- */
187
- public function getClauses()
188
- {
189
- return $this->_clauses;
190
- }
191
- }
1
+ <?php
2
+ /**
3
+ * LICENSE
4
+ *
5
+ * This source file is subject to the new BSD license that is bundled
6
+ * with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://framework.zend.com/license/new-bsd
9
+ * If you did not receive a copy of the license and are unable to
10
+ * obtain it through the world-wide-web, please send an email
11
+ * to license@zend.com so we can send you a copy immediately.
12
+ *
13
+ * @category Zend
14
+ * @package Zend_Cloud
15
+ * @subpackage DocumentService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
+ * @license http://framework.zend.com/license/new-bsd New BSD License
18
+ */
19
+
20
+ #require_once 'Zend/Cloud/DocumentService/QueryAdapter.php';
21
+
22
+ /**
23
+ * Generic query object
24
+ *
25
+ * Aggregates operations in an array of clauses, where the first element
26
+ * describes the clause type, and the next element describes the criteria.
27
+ *
28
+ * @category Zend
29
+ * @package Zend_Cloud
30
+ * @subpackage DocumentService
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
+ * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ */
34
+ class Zend_Cloud_DocumentService_Query
35
+ implements Zend_Cloud_DocumentService_QueryAdapter
36
+ {
37
+ /**
38
+ * Known query types
39
+ */
40
+ const QUERY_SELECT = 'select';
41
+ const QUERY_FROM = 'from';
42
+ const QUERY_WHERE = 'where';
43
+ const QUERY_WHEREID = 'whereid'; // request element by ID
44
+ const QUERY_LIMIT = 'limit';
45
+ const QUERY_ORDER = 'order';
46
+
47
+ /**
48
+ * Clause list
49
+ *
50
+ * @var array
51
+ */
52
+ protected $_clauses = array();
53
+
54
+ /**
55
+ * Generic clause
56
+ *
57
+ * You can use any clause by doing $query->foo('bar')
58
+ * but concrete adapters should be able to recognise it
59
+ *
60
+ * The call will be iterpreted as clause 'foo' with argument 'bar'
61
+ *
62
+ * @param string $name Clause/method name
63
+ * @param mixed $args
64
+ * @return Zend_Cloud_DocumentService_Query
65
+ */
66
+ public function __call($name, $args)
67
+ {
68
+ $this->_clauses[] = array(strtolower($name), $args);
69
+ return $this;
70
+ }
71
+
72
+ /**
73
+ * SELECT clause (fields to be selected)
74
+ *
75
+ * @param null|string|array $select
76
+ * @return Zend_Cloud_DocumentService_Query
77
+ */
78
+ public function select($select)
79
+ {
80
+ if (empty($select)) {
81
+ return $this;
82
+ }
83
+ if (!is_string($select) && !is_array($select)) {
84
+ #require_once 'Zend/Cloud/DocumentService/Exception.php';
85
+ throw new Zend_Cloud_DocumentService_Exception("SELECT argument must be a string or an array of strings");
86
+ }
87
+ $this->_clauses[] = array(self::QUERY_SELECT, $select);
88
+ return $this;
89
+ }
90
+
91
+ /**
92
+ * FROM clause
93
+ *
94
+ * @param string $name Field names
95
+ * @return Zend_Cloud_DocumentService_Query
96
+ */
97
+ public function from($name)
98
+ {
99
+ if(!is_string($name)) {
100
+ #require_once 'Zend/Cloud/DocumentService/Exception.php';
101
+ throw new Zend_Cloud_DocumentService_Exception("FROM argument must be a string");
102
+ }
103
+ $this->_clauses[] = array(self::QUERY_FROM, $name);
104
+ return $this;
105
+ }
106
+
107
+ /**
108
+ * WHERE query
109
+ *
110
+ * @param string $cond Condition
111
+ * @param array $args Arguments to substitute instead of ?'s in condition
112
+ * @param string $op relation to other clauses - and/or
113
+ * @return Zend_Cloud_DocumentService_Query
114
+ */
115
+ public function where($cond, $value = null, $op = 'and')
116
+ {
117
+ if (!is_string($cond)) {
118
+ #require_once 'Zend/Cloud/DocumentService/Exception.php';
119
+ throw new Zend_Cloud_DocumentService_Exception("WHERE argument must be a string");
120
+ }
121
+ $this->_clauses[] = array(self::QUERY_WHERE, array($cond, $value, $op));
122
+ return $this;
123
+ }
124
+
125
+ /**
126
+ * Select record or fields by ID
127
+ *
128
+ * @param string|int $value Identifier to select by
129
+ * @return Zend_Cloud_DocumentService_Query
130
+ */
131
+ public function whereId($value)
132
+ {
133
+ if (!is_scalar($value)) {
134
+ #require_once 'Zend/Cloud/DocumentService/Exception.php';
135
+ throw new Zend_Cloud_DocumentService_Exception("WHEREID argument must be a scalar");
136
+ }
137
+ $this->_clauses[] = array(self::QUERY_WHEREID, $value);
138
+ return $this;
139
+ }
140
+
141
+ /**
142
+ * LIMIT clause (how many items to return)
143
+ *
144
+ * @param int $limit
145
+ * @return Zend_Cloud_DocumentService_Query
146
+ */
147
+ public function limit($limit)
148
+ {
149
+ if ($limit != (int) $limit) {
150
+ #require_once 'Zend/Cloud/DocumentService/Exception.php';
151
+ throw new Zend_Cloud_DocumentService_Exception("LIMIT argument must be an integer");
152
+ }
153
+ $this->_clauses[] = array(self::QUERY_LIMIT, $limit);
154
+ return $this;
155
+ }
156
+
157
+ /**
158
+ * ORDER clause; field or fields to sort by, and direction to sort
159
+ *
160
+ * @param string|int|array $sort
161
+ * @param string $direction
162
+ * @return Zend_Cloud_DocumentService_Query
163
+ */
164
+ public function order($sort, $direction = 'asc')
165
+ {
166
+ $this->_clauses[] = array(self::QUERY_ORDER, array($sort, $direction));
167
+ return $this;
168
+ }
169
+
170
+ /**
171
+ * "Assemble" the query
172
+ *
173
+ * Simply returns the clauses present.
174
+ *
175
+ * @return array
176
+ */
177
+ public function assemble()
178
+ {
179
+ return $this->getClauses();
180
+ }
181
+
182
+ /**
183
+ * Return query clauses as an array
184
+ *
185
+ * @return array Clauses in the query
186
+ */
187
+ public function getClauses()
188
+ {
189
+ return $this->_clauses;
190
+ }
191
+ }
lib/Zend/Cloud/DocumentService/QueryAdapter.php CHANGED
@@ -1,102 +1,102 @@
1
- <?php
2
- /**
3
- * LICENSE
4
- *
5
- * This source file is subject to the new BSD license that is bundled
6
- * with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://framework.zend.com/license/new-bsd
9
- * If you did not receive a copy of the license and are unable to
10
- * obtain it through the world-wide-web, please send an email
11
- * to license@zend.com so we can send you a copy immediately.
12
- *
13
- * @category Zend
14
- * @package Zend_Cloud
15
- * @subpackage DocumentService
16
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
17
- * @license http://framework.zend.com/license/new-bsd New BSD License
18
- */
19
-
20
- /**
21
- * This interface describes the API that concrete query adapter should implement
22
- *
23
- * Common interface for document storage services in the cloud. This interface
24
- * supports most document services and provides some flexibility for
25
- * vendor-specific features and requirements via an optional $options array in
26
- * each method signature. Classes implementing this interface should implement
27
- * URI construction for collections and documents from the parameters given in each
28
- * method and the account data passed in to the constructor. Classes
29
- * implementing this interface are also responsible for security; access control
30
- * isn't currently supported in this interface, although we are considering
31
- * access control support in future versions of the interface. Query
32
- * optimization mechanisms are also not supported in this version.
33
- *
34
- * @category Zend
35
- * @package Zend_Cloud
36
- * @subpackage DocumentService
37
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
38
- * @license http://framework.zend.com/license/new-bsd New BSD License
39
- */
40
- interface Zend_Cloud_DocumentService_QueryAdapter
41
- {
42
- /**
43
- * SELECT clause (fields to be selected)
44
- *
45
- * @param string $select
46
- * @return Zend_Cloud_DocumentService_QueryAdapter
47
- */
48
- public function select($select);
49
-
50
- /**
51
- * FROM clause (table name)
52
- *
53
- * @param string $from
54
- * @return Zend_Cloud_DocumentService_QueryAdapter
55
- */
56
- public function from($from);
57
-
58
- /**
59
- * WHERE clause (conditions to be used)
60
- *
61
- * @param string $where
62
- * @param mixed $value Value or array of values to be inserted instead of ?
63
- * @param string $op Operation to use to join where clauses (AND/OR)
64
- * @return Zend_Cloud_DocumentService_QueryAdapter
65
- */
66
- public function where($where, $value = null, $op = 'and');
67
-
68
- /**
69
- * WHERE clause for item ID
70
- *
71
- * This one should be used when fetching specific rows since some adapters
72
- * have special syntax for primary keys
73
- *
74
- * @param mixed $value Row ID for the document
75
- * @return Zend_Cloud_DocumentService_QueryAdapter
76
- */
77
- public function whereId($value);
78
-
79
- /**
80
- * LIMIT clause (how many rows ot return)
81
- *
82
- * @param int $limit
83
- * @return Zend_Cloud_DocumentService_QueryAdapter
84
- */
85
- public function limit($limit);
86
-
87
- /**
88
- * ORDER BY clause (sorting)
89
- *
90
- * @param string $sort Column to sort by
91
- * @param string $direction Direction - asc/desc
92
- * @return Zend_Cloud_DocumentService_QueryAdapter
93
- */
94
- public function order($sort, $direction = 'asc');
95
-
96
- /**
97
- * Assemble the query into a format the adapter can utilize
98
- *
99
- * @return mixed
100
- */
101
- public function assemble();
102
- }
1
+ <?php
2
+ /**
3
+ * LICENSE
4
+ *
5
+ * This source file is subject to the new BSD license that is bundled
6
+ * with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://framework.zend.com/license/new-bsd
9
+ * If you did not receive a copy of the license and are unable to
10
+ * obtain it through the world-wide-web, please send an email
11
+ * to license@zend.com so we can send you a copy immediately.
12
+ *
13
+ * @category Zend
14
+ * @package Zend_Cloud
15
+ * @subpackage DocumentService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
+ * @license http://framework.zend.com/license/new-bsd New BSD License
18
+ */
19
+
20
+ /**
21
+ * This interface describes the API that concrete query adapter should implement
22
+ *
23
+ * Common interface for document storage services in the cloud. This interface
24
+ * supports most document services and provides some flexibility for
25
+ * vendor-specific features and requirements via an optional $options array in
26
+ * each method signature. Classes implementing this interface should implement
27
+ * URI construction for collections and documents from the parameters given in each
28
+ * method and the account data passed in to the constructor. Classes
29
+ * implementing this interface are also responsible for security; access control
30
+ * isn't currently supported in this interface, although we are considering
31
+ * access control support in future versions of the interface. Query
32
+ * optimization mechanisms are also not supported in this version.
33
+ *
34
+ * @category Zend
35
+ * @package Zend_Cloud
36
+ * @subpackage DocumentService
37
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
38
+ * @license http://framework.zend.com/license/new-bsd New BSD License
39
+ */
40
+ interface Zend_Cloud_DocumentService_QueryAdapter
41
+ {
42
+ /**
43
+ * SELECT clause (fields to be selected)
44
+ *
45
+ * @param string $select
46
+ * @return Zend_Cloud_DocumentService_QueryAdapter
47
+ */
48
+ public function select($select);
49
+
50
+ /**
51
+ * FROM clause (table name)
52
+ *
53
+ * @param string $from
54
+ * @return Zend_Cloud_DocumentService_QueryAdapter
55
+ */
56
+ public function from($from);
57
+
58
+ /**
59
+ * WHERE clause (conditions to be used)
60
+ *
61
+ * @param string $where
62
+ * @param mixed $value Value or array of values to be inserted instead of ?
63
+ * @param string $op Operation to use to join where clauses (AND/OR)
64
+ * @return Zend_Cloud_DocumentService_QueryAdapter
65
+ */
66
+ public function where($where, $value = null, $op = 'and');
67
+
68
+ /**
69
+ * WHERE clause for item ID
70
+ *
71
+ * This one should be used when fetching specific rows since some adapters
72
+ * have special syntax for primary keys
73
+ *
74
+ * @param mixed $value Row ID for the document
75
+ * @return Zend_Cloud_DocumentService_QueryAdapter
76
+ */
77
+ public function whereId($value);
78
+
79
+ /**
80
+ * LIMIT clause (how many rows ot return)
81
+ *
82
+ * @param int $limit
83
+ * @return Zend_Cloud_DocumentService_QueryAdapter
84
+ */
85
+ public function limit($limit);
86
+
87
+ /**
88
+ * ORDER BY clause (sorting)
89
+ *
90
+ * @param string $sort Column to sort by
91
+ * @param string $direction Direction - asc/desc
92
+ * @return Zend_Cloud_DocumentService_QueryAdapter
93
+ */
94
+ public function order($sort, $direction = 'asc');
95
+
96
+ /**
97
+ * Assemble the query into a format the adapter can utilize
98
+ *
99
+ * @return mixed
100
+ */
101
+ public function assemble();
102
+ }
lib/Zend/Cloud/Exception.php CHANGED
@@ -1,53 +1,53 @@
1
- <?php
2
- /**
3
- * Zend Framework
4
- *
5
- * LICENSE
6
- *
7
- * This source file is subject to the new BSD license that is bundled
8
- * with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://framework.zend.com/license/new-bsd
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@zend.com so we can send you a copy immediately.
14
- *
15
- * @category Zend
16
- * @package Zend_Cloud
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
- * @license http://framework.zend.com/license/new-bsd New BSD License
19
- */
20
-
21
-
22
- /**
23
- * Zend_Exception
24
- */
25
- #require_once 'Zend/Exception.php';
26
-
27
-
28
- /**
29
- * @category Zend
30
- * @package Zend_Cloud
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
- * @license http://framework.zend.com/license/new-bsd New BSD License
33
- */
34
- class Zend_Cloud_Exception extends Zend_Exception
35
- {
36
- /**
37
- * Exception for the underlying adapter
38
- *
39
- * @var Exception
40
- */
41
- protected $_clientException;
42
-
43
- public function __construct($message, $code = 0, $clientException = null)
44
- {
45
- $this->_clientException = $clientException;
46
- parent::__construct($message, $code, $clientException);
47
- }
48
-
49
- public function getClientException() {
50
- return $this->_getPrevious();
51
- }
52
- }
53
-
1
+ <?php
2
+ /**
3
+ * Zend Framework
4
+ *
5
+ * LICENSE
6
+ *
7
+ * This source file is subject to the new BSD license that is bundled
8
+ * with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://framework.zend.com/license/new-bsd
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@zend.com so we can send you a copy immediately.
14
+ *
15
+ * @category Zend
16
+ * @package Zend_Cloud
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
+ * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ */
20
+
21
+
22
+ /**
23
+ * Zend_Exception
24
+ */
25
+ #require_once 'Zend/Exception.php';
26
+
27
+
28
+ /**
29
+ * @category Zend
30
+ * @package Zend_Cloud
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
+ * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ */
34
+ class Zend_Cloud_Exception extends Zend_Exception
35
+ {
36
+ /**
37
+ * Exception for the underlying adapter
38
+ *
39
+ * @var Exception
40
+ */
41
+ protected $_clientException;
42
+
43
+ public function __construct($message, $code = 0, $clientException = null)
44
+ {
45
+ $this->_clientException = $clientException;
46
+ parent::__construct($message, $code, $clientException);
47
+ }
48
+
49
+ public function getClientException() {
50
+ return $this->_getPrevious();
51
+ }
52
+ }
53
+
lib/Zend/Cloud/Infrastructure/Adapter.php ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Zend
4
+ * @package Zend_Cloud
5
+ * @subpackage Infrastructure
6
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
7
+ * @license http://framework.zend.com/license/new-bsd New BSD License
8
+ */
9
+
10
+ /**
11
+ * Adapter interface for infrastructure service
12
+ *
13
+ * @package Zend_Cloud
14
+ * @subpackage Infrastructure
15
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
16
+ * @license http://framework.zend.com/license/new-bsd New BSD License
17
+ */
18
+ interface Zend_Cloud_Infrastructure_Adapter
19
+ {
20
+ const HTTP_ADAPTER = 'http_adapter';
21
+
22
+ /**
23
+ * The max. amount of time, in seconds, to wait for a status change
24
+ */
25
+ const TIMEOUT_STATUS_CHANGE = 30;
26
+
27
+ /**
28
+ * The time step, in seconds, for the status change
29
+ */
30
+ const TIME_STEP_STATUS_CHANGE = 5;
31
+
32
+ /**
33
+ * Return a list of the available instances
34
+ *
35
+ * @return InstanceList
36
+ */
37
+ public function listInstances();
38
+
39
+ /**
40
+ * Return the status of an instance
41
+ *
42
+ * @param string $id
43
+ * @return string
44
+ */
45
+ public function statusInstance($id);
46
+
47
+ /**
48
+ * Wait for status $status with a timeout of $timeout seconds
49
+ *
50
+ * @param string $id
51
+ * @param string $status
52
+ * @param integer $timeout
53
+ * @return boolean
54
+ */
55
+ public function waitStatusInstance($id, $status, $timeout = self::TIMEOUT_STATUS_CHANGE);
56
+
57
+ /**
58
+ * Return the public DNS name of the instance
59
+ *
60
+ * @param string $id
61
+ * @return string|boolean
62
+ */
63
+ public function publicDnsInstance($id);
64
+
65
+ /**
66
+ * Reboot an instance
67
+ *
68
+ * @param string $id
69
+ * @return boolean
70
+ */
71
+ public function rebootInstance($id);
72
+
73
+ /**
74
+ * Create a new instance
75
+ *
76
+ * @param string $name
77
+ * @param array $options
78
+ * @return boolean
79
+ */
80
+ public function createInstance($name, $options);
81
+
82
+ /**
83
+ * Stop the execution of an instance
84
+ *
85
+ * @param string $id
86
+ * @return boolean
87
+ */
88
+ public function stopInstance($id);
89
+
90
+ /**
91
+ * Start the execution of an instance
92
+ *
93
+ * @param string $id
94
+ * @return boolean
95
+ */
96
+ public function startInstance($id);
97
+
98
+ /**
99
+ * Destroy an instance
100
+ *
101
+ * @param string $id
102
+ * @return boolean
103
+ */
104
+ public function destroyInstance($id);
105
+
106
+ /**
107
+ * Return all the available instances images
108
+ *
109
+ * @return ImageList
110
+ */
111
+ public function imagesInstance();
112
+
113
+ /**
114
+ * Return all the available zones
115
+ *
116
+ * @return array
117
+ */
118
+ public function zonesInstance();
119
+
120
+ /**
121
+ * Return the system informations about the $metric of an instance
122
+ *
123
+ * @param string $id
124
+ * @param string $metric
125
+ * @param array $options
126
+ * @return array
127
+ */
128
+ public function monitorInstance($id, $metric, $options = null);
129
+
130
+ /**
131
+ * Run arbitrary shell script on an instance
132
+ *
133
+ * @param string $id
134
+ * @param array $param
135
+ * @param string|array $cmd
136
+ * @return string|array
137
+ */
138
+ public function deployInstance($id, $param, $cmd);
139
+
140
+ /**
141
+ * Get the adapter instance
142
+ *
143
+ * @return object
144
+ */
145
+ public function getAdapter();
146
+
147
+ /**
148
+ * Get the adapter result
149
+ *
150
+ * @return array
151
+ */
152
+ public function getAdapterResult();
153
+
154
+ /**
155
+ * Get the last HTTP response
156
+ *
157
+ * @return Zend_Http_Response
158
+ */
159
+ public function getLastHttpResponse();
160
+
161
+ /**
162
+ * Get the last HTTP request
163
+ *
164
+ * @return string
165
+ */
166
+ public function getLastHttpRequest();
167
+ }
lib/Zend/Cloud/Infrastructure/Adapter/AbstractAdapter.php ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * LICENSE
4
+ *
5
+ * This source file is subject to the new BSD license that is bundled
6
+ * with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://framework.zend.com/license/new-bsd
9
+ * If you did not receive a copy of the license and are unable to
10
+ * obtain it through the world-wide-web, please send an email
11
+ * to license@zend.com so we can send you a copy immediately.
12
+ *
13
+ * @category Zend
14
+ * @package Zend_Cloud
15
+ * @subpackage DocumentService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
+ * @license http://framework.zend.com/license/new-bsd New BSD License
18
+ */
19
+
20
+ #require_once 'Zend/Cloud/Infrastructure/Adapter.php';
21
+ #require_once 'Zend/Cloud/Infrastructure/Instance.php';
22
+
23
+ /**
24
+ * Abstract infrastructure service adapter
25
+ *
26
+ * @category Zend
27
+ * @package Zend_Cloud_Infrastructure
28
+ * @subpackage Adapter
29
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30
+ * @license http://framework.zend.com/license/new-bsd New BSD License
31
+ */
32
+ abstract class Zend_Cloud_Infrastructure_Adapter_AbstractAdapter implements Zend_Cloud_Infrastructure_Adapter
33
+ {
34
+ /**
35
+ * Store the last response from the adpter
36
+ *
37
+ * @var array
38
+ */
39
+ protected $adapterResult;
40
+
41
+ /**
42
+ * Valid metrics for monitor
43
+ *
44
+ * @var array
45
+ */
46
+ protected $validMetrics = array(
47
+ Zend_Cloud_Infrastructure_Instance::MONITOR_CPU,
48
+ Zend_Cloud_Infrastructure_Instance::MONITOR_RAM,
49
+ Zend_Cloud_Infrastructure_Instance::MONITOR_DISK,
50
+ Zend_Cloud_Infrastructure_Instance::MONITOR_DISK_READ,
51
+ Zend_Cloud_Infrastructure_Instance::MONITOR_DISK_WRITE,
52
+ Zend_Cloud_Infrastructure_Instance::MONITOR_NETWORK_IN,
53
+ Zend_Cloud_Infrastructure_Instance::MONITOR_NETWORK_OUT,
54
+ );
55
+
56
+ /**
57
+ * Get the last result of the adapter
58
+ *
59
+ * @return array
60
+ */
61
+ public function getAdapterResult()
62
+ {
63
+ return $this->adapterResult;
64
+ }
65
+
66
+ /**
67
+ * Wait for status $status with a timeout of $timeout seconds
68
+ *
69
+ * @param string $id
70
+ * @param string $status
71
+ * @param integer $timeout
72
+ * @return boolean
73
+ */
74
+ public function waitStatusInstance($id, $status, $timeout = self::TIMEOUT_STATUS_CHANGE)
75
+ {
76
+ if (empty($id) || empty($status)) {
77
+ return false;
78
+ }
79
+
80
+ $num = 0;
81
+ while (($num<$timeout) && ($this->statusInstance($id) != $status)) {
82
+ sleep(self::TIME_STEP_STATUS_CHANGE);
83
+ $num += self::TIME_STEP_STATUS_CHANGE;
84
+ }
85
+ return ($num < $timeout);
86
+ }
87
+
88
+ /**
89
+ * Run arbitrary shell script on an instance
90
+ *
91
+ * @param string $id
92
+ * @param array $param
93
+ * @param string|array $cmd
94
+ * @return string|array
95
+ */
96
+ public function deployInstance($id, $params, $cmd)
97
+ {
98
+ if (!function_exists("ssh2_connect")) {
99
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
100
+ throw new Zend_Cloud_Infrastructure_Exception('Deployment requires the PHP "SSH" extension (ext/ssh2)');
101
+ }
102
+
103
+ if (empty($id)) {
104
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
105
+ throw new Zend_Cloud_Infrastructure_Exception('You must specify the instance where to deploy');
106
+ }
107
+
108
+ if (empty($cmd)) {
109
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
110
+ throw new Zend_Cloud_Infrastructure_Exception('You must specify the shell commands to run on the instance');
111
+ }
112
+
113
+ if (empty($params)
114
+ || empty($params[Zend_Cloud_Infrastructure_Instance::SSH_USERNAME])
115
+ || (empty($params[Zend_Cloud_Infrastructure_Instance::SSH_PASSWORD])
116
+ && empty($params[Zend_Cloud_Infrastructure_Instance::SSH_KEY]))
117
+ ) {
118
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
119
+ throw new Zend_Cloud_Infrastructure_Exception('You must specify the params for the SSH connection');
120
+ }
121
+
122
+ $host = $this->publicDnsInstance($id);
123
+ if (empty($host)) {
124
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
125
+ throw new Zend_Cloud_Infrastructure_Exception(sprintf(
126
+ 'The instance identified by "%s" does not exist',
127
+ $id
128
+ ));
129
+ }
130
+
131
+ $conn = ssh2_connect($host);
132
+ if (!ssh2_auth_password($conn, $params[Zend_Cloud_Infrastructure_Instance::SSH_USERNAME],
133
+ $params[Zend_Cloud_Infrastructure_Instance::SSH_PASSWORD])) {
134
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
135
+ throw new Zend_Cloud_Infrastructure_Exception('SSH authentication failed');
136
+ }
137
+
138
+ if (is_array($cmd)) {
139
+ $result = array();
140
+ foreach ($cmd as $command) {
141
+ $stream = ssh2_exec($conn, $command);
142
+ $errorStream = ssh2_fetch_stream($stream, SSH2_STREAM_STDERR);
143
+
144
+ stream_set_blocking($errorStream, true);
145
+ stream_set_blocking($stream, true);
146
+
147
+ $output = stream_get_contents($stream);
148
+ $error = stream_get_contents($errorStream);
149
+
150
+ if (empty($error)) {
151
+ $result[$command] = $output;
152
+ } else {
153
+ $result[$command] = $error;
154
+ }
155
+ }
156
+ } else {
157
+ $stream = ssh2_exec($conn, $cmd);
158
+ $result = stream_set_blocking($stream, true);
159
+ $errorStream = ssh2_fetch_stream($stream, SSH2_STREAM_STDERR);
160
+
161
+ stream_set_blocking($errorStream, true);
162
+ stream_set_blocking($stream, true);
163
+
164
+ $output = stream_get_contents($stream);
165
+ $error = stream_get_contents($errorStream);
166
+
167
+ if (empty($error)) {
168
+ $result = $output;
169
+ } else {
170
+ $result = $error;
171
+ }
172
+ }
173
+ return $result;
174
+ }
175
+ }
lib/Zend/Cloud/Infrastructure/Adapter/Ec2.php ADDED
@@ -0,0 +1,496 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Zend
4
+ * @package Zend_Cloud_Infrastructure
5
+ * @subpackage Adapter
6
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
7
+ * @license http://framework.zend.com/license/new-bsd New BSD License
8
+ */
9
+
10
+ #require_once 'Zend/Service/Amazon/Ec2/Instance.php';
11
+ #require_once 'Zend/Service/Amazon/Ec2/Image.php';
12
+ #require_once 'Zend/Service/Amazon/Ec2/Availabilityzones.php';
13
+ #require_once 'Zend/Service/Amazon/Ec2/CloudWatch.php';
14
+ #require_once 'Zend/Cloud/Infrastructure/Instance.php';
15
+ #require_once 'Zend/Cloud/Infrastructure/InstanceList.php';
16
+ #require_once 'Zend/Cloud/Infrastructure/Image.php';
17
+ #require_once 'Zend/Cloud/Infrastructure/ImageList.php';
18
+ #require_once 'Zend/Cloud/Infrastructure/Adapter/AbstractAdapter.php';
19
+
20
+ /**
21
+ * Amazon EC2 adapter for infrastructure service
22
+ *
23
+ * @package Zend_Cloud_Infrastructure
24
+ * @subpackage Adapter
25
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
26
+ * @license http://framework.zend.com/license/new-bsd New BSD License
27
+ */
28
+ class Zend_Cloud_Infrastructure_Adapter_Ec2 extends Zend_Cloud_Infrastructure_Adapter_AbstractAdapter
29
+ {
30
+ /**
31
+ * AWS constants
32
+ */
33
+ const AWS_ACCESS_KEY = 'aws_accesskey';
34
+ const AWS_SECRET_KEY = 'aws_secretkey';
35
+ const AWS_REGION = 'aws_region';
36
+ const AWS_SECURITY_GROUP = 'securityGroup';
37
+
38
+ /**
39
+ * Ec2 Instance
40
+ *
41
+ * @var Ec2Instance
42
+ */
43
+ protected $ec2;
44
+
45
+ /**
46
+ * Ec2 Image
47
+ *
48
+ * @var Ec2Image
49
+ */
50
+ protected $ec2Image;
51
+
52
+ /**
53
+ * Ec2 Zone
54
+ *
55
+ * @var Ec2Zone
56
+ */
57
+ protected $ec2Zone;
58
+
59
+ /**
60
+ * Ec2 Monitor
61
+ *
62
+ * @var Ec2Monitor
63
+ */
64
+ protected $ec2Monitor;
65
+
66
+ /**
67
+ * AWS Access Key
68
+ *
69
+ * @var string
70
+ */
71
+ protected $accessKey;
72
+
73
+ /**
74
+ * AWS Access Secret
75
+ *
76
+ * @var string
77
+ */
78
+ protected $accessSecret;
79
+
80
+ /**
81
+ * Region zone
82
+ *
83
+ * @var string
84
+ */
85
+ protected $region;
86
+
87
+ /**
88
+ * Map array between EC2 and Infrastructure status
89
+ *
90
+ * @var array
91
+ */
92
+ protected $mapStatus = array (
93
+ 'running' => Zend_Cloud_Infrastructure_Instance::STATUS_RUNNING,
94
+ 'terminated' => Zend_Cloud_Infrastructure_Instance::STATUS_TERMINATED,
95
+ 'pending' => Zend_Cloud_Infrastructure_Instance::STATUS_PENDING,
96
+ 'shutting-down' => Zend_Cloud_Infrastructure_Instance::STATUS_SHUTTING_DOWN,
97
+ 'stopping' => Zend_Cloud_Infrastructure_Instance::STATUS_PENDING,
98
+ 'stopped' => Zend_Cloud_Infrastructure_Instance::STATUS_STOPPED,
99
+ 'rebooting' => Zend_Cloud_Infrastructure_Instance::STATUS_REBOOTING,
100
+ );
101
+
102
+ /**
103
+ * Map monitor metrics between Infrastructure and EC2
104
+ *
105
+ * @var array
106
+ */
107
+ protected $mapMetrics= array (
108
+ Zend_Cloud_Infrastructure_Instance::MONITOR_CPU => 'CPUUtilization',
109
+ Zend_Cloud_Infrastructure_Instance::MONITOR_DISK_READ => 'DiskReadBytes',
110
+ Zend_Cloud_Infrastructure_Instance::MONITOR_DISK_WRITE => 'DiskWriteBytes',
111
+ Zend_Cloud_Infrastructure_Instance::MONITOR_NETWORK_IN => 'NetworkIn',
112
+ Zend_Cloud_Infrastructure_Instance::MONITOR_NETWORK_OUT => 'NetworkOut',
113
+ );
114
+
115
+ /**
116
+ * Constructor
117
+ *
118
+ * @param array|Zend_Config $options
119
+ * @return void
120
+ */
121
+ public function __construct($options = array())
122
+ {
123
+ if (is_object($options)) {
124
+ if (method_exists($options, 'toArray')) {
125
+ $options= $options->toArray();
126
+ } elseif ($options instanceof Traversable) {
127
+ $options = iterator_to_array($options);
128
+ }
129
+ }
130
+
131
+ if (empty($options) || !is_array($options)) {
132
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
133
+ throw new Zend_Cloud_Infrastructure_Exception('Invalid options provided');
134
+ }
135
+
136
+ if (!isset($options[self::AWS_ACCESS_KEY])
137
+ || !isset($options[self::AWS_SECRET_KEY])
138
+ ) {
139
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
140
+ throw new Zend_Cloud_Infrastructure_Exception('AWS keys not specified!');
141
+ }
142
+
143
+ $this->accessKey = $options[self::AWS_ACCESS_KEY];
144
+ $this->accessSecret = $options[self::AWS_SECRET_KEY];
145
+ $this->region = '';
146
+
147
+ if (isset($options[self::AWS_REGION])) {
148
+ $this->region= $options[self::AWS_REGION];
149
+ }
150
+
151
+ try {
152
+ $this->ec2 = new Zend_Service_Amazon_Ec2_Instance($options[self::AWS_ACCESS_KEY], $options[self::AWS_SECRET_KEY], $this->region);
153
+ } catch (Exception $e) {
154
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
155
+ throw new Zend_Cloud_Infrastructure_Exception('Error on create: ' . $e->getMessage(), $e->getCode(), $e);
156
+ }
157
+
158
+ if (isset($options[self::HTTP_ADAPTER])) {
159
+ $this->ec2->getHttpClient()->setAdapter($options[self::HTTP_ADAPTER]);
160
+ }
161
+ }
162
+
163
+ /**
164
+ * Convert the attributes of EC2 into attributes of Infrastructure
165
+ *
166
+ * @param array $attr
167
+ * @return array|boolean
168
+ */
169
+ private function convertAttributes($attr)
170
+ {
171
+ $result = array();
172
+ if (!empty($attr) && is_array($attr)) {
173
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_ID] = $attr['instanceId'];
174
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_STATUS] = $this->mapStatus[$attr['instanceState']['name']];
175
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_IMAGEID] = $attr['imageId'];
176
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_ZONE] = $attr['availabilityZone'];
177
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_LAUNCHTIME] = $attr['launchTime'];
178
+
179
+ switch ($attr['instanceType']) {
180
+ case Zend_Service_Amazon_Ec2_Instance::MICRO:
181
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_CPU] = '1 virtual core';
182
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_RAM] = '613MB';
183
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_STORAGE] = '0GB';
184
+ break;
185
+ case Zend_Service_Amazon_Ec2_Instance::SMALL:
186
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_CPU] = '1 virtual core';
187
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_RAM] = '1.7GB';
188
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_STORAGE] = '160GB';
189
+ break;
190
+ case Zend_Service_Amazon_Ec2_Instance::LARGE:
191
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_CPU] = '2 virtual core';
192
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_RAM] = '7.5GB';
193
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_STORAGE] = '850GB';
194
+ break;
195
+ case Zend_Service_Amazon_Ec2_Instance::XLARGE:
196
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_CPU] = '4 virtual core';
197
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_RAM] = '15GB';
198
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_STORAGE] = '1690GB';
199
+ break;
200
+ case Zend_Service_Amazon_Ec2_Instance::HCPU_MEDIUM:
201
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_CPU] = '2 virtual core';
202
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_RAM] = '1.7GB';
203
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_STORAGE] = '350GB';
204
+ break;
205
+ case Zend_Service_Amazon_Ec2_Instance::HCPU_XLARGE:
206
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_CPU] = '8 virtual core';
207
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_RAM] = '7GB';
208
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_STORAGE] = '1690GB';
209
+ break;
210
+ }
211
+ }
212
+ return $result;
213
+ }
214
+
215
+ /**
216
+ * Return a list of the available instancies
217
+ *
218
+ * @return Zend_Cloud_Infrastructure_InstanceList
219
+ */
220
+ public function listInstances()
221
+ {
222
+ $this->adapterResult = $this->ec2->describe();
223
+
224
+ $result = array();
225
+ foreach ($this->adapterResult['instances'] as $instance) {
226
+ $result[]= $this->convertAttributes($instance);
227
+ }
228
+ return new Zend_Cloud_Infrastructure_InstanceList($this, $result);
229
+ }
230
+
231
+ /**
232
+ * Return the status of an instance
233
+ *
234
+ * @param string
235
+ * @return string|boolean
236
+ */
237
+ public function statusInstance($id)
238
+ {
239
+ $this->adapterResult = $this->ec2->describe($id);
240
+ if (empty($this->adapterResult['instances'])) {
241
+ return false;
242
+ }
243
+ $result = $this->adapterResult['instances'][0];
244
+ return $this->mapStatus[$result['instanceState']['name']];
245
+ }
246
+
247
+ /**
248
+ * Return the public DNS name of the instance
249
+ *
250
+ * @param string $id
251
+ * @return string|boolean
252
+ */
253
+ public function publicDnsInstance($id)
254
+ {
255
+ $this->adapterResult = $this->ec2->describe($id);
256
+ if (empty($this->adapterResult['instances'])) {
257
+ return false;
258
+ }
259
+ $result = $this->adapterResult['instances'][0];
260
+ return $result['dnsName'];
261
+ }
262
+
263
+ /**
264
+ * Reboot an instance
265
+ *
266
+ * @param string $id
267
+ * @return boolean
268
+ */
269
+ public function rebootInstance($id)
270
+ {
271
+ $this->adapterResult= $this->ec2->reboot($id);
272
+ return $this->adapterResult;
273
+ }
274
+
275
+ /**
276
+ * Create a new instance
277
+ *
278
+ * @param string $name
279
+ * @param array $options
280
+ * @return Instance|boolean
281
+ */
282
+ public function createInstance($name, $options)
283
+ {
284
+ // @todo instance's name management?
285
+ $this->adapterResult = $this->ec2->run($options);
286
+ if (empty($this->adapterResult['instances'])) {
287
+ return false;
288
+ }
289
+ $this->error= false;
290
+ return new Zend_Cloud_Infrastructure_Instance($this, $this->convertAttributes($this->adapterResult['instances'][0]));
291
+ }
292
+
293
+ /**
294
+ * Stop an instance
295
+ *
296
+ * @param string $id
297
+ * @return boolean
298
+ */
299
+ public function stopInstance($id)
300
+ {
301
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
302
+ throw new Zend_Cloud_Infrastructure_Exception('The stopInstance method is not implemented in the adapter');
303
+ }
304
+
305
+ /**
306
+ * Start an instance
307
+ *
308
+ * @param string $id
309
+ * @return boolean
310
+ */
311
+ public function startInstance($id)
312
+ {
313
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
314
+ throw new Zend_Cloud_Infrastructure_Exception('The startInstance method is not implemented in the adapter');
315
+ }
316
+
317
+ /**
318
+ * Destroy an instance
319
+ *
320
+ * @param string $id
321
+ * @return boolean
322
+ */
323
+ public function destroyInstance($id)
324
+ {
325
+ $this->adapterResult = $this->ec2->terminate($id);
326
+ return (!empty($this->adapterResult));
327
+ }
328
+
329
+ /**
330
+ * Return a list of all the available instance images
331
+ *
332
+ * @return ImageList
333
+ */
334
+ public function imagesInstance()
335
+ {
336
+ if (!isset($this->ec2Image)) {
337
+ $this->ec2Image = new Zend_Service_Amazon_Ec2_Image($this->accessKey, $this->accessSecret, $this->region);
338
+ }
339
+
340
+ $this->adapterResult = $this->ec2Image->describe();
341
+
342
+ $images = array();
343
+
344
+ foreach ($this->adapterResult as $result) {
345
+ switch (strtolower($result['platform'])) {
346
+ case 'windows' :
347
+ $platform = Zend_Cloud_Infrastructure_Image::IMAGE_WINDOWS;
348
+ break;
349
+ default:
350
+ $platform = Zend_Cloud_Infrastructure_Image::IMAGE_LINUX;
351
+ break;
352
+ }
353
+
354
+ $images[]= array (
355
+ Zend_Cloud_Infrastructure_Image::IMAGE_ID => $result['imageId'],
356
+ Zend_Cloud_Infrastructure_Image::IMAGE_NAME => '',
357
+ Zend_Cloud_Infrastructure_Image::IMAGE_DESCRIPTION => $result['imageLocation'],
358
+ Zend_Cloud_Infrastructure_Image::IMAGE_OWNERID => $result['imageOwnerId'],
359
+ Zend_Cloud_Infrastructure_Image::IMAGE_ARCHITECTURE => $result['architecture'],
360
+ Zend_Cloud_Infrastructure_Image::IMAGE_PLATFORM => $platform,
361
+ );
362
+ }
363
+ return new Zend_Cloud_Infrastructure_ImageList($images,$this->ec2Image);
364
+ }
365
+
366
+ /**
367
+ * Return all the available zones
368
+ *
369
+ * @return array
370
+ */
371
+ public function zonesInstance()
372
+ {
373
+ if (!isset($this->ec2Zone)) {
374
+ $this->ec2Zone = new Zend_Service_Amazon_Ec2_AvailabilityZones($this->accessKey,$this->accessSecret,$this->region);
375
+ }
376
+ $this->adapterResult = $this->ec2Zone->describe();
377
+
378
+ $zones = array();
379
+ foreach ($this->adapterResult as $zone) {
380
+ if (strtolower($zone['zoneState']) === 'available') {
381
+ $zones[] = array (
382
+ Zend_Cloud_Infrastructure_Instance::INSTANCE_ZONE => $zone['zoneName'],
383
+ );
384
+ }
385
+ }
386
+ return $zones;
387
+ }
388
+
389
+ /**
390
+ * Return the system information about the $metric of an instance
391
+ *
392
+ * @param string $id
393
+ * @param string $metric
394
+ * @param null|array $options
395
+ * @return array
396
+ */
397
+ public function monitorInstance($id, $metric, $options = null)
398
+ {
399
+ if (empty($id) || empty($metric)) {
400
+ return false;
401
+ }
402
+
403
+ if (!in_array($metric,$this->validMetrics)) {
404
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
405
+ throw new Zend_Cloud_Infrastructure_Exception(sprintf(
406
+ 'The metric "%s" is not valid',
407
+ $metric
408
+ ));
409
+ }
410
+
411
+ if (!empty($options) && !is_array($options)) {
412
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
413
+ throw new Zend_Cloud_Infrastructure_Exception('The options must be an array');
414
+ }
415
+
416
+ if (!empty($options)
417
+ && (empty($options[Zend_Cloud_Infrastructure_Instance::MONITOR_START_TIME])
418
+ || empty($options[Zend_Cloud_Infrastructure_Instance::MONITOR_END_TIME]))
419
+ ) {
420
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
421
+ throw new Zend_Cloud_Infrastructure_Exception(sprintf(
422
+ 'The options array must contain: "%s" and "%s"',
423
+ $options[Zend_Cloud_Infrastructure_Instance::MONITOR_START_TIME],
424
+ $options[Zend_Cloud_Infrastructure_Instance::MONITOR_END_TIME]
425
+ ));
426
+ }
427
+
428
+ if (!isset($this->ec2Monitor)) {
429
+ $this->ec2Monitor = new Zend_Service_Amazon_Ec2_CloudWatch($this->accessKey, $this->accessSecret, $this->region);
430
+ }
431
+
432
+ $param = array(
433
+ 'MeasureName' => $this->mapMetrics[$metric],
434
+ 'Statistics' => array('Average'),
435
+ 'Dimensions' => array('InstanceId' => $id),
436
+ );
437
+
438
+ if (!empty($options)) {
439
+ $param['StartTime'] = $options[Zend_Cloud_Infrastructure_Instance::MONITOR_START_TIME];
440
+ $param['EndTime'] = $options[Zend_Cloud_Infrastructure_Instance::MONITOR_END_TIME];
441
+ }
442
+
443
+ $this->adapterResult = $this->ec2Monitor->getMetricStatistics($param);
444
+
445
+ $monitor = array();
446
+ $num = 0;
447
+ $average = 0;
448
+
449
+ if (!empty($this->adapterResult['datapoints'])) {
450
+ foreach ($this->adapterResult['datapoints'] as $result) {
451
+ $monitor['series'][] = array (
452
+ 'timestamp' => $result['Timestamp'],
453
+ 'value' => $result['Average'],
454
+ );
455
+ $average += $result['Average'];
456
+ $num++;
457
+ }
458
+ }
459
+
460
+ if ($num > 0) {
461
+ $monitor['average'] = $average / $num;
462
+ }
463
+
464
+ return $monitor;
465
+ }
466
+
467
+ /**
468
+ * Get the adapter
469
+ *
470
+ * @return Zend_Service_Amazon_Ec2_Instance
471
+ */
472
+ public function getAdapter()
473
+ {
474
+ return $this->ec2;
475
+ }
476
+
477
+ /**
478
+ * Get last HTTP request
479
+ *
480
+ * @return string
481
+ */
482
+ public function getLastHttpRequest()
483
+ {
484
+ return $this->ec2->getHttpClient()->getLastRequest();
485
+ }
486
+
487
+ /**
488
+ * Get the last HTTP response
489
+ *
490
+ * @return Zend_Http_Response
491
+ */
492
+ public function getLastHttpResponse()
493
+ {
494
+ return $this->ec2->getHttpClient()->getLastResponse();
495
+ }
496
+ }
lib/Zend/Cloud/Infrastructure/Adapter/Rackspace.php ADDED
@@ -0,0 +1,483 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Zend
4
+ * @package Zend_Cloud_Infrastructure
5
+ * @subpackage Adapter
6
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
7
+ * @license http://framework.zend.com/license/new-bsd New BSD License
8
+ */
9
+
10
+ #require_once 'Zend/Service/Rackspace/Servers.php';
11
+ #require_once 'Zend/Cloud/Infrastructure/Instance.php';
12
+ #require_once 'Zend/Cloud/Infrastructure/InstanceList.php';
13
+ #require_once 'Zend/Cloud/Infrastructure/Image.php';
14
+ #require_once 'Zend/Cloud/Infrastructure/ImageList.php';
15
+ #require_once 'Zend/Cloud/Infrastructure/Adapter/AbstractAdapter.php';
16
+
17
+ /**
18
+ * Rackspace servers adapter for infrastructure service
19
+ *
20
+ * @package Zend_Cloud_Infrastructure
21
+ * @subpackage Adapter
22
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
23
+ * @license http://framework.zend.com/license/new-bsd New BSD License
24
+ */
25
+ class Zend_Cloud_Infrastructure_Adapter_Rackspace extends Zend_Cloud_Infrastructure_Adapter_AbstractAdapter
26
+ {
27
+ /**
28
+ * RACKSPACE constants
29
+ */
30
+ const RACKSPACE_USER = 'rackspace_user';
31
+ const RACKSPACE_KEY = 'rackspace_key';
32
+ const RACKSPACE_REGION = 'rackspace_region';
33
+ const RACKSPACE_ZONE_USA = 'USA';
34
+ const RACKSPACE_ZONE_UK = 'UK';
35
+ const MONITOR_CPU_SAMPLES = 3;
36
+ /**
37
+ * Rackspace Servers Instance
38
+ *
39
+ * @var Zend_Service_Rackspace_Servers
40
+ */
41
+ protected $rackspace;
42
+ /**
43
+ * Rackspace access user
44
+ *
45
+ * @var string
46
+ */
47
+ protected $accessUser;
48
+
49
+ /**
50
+ * Rackspace access key
51
+ *
52
+ * @var string
53
+ */
54
+ protected $accessKey;
55
+ /**
56
+ * Rackspace Region
57
+ *
58
+ * @var string
59
+ */
60
+ protected $region;
61
+ /**
62
+ * Flavors
63
+ *
64
+ * @var array
65
+ */
66
+ protected $flavors;
67
+ /**
68
+ * Map array between Rackspace and Infrastructure status
69
+ *
70
+ * @var array
71
+ */
72
+ protected $mapStatus = array (
73
+ 'ACTIVE' => Zend_Cloud_Infrastructure_Instance::STATUS_RUNNING,
74
+ 'SUSPENDED' => Zend_Cloud_Infrastructure_Instance::STATUS_STOPPED,
75
+ 'BUILD' => Zend_Cloud_Infrastructure_Instance::STATUS_REBUILD,
76
+ 'REBUILD' => Zend_Cloud_Infrastructure_Instance::STATUS_REBUILD,
77
+ 'QUEUE_RESIZE' => Zend_Cloud_Infrastructure_Instance::STATUS_PENDING,
78
+ 'PREP_RESIZE' => Zend_Cloud_Infrastructure_Instance::STATUS_PENDING,
79
+ 'RESIZE' => Zend_Cloud_Infrastructure_Instance::STATUS_REBUILD,
80
+ 'VERIFY_RESIZE' => Zend_Cloud_Infrastructure_Instance::STATUS_REBUILD,
81
+ 'PASSWORD' => Zend_Cloud_Infrastructure_Instance::STATUS_PENDING,
82
+ 'RESCUE' => Zend_Cloud_Infrastructure_Instance::STATUS_PENDING,
83
+ 'REBOOT' => Zend_Cloud_Infrastructure_Instance::STATUS_REBOOTING,
84
+ 'HARD_REBOOT' => Zend_Cloud_Infrastructure_Instance::STATUS_REBOOTING,
85
+ 'SHARE_IP' => Zend_Cloud_Infrastructure_Instance::STATUS_PENDING,
86
+ 'SHARE_IP_NO_CONFIG' => Zend_Cloud_Infrastructure_Instance::STATUS_PENDING,
87
+ 'DELETE_IP' => Zend_Cloud_Infrastructure_Instance::STATUS_PENDING,
88
+ 'UNKNOWN' => Zend_Cloud_Infrastructure_Instance::STATUS_PENDING
89
+ );
90
+ /**
91
+ * Constructor
92
+ *
93
+ * @param array|Zend_Config $options
94
+ * @return void
95
+ */
96
+ public function __construct($options = array())
97
+ {
98
+ if (is_object($options)) {
99
+ if (method_exists($options, 'toArray')) {
100
+ $options= $options->toArray();
101
+ } elseif ($options instanceof Traversable) {
102
+ $options = iterator_to_array($options);
103
+ }
104
+ }
105
+
106
+ if (empty($options) || !is_array($options)) {
107
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
108
+ throw new Zend_Cloud_Infrastructure_Exception('Invalid options provided');
109
+ }
110
+
111
+ if (!isset($options[self::RACKSPACE_USER])) {
112
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
113
+ throw new Zend_Cloud_Infrastructure_Exception('Rackspace access user not specified!');
114
+ }
115
+
116
+ if (!isset($options[self::RACKSPACE_KEY])) {
117
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
118
+ throw new Zend_Cloud_Infrastructure_Exception('Rackspace access key not specified!');
119
+ }
120
+
121
+ $this->accessUser = $options[self::RACKSPACE_USER];
122
+ $this->accessKey = $options[self::RACKSPACE_KEY];
123
+
124
+ if (isset($options[self::RACKSPACE_REGION])) {
125
+ switch ($options[self::RACKSPACE_REGION]) {
126
+ case self::RACKSPACE_ZONE_UK:
127
+ $this->region= Zend_Service_Rackspace_Servers::UK_AUTH_URL;
128
+ break;
129
+ case self::RACKSPACE_ZONE_USA:
130
+ $this->region = Zend_Service_Rackspace_Servers::US_AUTH_URL;
131
+ break;
132
+ default:
133
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
134
+ throw new Zend_Cloud_Infrastructure_Exception('The region is not valid');
135
+ }
136
+ } else {
137
+ $this->region = Zend_Service_Rackspace_Servers::US_AUTH_URL;
138
+ }
139
+
140
+ try {
141
+ $this->rackspace = new Zend_Service_Rackspace_Servers($this->accessUser,$this->accessKey, $this->region);
142
+ } catch (Exception $e) {
143
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
144
+ throw new Zend_Cloud_Infrastructure_Exception('Error on create: ' . $e->getMessage(), $e->getCode(), $e);
145
+ }
146
+
147
+ if (isset($options[self::HTTP_ADAPTER])) {
148
+ $this->rackspace->getHttpClient()->setAdapter($options[self::HTTP_ADAPTER]);
149
+ }
150
+
151
+ }
152
+ /**
153
+ * Convert the attributes of Rackspace server into attributes of Infrastructure
154
+ *
155
+ * @param array $attr
156
+ * @return array|boolean
157
+ */
158
+ protected function convertAttributes($attr)
159
+ {
160
+ $result = array();
161
+ if (!empty($attr) && is_array($attr)) {
162
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_ID] = $attr['id'];
163
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_NAME] = $attr['name'];
164
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_STATUS] = $this->mapStatus[$attr['status']];
165
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_IMAGEID] = $attr['imageId'];
166
+ if ($this->region==Zend_Service_Rackspace_Servers::US_AUTH_URL) {
167
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_ZONE] = self::RACKSPACE_ZONE_USA;
168
+ } else {
169
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_ZONE] = self::RACKSPACE_ZONE_UK;
170
+ }
171
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_RAM] = $this->flavors[$attr['flavorId']]['ram'];
172
+ $result[Zend_Cloud_Infrastructure_Instance::INSTANCE_STORAGE] = $this->flavors[$attr['flavorId']]['disk'];
173
+ }
174
+ return $result;
175
+ }
176
+ /**
177
+ * Return a list of the available instancies
178
+ *
179
+ * @return InstanceList|boolean
180
+ */
181
+ public function listInstances()
182
+ {
183
+ $this->adapterResult = $this->rackspace->listServers(true);
184
+ if ($this->adapterResult===false) {
185
+ return false;
186
+ }
187
+ $array= $this->adapterResult->toArray();
188
+ $result = array();
189
+ foreach ($array as $instance) {
190
+ $result[]= $this->convertAttributes($instance);
191
+ }
192
+ return new Zend_Cloud_Infrastructure_InstanceList($this, $result);
193
+ }
194
+ /**
195
+ * Return the status of an instance
196
+ *
197
+ * @param string
198
+ * @return string|boolean
199
+ */
200
+ public function statusInstance($id)
201
+ {
202
+ $this->adapterResult = $this->rackspace->getServer($id);
203
+ if ($this->adapterResult===false) {
204
+ return false;
205
+ }
206
+ $array= $this->adapterResult->toArray();
207
+ return $this->mapStatus[$array['status']];
208
+ }
209
+ /**
210
+ * Return the public DNS name/Ip address of the instance
211
+ *
212
+ * @param string $id
213
+ * @return string|boolean
214
+ */
215
+ public function publicDnsInstance($id)
216
+ {
217
+ $this->adapterResult = $this->rackspace->getServerPublicIp($id);
218
+ if (empty($this->adapterResult)) {
219
+ return false;
220
+ }
221
+ return $this->adapterResult[0];
222
+ }
223
+ /**
224
+ * Reboot an instance
225
+ *
226
+ * @param string $id
227
+ * @return boolean
228
+ */
229
+ public function rebootInstance($id)
230
+ {
231
+ return $this->rackspace->rebootServer($id,true);
232
+ }
233
+ /**
234
+ * Create a new instance
235
+ *
236
+ * @param string $name
237
+ * @param array $options
238
+ * @return Instance|boolean
239
+ */
240
+ public function createInstance($name, $options)
241
+ {
242
+ if (empty($name)) {
243
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
244
+ throw new Zend_Cloud_Infrastructure_Exception('You must specify the name of the instance');
245
+ }
246
+ if (empty($options) || !is_array($options)) {
247
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
248
+ throw new Zend_Cloud_Infrastructure_Exception('The options must be an array');
249
+ }
250
+ // @todo create an generic abstract definition for an instance?
251
+ $metadata= array();
252
+ if (isset($options['metadata'])) {
253
+ $metadata= $options['metadata'];
254
+ unset($options['metadata']);
255
+ }
256
+ $files= array();
257
+ if (isset($options['files'])) {
258
+ $files= $options['files'];
259
+ unset($options['files']);
260
+ }
261
+ $options['name']= $name;
262
+ $this->adapterResult = $this->rackspace->createServer($options,$metadata,$files);
263
+ if ($this->adapterResult===false) {
264
+ return false;
265
+ }
266
+ return new Zend_Cloud_Infrastructure_Instance($this, $this->convertAttributes($this->adapterResult->toArray()));
267
+ }
268
+ /**
269
+ * Stop an instance
270
+ *
271
+ * @param string $id
272
+ * @return boolean
273
+ */
274
+ public function stopInstance($id)
275
+ {
276
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
277
+ throw new Zend_Cloud_Infrastructure_Exception('The stopInstance method is not implemented in the adapter');
278
+ }
279
+
280
+ /**
281
+ * Start an instance
282
+ *
283
+ * @param string $id
284
+ * @return boolean
285
+ */
286
+ public function startInstance($id)
287
+ {
288
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
289
+ throw new Zend_Cloud_Infrastructure_Exception('The startInstance method is not implemented in the adapter');
290
+ }
291
+
292
+ /**
293
+ * Destroy an instance
294
+ *
295
+ * @param string $id
296
+ * @return boolean
297
+ */
298
+ public function destroyInstance($id)
299
+ {
300
+ $this->adapterResult= $this->rackspace->deleteServer($id);
301
+ return $this->adapterResult;
302
+ }
303
+ /**
304
+ * Return a list of all the available instance images
305
+ *
306
+ * @return ImageList|boolean
307
+ */
308
+ public function imagesInstance()
309
+ {
310
+ $this->adapterResult = $this->rackspace->listImages(true);
311
+ if ($this->adapterResult===false) {
312
+ return false;
313
+ }
314
+
315
+ $images= $this->adapterResult->toArray();
316
+ $result= array();
317
+
318
+ foreach ($images as $image) {
319
+ if (strtolower($image['status'])==='active') {
320
+ if (strpos($image['name'],'Windows')!==false) {
321
+ $platform = Zend_Cloud_Infrastructure_Image::IMAGE_WINDOWS;
322
+ } else {
323
+ $platform = Zend_Cloud_Infrastructure_Image::IMAGE_LINUX;
324
+ }
325
+ if (strpos($image['name'],'x64')!==false) {
326
+ $arch = Zend_Cloud_Infrastructure_Image::ARCH_64BIT;
327
+ } else {
328
+ $arch = Zend_Cloud_Infrastructure_Image::ARCH_32BIT;
329
+ }
330
+ $result[]= array (
331
+ Zend_Cloud_Infrastructure_Image::IMAGE_ID => $image['id'],
332
+ Zend_Cloud_Infrastructure_Image::IMAGE_NAME => $image['name'],
333
+ Zend_Cloud_Infrastructure_Image::IMAGE_DESCRIPTION => $image['name'],
334
+ Zend_Cloud_Infrastructure_Image::IMAGE_ARCHITECTURE => $arch,
335
+ Zend_Cloud_Infrastructure_Image::IMAGE_PLATFORM => $platform,
336
+ );
337
+ }
338
+ }
339
+ return new Zend_Cloud_Infrastructure_ImageList($result,$this->adapterResult);
340
+ }
341
+ /**
342
+ * Return all the available zones
343
+ *
344
+ * @return array
345
+ */
346
+ public function zonesInstance()
347
+ {
348
+ return array(self::RACKSPACE_ZONE_USA,self::RACKSPACE_ZONE_UK);
349
+ }
350
+ /**
351
+ * Return the system information about the $metric of an instance
352
+ * NOTE: it works only for Linux servers
353
+ *
354
+ * @param string $id
355
+ * @param string $metric
356
+ * @param null|array $options
357
+ * @return array|boolean
358
+ */
359
+ public function monitorInstance($id, $metric, $options = null)
360
+ {
361
+ if (!function_exists("ssh2_connect")) {
362
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
363
+ throw new Zend_Cloud_Infrastructure_Exception('Monitor requires the PHP "SSH" extension (ext/ssh2)');
364
+ }
365
+ if (empty($id)) {
366
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
367
+ throw new Zend_Cloud_Infrastructure_Exception('You must specify the id of the instance to monitor');
368
+ }
369
+ if (empty($metric)) {
370
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
371
+ throw new Zend_Cloud_Infrastructure_Exception('You must specify the metric to monitor');
372
+ }
373
+ if (!in_array($metric,$this->validMetrics)) {
374
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
375
+ throw new Zend_Cloud_Infrastructure_Exception(sprintf('The metric "%s" is not valid', $metric));
376
+ }
377
+ if (!empty($options) && !is_array($options)) {
378
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
379
+ throw new Zend_Cloud_Infrastructure_Exception('The options must be an array');
380
+ }
381
+
382
+ switch ($metric) {
383
+ case Zend_Cloud_Infrastructure_Instance::MONITOR_CPU:
384
+ $cmd= 'top -b -n '.self::MONITOR_CPU_SAMPLES.' | grep \'Cpu\'';
385
+ break;
386
+ case Zend_Cloud_Infrastructure_Instance::MONITOR_RAM:
387
+ $cmd= 'top -b -n 1 | grep \'Mem\'';
388
+ break;
389
+ case Zend_Cloud_Infrastructure_Instance::MONITOR_DISK:
390
+ $cmd= 'df --total | grep total';
391
+ break;
392
+ }
393
+ if (empty($cmd)) {
394
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
395
+ throw new Zend_Cloud_Infrastructure_Exception('The metric specified is not supported by the adapter');
396
+ }
397
+
398
+ $params= array(
399
+ Zend_Cloud_Infrastructure_Instance::SSH_USERNAME => $options['username'],
400
+ Zend_Cloud_Infrastructure_Instance::SSH_PASSWORD => $options['password']
401
+ );
402
+ $exec_time= time();
403
+ $result= $this->deployInstance($id,$params,$cmd);
404
+
405
+ if (empty($result)) {
406
+ return false;
407
+ }
408
+
409
+ $monitor = array();
410
+ $num = 0;
411
+ $average = 0;
412
+
413
+ $outputs= explode("\n",$result);
414
+ foreach ($outputs as $output) {
415
+ if (!empty($output)) {
416
+ switch ($metric) {
417
+ case Zend_Cloud_Infrastructure_Instance::MONITOR_CPU:
418
+ if (preg_match('/(\d+\.\d)%us/', $output,$match)) {
419
+ $usage = (float) $match[1];
420
+ }
421
+ break;
422
+ case Zend_Cloud_Infrastructure_Instance::MONITOR_RAM:
423
+ if (preg_match('/(\d+)k total/', $output,$match)) {
424
+ $total = (integer) $match[1];
425
+ }
426
+ if (preg_match('/(\d+)k used/', $output,$match)) {
427
+ $used = (integer) $match[1];
428
+ }
429
+ if ($total>0) {
430
+ $usage= (float) $used/$total;
431
+ }
432
+ break;
433
+ case Zend_Cloud_Infrastructure_Instance::MONITOR_DISK:
434
+ if (preg_match('/(\d+)%/', $output,$match)) {
435
+ $usage = (float) $match[1];
436
+ }
437
+ break;
438
+ }
439
+
440
+ $monitor['series'][] = array (
441
+ 'timestamp' => $exec_time,
442
+ 'value' => number_format($usage,2).'%'
443
+ );
444
+
445
+ $average += $usage;
446
+ $exec_time+= 60; // seconds
447
+ $num++;
448
+ }
449
+ }
450
+
451
+ if ($num>0) {
452
+ $monitor['average'] = number_format($average/$num,2).'%';
453
+ }
454
+ return $monitor;
455
+ }
456
+ /**
457
+ * Get the adapter
458
+ *
459
+ * @return Zend_Service_Rackspace_Servers
460
+ */
461
+ public function getAdapter()
462
+ {
463
+ return $this->rackspace;
464
+ }
465
+ /**
466
+ * Get last HTTP request
467
+ *
468
+ * @return string
469
+ */
470
+ public function getLastHttpRequest()
471
+ {
472
+ return $this->rackspace->getHttpClient()->getLastRequest();
473
+ }
474
+ /**
475
+ * Get the last HTTP response
476
+ *
477
+ * @return Zend_Http_Response
478
+ */
479
+ public function getLastHttpResponse()
480
+ {
481
+ return $this->rackspace->getHttpClient()->getLastResponse();
482
+ }
483
+ }
lib/Zend/Cloud/Infrastructure/Exception.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Exception
4
+ *
5
+ * @category Zend
6
+ * @package Zend_Cloud
7
+ * @subpackage Infrastructure
8
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
9
+ * @license http://framework.zend.com/license/new-bsd New BSD License
10
+ */
11
+
12
+ /**
13
+ * Zend_Cloud_Exception
14
+ */
15
+ #require_once 'Zend/Cloud/Exception.php';
16
+
17
+ /**
18
+ * @category Zend
19
+ * @package Zend_Cloud
20
+ * @subpackage Infrastructure
21
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
22
+ * @license http://framework.zend.com/license/new-bsd New BSD License
23
+ */
24
+ class Zend_Cloud_Infrastructure_Exception extends Zend_Cloud_Exception
25
+ {}
lib/Zend/Cloud/Infrastructure/Factory.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Zend
4
+ * @package Zend_Cloud
5
+ * @subpackage Infrastructure
6
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
7
+ * @license http://framework.zend.com/license/new-bsd New BSD License
8
+ */
9
+
10
+ #require_once 'Zend/Cloud/AbstractFactory.php';
11
+
12
+
13
+ /**
14
+ * Factory for infrastructure adapters
15
+ *
16
+ * @package Zend_Cloud
17
+ * @subpackage Infrastructure
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
+ * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ */
21
+ class Zend_Cloud_Infrastructure_Factory extends Zend_Cloud_AbstractFactory
22
+ {
23
+ const INFRASTRUCTURE_ADAPTER_KEY = 'infrastructure_adapter';
24
+
25
+ /**
26
+ * @var string Interface which adapter must implement to be considered valid
27
+ */
28
+ protected static $_adapterInterface = 'Zend_Cloud_Infrastructure_Adapter';
29
+
30
+ /**
31
+ * Constructor
32
+ *
33
+ * Private ctor - should not be used
34
+ *
35
+ * @return void
36
+ */
37
+ private function __construct()
38
+ {
39
+ }
40
+
41
+ /**
42
+ * Retrieve an adapter instance
43
+ *
44
+ * @param array $options
45
+ * @return void
46
+ */
47
+ public static function getAdapter($options = array())
48
+ {
49
+ $adapter = parent::_getAdapter(self::INFRASTRUCTURE_ADAPTER_KEY, $options);
50
+
51
+ if (!$adapter) {
52
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
53
+ throw new Zend_Cloud_Infrastructure_Exception(sprintf(
54
+ 'Class must be specified using the "%s" key',
55
+ self::INFRASTRUCTURE_ADAPTER_KEY
56
+ ));
57
+ } elseif (!$adapter instanceof self::$_adapterInterface) {
58
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
59
+ throw new Zend_Cloud_Infrastructure_Exception(sprintf(
60
+ 'Adapter must implement "%s"', self::$_adapterInterface
61
+ ));
62
+ }
63
+ return $adapter;
64
+ }
65
+ }
lib/Zend/Cloud/Infrastructure/Image.php ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Zend
4
+ * @package Zend_Cloud
5
+ * @subpackage Infrastructure
6
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
7
+ * @license http://framework.zend.com/license/new-bsd New BSD License
8
+ */
9
+
10
+ /**
11
+ * Instance of an infrastructure service
12
+ *
13
+ * @package Zend_Cloud
14
+ * @subpackage Infrastructure
15
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
16
+ * @license http://framework.zend.com/license/new-bsd New BSD License
17
+ */
18
+ class Zend_Cloud_Infrastructure_Image
19
+ {
20
+ const IMAGE_ID = 'imageId';
21
+ const IMAGE_OWNERID = 'ownerId';
22
+ const IMAGE_NAME = 'name';
23
+ const IMAGE_DESCRIPTION = 'description';
24
+ const IMAGE_PLATFORM = 'platform';
25
+ const IMAGE_ARCHITECTURE = 'architecture';
26
+ const ARCH_32BIT = 'i386';
27
+ const ARCH_64BIT = 'x86_64';
28
+ const IMAGE_WINDOWS = 'windows';
29
+ const IMAGE_LINUX = 'linux';
30
+
31
+ /**
32
+ * Image's attributes
33
+ *
34
+ * @var array
35
+ */
36
+ protected $attributes = array();
37
+
38
+ /**
39
+ * The Image adapter (if exists)
40
+ *
41
+ * @var object
42
+ */
43
+ protected $adapter;
44
+
45
+ /**
46
+ * Required attributes
47
+ *
48
+ * @var array
49
+ */
50
+ protected $attributeRequired = array(
51
+ self::IMAGE_ID,
52
+ self::IMAGE_DESCRIPTION,
53
+ self::IMAGE_PLATFORM,
54
+ self::IMAGE_ARCHITECTURE,
55
+ );
56
+
57
+ /**
58
+ * Constructor
59
+ *
60
+ * @param array $data
61
+ * @param object $adapter
62
+ */
63
+ public function __construct($data, $adapter = null)
64
+ {
65
+ if (is_object($data)) {
66
+ if (method_exists($data, 'toArray')) {
67
+ $data= $data->toArray();
68
+ } elseif ($data instanceof Traversable) {
69
+ $data = iterator_to_array($data);
70
+ }
71
+ }
72
+
73
+ if (empty($data) || !is_array($data)) {
74
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
75
+ throw new Zend_Cloud_Infrastructure_Exception('You must pass an array of parameters');
76
+ }
77
+
78
+ foreach ($this->attributeRequired as $key) {
79
+ if (empty($data[$key])) {
80
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
81
+ throw new Zend_Cloud_Infrastructure_Exception(sprintf(
82
+ 'The param "%s" is a required parameter for class %s',
83
+ $key,
84
+ __CLASS__
85
+ ));
86
+ }
87
+ }
88
+
89
+ $this->attributes = $data;
90
+ $this->adapter = $adapter;
91
+ }
92
+
93
+ /**
94
+ * Get Attribute with a specific key
95
+ *
96
+ * @param array $data
97
+ * @return misc|boolean
98
+ */
99
+ public function getAttribute($key)
100
+ {
101
+ if (!empty($this->attributes[$key])) {
102
+ return $this->attributes[$key];
103
+ }
104
+ return false;
105
+ }
106
+
107
+ /**
108
+ * Get all the attributes
109
+ *
110
+ * @return array
111
+ */
112
+ public function getAttributes()
113
+ {
114
+ return $this->attributes;
115
+ }
116
+
117
+ /**
118
+ * Get the image ID
119
+ *
120
+ * @return string
121
+ */
122
+ public function getId()
123
+ {
124
+ return $this->attributes[self::IMAGE_ID];
125
+ }
126
+
127
+ /**
128
+ * Get the Owner ID
129
+ *
130
+ * @return string
131
+ */
132
+ public function getOwnerId()
133
+ {
134
+ return $this->attributes[self::IMAGE_OWNERID];
135
+ }
136
+
137
+ /**
138
+ * Get the name
139
+ *
140
+ * @return string
141
+ */
142
+ public function getName()
143
+ {
144
+ return $this->attributes[self::IMAGE_NAME];
145
+ }
146
+
147
+ /**
148
+ * Get the description
149
+ *
150
+ * @return string
151
+ */
152
+ public function getDescription()
153
+ {
154
+ return $this->attributes[self::IMAGE_DESCRIPTION];
155
+ }
156
+
157
+ /**
158
+ * Get the platform
159
+ *
160
+ * @return string
161
+ */
162
+ public function getPlatform()
163
+ {
164
+ return $this->attributes[self::IMAGE_PLATFORM];
165
+ }
166
+
167
+ /**
168
+ * Get the architecture
169
+ *
170
+ * @return string
171
+ */
172
+ public function getArchitecture()
173
+ {
174
+ return $this->attributes[self::IMAGE_ARCHITECTURE];
175
+ }
176
+ }
lib/Zend/Cloud/Infrastructure/ImageList.php ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Zend
4
+ * @package Zend_Cloud
5
+ * @subpackage Infrastructure
6
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
7
+ * @license http://framework.zend.com/license/new-bsd New BSD License
8
+ */
9
+
10
+
11
+ #require_once 'Zend/Cloud/Infrastructure/Image.php';
12
+
13
+ /**
14
+ * List of images
15
+ *
16
+ * @package Zend_Cloud
17
+ * @subpackage Infrastructure
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
+ * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ */
21
+ class Zend_Cloud_Infrastructure_ImageList implements Countable, Iterator, ArrayAccess
22
+ {
23
+ /**
24
+ * @var array Array of Zend_Cloud_Infrastructure_Image
25
+ */
26
+ protected $images = array();
27
+
28
+ /**
29
+ * @var int Iterator key
30
+ */
31
+ protected $iteratorKey = 0;
32
+
33
+ /**
34
+ * The Image adapter (if exists)
35
+ *
36
+ * @var object
37
+ */
38
+ protected $adapter;
39
+
40
+ /**
41
+ * Constructor
42
+ *
43
+ * @param array $list
44
+ * @param null|object $adapter
45
+ * @return boolean
46
+ */
47
+ public function __construct($images, $adapter = null)
48
+ {
49
+ if (empty($images) || !is_array($images)) {
50
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
51
+ throw new Zend_Cloud_Infrastructure_Exception(__CLASS__ . ' expects an array of images');
52
+ }
53
+
54
+ $this->adapter = $adapter;
55
+ $this->constructFromArray($images);
56
+ }
57
+
58
+ /**
59
+ * Transforms the Array to array of Instances
60
+ *
61
+ * @param array $list
62
+ * @return void
63
+ */
64
+ protected function constructFromArray(array $list)
65
+ {
66
+ foreach ($list as $image) {
67
+ $this->addImage(new Zend_Cloud_Infrastructure_Image($image, $this->adapter));
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Add an image
73
+ *
74
+ * @param Image
75
+ * @return ImageList
76
+ */
77
+ protected function addImage(Zend_Cloud_Infrastructure_Image $image)
78
+ {
79
+ $this->images[] = $image;
80
+ return $this;
81
+ }
82
+
83
+ /**
84
+ * Return number of images
85
+ *
86
+ * Implement Countable::count()
87
+ *
88
+ * @return int
89
+ */
90
+ public function count()
91
+ {
92
+ return count($this->images);
93
+ }
94
+
95
+ /**
96
+ * Return the current element
97
+ *
98
+ * Implement Iterator::current()
99
+ *
100
+ * @return Image
101
+ */
102
+ public function current()
103
+ {
104
+ return $this->images[$this->iteratorKey];
105
+ }
106
+
107
+ /**
108
+ * Return the key of the current element
109
+ *
110
+ * Implement Iterator::key()
111
+ *
112
+ * @return int
113
+ */
114
+ public function key()
115
+ {
116
+ return $this->iteratorKey;
117
+ }
118
+
119
+ /**
120
+ * Move forward to next element
121
+ *
122
+ * Implement Iterator::next()
123
+ *
124
+ * @return void
125
+ */
126
+ public function next()
127
+ {
128
+ $this->iteratorKey++;
129
+ }
130
+
131
+ /**
132
+ * Rewind the Iterator to the first element
133
+ *
134
+ * Implement Iterator::rewind()
135
+ *
136
+ * @return void
137
+ */
138
+ public function rewind()
139
+ {
140
+ $this->iteratorKey = 0;
141
+ }
142
+
143
+ /**
144
+ * Check if there is a current element after calls to rewind() or next()
145
+ *
146
+ * Implement Iterator::valid()
147
+ *
148
+ * @return bool
149
+ */
150
+ public function valid()
151
+ {
152
+ $numItems = $this->count();
153
+ if ($numItems > 0 && $this->iteratorKey < $numItems) {
154
+ return true;
155
+ }
156
+ return false;
157
+ }
158
+
159
+ /**
160
+ * Whether the offset exists
161
+ *
162
+ * Implement ArrayAccess::offsetExists()
163
+ *
164
+ * @param int $offset
165
+ * @return bool
166
+ */
167
+ public function offsetExists($offset)
168
+ {
169
+ return ($offset < $this->count());
170
+ }
171
+
172
+ /**
173
+ * Return value at given offset
174
+ *
175
+ * Implement ArrayAccess::offsetGet()
176
+ *
177
+ * @param int $offset
178
+ * @throws Zend_Cloud_Infrastructure_Exception
179
+ * @return Image
180
+ */
181
+ public function offsetGet($offset)
182
+ {
183
+ if (!$this->offsetExists($offset)) {
184
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
185
+ throw new Zend_Cloud_Infrastructure_Exception('Illegal index');
186
+ }
187
+ return $this->images[$offset];
188
+ }
189
+
190
+ /**
191
+ * Throws exception because all values are read-only
192
+ *
193
+ * Implement ArrayAccess::offsetSet()
194
+ *
195
+ * @param int $offset
196
+ * @param string $value
197
+ * @throws Zend_Cloud_Infrastructure_Exception
198
+ */
199
+ public function offsetSet($offset, $value)
200
+ {
201
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
202
+ throw new Zend_Cloud_Infrastructure_Exception('You are trying to set read-only property');
203
+ }
204
+
205
+ /**
206
+ * Throws exception because all values are read-only
207
+ *
208
+ * Implement ArrayAccess::offsetUnset()
209
+ *
210
+ * @param int $offset
211
+ * @throws Zend_Cloud_Infrastructure_Exception
212
+ */
213
+ public function offsetUnset($offset)
214
+ {
215
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
216
+ throw new Zend_Cloud_Infrastructure_Exception('You are trying to unset read-only property');
217
+ }
218
+ }
lib/Zend/Cloud/Infrastructure/Instance.php ADDED
@@ -0,0 +1,320 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Zend
4
+ * @package Zend_Cloud
5
+ * @subpackage Infrastructure
6
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
7
+ * @license http://framework.zend.com/license/new-bsd New BSD License
8
+ */
9
+
10
+ /**
11
+ * Instance of an infrastructure service
12
+ *
13
+ * @package Zend_Cloud
14
+ * @subpackage Infrastructure
15
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
16
+ * @license http://framework.zend.com/license/new-bsd New BSD License
17
+ */
18
+ class Zend_Cloud_Infrastructure_Instance
19
+ {
20
+ const STATUS_RUNNING = 'running';
21
+ const STATUS_STOPPED = 'stopped';
22
+ const STATUS_SHUTTING_DOWN = 'shutting-down';
23
+ const STATUS_REBOOTING = 'rebooting';
24
+ const STATUS_TERMINATED = 'terminated';
25
+ const STATUS_PENDING = 'pending';
26
+ const STATUS_REBUILD = 'rebuild';
27
+ const INSTANCE_ID = 'id';
28
+ const INSTANCE_IMAGEID = 'imageId';
29
+ const INSTANCE_NAME = 'name';
30
+ const INSTANCE_STATUS = 'status';
31
+ const INSTANCE_PUBLICDNS = 'publicDns';
32
+ const INSTANCE_CPU = 'cpu';
33
+ const INSTANCE_RAM = 'ram';
34
+ const INSTANCE_STORAGE = 'storageSize';
35
+ const INSTANCE_ZONE = 'zone';
36
+ const INSTANCE_LAUNCHTIME = 'launchTime';
37
+ const MONITOR_CPU = 'CpuUsage';
38
+ const MONITOR_RAM = 'RamUsage';
39
+ const MONITOR_NETWORK_IN = 'NetworkIn';
40
+ const MONITOR_NETWORK_OUT = 'NetworkOut';
41
+ const MONITOR_DISK = 'DiskUsage';
42
+ const MONITOR_DISK_WRITE = 'DiskWrite';
43
+ const MONITOR_DISK_READ = 'DiskRead';
44
+ const MONITOR_START_TIME = 'StartTime';
45
+ const MONITOR_END_TIME = 'EndTime';
46
+ const SSH_USERNAME = 'username';
47
+ const SSH_PASSWORD = 'password';
48
+ const SSH_PRIVATE_KEY = 'privateKey';
49
+ const SSH_PUBLIC_KEY = 'publicKey';
50
+ const SSH_PASSPHRASE = 'passphrase';
51
+
52
+ /**
53
+ * @var Zend_Cloud_Infrastructure_Adapter
54
+ */
55
+ protected $adapter;
56
+
57
+ /**
58
+ * Instance's attribute
59
+ *
60
+ * @var array
61
+ */
62
+ protected $attributes;
63
+
64
+ /**
65
+ * Attributes required for an instance
66
+ *
67
+ * @var array
68
+ */
69
+ protected $attributeRequired = array(
70
+ self::INSTANCE_ID,
71
+ self::INSTANCE_STATUS,
72
+ self::INSTANCE_IMAGEID,
73
+ self::INSTANCE_ZONE
74
+ );
75
+
76
+ /**
77
+ * Constructor
78
+ *
79
+ * @param Adapter $adapter
80
+ * @param array $data
81
+ * @return void
82
+ */
83
+ public function __construct($adapter, $data = null)
84
+ {
85
+ if (!($adapter instanceof Zend_Cloud_Infrastructure_Adapter)) {
86
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
87
+ throw new Zend_Cloud_Infrastructure_Exception("You must pass a Zend_Cloud_Infrastructure_Adapter instance");
88
+ }
89
+
90
+ if (is_object($data)) {
91
+ if (method_exists($data, 'toArray')) {
92
+ $data= $data->toArray();
93
+ } elseif ($data instanceof Traversable) {
94
+ $data = iterator_to_array($data);
95
+ }
96
+ }
97
+
98
+ if (empty($data) || !is_array($data)) {
99
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
100
+ throw new Zend_Cloud_Infrastructure_Exception("You must pass an array of parameters");
101
+ }
102
+
103
+ foreach ($this->attributeRequired as $key) {
104
+ if (empty($data[$key])) {
105
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
106
+ throw new Zend_Cloud_Infrastructure_Exception(sprintf(
107
+ 'The param "%s" is a required param for %s',
108
+ $key,
109
+ __CLASS__
110
+ ));
111
+ }
112
+ }
113
+
114
+ $this->adapter = $adapter;
115
+ $this->attributes = $data;
116
+ }
117
+
118
+ /**
119
+ * Get Attribute with a specific key
120
+ *
121
+ * @param array $data
122
+ * @return misc|false
123
+ */
124
+ public function getAttribute($key)
125
+ {
126
+ if (!empty($this->attributes[$key])) {
127
+ return $this->attributes[$key];
128
+ }
129
+ return false;
130
+ }
131
+
132
+ /**
133
+ * Get all the attributes
134
+ *
135
+ * @return array
136
+ */
137
+ public function getAttributes()
138
+ {
139
+ return $this->attributes;
140
+ }
141
+
142
+ /**
143
+ * Get the instance's id
144
+ *
145
+ * @return string
146
+ */
147
+ public function getId()
148
+ {
149
+ return $this->attributes[self::INSTANCE_ID];
150
+ }
151
+
152
+ /**
153
+ * Get the instance's image id
154
+ *
155
+ * @return string
156
+ */
157
+ public function getImageId()
158
+ {
159
+ return $this->attributes[self::INSTANCE_IMAGEID];
160
+ }
161
+
162
+ /**
163
+ * Get the instance's name
164
+ *
165
+ * @return string
166
+ */
167
+ public function getName()
168
+ {
169
+ return $this->attributes[self::INSTANCE_NAME];
170
+ }
171
+
172
+ /**
173
+ * Get the status of the instance
174
+ *
175
+ * @return string|boolean
176
+ */
177
+ public function getStatus()
178
+ {
179
+ return $this->adapter->statusInstance($this->attributes[self::INSTANCE_ID]);
180
+ }
181
+
182
+ /**
183
+ * Wait for status $status with a timeout of $timeout seconds
184
+ *
185
+ * @param string $status
186
+ * @param integer $timeout
187
+ * @return boolean
188
+ */
189
+ public function waitStatus($status, $timeout = Adapter::TIMEOUT_STATUS_CHANGE)
190
+ {
191
+ return $this->adapter->waitStatusInstance($this->attributes[self::INSTANCE_ID], $status, $timeout);
192
+ }
193
+
194
+ /**
195
+ * Get the public DNS of the instance
196
+ *
197
+ * @return string
198
+ */
199
+ public function getPublicDns()
200
+ {
201
+ if (!isset($this->attributes[self::INSTANCE_PUBLICDNS])) {
202
+ $this->attributes[self::INSTANCE_PUBLICDNS] = $this->adapter->publicDnsInstance($this->attributes[self::INSTANCE_ID]);
203
+ }
204
+ return $this->attributes[self::INSTANCE_PUBLICDNS];
205
+ }
206
+
207
+ /**
208
+ * Get the instance's CPU
209
+ *
210
+ * @return string
211
+ */
212
+ public function getCpu()
213
+ {
214
+ return $this->attributes[self::INSTANCE_CPU];
215
+ }
216
+
217
+ /**
218
+ * Get the instance's RAM size
219
+ *
220
+ * @return string
221
+ */
222
+ public function getRamSize()
223
+ {
224
+ return $this->attributes[self::INSTANCE_RAM];
225
+ }
226
+
227
+ /**
228
+ * Get the instance's storage size
229
+ *
230
+ * @return string
231
+ */
232
+ public function getStorageSize()
233
+ {
234
+ return $this->attributes[self::INSTANCE_STORAGE];
235
+ }
236
+
237
+ /**
238
+ * Get the instance's zone
239
+ *
240
+ * @return string
241
+ */
242
+ public function getZone()
243
+ {
244
+ return $this->attributes[self::INSTANCE_ZONE];
245
+ }
246
+
247
+ /**
248
+ * Get the instance's launch time
249
+ *
250
+ * @return string
251
+ */
252
+ public function getLaunchTime()
253
+ {
254
+ return $this->attributes[self::INSTANCE_LAUNCHTIME];
255
+ }
256
+
257
+ /**
258
+ * Reboot the instance
259
+ *
260
+ * @return boolean
261
+ */
262
+ public function reboot()
263
+ {
264
+ return $this->adapter->rebootInstance($this->attributes[self::INSTANCE_ID]);
265
+ }
266
+
267
+ /**
268
+ * Stop the instance
269
+ *
270
+ * @return boolean
271
+ */
272
+ public function stop()
273
+ {
274
+ return $this->adapter->stopInstance($this->attributes[self::INSTANCE_ID]);
275
+ }
276
+
277
+ /**
278
+ * Start the instance
279
+ *
280
+ * @return boolean
281
+ */
282
+ public function start()
283
+ {
284
+ return $this->adapter->startInstance($this->attributes[self::INSTANCE_ID]);
285
+ }
286
+
287
+ /**
288
+ * Destroy the instance
289
+ *
290
+ * @return boolean
291
+ */
292
+ public function destroy()
293
+ {
294
+ return $this->adapter->destroyInstance($this->attributes[self::INSTANCE_ID]);
295
+ }
296
+
297
+ /**
298
+ * Return the system informations about the $metric of an instance
299
+ *
300
+ * @param string $metric
301
+ * @param null|array $options
302
+ * @return array|boolean
303
+ */
304
+ public function monitor($metric, $options = null)
305
+ {
306
+ return $this->adapter->monitorInstance($this->attributes[self::INSTANCE_ID], $metric, $options);
307
+ }
308
+
309
+ /**
310
+ * Run arbitrary shell script on the instance
311
+ *
312
+ * @param array $param
313
+ * @param string|array $cmd
314
+ * @return string|array
315
+ */
316
+ public function deploy($params, $cmd)
317
+ {
318
+ return $this->adapter->deployInstance($this->attributes[self::INSTANCE_ID], $params, $cmd);
319
+ }
320
+ }
lib/Zend/Cloud/Infrastructure/InstanceList.php ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Zend
4
+ * @package Zend_Cloud
5
+ * @subpackage Infrastructure
6
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
7
+ * @license http://framework.zend.com/license/new-bsd New BSD License
8
+ */
9
+
10
+ #require_once 'Zend/Cloud/Infrastructure/Instance.php';
11
+
12
+ /**
13
+ * List of instances
14
+ *
15
+ * @package Zend_Cloud
16
+ * @subpackage Infrastructure
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
+ * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ */
20
+ class Zend_Cloud_Infrastructure_InstanceList implements Countable, Iterator, ArrayAccess
21
+ {
22
+ /**
23
+ * @var array Array of Zend_Cloud_Infrastructure_Instance
24
+ */
25
+ protected $instances = array();
26
+
27
+ /**
28
+ * @var int Iterator key
29
+ */
30
+ protected $iteratorKey = 0;
31
+
32
+ /**
33
+ * @var Zend_Cloud_Infrastructure_Adapter
34
+ */
35
+ protected $adapter;
36
+
37
+ /**
38
+ * Constructor
39
+ *
40
+ * @param Adapter $adapter
41
+ * @param array $instances
42
+ * @return void
43
+ */
44
+ public function __construct($adapter, array $instances = null)
45
+ {
46
+ if (!($adapter instanceof Zend_Cloud_Infrastructure_Adapter)) {
47
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
48
+ throw new Zend_Cloud_Infrastructure_Exception('You must pass a Zend_Cloud_Infrastructure_Adapter');
49
+ }
50
+ if (empty($instances)) {
51
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
52
+ throw new Zend_Cloud_Infrastructure_Exception('You must pass an array of Instances');
53
+ }
54
+
55
+ $this->adapter = $adapter;
56
+ $this->constructFromArray($instances);
57
+ }
58
+
59
+ /**
60
+ * Transforms the Array to array of Instances
61
+ *
62
+ * @param array $list
63
+ * @return void
64
+ */
65
+ protected function constructFromArray(array $list)
66
+ {
67
+ foreach ($list as $instance) {
68
+ $this->addInstance(new Zend_Cloud_Infrastructure_Instance($this->adapter,$instance));
69
+ }
70
+ }
71
+
72
+ /**
73
+ * Add an instance
74
+ *
75
+ * @param Instance
76
+ * @return InstanceList
77
+ */
78
+ protected function addInstance(Zend_Cloud_Infrastructure_Instance $instance)
79
+ {
80
+ $this->instances[] = $instance;
81
+ return $this;
82
+ }
83
+
84
+ /**
85
+ * Return number of instances
86
+ *
87
+ * Implement Countable::count()
88
+ *
89
+ * @return int
90
+ */
91
+ public function count()
92
+ {
93
+ return count($this->instances);
94
+ }
95
+
96
+ /**
97
+ * Return the current element
98
+ *
99
+ * Implement Iterator::current()
100
+ *
101
+ * @return Instance
102
+ */
103
+ public function current()
104
+ {
105
+ return $this->instances[$this->iteratorKey];
106
+ }
107
+
108
+ /**
109
+ * Return the key of the current element
110
+ *
111
+ * Implement Iterator::key()
112
+ *
113
+ * @return int
114
+ */
115
+ public function key()
116
+ {
117
+ return $this->iteratorKey;
118
+ }
119
+
120
+ /**
121
+ * Move forward to next element
122
+ *
123
+ * Implement Iterator::next()
124
+ *
125
+ * @return void
126
+ */
127
+ public function next()
128
+ {
129
+ $this->iteratorKey++;
130
+ }
131
+
132
+ /**
133
+ * Rewind the Iterator to the first element
134
+ *
135
+ * Implement Iterator::rewind()
136
+ *
137
+ * @return void
138
+ */
139
+ public function rewind()
140
+ {
141
+ $this->iteratorKey = 0;
142
+ }
143
+
144
+ /**
145
+ * Check if there is a current element after calls to rewind() or next()
146
+ *
147
+ * Implement Iterator::valid()
148
+ *
149
+ * @return bool
150
+ */
151
+ public function valid()
152
+ {
153
+ $numItems = $this->count();
154
+ if ($numItems > 0 && $this->iteratorKey < $numItems) {
155
+ return true;
156
+ }
157
+ return false;
158
+ }
159
+
160
+ /**
161
+ * Whether the offset exists
162
+ *
163
+ * Implement ArrayAccess::offsetExists()
164
+ *
165
+ * @param int $offset
166
+ * @return bool
167
+ */
168
+ public function offsetExists($offset)
169
+ {
170
+ return ($offset < $this->count());
171
+ }
172
+
173
+ /**
174
+ * Return value at given offset
175
+ *
176
+ * Implement ArrayAccess::offsetGet()
177
+ *
178
+ * @param int $offset
179
+ * @return Instance
180
+ * @throws Zend_Cloud_Infrastructure_Exception
181
+ */
182
+ public function offsetGet($offset)
183
+ {
184
+ if (!$this->offsetExists($offset)) {
185
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
186
+ throw new Zend_Cloud_Infrastructure_Exception('Illegal index');
187
+ }
188
+ return $this->instances[$offset];
189
+ }
190
+
191
+ /**
192
+ * Throws exception because all values are read-only
193
+ *
194
+ * Implement ArrayAccess::offsetSet()
195
+ *
196
+ * @param int $offset
197
+ * @param string $value
198
+ * @throws Zend_Cloud_Infrastructure_Exception
199
+ */
200
+ public function offsetSet($offset, $value)
201
+ {
202
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
203
+ throw new Zend_Cloud_Infrastructure_Exception('You are trying to set read-only property');
204
+ }
205
+
206
+ /**
207
+ * Throws exception because all values are read-only
208
+ *
209
+ * Implement ArrayAccess::offsetUnset()
210
+ *
211
+ * @param int $offset
212
+ * @throws Zend_Cloud_Infrastructure_Exception
213
+ */
214
+ public function offsetUnset($offset)
215
+ {
216
+ #require_once 'Zend/Cloud/Infrastructure/Exception.php';
217
+ throw new Zend_Cloud_Infrastructure_Exception('You are trying to unset read-only property');
218
+ }
219
+ }
lib/Zend/Cloud/OperationNotAvailableException.php CHANGED
@@ -1,34 +1,34 @@
1
- <?php
2
- /**
3
- * Zend Framework
4
- *
5
- * LICENSE
6
- *
7
- * This source file is subject to the new BSD license that is bundled
8
- * with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://framework.zend.com/license/new-bsd
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@zend.com so we can send you a copy immediately.
14
- *
15
- * @category Zend
16
- * @package Zend_Cloud
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
- * @license http://framework.zend.com/license/new-bsd New BSD License
19
- */
20
-
21
- /**
22
- * Zend_Exception
23
- */
24
- #require_once 'Zend/Exception.php';
25
-
26
- /**
27
- * @category Zend
28
- * @package Zend_Cloud
29
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
30
- * @license http://framework.zend.com/license/new-bsd New BSD License
31
- */
32
- class Zend_Cloud_OperationNotAvailableException extends Zend_Exception
33
- {}
34
-
1
+ <?php
2
+ /**
3
+ * Zend Framework
4
+ *
5
+ * LICENSE
6
+ *
7
+ * This source file is subject to the new BSD license that is bundled
8
+ * with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://framework.zend.com/license/new-bsd
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@zend.com so we can send you a copy immediately.
14
+ *
15
+ * @category Zend
16
+ * @package Zend_Cloud
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
+ * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ */
20
+
21
+ /**
22
+ * Zend_Exception
23
+ */
24
+ #require_once 'Zend/Exception.php';
25
+
26
+ /**
27
+ * @category Zend
28
+ * @package Zend_Cloud
29
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30
+ * @license http://framework.zend.com/license/new-bsd New BSD License
31
+ */
32
+ class Zend_Cloud_OperationNotAvailableException extends Zend_Exception
33
+ {}
34
+
lib/Zend/Cloud/QueueService/Adapter.php CHANGED
@@ -13,7 +13,7 @@
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage QueueService
16
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
@@ -31,7 +31,7 @@
31
  * @category Zend
32
  * @package Zend_Cloud
33
  * @subpackage QueueService
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  interface Zend_Cloud_QueueService_Adapter
@@ -49,7 +49,7 @@ interface Zend_Cloud_QueueService_Adapter
49
  * Create a queue. Returns the ID of the created queue (typically the URL).
50
  * It may take some time to create the queue. Check your vendor's
51
  * documentation for details.
52
- *
53
  * Name constraints: Maximum 80 characters
54
  * Only alphanumeric characters, hyphens (-), and underscores (_)
55
  *
@@ -67,7 +67,7 @@ interface Zend_Cloud_QueueService_Adapter
67
  * @return boolean true if successful, false otherwise
68
  */
69
  public function deleteQueue($queueId, $options = null);
70
-
71
  /**
72
  * List all queues.
73
  *
@@ -75,7 +75,7 @@ interface Zend_Cloud_QueueService_Adapter
75
  * @return array Queue IDs
76
  */
77
  public function listQueues($options = null);
78
-
79
  /**
80
  * Get a key/value array of metadata for the given queue.
81
  *
@@ -84,40 +84,40 @@ interface Zend_Cloud_QueueService_Adapter
84
  * @return array
85
  */
86
  public function fetchQueueMetadata($queueId, $options = null);
87
-
88
  /**
89
  * Store a key/value array of metadata for the specified queue.
90
- * WARNING: This operation overwrites any metadata that is located at
91
  * $destinationPath. Some adapters may not support this method.
92
- *
93
  * @param string $queueId
94
  * @param array $metadata
95
  * @param array $options
96
  * @return void
97
  */
98
  public function storeQueueMetadata($queueId, $metadata, $options = null);
99
-
100
  /**
101
  * Send a message to the specified queue.
102
- *
103
  * @param string $queueId
104
  * @param string $message
105
  * @param array $options
106
  * @return string Message ID
107
  */
108
  public function sendMessage($queueId, $message, $options = null);
109
-
110
  /**
111
  * Recieve at most $max messages from the specified queue and return the
112
  * message IDs for messages recieved.
113
- *
114
  * @param string $queueId
115
  * @param int $max
116
  * @param array $options
117
  * @return array[Zend_Cloud_QueueService_Message] Array of messages
118
  */
119
  public function receiveMessages($queueId, $max = 1, $options = null);
120
-
121
  /**
122
  * Peek at the messages from the specified queue without removing them.
123
  *
@@ -127,18 +127,18 @@ interface Zend_Cloud_QueueService_Adapter
127
  * @return array[Zend_Cloud_QueueService_Message]
128
  */
129
  public function peekMessages($queueId, $num = 1, $options = null);
130
-
131
  /**
132
  * Delete the specified message from the specified queue.
133
- *
134
  * @param string $queueId
135
- * @param Zend_Cloud_QueueService_Message $message Message to delete
136
  * @param array $options
137
  * @return void
138
- *
139
  */
140
  public function deleteMessage($queueId, $message, $options = null);
141
-
142
  /**
143
  * Get the concrete adapter.
144
  */
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage QueueService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
31
  * @category Zend
32
  * @package Zend_Cloud
33
  * @subpackage QueueService
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  interface Zend_Cloud_QueueService_Adapter
49
  * Create a queue. Returns the ID of the created queue (typically the URL).
50
  * It may take some time to create the queue. Check your vendor's
51
  * documentation for details.
52
+ *
53
  * Name constraints: Maximum 80 characters
54
  * Only alphanumeric characters, hyphens (-), and underscores (_)
55
  *
67
  * @return boolean true if successful, false otherwise
68
  */
69
  public function deleteQueue($queueId, $options = null);
70
+
71
  /**
72
  * List all queues.
73
  *
75
  * @return array Queue IDs
76
  */
77
  public function listQueues($options = null);
78
+
79
  /**
80
  * Get a key/value array of metadata for the given queue.
81
  *
84
  * @return array
85
  */
86
  public function fetchQueueMetadata($queueId, $options = null);
87
+
88
  /**
89
  * Store a key/value array of metadata for the specified queue.
90
+ * WARNING: This operation overwrites any metadata that is located at
91
  * $destinationPath. Some adapters may not support this method.
92
+ *
93
  * @param string $queueId
94
  * @param array $metadata
95
  * @param array $options
96
  * @return void
97
  */
98
  public function storeQueueMetadata($queueId, $metadata, $options = null);
99
+
100
  /**
101
  * Send a message to the specified queue.
102
+ *
103
  * @param string $queueId
104
  * @param string $message
105
  * @param array $options
106
  * @return string Message ID
107
  */
108
  public function sendMessage($queueId, $message, $options = null);
109
+
110
  /**
111
  * Recieve at most $max messages from the specified queue and return the
112
  * message IDs for messages recieved.
113
+ *
114
  * @param string $queueId
115
  * @param int $max
116
  * @param array $options
117
  * @return array[Zend_Cloud_QueueService_Message] Array of messages
118
  */
119
  public function receiveMessages($queueId, $max = 1, $options = null);
120
+
121
  /**
122
  * Peek at the messages from the specified queue without removing them.
123
  *
127
  * @return array[Zend_Cloud_QueueService_Message]
128
  */
129
  public function peekMessages($queueId, $num = 1, $options = null);
130
+
131
  /**
132
  * Delete the specified message from the specified queue.
133
+ *
134
  * @param string $queueId
135
+ * @param Zend_Cloud_QueueService_Message $message Message to delete
136
  * @param array $options
137
  * @return void
138
+ *
139
  */
140
  public function deleteMessage($queueId, $message, $options = null);
141
+
142
  /**
143
  * Get the concrete adapter.
144
  */
lib/Zend/Cloud/QueueService/Adapter/AbstractAdapter.php CHANGED
@@ -13,7 +13,7 @@
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage QueueService
16
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
@@ -29,7 +29,7 @@
29
  * @category Zend
30
  * @package Zend_Cloud
31
  * @subpackage QueueService
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  abstract class Zend_Cloud_QueueService_Adapter_AbstractAdapter
@@ -48,8 +48,8 @@ abstract class Zend_Cloud_QueueService_Adapter_AbstractAdapter
48
 
49
  /**
50
  * Set class to use for message objects
51
- *
52
- * @param string $class
53
  * @return Zend_Cloud_QueueService_Adapter_AbstractAdapter
54
  */
55
  public function setMessageClass($class)
@@ -60,7 +60,7 @@ abstract class Zend_Cloud_QueueService_Adapter_AbstractAdapter
60
 
61
  /**
62
  * Get class to use for message objects
63
- *
64
  * @return string
65
  */
66
  public function getMessageClass()
@@ -70,8 +70,8 @@ abstract class Zend_Cloud_QueueService_Adapter_AbstractAdapter
70
 
71
  /**
72
  * Set class to use for message collection objects
73
- *
74
- * @param string $class
75
  * @return Zend_Cloud_QueueService_Adapter_AbstractAdapter
76
  */
77
  public function setMessageSetClass($class)
@@ -82,7 +82,7 @@ abstract class Zend_Cloud_QueueService_Adapter_AbstractAdapter
82
 
83
  /**
84
  * Get class to use for message collection objects
85
- *
86
  * @return string
87
  */
88
  public function getMessageSetClass()
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage QueueService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
29
  * @category Zend
30
  * @package Zend_Cloud
31
  * @subpackage QueueService
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  abstract class Zend_Cloud_QueueService_Adapter_AbstractAdapter
48
 
49
  /**
50
  * Set class to use for message objects
51
+ *
52
+ * @param string $class
53
  * @return Zend_Cloud_QueueService_Adapter_AbstractAdapter
54
  */
55
  public function setMessageClass($class)
60
 
61
  /**
62
  * Get class to use for message objects
63
+ *
64
  * @return string
65
  */
66
  public function getMessageClass()
70
 
71
  /**
72
  * Set class to use for message collection objects
73
+ *
74
+ * @param string $class
75
  * @return Zend_Cloud_QueueService_Adapter_AbstractAdapter
76
  */
77
  public function setMessageSetClass($class)
82
 
83
  /**
84
  * Get class to use for message collection objects
85
+ *
86
  * @return string
87
  */
88
  public function getMessageSetClass()
lib/Zend/Cloud/QueueService/Adapter/Sqs.php CHANGED
@@ -13,7 +13,7 @@
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage QueueService
16
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
@@ -28,10 +28,10 @@
28
  * @category Zend
29
  * @package Zend_Cloud
30
  * @subpackage QueueService
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
- class Zend_Cloud_QueueService_Adapter_Sqs
35
  extends Zend_Cloud_QueueService_Adapter_AbstractAdapter
36
  {
37
  /*
@@ -53,11 +53,11 @@ class Zend_Cloud_QueueService_Adapter_Sqs
53
 
54
  /**
55
  * Constructor
56
- *
57
- * @param array|Zend_Config $options
58
  * @return void
59
  */
60
- public function __construct($options = array())
61
  {
62
  if ($options instanceof Zend_Config) {
63
  $options = $options->toArray();
@@ -85,7 +85,7 @@ class Zend_Cloud_QueueService_Adapter_Sqs
85
 
86
  if(isset($options[self::HTTP_ADAPTER])) {
87
  $this->_sqs->getHttpClient()->setAdapter($options[self::HTTP_ADAPTER]);
88
- }
89
  }
90
 
91
  /**
@@ -97,7 +97,7 @@ class Zend_Cloud_QueueService_Adapter_Sqs
97
  * @param array $options
98
  * @return string Queue ID (typically URL)
99
  */
100
- public function createQueue($name, $options = null)
101
  {
102
  try {
103
  return $this->_sqs->create($name, $options[self::CREATE_TIMEOUT]);
@@ -113,7 +113,7 @@ class Zend_Cloud_QueueService_Adapter_Sqs
113
  * @param array $options
114
  * @return boolean true if successful, false otherwise
115
  */
116
- public function deleteQueue($queueId, $options = null)
117
  {
118
  try {
119
  return $this->_sqs->delete($queueId);
@@ -128,7 +128,7 @@ class Zend_Cloud_QueueService_Adapter_Sqs
128
  * @param array $options
129
  * @return array Queue IDs
130
  */
131
- public function listQueues($options = null)
132
  {
133
  try {
134
  return $this->_sqs->getQueues();
@@ -144,7 +144,7 @@ class Zend_Cloud_QueueService_Adapter_Sqs
144
  * @param array $options
145
  * @return array
146
  */
147
- public function fetchQueueMetadata($queueId, $options = null)
148
  {
149
  try {
150
  // TODO: ZF-9050 Fix the SQS client library in trunk to return all attribute values
@@ -169,7 +169,7 @@ class Zend_Cloud_QueueService_Adapter_Sqs
169
  * @param array $options
170
  * @return void
171
  */
172
- public function storeQueueMetadata($queueId, $metadata, $options = null)
173
  {
174
  // TODO Add support for SetQueueAttributes to client library
175
  #require_once 'Zend/Cloud/OperationNotAvailableException.php';
@@ -184,7 +184,7 @@ class Zend_Cloud_QueueService_Adapter_Sqs
184
  * @param array $options
185
  * @return string Message ID
186
  */
187
- public function sendMessage($queueId, $message, $options = null)
188
  {
189
  try {
190
  return $this->_sqs->send($queueId, $message);
@@ -202,7 +202,7 @@ class Zend_Cloud_QueueService_Adapter_Sqs
202
  * @param array $options
203
  * @return array
204
  */
205
- public function receiveMessages($queueId, $max = 1, $options = null)
206
  {
207
  try {
208
  return $this->_makeMessages($this->_sqs->receive($queueId, $max, $options[self::VISIBILITY_TIMEOUT]));
@@ -210,11 +210,11 @@ class Zend_Cloud_QueueService_Adapter_Sqs
210
  throw new Zend_Cloud_QueueService_Exception('Error on recieving messages: '.$e->getMessage(), $e->getCode(), $e);
211
  }
212
  }
213
-
214
  /**
215
  * Create Zend_Cloud_QueueService_Message array for
216
  * Sqs messages.
217
- *
218
  * @param array $messages
219
  * @return Zend_Cloud_QueueService_Message[]
220
  */
@@ -237,7 +237,7 @@ class Zend_Cloud_QueueService_Adapter_Sqs
237
  * @param array $options
238
  * @return void
239
  */
240
- public function deleteMessage($queueId, $message, $options = null)
241
  {
242
  try {
243
  if($message instanceof Zend_Cloud_QueueService_Message) {
@@ -249,7 +249,7 @@ class Zend_Cloud_QueueService_Adapter_Sqs
249
  throw new Zend_Cloud_QueueService_Exception('Error on deleting a message: '.$e->getMessage(), $e->getCode(), $e);
250
  }
251
  }
252
-
253
  /**
254
  * Peek at the messages from the specified queue without removing them.
255
  *
@@ -269,7 +269,7 @@ class Zend_Cloud_QueueService_Adapter_Sqs
269
 
270
  /**
271
  * Get SQS implementation
272
- * @return Zend_Service_Amazon_Sqs
273
  */
274
  public function getClient()
275
  {
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage QueueService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
28
  * @category Zend
29
  * @package Zend_Cloud
30
  * @subpackage QueueService
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
+ class Zend_Cloud_QueueService_Adapter_Sqs
35
  extends Zend_Cloud_QueueService_Adapter_AbstractAdapter
36
  {
37
  /*
53
 
54
  /**
55
  * Constructor
56
+ *
57
+ * @param array|Zend_Config $options
58
  * @return void
59
  */
60
+ public function __construct($options = array())
61
  {
62
  if ($options instanceof Zend_Config) {
63
  $options = $options->toArray();
85
 
86
  if(isset($options[self::HTTP_ADAPTER])) {
87
  $this->_sqs->getHttpClient()->setAdapter($options[self::HTTP_ADAPTER]);
88
+ }
89
  }
90
 
91
  /**
97
  * @param array $options
98
  * @return string Queue ID (typically URL)
99
  */
100
+ public function createQueue($name, $options = null)
101
  {
102
  try {
103
  return $this->_sqs->create($name, $options[self::CREATE_TIMEOUT]);
113
  * @param array $options
114
  * @return boolean true if successful, false otherwise
115
  */
116
+ public function deleteQueue($queueId, $options = null)
117
  {
118
  try {
119
  return $this->_sqs->delete($queueId);
128
  * @param array $options
129
  * @return array Queue IDs
130
  */
131
+ public function listQueues($options = null)
132
  {
133
  try {
134
  return $this->_sqs->getQueues();
144
  * @param array $options
145
  * @return array
146
  */
147
+ public function fetchQueueMetadata($queueId, $options = null)
148
  {
149
  try {
150
  // TODO: ZF-9050 Fix the SQS client library in trunk to return all attribute values
169
  * @param array $options
170
  * @return void
171
  */
172
+ public function storeQueueMetadata($queueId, $metadata, $options = null)
173
  {
174
  // TODO Add support for SetQueueAttributes to client library
175
  #require_once 'Zend/Cloud/OperationNotAvailableException.php';
184
  * @param array $options
185
  * @return string Message ID
186
  */
187
+ public function sendMessage($queueId, $message, $options = null)
188
  {
189
  try {
190
  return $this->_sqs->send($queueId, $message);
202
  * @param array $options
203
  * @return array
204
  */
205
+ public function receiveMessages($queueId, $max = 1, $options = null)
206
  {
207
  try {
208
  return $this->_makeMessages($this->_sqs->receive($queueId, $max, $options[self::VISIBILITY_TIMEOUT]));
210
  throw new Zend_Cloud_QueueService_Exception('Error on recieving messages: '.$e->getMessage(), $e->getCode(), $e);
211
  }
212
  }
213
+
214
  /**
215
  * Create Zend_Cloud_QueueService_Message array for
216
  * Sqs messages.
217
+ *
218
  * @param array $messages
219
  * @return Zend_Cloud_QueueService_Message[]
220
  */
237
  * @param array $options
238
  * @return void
239
  */
240
+ public function deleteMessage($queueId, $message, $options = null)
241
  {
242
  try {
243
  if($message instanceof Zend_Cloud_QueueService_Message) {
249
  throw new Zend_Cloud_QueueService_Exception('Error on deleting a message: '.$e->getMessage(), $e->getCode(), $e);
250
  }
251
  }
252
+
253
  /**
254
  * Peek at the messages from the specified queue without removing them.
255
  *
269
 
270
  /**
271
  * Get SQS implementation
272
+ * @return Zend_Service_Amazon_Sqs
273
  */
274
  public function getClient()
275
  {
lib/Zend/Cloud/QueueService/Adapter/WindowsAzure.php CHANGED
@@ -13,7 +13,7 @@
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage QueueService
16
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
@@ -27,10 +27,10 @@
27
  * @category Zend
28
  * @package Zend_Cloud
29
  * @subpackage QueueService
30
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
- class Zend_Cloud_QueueService_Adapter_WindowsAzure
34
  extends Zend_Cloud_QueueService_Adapter_AbstractAdapter
35
  {
36
  /**
@@ -49,20 +49,20 @@ class Zend_Cloud_QueueService_Adapter_WindowsAzure
49
 
50
  /** message options */
51
  const MESSAGE_TTL = 'ttl';
52
-
53
  const DEFAULT_HOST = Zend_Service_WindowsAzure_Storage::URL_CLOUD_QUEUE;
54
 
55
  /**
56
  * Storage client
57
- *
58
  * @var Zend_Service_WindowsAzure_Storage_Queue
59
  */
60
  protected $_storageClient = null;
61
-
62
  /**
63
  * Constructor
64
- *
65
- * @param array|Zend_Config $options
66
  * @return void
67
  */
68
  public function __construct($options = array())
@@ -112,9 +112,9 @@ class Zend_Cloud_QueueService_Adapter_WindowsAzure
112
  } catch(Zend_Service_WindowsAzure_Exception $e) {
113
  throw new Zend_Cloud_QueueService_Exception('Error on create: '.$e->getMessage(), $e->getCode(), $e);
114
  }
115
-
116
  }
117
-
118
  /**
119
  * Create a queue. Returns the ID of the created queue (typically the URL).
120
  * It may take some time to create the queue. Check your vendor's
@@ -133,7 +133,7 @@ class Zend_Cloud_QueueService_Adapter_WindowsAzure
133
  throw new Zend_Cloud_QueueService_Exception('Error on queue creation: '.$e->getMessage(), $e->getCode(), $e);
134
  }
135
  }
136
-
137
  /**
138
  * Delete a queue. All messages in the queue will also be deleted.
139
  *
@@ -152,7 +152,7 @@ class Zend_Cloud_QueueService_Adapter_WindowsAzure
152
  throw new Zend_Cloud_QueueService_Exception('Error on queue deletion: '.$e->getMessage(), $e->getCode(), $e);
153
  }
154
  }
155
-
156
  /**
157
  * List all queues.
158
  *
@@ -177,7 +177,7 @@ class Zend_Cloud_QueueService_Adapter_WindowsAzure
177
  throw new Zend_Cloud_QueueService_Exception('Error on listing queues: '.$e->getMessage(), $e->getCode(), $e);
178
  }
179
  }
180
-
181
  /**
182
  * Get a key/value array of metadata for the given queue.
183
  *
@@ -196,12 +196,12 @@ class Zend_Cloud_QueueService_Adapter_WindowsAzure
196
  throw new Zend_Cloud_QueueService_Exception('Error on fetching queue metadata: '.$e->getMessage(), $e->getCode(), $e);
197
  }
198
  }
199
-
200
  /**
201
  * Store a key/value array of metadata for the specified queue.
202
- * WARNING: This operation overwrites any metadata that is located at
203
  * $destinationPath. Some adapters may not support this method.
204
- *
205
  * @param string $queueId
206
  * @param array $metadata
207
  * @param array $options
@@ -218,10 +218,10 @@ class Zend_Cloud_QueueService_Adapter_WindowsAzure
218
  throw new Zend_Cloud_QueueService_Exception('Error on setting queue metadata: '.$e->getMessage(), $e->getCode(), $e);
219
  }
220
  }
221
-
222
  /**
223
  * Send a message to the specified queue.
224
- *
225
  * @param string $queueId
226
  * @param string $message
227
  * @param array $options
@@ -240,11 +240,11 @@ class Zend_Cloud_QueueService_Adapter_WindowsAzure
240
  throw new Zend_Cloud_QueueService_Exception('Error on sending message: '.$e->getMessage(), $e->getCode(), $e);
241
  }
242
  }
243
-
244
  /**
245
  * Recieve at most $max messages from the specified queue and return the
246
  * message IDs for messages recieved.
247
- *
248
  * @param string $queueId
249
  * @param int $max
250
  * @param array $options
@@ -266,11 +266,11 @@ class Zend_Cloud_QueueService_Adapter_WindowsAzure
266
  throw new Zend_Cloud_QueueService_Exception('Error on recieving messages: '.$e->getMessage(), $e->getCode(), $e);
267
  }
268
  }
269
-
270
  /**
271
  * Create Zend_Cloud_QueueService_Message array for
272
  * Azure messages.
273
- *
274
  * @param array $messages
275
  * @return Zend_Cloud_QueueService_Message[]
276
  */
@@ -287,9 +287,9 @@ class Zend_Cloud_QueueService_Adapter_WindowsAzure
287
 
288
  /**
289
  * Delete the specified message from the specified queue.
290
- *
291
  * @param string $queueId
292
- * @param Zend_Cloud_QueueService_Message $message Message ID or message
293
  * @param array $options
294
  * @return void
295
  */
@@ -331,10 +331,10 @@ class Zend_Cloud_QueueService_Adapter_WindowsAzure
331
  throw new Zend_Cloud_QueueService_Exception('Error on peeking messages: '.$e->getMessage(), $e->getCode(), $e);
332
  }
333
  }
334
-
335
  /**
336
  * Get Azure implementation
337
- * @return Zend_Service_Azure_Storage_Queue
338
  */
339
  public function getClient()
340
  {
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage QueueService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
27
  * @category Zend
28
  * @package Zend_Cloud
29
  * @subpackage QueueService
30
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
+ class Zend_Cloud_QueueService_Adapter_WindowsAzure
34
  extends Zend_Cloud_QueueService_Adapter_AbstractAdapter
35
  {
36
  /**
49
 
50
  /** message options */
51
  const MESSAGE_TTL = 'ttl';
52
+
53
  const DEFAULT_HOST = Zend_Service_WindowsAzure_Storage::URL_CLOUD_QUEUE;
54
 
55
  /**
56
  * Storage client
57
+ *
58
  * @var Zend_Service_WindowsAzure_Storage_Queue
59
  */
60
  protected $_storageClient = null;
61
+
62
  /**
63
  * Constructor
64
+ *
65
+ * @param array|Zend_Config $options
66
  * @return void
67
  */
68
  public function __construct($options = array())
112
  } catch(Zend_Service_WindowsAzure_Exception $e) {
113
  throw new Zend_Cloud_QueueService_Exception('Error on create: '.$e->getMessage(), $e->getCode(), $e);
114
  }
115
+
116
  }
117
+
118
  /**
119
  * Create a queue. Returns the ID of the created queue (typically the URL).
120
  * It may take some time to create the queue. Check your vendor's
133
  throw new Zend_Cloud_QueueService_Exception('Error on queue creation: '.$e->getMessage(), $e->getCode(), $e);
134
  }
135
  }
136
+
137
  /**
138
  * Delete a queue. All messages in the queue will also be deleted.
139
  *
152
  throw new Zend_Cloud_QueueService_Exception('Error on queue deletion: '.$e->getMessage(), $e->getCode(), $e);
153
  }
154
  }
155
+
156
  /**
157
  * List all queues.
158
  *
177
  throw new Zend_Cloud_QueueService_Exception('Error on listing queues: '.$e->getMessage(), $e->getCode(), $e);
178
  }
179
  }
180
+
181
  /**
182
  * Get a key/value array of metadata for the given queue.
183
  *
196
  throw new Zend_Cloud_QueueService_Exception('Error on fetching queue metadata: '.$e->getMessage(), $e->getCode(), $e);
197
  }
198
  }
199
+
200
  /**
201
  * Store a key/value array of metadata for the specified queue.
202
+ * WARNING: This operation overwrites any metadata that is located at
203
  * $destinationPath. Some adapters may not support this method.
204
+ *
205
  * @param string $queueId
206
  * @param array $metadata
207
  * @param array $options
218
  throw new Zend_Cloud_QueueService_Exception('Error on setting queue metadata: '.$e->getMessage(), $e->getCode(), $e);
219
  }
220
  }
221
+
222
  /**
223
  * Send a message to the specified queue.
224
+ *
225
  * @param string $queueId
226
  * @param string $message
227
  * @param array $options
240
  throw new Zend_Cloud_QueueService_Exception('Error on sending message: '.$e->getMessage(), $e->getCode(), $e);
241
  }
242
  }
243
+
244
  /**
245
  * Recieve at most $max messages from the specified queue and return the
246
  * message IDs for messages recieved.
247
+ *
248
  * @param string $queueId
249
  * @param int $max
250
  * @param array $options
266
  throw new Zend_Cloud_QueueService_Exception('Error on recieving messages: '.$e->getMessage(), $e->getCode(), $e);
267
  }
268
  }
269
+
270
  /**
271
  * Create Zend_Cloud_QueueService_Message array for
272
  * Azure messages.
273
+ *
274
  * @param array $messages
275
  * @return Zend_Cloud_QueueService_Message[]
276
  */
287
 
288
  /**
289
  * Delete the specified message from the specified queue.
290
+ *
291
  * @param string $queueId
292
+ * @param Zend_Cloud_QueueService_Message $message Message ID or message
293
  * @param array $options
294
  * @return void
295
  */
331
  throw new Zend_Cloud_QueueService_Exception('Error on peeking messages: '.$e->getMessage(), $e->getCode(), $e);
332
  }
333
  }
334
+
335
  /**
336
  * Get Azure implementation
337
+ * @return Zend_Service_Azure_Storage_Queue
338
  */
339
  public function getClient()
340
  {
lib/Zend/Cloud/QueueService/Adapter/ZendQueue.php CHANGED
@@ -13,7 +13,7 @@
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage QueueService
16
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
@@ -27,33 +27,33 @@
27
  * @category Zend
28
  * @package Zend_Cloud
29
  * @subpackage QueueService
30
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
- class Zend_Cloud_QueueService_Adapter_ZendQueue
34
  extends Zend_Cloud_QueueService_Adapter_AbstractAdapter
35
  {
36
  /**
37
  * Options array keys for the Zend_Queue adapter.
38
  */
39
  const ADAPTER = 'adapter';
40
-
41
  /**
42
  * Storage client
43
- *
44
  * @var Zend_Queue
45
  */
46
  protected $_queue = null;
47
-
48
  /**
49
  * @var array All queues
50
  */
51
  protected $_queues = array();
52
-
53
  /**
54
  * Constructor
55
- *
56
- * @param array|Zend_Config $options
57
  * @return void
58
  */
59
  public function __construct ($options = array())
@@ -87,7 +87,7 @@ class Zend_Cloud_QueueService_Adapter_ZendQueue
87
  throw new Zend_Cloud_QueueService_Exception('Error on create: '.$e->getMessage(), $e->getCode(), $e);
88
  }
89
  }
90
-
91
  /**
92
  * Create a queue. Returns the ID of the created queue (typically the URL).
93
  * It may take some time to create the queue. Check your vendor's
@@ -106,7 +106,7 @@ class Zend_Cloud_QueueService_Adapter_ZendQueue
106
  throw new Zend_Cloud_QueueService_Exception('Error on queue creation: '.$e->getMessage(), $e->getCode(), $e);
107
  }
108
  }
109
-
110
  /**
111
  * Delete a queue. All messages in the queue will also be deleted.
112
  *
@@ -128,7 +128,7 @@ class Zend_Cloud_QueueService_Adapter_ZendQueue
128
  throw new Zend_Cloud_QueueService_Exception('Error on queue deletion: '.$e->getMessage(), $e->getCode(), $e);
129
  }
130
  }
131
-
132
  /**
133
  * List all queues.
134
  *
@@ -143,7 +143,7 @@ class Zend_Cloud_QueueService_Adapter_ZendQueue
143
  throw new Zend_Cloud_QueueService_Exception('Error on listing queues: '.$e->getMessage(), $e->getCode(), $e);
144
  }
145
  }
146
-
147
  /**
148
  * Get a key/value array of metadata for the given queue.
149
  *
@@ -162,12 +162,12 @@ class Zend_Cloud_QueueService_Adapter_ZendQueue
162
  throw new Zend_Cloud_QueueService_Exception('Error on fetching queue metadata: '.$e->getMessage(), $e->getCode(), $e);
163
  }
164
  }
165
-
166
  /**
167
  * Store a key/value array of metadata for the specified queue.
168
- * WARNING: This operation overwrites any metadata that is located at
169
  * $destinationPath. Some adapters may not support this method.
170
- *
171
  * @param string $queueId
172
  * @param array $metadata
173
  * @param array $options
@@ -184,10 +184,10 @@ class Zend_Cloud_QueueService_Adapter_ZendQueue
184
  throw new Zend_Cloud_QueueService_Exception('Error on setting queue metadata: '.$e->getMessage(), $e->getCode(), $e);
185
  }
186
  }
187
-
188
  /**
189
  * Send a message to the specified queue.
190
- *
191
  * @param string $queueId
192
  * @param string $message
193
  * @param array $options
@@ -204,11 +204,11 @@ class Zend_Cloud_QueueService_Adapter_ZendQueue
204
  throw new Zend_Cloud_QueueService_Exception('Error on sending message: '.$e->getMessage(), $e->getCode(), $e);
205
  }
206
  }
207
-
208
  /**
209
  * Recieve at most $max messages from the specified queue and return the
210
  * message IDs for messages recieved.
211
- *
212
  * @param string $queueId
213
  * @param int $max
214
  * @param array $options
@@ -230,11 +230,11 @@ class Zend_Cloud_QueueService_Adapter_ZendQueue
230
  throw new Zend_Cloud_QueueService_Exception('Error on recieving messages: '.$e->getMessage(), $e->getCode(), $e);
231
  }
232
  }
233
-
234
  /**
235
  * Create Zend_Cloud_QueueService_Message array for
236
  * Azure messages.
237
- *
238
  * @param array $messages
239
  * @return Zend_Cloud_QueueService_Message[]
240
  */
@@ -248,12 +248,12 @@ class Zend_Cloud_QueueService_Adapter_ZendQueue
248
  }
249
  return new $setClass($result);
250
  }
251
-
252
  /**
253
  * Delete the specified message from the specified queue.
254
- *
255
  * @param string $queueId
256
- * @param Zend_Cloud_QueueService_Message $message Message ID or message
257
  * @param array $options
258
  * @return void
259
  */
@@ -269,13 +269,13 @@ class Zend_Cloud_QueueService_Adapter_ZendQueue
269
  if (!($message instanceof Zend_Queue_Message)) {
270
  throw new Zend_Cloud_QueueService_Exception('Cannot delete the message: Zend_Queue_Message object required');
271
  }
272
-
273
  return $this->_queues[$queueId]->deleteMessage($message);
274
  } catch (Zend_Queue_Exception $e) {
275
  throw new Zend_Cloud_QueueService_Exception('Error on deleting a message: '.$e->getMessage(), $e->getCode(), $e);
276
  }
277
  }
278
-
279
  /**
280
  * Peek at the messages from the specified queue without removing them.
281
  *
@@ -289,10 +289,10 @@ class Zend_Cloud_QueueService_Adapter_ZendQueue
289
  #require_once 'Zend/Cloud/OperationNotAvailableException.php';
290
  throw new Zend_Cloud_OperationNotAvailableException('ZendQueue doesn\'t currently support message peeking');
291
  }
292
-
293
  /**
294
  * Get Azure implementation
295
- * @return Zend_Queue
296
  */
297
  public function getClient()
298
  {
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage QueueService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
27
  * @category Zend
28
  * @package Zend_Cloud
29
  * @subpackage QueueService
30
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
+ class Zend_Cloud_QueueService_Adapter_ZendQueue
34
  extends Zend_Cloud_QueueService_Adapter_AbstractAdapter
35
  {
36
  /**
37
  * Options array keys for the Zend_Queue adapter.
38
  */
39
  const ADAPTER = 'adapter';
40
+
41
  /**
42
  * Storage client
43
+ *
44
  * @var Zend_Queue
45
  */
46
  protected $_queue = null;
47
+
48
  /**
49
  * @var array All queues
50
  */
51
  protected $_queues = array();
52
+
53
  /**
54
  * Constructor
55
+ *
56
+ * @param array|Zend_Config $options
57
  * @return void
58
  */
59
  public function __construct ($options = array())
87
  throw new Zend_Cloud_QueueService_Exception('Error on create: '.$e->getMessage(), $e->getCode(), $e);
88
  }
89
  }
90
+
91
  /**
92
  * Create a queue. Returns the ID of the created queue (typically the URL).
93
  * It may take some time to create the queue. Check your vendor's
106
  throw new Zend_Cloud_QueueService_Exception('Error on queue creation: '.$e->getMessage(), $e->getCode(), $e);
107
  }
108
  }
109
+
110
  /**
111
  * Delete a queue. All messages in the queue will also be deleted.
112
  *
128
  throw new Zend_Cloud_QueueService_Exception('Error on queue deletion: '.$e->getMessage(), $e->getCode(), $e);
129
  }
130
  }
131
+
132
  /**
133
  * List all queues.
134
  *
143
  throw new Zend_Cloud_QueueService_Exception('Error on listing queues: '.$e->getMessage(), $e->getCode(), $e);
144
  }
145
  }
146
+
147
  /**
148
  * Get a key/value array of metadata for the given queue.
149
  *
162
  throw new Zend_Cloud_QueueService_Exception('Error on fetching queue metadata: '.$e->getMessage(), $e->getCode(), $e);
163
  }
164
  }
165
+
166
  /**
167
  * Store a key/value array of metadata for the specified queue.
168
+ * WARNING: This operation overwrites any metadata that is located at
169
  * $destinationPath. Some adapters may not support this method.
170
+ *
171
  * @param string $queueId
172
  * @param array $metadata
173
  * @param array $options
184
  throw new Zend_Cloud_QueueService_Exception('Error on setting queue metadata: '.$e->getMessage(), $e->getCode(), $e);
185
  }
186
  }
187
+
188
  /**
189
  * Send a message to the specified queue.
190
+ *
191
  * @param string $queueId
192
  * @param string $message
193
  * @param array $options
204
  throw new Zend_Cloud_QueueService_Exception('Error on sending message: '.$e->getMessage(), $e->getCode(), $e);
205
  }
206
  }
207
+
208
  /**
209
  * Recieve at most $max messages from the specified queue and return the
210
  * message IDs for messages recieved.
211
+ *
212
  * @param string $queueId
213
  * @param int $max
214
  * @param array $options
230
  throw new Zend_Cloud_QueueService_Exception('Error on recieving messages: '.$e->getMessage(), $e->getCode(), $e);
231
  }
232
  }
233
+
234
  /**
235
  * Create Zend_Cloud_QueueService_Message array for
236
  * Azure messages.
237
+ *
238
  * @param array $messages
239
  * @return Zend_Cloud_QueueService_Message[]
240
  */
248
  }
249
  return new $setClass($result);
250
  }
251
+
252
  /**
253
  * Delete the specified message from the specified queue.
254
+ *
255
  * @param string $queueId
256
+ * @param Zend_Cloud_QueueService_Message $message Message ID or message
257
  * @param array $options
258
  * @return void
259
  */
269
  if (!($message instanceof Zend_Queue_Message)) {
270
  throw new Zend_Cloud_QueueService_Exception('Cannot delete the message: Zend_Queue_Message object required');
271
  }
272
+
273
  return $this->_queues[$queueId]->deleteMessage($message);
274
  } catch (Zend_Queue_Exception $e) {
275
  throw new Zend_Cloud_QueueService_Exception('Error on deleting a message: '.$e->getMessage(), $e->getCode(), $e);
276
  }
277
  }
278
+
279
  /**
280
  * Peek at the messages from the specified queue without removing them.
281
  *
289
  #require_once 'Zend/Cloud/OperationNotAvailableException.php';
290
  throw new Zend_Cloud_OperationNotAvailableException('ZendQueue doesn\'t currently support message peeking');
291
  }
292
+
293
  /**
294
  * Get Azure implementation
295
+ * @return Zend_Queue
296
  */
297
  public function getClient()
298
  {
lib/Zend/Cloud/QueueService/Exception.php CHANGED
@@ -1,37 +1,37 @@
1
- <?php
2
- /**
3
- * Zend Framework
4
- *
5
- * LICENSE
6
- *
7
- * This source file is subject to the new BSD license that is bundled
8
- * with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://framework.zend.com/license/new-bsd
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@zend.com so we can send you a copy immediately.
14
- *
15
- * @category Zend
16
- * @package Zend_Cloud
17
- * @subpackage QueueService
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
- * @license http://framework.zend.com/license/new-bsd New BSD License
20
- */
21
-
22
-
23
- /**
24
- * Zend_Cloud_Exception
25
- */
26
- #require_once 'Zend/Cloud/Exception.php';
27
-
28
-
29
- /**
30
- * @category Zend
31
- * @package Zend_Cloud
32
- * @subpackage QueueService
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
- * @license http://framework.zend.com/license/new-bsd New BSD License
35
- */
36
- class Zend_Cloud_QueueService_Exception extends Zend_Cloud_Exception
37
- {}
1
+ <?php
2
+ /**
3
+ * Zend Framework
4
+ *
5
+ * LICENSE
6
+ *
7
+ * This source file is subject to the new BSD license that is bundled
8
+ * with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://framework.zend.com/license/new-bsd
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@zend.com so we can send you a copy immediately.
14
+ *
15
+ * @category Zend
16
+ * @package Zend_Cloud
17
+ * @subpackage QueueService
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
+ * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ */
21
+
22
+
23
+ /**
24
+ * Zend_Cloud_Exception
25
+ */
26
+ #require_once 'Zend/Cloud/Exception.php';
27
+
28
+
29
+ /**
30
+ * @category Zend
31
+ * @package Zend_Cloud
32
+ * @subpackage QueueService
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
+ * @license http://framework.zend.com/license/new-bsd New BSD License
35
+ */
36
+ class Zend_Cloud_QueueService_Exception extends Zend_Cloud_Exception
37
+ {}
lib/Zend/Cloud/QueueService/Factory.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Cloud
17
  * @subpackage QueueService
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -25,7 +25,7 @@
25
  * @category Zend
26
  * @package Zend_Cloud
27
  * @subpackage QueueService
28
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
29
  * @license http://framework.zend.com/license/new-bsd New BSD License
30
  */
31
  class Zend_Cloud_QueueService_Factory extends Zend_Cloud_AbstractFactory
@@ -39,21 +39,21 @@ class Zend_Cloud_QueueService_Factory extends Zend_Cloud_AbstractFactory
39
 
40
  /**
41
  * Constructor
42
- *
43
  * @return void
44
  */
45
  private function __construct()
46
  {
47
  // private ctor - should not be used
48
  }
49
-
50
  /**
51
  * Retrieve QueueService adapter
52
- *
53
- * @param array $options
54
  * @return void
55
  */
56
- public static function getAdapter($options = array())
57
  {
58
  $adapter = parent::_getAdapter(self::QUEUE_ADAPTER_KEY, $options);
59
  if (!$adapter) {
15
  * @category Zend
16
  * @package Zend_Cloud
17
  * @subpackage QueueService
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
25
  * @category Zend
26
  * @package Zend_Cloud
27
  * @subpackage QueueService
28
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
29
  * @license http://framework.zend.com/license/new-bsd New BSD License
30
  */
31
  class Zend_Cloud_QueueService_Factory extends Zend_Cloud_AbstractFactory
39
 
40
  /**
41
  * Constructor
42
+ *
43
  * @return void
44
  */
45
  private function __construct()
46
  {
47
  // private ctor - should not be used
48
  }
49
+
50
  /**
51
  * Retrieve QueueService adapter
52
+ *
53
+ * @param array $options
54
  * @return void
55
  */
56
+ public static function getAdapter($options = array())
57
  {
58
  $adapter = parent::_getAdapter(self::QUEUE_ADAPTER_KEY, $options);
59
  if (!$adapter) {
lib/Zend/Cloud/QueueService/Message.php CHANGED
@@ -1,60 +1,60 @@
1
- <?php
2
- /**
3
- * LICENSE
4
- *
5
- * This source file is subject to the new BSD license that is bundled
6
- * with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://framework.zend.com/license/new-bsd
9
- * If you did not receive a copy of the license and are unable to
10
- * obtain it through the world-wide-web, please send an email
11
- * to license@zend.com so we can send you a copy immediately.
12
- *
13
- * @category Zend
14
- * @package Zend_Cloud
15
- * @subpackage QueueService
16
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
17
- * @license http://framework.zend.com/license/new-bsd New BSD License
18
- */
19
-
20
- /**
21
- * Generic message class
22
- *
23
- * @category Zend
24
- * @package Zend_Cloud
25
- * @subpackage QueueService
26
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
27
- * @license http://framework.zend.com/license/new-bsd New BSD License
28
- */
29
- class Zend_Cloud_QueueService_Message
30
- {
31
- protected $_body;
32
- protected $_clientMessage;
33
-
34
- /**
35
- * @param string $body Message text
36
- * @param $message Original message
37
- */
38
- function __construct($body, $message)
39
- {
40
- $this->_body = $body;
41
- $this->_clientMessage = $message;
42
- }
43
-
44
- /**
45
- * Get the message body
46
- * @return string
47
- */
48
- public function getBody()
49
- {
50
- return $this->_body;
51
- }
52
-
53
- /**
54
- * Get the original adapter-specific message
55
- */
56
- public function getMessage()
57
- {
58
- return $this->_clientMessage;
59
- }
60
- }
1
+ <?php
2
+ /**
3
+ * LICENSE
4
+ *
5
+ * This source file is subject to the new BSD license that is bundled
6
+ * with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://framework.zend.com/license/new-bsd
9
+ * If you did not receive a copy of the license and are unable to
10
+ * obtain it through the world-wide-web, please send an email
11
+ * to license@zend.com so we can send you a copy immediately.
12
+ *
13
+ * @category Zend
14
+ * @package Zend_Cloud
15
+ * @subpackage QueueService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
+ * @license http://framework.zend.com/license/new-bsd New BSD License
18
+ */
19
+
20
+ /**
21
+ * Generic message class
22
+ *
23
+ * @category Zend
24
+ * @package Zend_Cloud
25
+ * @subpackage QueueService
26
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27
+ * @license http://framework.zend.com/license/new-bsd New BSD License
28
+ */
29
+ class Zend_Cloud_QueueService_Message
30
+ {
31
+ protected $_body;
32
+ protected $_clientMessage;
33
+
34
+ /**
35
+ * @param string $body Message text
36
+ * @param string $message Original message
37
+ */
38
+ function __construct($body, $message)
39
+ {
40
+ $this->_body = $body;
41
+ $this->_clientMessage = $message;
42
+ }
43
+
44
+ /**
45
+ * Get the message body
46
+ * @return string
47
+ */
48
+ public function getBody()
49
+ {
50
+ return $this->_body;
51
+ }
52
+
53
+ /**
54
+ * Get the original adapter-specific message
55
+ */
56
+ public function getMessage()
57
+ {
58
+ return $this->_clientMessage;
59
+ }
60
+ }
lib/Zend/Cloud/QueueService/MessageSet.php CHANGED
@@ -13,7 +13,7 @@
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage QueueService
16
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
@@ -23,7 +23,7 @@
23
  * @category Zend
24
  * @package Zend_Cloud
25
  * @subpackage QueueService
26
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  class Zend_Cloud_QueueService_MessageSet implements Countable, IteratorAggregate
@@ -36,8 +36,8 @@ class Zend_Cloud_QueueService_MessageSet implements Countable, IteratorAggregate
36
 
37
  /**
38
  * Constructor
39
- *
40
- * @param array $messages
41
  * @return void
42
  */
43
  public function __construct(array $messages)
@@ -48,7 +48,7 @@ class Zend_Cloud_QueueService_MessageSet implements Countable, IteratorAggregate
48
 
49
  /**
50
  * Countable: number of messages in collection
51
- *
52
  * @return int
53
  */
54
  public function count()
@@ -58,7 +58,7 @@ class Zend_Cloud_QueueService_MessageSet implements Countable, IteratorAggregate
58
 
59
  /**
60
  * IteratorAggregate: return iterable object
61
- *
62
  * @return Traversable
63
  */
64
  public function getIterator()
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage QueueService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
23
  * @category Zend
24
  * @package Zend_Cloud
25
  * @subpackage QueueService
26
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  class Zend_Cloud_QueueService_MessageSet implements Countable, IteratorAggregate
36
 
37
  /**
38
  * Constructor
39
+ *
40
+ * @param array $messages
41
  * @return void
42
  */
43
  public function __construct(array $messages)
48
 
49
  /**
50
  * Countable: number of messages in collection
51
+ *
52
  * @return int
53
  */
54
  public function count()
58
 
59
  /**
60
  * IteratorAggregate: return iterable object
61
+ *
62
  * @return Traversable
63
  */
64
  public function getIterator()
lib/Zend/Cloud/StorageService/Adapter.php CHANGED
@@ -13,7 +13,7 @@
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage StorageService
16
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
@@ -23,7 +23,7 @@
23
  * @category Zend
24
  * @package Zend_Cloud
25
  * @subpackage StorageService
26
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  interface Zend_Cloud_StorageService_Adapter
@@ -39,10 +39,10 @@ interface Zend_Cloud_StorageService_Adapter
39
  * @return mixed
40
  */
41
  public function fetchItem($path, $options = null);
42
-
43
  /**
44
  * Store an item in the storage service.
45
- * WARNING: This operation overwrites any item that is located at
46
  * $destinationPath.
47
  * @param string $destinationPath
48
  * @param mixed $data
@@ -52,7 +52,7 @@ interface Zend_Cloud_StorageService_Adapter
52
  public function storeItem($destinationPath,
53
  $data,
54
  $options = null);
55
-
56
  /**
57
  * Delete an item in the storage service.
58
  *
@@ -61,10 +61,10 @@ interface Zend_Cloud_StorageService_Adapter
61
  * @return void
62
  */
63
  public function deleteItem($path, $options = null);
64
-
65
  /**
66
  * Copy an item in the storage service to a given path.
67
- *
68
  * The $destinationPath must be a directory.
69
  *
70
  * @param string $sourcePath
@@ -73,10 +73,10 @@ interface Zend_Cloud_StorageService_Adapter
73
  * @return void
74
  */
75
  public function copyItem($sourcePath, $destinationPath, $options = null);
76
-
77
  /**
78
  * Move an item in the storage service to a given path.
79
- *
80
  * The $destinationPath must be a directory.
81
  *
82
  * @param string $sourcePath
@@ -85,7 +85,7 @@ interface Zend_Cloud_StorageService_Adapter
85
  * @return void
86
  */
87
  public function moveItem($sourcePath, $destinationPath, $options = null);
88
-
89
  /**
90
  * Rename an item in the storage service to a given name.
91
  *
@@ -96,10 +96,10 @@ interface Zend_Cloud_StorageService_Adapter
96
  * @return void
97
  */
98
  public function renameItem($path, $name, $options = null);
99
-
100
  /**
101
  * List items in the given directory in the storage service
102
- *
103
  * The $path must be a directory
104
  *
105
  *
@@ -108,7 +108,7 @@ interface Zend_Cloud_StorageService_Adapter
108
  * @return array A list of item names
109
  */
110
  public function listItems($path, $options = null);
111
-
112
  /**
113
  * Get a key/value array of metadata for the given path.
114
  *
@@ -117,10 +117,10 @@ interface Zend_Cloud_StorageService_Adapter
117
  * @return array
118
  */
119
  public function fetchMetadata($path, $options = null);
120
-
121
  /**
122
  * Store a key/value array of metadata at the given path.
123
- * WARNING: This operation overwrites any metadata that is located at
124
  * $destinationPath.
125
  *
126
  * @param string $destinationPath
@@ -128,7 +128,7 @@ interface Zend_Cloud_StorageService_Adapter
128
  * @return void
129
  */
130
  public function storeMetadata($destinationPath, $metadata, $options = null);
131
-
132
  /**
133
  * Delete a key/value array of metadata at the given path.
134
  *
13
  * @category Zend
14
  * @package Zend_Cloud
15
  * @subpackage StorageService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
  * @license http://framework.zend.com/license/new-bsd New BSD License
18
  */
19
 
23
  * @category Zend
24
  * @package Zend_Cloud
25
  * @subpackage StorageService
26
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  interface Zend_Cloud_StorageService_Adapter
39
  * @return mixed
40
  */
41
  public function fetchItem($path, $options = null);
42
+
43
  /**
44
  * Store an item in the storage service.
45
+ * WARNING: This operation overwrites any item that is located at
46
  * $destinationPath.
47
  * @param string $destinationPath
48
  * @param mixed $data
52
  public function storeItem($destinationPath,
53
  $data,
54
  $options = null);
55
+
56
  /**
57
  * Delete an item in the storage service.
58
  *
61
  * @return void
62
  */
63
  public function deleteItem($path, $options = null);
64
+
65
  /**
66
  * Copy an item in the storage service to a given path.
67
+ *
68
  * The $destinationPath must be a directory.
69
  *
70
  * @param string $sourcePath
73
  * @return void
74
  */
75
  public function copyItem($sourcePath, $destinationPath, $options = null);
76
+
77
  /**
78
  * Move an item in the storage service to a given path.
79
+ *
80
  * The $destinationPath must be a directory.
81
  *
82
  * @param string $sourcePath
85
  * @return void
86
  */
87
  public function moveItem($sourcePath, $destinationPath, $options = null);
88
+
89
  /**
90
  * Rename an item in the storage service to a given name.
91
  *
96
  * @return void
97
  */
98
  public function renameItem($path, $name, $options = null);
99
+
100
  /**
101
  * List items in the given directory in the storage service
102
+ *
103
  * The $path must be a directory
104
  *
105
  *
108
  * @return array A list of item names
109
  */
110
  public function listItems($path, $options = null);
111
+
112
  /**
113
  * Get a key/value array of metadata for the given path.
114
  *
117
  * @return array
118
  */
119
  public function fetchMetadata($path, $options = null);
120
+
121
  /**
122
  * Store a key/value array of metadata at the given path.
123
+ * WARNING: This operation overwrites any metadata that is located at
124
  * $destinationPath.
125
  *
126
  * @param string $destinationPath
128
  * @return void
129
  */
130
  public function storeMetadata($destinationPath, $metadata, $options = null);
131
+
132
  /**
133
  * Delete a key/value array of metadata at the given path.
134
  *
lib/Zend/Cloud/StorageService/Adapter/FileSystem.php CHANGED
@@ -1,267 +1,267 @@
1
- <?php
2
- /**
3
- * LICENSE
4
- *
5
- * This source file is subject to the new BSD license that is bundled
6
- * with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://framework.zend.com/license/new-bsd
9
- * If you did not receive a copy of the license and are unable to
10
- * obtain it through the world-wide-web, please send an email
11
- * to license@zend.com so we can send you a copy immediately.
12
- *
13
- * @category Zend
14
- * @package Zend_Cloud
15
- * @subpackage StorageService
16
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
17
- * @license http://framework.zend.com/license/new-bsd New BSD License
18
- */
19
-
20
- #require_once 'Zend/Cloud/StorageService/Adapter.php';
21
- #require_once 'Zend/Cloud/StorageService/Exception.php';
22
-
23
- /**
24
- * FileSystem adapter for unstructured cloud storage.
25
- *
26
- * @category Zend
27
- * @package Zend_Cloud
28
- * @subpackage StorageService
29
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
30
- * @license http://framework.zend.com/license/new-bsd New BSD License
31
- */
32
- class Zend_Cloud_StorageService_Adapter_FileSystem implements Zend_Cloud_StorageService_Adapter
33
- {
34
-
35
- /**
36
- * Options array keys for the file system adapter.
37
- */
38
- const LOCAL_DIRECTORY = 'local_directory';
39
-
40
- /**
41
- * The directory for the data
42
- * @var string
43
- */
44
- protected $_directory = null;
45
-
46
- /**
47
- * Constructor
48
- *
49
- * @param array|Zend_Config $options
50
- * @return void
51
- */
52
- public function __construct($options = array())
53
- {
54
- if ($options instanceof Zend_Config) {
55
- $options = $options->toArray();
56
- }
57
-
58
- if (!is_array($options)) {
59
- throw new Zend_Cloud_StorageService_Exception('Invalid options provided');
60
- }
61
-
62
- if (isset($options[self::LOCAL_DIRECTORY])) {
63
- $this->_directory = $options[self::LOCAL_DIRECTORY];
64
- } else {
65
- $this->_directory = realpath(sys_get_temp_dir());
66
- }
67
- }
68
-
69
- /**
70
- * Get an item from the storage service.
71
- *
72
- * TODO: Support streaming
73
- *
74
- * @param string $path
75
- * @param array $options
76
- * @return false|string
77
- */
78
- public function fetchItem($path, $options = array())
79
- {
80
- $filepath = $this->_getFullPath($path);
81
- $path = realpath($filepath);
82
-
83
- if (!$path) {
84
- return false;
85
- }
86
-
87
- return file_get_contents($path);
88
- }
89
-
90
- /**
91
- * Store an item in the storage service.
92
- *
93
- * WARNING: This operation overwrites any item that is located at
94
- * $destinationPath.
95
- *
96
- * @TODO Support streams
97
- *
98
- * @param string $destinationPath
99
- * @param mixed $data
100
- * @param array $options
101
- * @return void
102
- */
103
- public function storeItem($destinationPath, $data, $options = array())
104
- {
105
- $path = $this->_getFullPath($destinationPath);
106
- file_put_contents($path, $data);
107
- chmod($path, 0777);
108
- }
109
-
110
- /**
111
- * Delete an item in the storage service.
112
- *
113
- * @param string $path
114
- * @param array $options
115
- * @return void
116
- */
117
- public function deleteItem($path, $options = array())
118
- {
119
- if (!isset($path)) {
120
- return;
121
- }
122
-
123
- $filepath = $this->_getFullPath($path);
124
- if (file_exists($filepath)) {
125
- unlink($filepath);
126
- }
127
- }
128
-
129
- /**
130
- * Copy an item in the storage service to a given path.
131
- *
132
- * WARNING: This operation is *very* expensive for services that do not
133
- * support copying an item natively.
134
- *
135
- * @TODO Support streams for those services that don't support natively
136
- *
137
- * @param string $sourcePath
138
- * @param string $destination path
139
- * @param array $options
140
- * @return void
141
- */
142
- public function copyItem($sourcePath, $destinationPath, $options = array())
143
- {
144
- copy($this->_getFullPath($sourcePath), $this->_getFullPath($destinationPath));
145
- }
146
-
147
- /**
148
- * Move an item in the storage service to a given path.
149
- *
150
- * WARNING: This operation is *very* expensive for services that do not
151
- * support moving an item natively.
152
- *
153
- * @TODO Support streams for those services that don't support natively
154
- *
155
- * @param string $sourcePath
156
- * @param string $destination path
157
- * @param array $options
158
- * @return void
159
- */
160
- public function moveItem($sourcePath, $destinationPath, $options = array())
161
- {
162
- rename($this->_getFullPath($sourcePath), $this->_getFullPath($destinationPath));
163
- }
164
-
165
- /**
166
- * Rename an item in the storage service to a given name.
167
- *
168
- *
169
- * @param string $path
170
- * @param string $name
171
- * @param array $options
172
- * @return void
173
- */
174
- public function renameItem($path, $name, $options = null)
175
- {
176
- rename(
177
- $this->_getFullPath($path),
178
- dirname($this->_getFullPath($path)) . DIRECTORY_SEPARATOR . $name
179
- );
180
- }
181
-
182
- /**
183
- * List items in the given directory in the storage service
184
- *
185
- * The $path must be a directory
186
- *
187
- *
188
- * @param string $path Must be a directory
189
- * @param array $options
190
- * @return array A list of item names
191
- */
192
- public function listItems($path, $options = null)
193
- {
194
- $listing = scandir($this->_getFullPath($path));
195
-
196
- // Remove the hidden navigation directories
197
- $listing = array_diff($listing, array('.', '..'));
198
-
199
- return $listing;
200
- }
201
-
202
- /**
203
- * Get a key/value array of metadata for the given path.
204
- *
205
- * @param string $path
206
- * @param array $options
207
- * @return array
208
- */
209
- public function fetchMetadata($path, $options = array())
210
- {
211
- $fullPath = $this->_getFullPath($path);
212
- $metadata = null;
213
- if (file_exists($fullPath)) {
214
- $metadata = stat(realpath($fullPath));
215
- }
216
-
217
- return isset($metadata) ? $metadata : false;
218
- }
219
-
220
- /**
221
- * Store a key/value array of metadata at the given path.
222
- * WARNING: This operation overwrites any metadata that is located at
223
- * $destinationPath.
224
- *
225
- * @param string $destinationPath
226
- * @param array $options
227
- * @return void
228
- */
229
- public function storeMetadata($destinationPath, $metadata, $options = array())
230
- {
231
- #require_once 'Zend/Cloud/OperationNotAvailableException.php';
232
- throw new Zend_Cloud_OperationNotAvailableException('Storing metadata not implemented');
233
- }
234
-
235
- /**
236
- * Delete a key/value array of metadata at the given path.
237
- *
238
- * @param string $path
239
- * @param array $options
240
- * @return void
241
- */
242
- public function deleteMetadata($path)
243
- {
244
- #require_once 'Zend/Cloud/OperationNotAvailableException.php';
245
- throw new Zend_Cloud_OperationNotAvailableException('Deleting metadata not implemented');
246
- }
247
-
248
- /**
249
- * Return the full path for the file.
250
- *
251
- * @param string $path
252
- * @return string
253
- */
254
- private function _getFullPath($path)
255
- {
256
- return $this->_directory . DIRECTORY_SEPARATOR . $path;
257
- }
258
-
259
- /**
260
- * Get the concrete client.
261
- * @return strings
262
- */
263
- public function getClient()
264
- {
265
- return $this->_directory;
266
- }
267
- }
1
+ <?php
2
+ /**
3
+ * LICENSE
4
+ *
5
+ * This source file is subject to the new BSD license that is bundled
6
+ * with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://framework.zend.com/license/new-bsd
9
+ * If you did not receive a copy of the license and are unable to
10
+ * obtain it through the world-wide-web, please send an email
11
+ * to license@zend.com so we can send you a copy immediately.
12
+ *
13
+ * @category Zend
14
+ * @package Zend_Cloud
15
+ * @subpackage StorageService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
+ * @license http://framework.zend.com/license/new-bsd New BSD License
18
+ */
19
+
20
+ #require_once 'Zend/Cloud/StorageService/Adapter.php';
21
+ #require_once 'Zend/Cloud/StorageService/Exception.php';
22
+
23
+ /**
24
+ * FileSystem adapter for unstructured cloud storage.
25
+ *
26
+ * @category Zend
27
+ * @package Zend_Cloud
28
+ * @subpackage StorageService
29
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30
+ * @license http://framework.zend.com/license/new-bsd New BSD License
31
+ */
32
+ class Zend_Cloud_StorageService_Adapter_FileSystem implements Zend_Cloud_StorageService_Adapter
33
+ {
34
+
35
+ /**
36
+ * Options array keys for the file system adapter.
37
+ */
38
+ const LOCAL_DIRECTORY = 'local_directory';
39
+
40
+ /**
41
+ * The directory for the data
42
+ * @var string
43
+ */
44
+ protected $_directory = null;
45
+
46
+ /**
47
+ * Constructor
48
+ *
49
+ * @param array|Zend_Config $options
50
+ * @return void
51
+ */
52
+ public function __construct($options = array())
53
+ {
54
+ if ($options instanceof Zend_Config) {
55
+ $options = $options->toArray();
56
+ }
57
+
58
+ if (!is_array($options)) {
59
+ throw new Zend_Cloud_StorageService_Exception('Invalid options provided');
60
+ }
61
+
62
+ if (isset($options[self::LOCAL_DIRECTORY])) {
63
+ $this->_directory = $options[self::LOCAL_DIRECTORY];
64
+ } else {
65
+ $this->_directory = realpath(sys_get_temp_dir());
66
+ }
67
+ }
68
+
69
+ /**
70
+ * Get an item from the storage service.
71
+ *
72
+ * TODO: Support streaming
73
+ *
74
+ * @param string $path
75
+ * @param array $options
76
+ * @return false|string
77
+ */
78
+ public function fetchItem($path, $options = array())
79
+ {
80
+ $filepath = $this->_getFullPath($path);
81
+ $path = realpath($filepath);
82
+
83
+ if (!$path || !file_exists($path)) {
84
+ return false;
85
+ }
86
+
87
+ return file_get_contents($path);
88
+ }
89
+
90
+ /**
91
+ * Store an item in the storage service.
92
+ *
93
+ * WARNING: This operation overwrites any item that is located at
94
+ * $destinationPath.
95
+ *
96
+ * @TODO Support streams
97
+ *
98
+ * @param string $destinationPath
99
+ * @param mixed $data
100
+ * @param array $options
101
+ * @return void
102
+ */
103
+ public function storeItem($destinationPath, $data, $options = array())
104
+ {
105
+ $path = $this->_getFullPath($destinationPath);
106
+ file_put_contents($path, $data);
107
+ chmod($path, 0777);
108
+ }
109
+
110
+ /**
111
+ * Delete an item in the storage service.
112
+ *
113
+ * @param string $path
114
+ * @param array $options
115
+ * @return void
116
+ */
117
+ public function deleteItem($path, $options = array())
118
+ {
119
+ if (!isset($path)) {
120
+ return;
121
+ }
122
+
123
+ $filepath = $this->_getFullPath($path);
124
+ if (file_exists($filepath)) {
125
+ unlink($filepath);
126
+ }
127
+ }
128
+
129
+ /**
130
+ * Copy an item in the storage service to a given path.
131
+ *
132
+ * WARNING: This operation is *very* expensive for services that do not
133
+ * support copying an item natively.
134
+ *
135
+ * @TODO Support streams for those services that don't support natively
136
+ *
137
+ * @param string $sourcePath
138
+ * @param string $destination path
139
+ * @param array $options
140
+ * @return void
141
+ */
142
+ public function copyItem($sourcePath, $destinationPath, $options = array())
143
+ {
144
+ copy($this->_getFullPath($sourcePath), $this->_getFullPath($destinationPath));
145
+ }
146
+
147
+ /**
148
+ * Move an item in the storage service to a given path.
149
+ *
150
+ * WARNING: This operation is *very* expensive for services that do not
151
+ * support moving an item natively.
152
+ *
153
+ * @TODO Support streams for those services that don't support natively
154
+ *
155
+ * @param string $sourcePath
156
+ * @param string $destination path
157
+ * @param array $options
158
+ * @return void
159
+ */
160
+ public function moveItem($sourcePath, $destinationPath, $options = array())
161
+ {
162
+ rename($this->_getFullPath($sourcePath), $this->_getFullPath($destinationPath));
163
+ }
164
+
165
+ /**
166
+ * Rename an item in the storage service to a given name.
167
+ *
168
+ *
169
+ * @param string $path
170
+ * @param string $name
171
+ * @param array $options
172
+ * @return void
173
+ */
174
+ public function renameItem($path, $name, $options = null)
175
+ {
176
+ rename(
177
+ $this->_getFullPath($path),
178
+ dirname($this->_getFullPath($path)) . DIRECTORY_SEPARATOR . $name
179
+ );
180
+ }
181
+
182
+ /**
183
+ * List items in the given directory in the storage service
184
+ *
185
+ * The $path must be a directory
186
+ *
187
+ *
188
+ * @param string $path Must be a directory
189
+ * @param array $options
190
+ * @return array A list of item names
191
+ */
192
+ public function listItems($path, $options = null)
193
+ {
194
+ $listing = scandir($this->_getFullPath($path));
195
+
196
+ // Remove the hidden navigation directories
197
+ $listing = array_diff($listing, array('.', '..'));
198
+
199
+ return $listing;
200
+ }
201
+
202
+ /**
203
+ * Get a key/value array of metadata for the given path.
204
+ *
205
+ * @param string $path
206
+ * @param array $options
207
+ * @return array
208
+ */
209
+ public function fetchMetadata($path, $options = array())
210
+ {
211
+ $fullPath = $this->_getFullPath($path);
212
+ $metadata = null;
213
+ if (file_exists($fullPath)) {
214
+ $metadata = stat(realpath($fullPath));
215
+ }
216
+
217
+ return isset($metadata) ? $metadata : false;
218
+ }
219
+
220
+ /**
221
+ * Store a key/value array of metadata at the given path.
222
+ * WARNING: This operation overwrites any metadata that is located at
223
+ * $destinationPath.
224
+ *
225
+ * @param string $destinationPath
226
+ * @param array $options
227
+ * @return void
228
+ */
229
+ public function storeMetadata($destinationPath, $metadata, $options = array())
230
+ {
231
+ #require_once 'Zend/Cloud/OperationNotAvailableException.php';
232
+ throw new Zend_Cloud_OperationNotAvailableException('Storing metadata not implemented');
233
+ }
234
+
235
+ /**
236
+ * Delete a key/value array of metadata at the given path.
237
+ *
238
+ * @param string $path
239
+ * @param array $options
240
+ * @return void
241
+ */
242
+ public function deleteMetadata($path)
243
+ {
244
+ #require_once 'Zend/Cloud/OperationNotAvailableException.php';
245
+ throw new Zend_Cloud_OperationNotAvailableException('Deleting metadata not implemented');
246
+ }
247
+
248
+ /**
249
+ * Return the full path for the file.
250
+ *
251
+ * @param string $path
252
+ * @return string
253
+ */
254
+ private function _getFullPath($path)
255
+ {
256
+ return $this->_directory . DIRECTORY_SEPARATOR . $path;
257
+ }
258
+
259
+ /**
260
+ * Get the concrete client.
261
+ * @return strings
262
+ */
263
+ public function getClient()
264
+ {
265
+ return $this->_directory;
266
+ }
267
+ }
lib/Zend/Cloud/StorageService/Adapter/Nirvanix.php CHANGED
@@ -1,399 +1,399 @@
1
- <?php
2
- /**
3
- * LICENSE
4
- *
5
- * This source file is subject to the new BSD license that is bundled
6
- * with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://framework.zend.com/license/new-bsd
9
- * If you did not receive a copy of the license and are unable to
10
- * obtain it through the world-wide-web, please send an email
11
- * to license@zend.com so we can send you a copy immediately.
12
- *
13
- * @category Zend
14
- * @package Zend_Cloud
15
- * @subpackage StorageService
16
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
17
- * @license http://framework.zend.com/license/new-bsd New BSD License
18
- */
19
-
20
- #require_once 'Zend/Cloud/StorageService/Adapter.php';
21
- #require_once 'Zend/Cloud/StorageService/Exception.php';
22
- #require_once 'Zend/Service/Nirvanix.php';
23
-
24
- /**
25
- * Adapter for Nirvanix cloud storage
26
- *
27
- * @category Zend
28
- * @package Zend_Cloud
29
- * @subpackage StorageService
30
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
31
- * @license http://framework.zend.com/license/new-bsd New BSD License
32
- */
33
- class Zend_Cloud_StorageService_Adapter_Nirvanix
34
- implements Zend_Cloud_StorageService_Adapter
35
- {
36
- const USERNAME = 'auth_username';
37
- const PASSWORD = 'auth_password';
38
- const APP_KEY = 'auth_accesskey';
39
- const REMOTE_DIRECTORY = 'remote_directory';
40
-
41
- /**
42
- * The Nirvanix adapter
43
- * @var Zend_Service_Nirvanix
44
- */
45
- protected $_nirvanix;
46
- protected $_imfNs;
47
- protected $_metadataNs;
48
- protected $_remoteDirectory;
49
- private $maxPageSize = 500;
50
-
51
- /**
52
- * Constructor
53
- *
54
- * @param array|Zend_Config $options
55
- * @return void
56
- */
57
- function __construct($options = array())
58
- {
59
- if ($options instanceof Zend_Config) {
60
- $options = $options->toArray();
61
- }
62
-
63
- if (!is_array($options)) {
64
- throw new Zend_Cloud_StorageService_Exception('Invalid options provided');
65
- }
66
-
67
- $auth = array(
68
- 'username' => $options[self::USERNAME],
69
- 'password' => $options[self::PASSWORD],
70
- 'appKey' => $options[self::APP_KEY],
71
- );
72
- $nirvanix_options = array();
73
- if (isset($options[self::HTTP_ADAPTER])) {
74
- $httpc = new Zend_Http_Client();
75
- $httpc->setAdapter($options[self::HTTP_ADAPTER]);
76
- $nirvanix_options['httpClient'] = $httpc;
77
- }
78
- try {
79
- $this->_nirvanix = new Zend_Service_Nirvanix($auth, $nirvanix_options);
80
- $this->_remoteDirectory = $options[self::REMOTE_DIRECTORY];
81
- $this->_imfNs = $this->_nirvanix->getService('IMFS');
82
- $this->_metadataNs = $this->_nirvanix->getService('Metadata');
83
- } catch (Zend_Service_Nirvanix_Exception $e) {
84
- throw new Zend_Cloud_StorageService_Exception('Error on create: '.$e->getMessage(), $e->getCode(), $e);
85
- }
86
- }
87
-
88
- /**
89
- * Get an item from the storage service.
90
- *
91
- * @param string $path
92
- * @param array $options
93
- * @return mixed
94
- */
95
- public function fetchItem($path, $options = null)
96
- {
97
- $path = $this->_getFullPath($path);
98
- try {
99
- $item = $this->_imfNs->getContents($path);
100
- } catch (Zend_Service_Nirvanix_Exception $e) {
101
- throw new Zend_Cloud_StorageService_Exception('Error on fetch: '.$e->getMessage(), $e->getCode(), $e);
102
- }
103
- return $item;
104
- }
105
-
106
- /**
107
- * Store an item in the storage service.
108
- * WARNING: This operation overwrites any item that is located at
109
- * $destinationPath.
110
- * @param string $destinationPath
111
- * @param mixed $data
112
- * @param array $options
113
- * @return void
114
- */
115
- public function storeItem($destinationPath, $data, $options = null)
116
- {
117
- try {
118
- $path = $this->_getFullPath($destinationPath);
119
- $this->_imfNs->putContents($path, $data);
120
- } catch (Zend_Service_Nirvanix_Exception $e) {
121
- throw new Zend_Cloud_StorageService_Exception('Error on store: '.$e->getMessage(), $e->getCode(), $e);
122
- }
123
- return true;
124
- }
125
-
126
- /**
127
- * Delete an item in the storage service.
128
- *
129
- * @param string $path
130
- * @param array $options
131
- * @return void
132
- */
133
- public function deleteItem($path, $options = null)
134
- {
135
- try {
136
- $path = $this->_getFullPath($path);
137
- $this->_imfNs->unlink($path);
138
- } catch(Zend_Service_Nirvanix_Exception $e) {
139
- // if (trim(strtoupper($e->getMessage())) != 'INVALID PATH') {
140
- // // TODO Differentiate among errors in the Nirvanix adapter
141
- throw new Zend_Cloud_StorageService_Exception('Error on delete: '.$e->getMessage(), $e->getCode(), $e);
142
- }
143
- }
144
-
145
- /**
146
- * Copy an item in the storage service to a given path.
147
- * WARNING: This operation is *very* expensive for services that do not
148
- * support copying an item natively.
149
- *
150
- * @param string $sourcePath
151
- * @param string $destination path
152
- * @param array $options
153
- * @return void
154
- */
155
- public function copyItem($sourcePath, $destinationPath, $options = null)
156
- {
157
- try {
158
- $sourcePath = $this->_getFullPath($sourcePath);
159
- $destinationPath = $this->_getFullPath($destinationPath);
160
- $this->_imfNs->CopyFiles(array('srcFilePath' => $sourcePath,
161
- 'destFolderPath' => $destinationPath));
162
- } catch (Zend_Service_Nirvanix_Exception $e) {
163
- throw new Zend_Cloud_StorageService_Exception('Error on copy: '.$e->getMessage(), $e->getCode(), $e);
164
- }
165
- }
166
-
167
- /**
168
- * Move an item in the storage service to a given path.
169
- * WARNING: This operation is *very* expensive for services that do not
170
- * support moving an item natively.
171
- *
172
- * @param string $sourcePath
173
- * @param string $destination path
174
- * @param array $options
175
- * @return void
176
- */
177
- public function moveItem($sourcePath, $destinationPath, $options = null)
178
- {
179
- try {
180
- $sourcePath = $this->_getFullPath($sourcePath);
181
- $destinationPath = $this->_getFullPath($destinationPath);
182
- $this->_imfNs->RenameFile(array('filePath' => $sourcePath,
183
- 'newFileName' => $destinationPath));
184
- // $this->_imfNs->MoveFiles(array('srcFilePath' => $sourcePath,
185
- // 'destFolderPath' => $destinationPath));
186
- } catch (Zend_Service_Nirvanix_Exception $e) {
187
- throw new Zend_Cloud_StorageService_Exception('Error on move: '.$e->getMessage(), $e->getCode(), $e);
188
- }
189
- }
190
-
191
- /**
192
- * Rename an item in the storage service to a given name.
193
- *
194
- *
195
- * @param string $path
196
- * @param string $name
197
- * @param array $options
198
- * @return void
199
- */
200
- public function renameItem($path, $name, $options = null)
201
- {
202
- #require_once 'Zend/Cloud/OperationNotAvailableException.php';
203
- throw new Zend_Cloud_OperationNotAvailableException('Renaming not implemented');
204
- }
205
-
206
- /**
207
- * Get a key/value array of metadata for the given path.
208
- *
209
- * @param string $path
210
- * @param array $options
211
- * @return array An associative array of key/value pairs specifying the metadata for this object.
212
- * If no metadata exists, an empty array is returned.
213
- */
214
- public function fetchMetadata($path, $options = null)
215
- {
216
- $path = $this->_getFullPath($path);
217
- try {
218
- $metadataNode = $this->_metadataNs->getMetadata(array('path' => $path));
219
- } catch (Zend_Service_Nirvanix_Exception $e) {
220
- throw new Zend_Cloud_StorageService_Exception('Error on fetching metadata: '.$e->getMessage(), $e->getCode(), $e);
221
- }
222
-
223
- $metadata = array();
224
- $length = count($metadataNode->Metadata);
225
-
226
- // Need to special case this as Nirvanix returns an array if there is
227
- // more than one, but doesn't return an array if there is only one.
228
- if ($length == 1)
229
- {
230
- $metadata[(string)$metadataNode->Metadata->Type->value] = (string)$metadataNode->Metadata->Value;
231
- }
232
- else if ($length > 1)
233
- {
234
- for ($i=0; $i<$length; $i++)
235
- {
236
- $metadata[(string)$metadataNode->Metadata[$i]->Type] = (string)$metadataNode->Metadata[$i]->Value;
237
- }
238
- }
239
- return $metadata;
240
- }
241
-
242
- /**
243
- * Store a key/value array of metadata at the given path.
244
- * WARNING: This operation overwrites any metadata that is located at
245
- * $destinationPath.
246
- *
247
- * @param array $metadata - An associative array specifying the key/value pairs for the metadata.
248
- * @param $destinationPath
249
- * @param array $options
250
- * @return void
251
- */
252
- public function storeMetadata($destinationPath, $metadata, $options = null)
253
- {
254
- $destinationPath = $this->_getFullPath($destinationPath);
255
- if ($metadata != null) {
256
- try {
257
- foreach ($metadata AS $key=>$value) {
258
- $metadataString = $key . ":" . $value;
259
- $this->_metadataNs->SetMetadata(array(
260
- 'path' => $destinationPath,
261
- 'metadata' => $metadataString,
262
- ));
263
- }
264
- } catch (Zend_Service_Nirvanix_Exception $e) {
265
- throw new Zend_Cloud_StorageService_Exception('Error on storing metadata: '.$e->getMessage(), $e->getCode(), $e);
266
- }
267
- }
268
- }
269
-
270
- /**
271
- * Delete a key/value array of metadata at the given path.
272
- *
273
- * @param string $path
274
- * @param array $metadata - An associative array specifying the key/value pairs for the metadata
275
- * to be deleted. If null, all metadata associated with the object will
276
- * be deleted.
277
- * @param array $options
278
- * @return void
279
- */
280
- public function deleteMetadata($path, $metadata = null, $options = null)
281
- {
282
- $path = $this->_getFullPath($path);
283
- try {
284
- if ($metadata == null) {
285
- $this->_metadataNs->DeleteAllMetadata(array('path' => $path));
286
- } else {
287
- foreach ($metadata AS $key=>$value) {
288
- $this->_metadataNs->DeleteMetadata(array(
289
- 'path' => $path,
290
- 'metadata' => $key,
291
- ));
292
- }
293
- }
294
- } catch (Zend_Service_Nirvanix_Exception $e) {
295
- throw new Zend_Cloud_StorageService_Exception('Error on deleting metadata: '.$e->getMessage(), $e->getCode(), $e);
296
- }
297
- }
298
-
299
- /*
300
- * Recursively traverse all the folders and build an array that contains
301
- * the path names for each folder.
302
- *
303
- * @param $path - The folder path to get the list of folders from.
304
- * @param &$resultArray - reference to the array that contains the path names
305
- * for each folder.
306
- */
307
- private function getAllFolders($path, &$resultArray)
308
- {
309
- $response = $this->_imfNs->ListFolder(array(
310
- 'folderPath' => $path,
311
- 'pageNumber' => 1,
312
- 'pageSize' => $this->maxPageSize,
313
- ));
314
- $numFolders = $response->ListFolder->TotalFolderCount;
315
- if ($numFolders == 0) {
316
- return;
317
- } else {
318
- //Need to special case this as Nirvanix returns an array if there is
319
- //more than one, but doesn't return an array if there is only one.
320
- if ($numFolders == 1) {
321
- $folderPath = $response->ListFolder->Folder->Path;
322
- array_push($resultArray, $folderPath);
323
- $this->getAllFolders('/' . $folderPath, $resultArray);
324
- } else {
325
- foreach ($response->ListFolder->Folder as $arrayElem) {
326
- $folderPath = $arrayElem->Path;
327
- array_push($resultArray, $folderPath);
328
- $this->getAllFolders('/' . $folderPath, $resultArray);
329
- }
330
- }
331
- }
332
- }
333
-
334
- /**
335
- * Return an array of the items contained in the given path. The items
336
- * returned are the files or objects that in the specified path.
337
- *
338
- * @param string $path
339
- * @param array $options
340
- * @return array
341
- */
342
- public function listItems($path, $options = null)
343
- {
344
- $path = $this->_getFullPath($path);
345
- $resultArray = array();
346
-
347
- if (!isset($path)) {
348
- return false;
349
- } else {
350
- try {
351
- $response = $this->_imfNs->ListFolder(array(
352
- 'folderPath' => $path,
353
- 'pageNumber' => 1,
354
- 'pageSize' => $this->maxPageSize,
355
- ));
356
- } catch (Zend_Service_Nirvanix_Exception $e) {
357
- throw new Zend_Cloud_StorageService_Exception('Error on list: '.$e->getMessage(), $e->getCode(), $e);
358
- }
359
-
360
- $numFiles = $response->ListFolder->TotalFileCount;
361
-
362
- //Add the file names to the array
363
- if ($numFiles != 0) {
364
- //Need to special case this as Nirvanix returns an array if there is
365
- //more than one, but doesn't return an array if there is only one.
366
- if ($numFiles == 1) {
367
- $resultArray[] = (string)$response->ListFolder->File->Name;
368
- }
369
- else {
370
- foreach ($response->ListFolder->File as $arrayElem) {
371
- $resultArray[] = (string) $arrayElem->Name;
372
- }
373
- }
374
- }
375
- }
376
-
377
- return $resultArray;
378
- }
379
-
380
- /**
381
- * Get full path to an object
382
- *
383
- * @param string $path
384
- * @return string
385
- */
386
- private function _getFullPath($path)
387
- {
388
- return $this->_remoteDirectory . $path;
389
- }
390
-
391
- /**
392
- * Get the concrete client.
393
- * @return Zend_Service_Nirvanix
394
- */
395
- public function getClient()
396
- {
397
- return $this->_nirvanix;
398
- }
399
- }
1
+ <?php
2
+ /**
3
+ * LICENSE
4
+ *
5
+ * This source file is subject to the new BSD license that is bundled
6
+ * with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://framework.zend.com/license/new-bsd
9
+ * If you did not receive a copy of the license and are unable to
10
+ * obtain it through the world-wide-web, please send an email
11
+ * to license@zend.com so we can send you a copy immediately.
12
+ *
13
+ * @category Zend
14
+ * @package Zend_Cloud
15
+ * @subpackage StorageService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
+ * @license http://framework.zend.com/license/new-bsd New BSD License
18
+ */
19
+
20
+ #require_once 'Zend/Cloud/StorageService/Adapter.php';
21
+ #require_once 'Zend/Cloud/StorageService/Exception.php';
22
+ #require_once 'Zend/Service/Nirvanix.php';
23
+
24
+ /**
25
+ * Adapter for Nirvanix cloud storage
26
+ *
27
+ * @category Zend
28
+ * @package Zend_Cloud
29
+ * @subpackage StorageService
30
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31
+ * @license http://framework.zend.com/license/new-bsd New BSD License
32
+ */
33
+ class Zend_Cloud_StorageService_Adapter_Nirvanix
34
+ implements Zend_Cloud_StorageService_Adapter
35
+ {
36
+ const USERNAME = 'auth_username';
37
+ const PASSWORD = 'auth_password';
38
+ const APP_KEY = 'auth_accesskey';
39
+ const REMOTE_DIRECTORY = 'remote_directory';
40
+
41
+ /**
42
+ * The Nirvanix adapter
43
+ * @var Zend_Service_Nirvanix
44
+ */
45
+ protected $_nirvanix;
46
+ protected $_imfNs;
47
+ protected $_metadataNs;
48
+ protected $_remoteDirectory;
49
+ private $maxPageSize = 500;
50
+
51
+ /**
52
+ * Constructor
53
+ *
54
+ * @param array|Zend_Config $options
55
+ * @return void
56
+ */
57
+ function __construct($options = array())
58
+ {
59
+ if ($options instanceof Zend_Config) {
60
+ $options = $options->toArray();
61
+ }
62
+
63
+ if (!is_array($options)) {
64
+ throw new Zend_Cloud_StorageService_Exception('Invalid options provided');
65
+ }
66
+
67
+ $auth = array(
68
+ 'username' => $options[self::USERNAME],
69
+ 'password' => $options[self::PASSWORD],
70
+ 'appKey' => $options[self::APP_KEY],
71
+ );
72
+ $nirvanix_options = array();
73
+ if (isset($options[self::HTTP_ADAPTER])) {
74
+ $httpc = new Zend_Http_Client();
75
+ $httpc->setAdapter($options[self::HTTP_ADAPTER]);
76
+ $nirvanix_options['httpClient'] = $httpc;
77
+ }
78
+ try {
79
+ $this->_nirvanix = new Zend_Service_Nirvanix($auth, $nirvanix_options);
80
+ $this->_remoteDirectory = $options[self::REMOTE_DIRECTORY];
81
+ $this->_imfNs = $this->_nirvanix->getService('IMFS');
82
+ $this->_metadataNs = $this->_nirvanix->getService('Metadata');
83
+ } catch (Zend_Service_Nirvanix_Exception $e) {
84
+ throw new Zend_Cloud_StorageService_Exception('Error on create: '.$e->getMessage(), $e->getCode(), $e);
85
+ }
86
+ }
87
+
88
+ /**
89
+ * Get an item from the storage service.
90
+ *
91
+ * @param string $path
92
+ * @param array $options
93
+ * @return mixed
94
+ */
95
+ public function fetchItem($path, $options = null)
96
+ {
97
+ $path = $this->_getFullPath($path);
98
+ try {
99
+ $item = $this->_imfNs->getContents($path);
100
+ } catch (Zend_Service_Nirvanix_Exception $e) {
101
+ throw new Zend_Cloud_StorageService_Exception('Error on fetch: '.$e->getMessage(), $e->getCode(), $e);
102
+ }
103
+ return $item;
104
+ }
105
+
106
+ /**
107
+ * Store an item in the storage service.
108
+ * WARNING: This operation overwrites any item that is located at
109
+ * $destinationPath.
110
+ * @param string $destinationPath
111
+ * @param mixed $data
112
+ * @param array $options
113
+ * @return void
114
+ */
115
+ public function storeItem($destinationPath, $data, $options = null)
116
+ {
117
+ try {
118
+ $path = $this->_getFullPath($destinationPath);
119
+ $this->_imfNs->putContents($path, $data);
120
+ } catch (Zend_Service_Nirvanix_Exception $e) {
121
+ throw new Zend_Cloud_StorageService_Exception('Error on store: '.$e->getMessage(), $e->getCode(), $e);
122
+ }
123
+ return true;
124
+ }
125
+
126
+ /**
127
+ * Delete an item in the storage service.
128
+ *
129
+ * @param string $path
130
+ * @param array $options
131
+ * @return void
132
+ */
133
+ public function deleteItem($path, $options = null)
134
+ {
135
+ try {
136
+ $path = $this->_getFullPath($path);
137
+ $this->_imfNs->unlink($path);
138
+ } catch(Zend_Service_Nirvanix_Exception $e) {
139
+ // if (trim(strtoupper($e->getMessage())) != 'INVALID PATH') {
140
+ // // TODO Differentiate among errors in the Nirvanix adapter
141
+ throw new Zend_Cloud_StorageService_Exception('Error on delete: '.$e->getMessage(), $e->getCode(), $e);
142
+ }
143
+ }
144
+
145
+ /**
146
+ * Copy an item in the storage service to a given path.
147
+ * WARNING: This operation is *very* expensive for services that do not
148
+ * support copying an item natively.
149
+ *
150
+ * @param string $sourcePath
151
+ * @param string $destination path
152
+ * @param array $options
153
+ * @return void
154
+ */
155
+ public function copyItem($sourcePath, $destinationPath, $options = null)
156
+ {
157
+ try {
158
+ $sourcePath = $this->_getFullPath($sourcePath);
159
+ $destinationPath = $this->_getFullPath($destinationPath);
160
+ $this->_imfNs->CopyFiles(array('srcFilePath' => $sourcePath,
161
+ 'destFolderPath' => $destinationPath));
162
+ } catch (Zend_Service_Nirvanix_Exception $e) {
163
+ throw new Zend_Cloud_StorageService_Exception('Error on copy: '.$e->getMessage(), $e->getCode(), $e);
164
+ }
165
+ }
166
+
167
+ /**
168
+ * Move an item in the storage service to a given path.
169
+ * WARNING: This operation is *very* expensive for services that do not
170
+ * support moving an item natively.
171
+ *
172
+ * @param string $sourcePath
173
+ * @param string $destination path
174
+ * @param array $options
175
+ * @return void
176
+ */
177
+ public function moveItem($sourcePath, $destinationPath, $options = null)
178
+ {
179
+ try {
180
+ $sourcePath = $this->_getFullPath($sourcePath);
181
+ $destinationPath = $this->_getFullPath($destinationPath);
182
+ $this->_imfNs->RenameFile(array('filePath' => $sourcePath,
183
+ 'newFileName' => $destinationPath));
184
+ // $this->_imfNs->MoveFiles(array('srcFilePath' => $sourcePath,
185
+ // 'destFolderPath' => $destinationPath));
186
+ } catch (Zend_Service_Nirvanix_Exception $e) {
187
+ throw new Zend_Cloud_StorageService_Exception('Error on move: '.$e->getMessage(), $e->getCode(), $e);
188
+ }
189
+ }
190
+
191
+ /**
192
+ * Rename an item in the storage service to a given name.
193
+ *
194
+ *
195
+ * @param string $path
196
+ * @param string $name
197
+ * @param array $options
198
+ * @return void
199
+ */
200
+ public function renameItem($path, $name, $options = null)
201
+ {
202
+ #require_once 'Zend/Cloud/OperationNotAvailableException.php';
203
+ throw new Zend_Cloud_OperationNotAvailableException('Renaming not implemented');
204
+ }
205
+
206
+ /**
207
+ * Get a key/value array of metadata for the given path.
208
+ *
209
+ * @param string $path
210
+ * @param array $options
211
+ * @return array An associative array of key/value pairs specifying the metadata for this object.
212
+ * If no metadata exists, an empty array is returned.
213
+ */
214
+ public function fetchMetadata($path, $options = null)
215
+ {
216
+ $path = $this->_getFullPath($path);
217
+ try {
218
+ $metadataNode = $this->_metadataNs->getMetadata(array('path' => $path));
219
+ } catch (Zend_Service_Nirvanix_Exception $e) {
220
+ throw new Zend_Cloud_StorageService_Exception('Error on fetching metadata: '.$e->getMessage(), $e->getCode(), $e);
221
+ }
222
+
223
+ $metadata = array();
224
+ $length = count($metadataNode->Metadata);
225
+
226
+ // Need to special case this as Nirvanix returns an array if there is
227
+ // more than one, but doesn't return an array if there is only one.
228
+ if ($length == 1)
229
+ {
230
+ $metadata[(string)$metadataNode->Metadata->Type->value] = (string)$metadataNode->Metadata->Value;
231
+ }
232
+ else if ($length > 1)
233
+ {
234
+ for ($i=0; $i<$length; $i++)
235
+ {
236
+ $metadata[(string)$metadataNode->Metadata[$i]->Type] = (string)$metadataNode->Metadata[$i]->Value;
237
+ }
238
+ }
239
+ return $metadata;
240
+ }
241
+
242
+ /**
243
+ * Store a key/value array of metadata at the given path.
244
+ * WARNING: This operation overwrites any metadata that is located at
245
+ * $destinationPath.
246
+ *
247
+ * @param string $destinationPath
248
+ * @param array $metadata associative array specifying the key/value pairs for the metadata.
249
+ * @param array $options
250
+ * @return void
251
+ */
252
+ public function storeMetadata($destinationPath, $metadata, $options = null)
253
+ {
254
+ $destinationPath = $this->_getFullPath($destinationPath);
255
+ if ($metadata != null) {
256
+ try {
257
+ foreach ($metadata AS $key=>$value) {
258
+ $metadataString = $key . ":" . $value;
259
+ $this->_metadataNs->SetMetadata(array(
260
+ 'path' => $destinationPath,
261
+ 'metadata' => $metadataString,
262
+ ));
263
+ }
264
+ } catch (Zend_Service_Nirvanix_Exception $e) {
265
+ throw new Zend_Cloud_StorageService_Exception('Error on storing metadata: '.$e->getMessage(), $e->getCode(), $e);
266
+ }
267
+ }
268
+ }
269
+
270
+ /**
271
+ * Delete a key/value array of metadata at the given path.
272
+ *
273
+ * @param string $path
274
+ * @param array $metadata - An associative array specifying the key/value pairs for the metadata
275
+ * to be deleted. If null, all metadata associated with the object will
276
+ * be deleted.
277
+ * @param array $options
278
+ * @return void
279
+ */
280
+ public function deleteMetadata($path, $metadata = null, $options = null)
281
+ {
282
+ $path = $this->_getFullPath($path);
283
+ try {
284
+ if ($metadata == null) {
285
+ $this->_metadataNs->DeleteAllMetadata(array('path' => $path));
286
+ } else {
287
+ foreach ($metadata AS $key=>$value) {
288
+ $this->_metadataNs->DeleteMetadata(array(
289
+ 'path' => $path,
290
+ 'metadata' => $key,
291
+ ));
292
+ }
293
+ }
294
+ } catch (Zend_Service_Nirvanix_Exception $e) {
295
+ throw new Zend_Cloud_StorageService_Exception('Error on deleting metadata: '.$e->getMessage(), $e->getCode(), $e);
296
+ }
297
+ }
298
+
299
+ /*
300
+ * Recursively traverse all the folders and build an array that contains
301
+ * the path names for each folder.
302
+ *
303
+ * @param string $path folder path to get the list of folders from.
304
+ * @param array& $resultArray reference to the array that contains the path names
305
+ * for each folder.
306
+ */
307
+ private function getAllFolders($path, &$resultArray)
308
+ {
309
+ $response = $this->_imfNs->ListFolder(array(
310
+ 'folderPath' => $path,
311
+ 'pageNumber' => 1,
312
+ 'pageSize' => $this->maxPageSize,
313
+ ));
314
+ $numFolders = $response->ListFolder->TotalFolderCount;
315
+ if ($numFolders == 0) {
316
+ return;
317
+ } else {
318
+ //Need to special case this as Nirvanix returns an array if there is
319
+ //more than one, but doesn't return an array if there is only one.
320
+ if ($numFolders == 1) {
321
+ $folderPath = $response->ListFolder->Folder->Path;
322
+ array_push($resultArray, $folderPath);
323
+ $this->getAllFolders('/' . $folderPath, $resultArray);
324
+ } else {
325
+ foreach ($response->ListFolder->Folder as $arrayElem) {
326
+ $folderPath = $arrayElem->Path;
327
+ array_push($resultArray, $folderPath);
328
+ $this->getAllFolders('/' . $folderPath, $resultArray);
329
+ }
330
+ }
331
+ }
332
+ }
333
+
334
+ /**
335
+ * Return an array of the items contained in the given path. The items
336
+ * returned are the files or objects that in the specified path.
337
+ *
338
+ * @param string $path
339
+ * @param array $options
340
+ * @return array
341
+ */
342
+ public function listItems($path, $options = null)
343
+ {
344
+ $path = $this->_getFullPath($path);
345
+ $resultArray = array();
346
+
347
+ if (!isset($path)) {
348
+ return false;
349
+ } else {
350
+ try {
351
+ $response = $this->_imfNs->ListFolder(array(
352
+ 'folderPath' => $path,
353
+ 'pageNumber' => 1,
354
+ 'pageSize' => $this->maxPageSize,
355
+ ));
356
+ } catch (Zend_Service_Nirvanix_Exception $e) {
357
+ throw new Zend_Cloud_StorageService_Exception('Error on list: '.$e->getMessage(), $e->getCode(), $e);
358
+ }
359
+
360
+ $numFiles = $response->ListFolder->TotalFileCount;
361
+
362
+ //Add the file names to the array
363
+ if ($numFiles != 0) {
364
+ //Need to special case this as Nirvanix returns an array if there is
365
+ //more than one, but doesn't return an array if there is only one.
366
+ if ($numFiles == 1) {
367
+ $resultArray[] = (string)$response->ListFolder->File->Name;
368
+ }
369
+ else {
370
+ foreach ($response->ListFolder->File as $arrayElem) {
371
+ $resultArray[] = (string) $arrayElem->Name;
372
+ }
373
+ }
374
+ }
375
+ }
376
+
377
+ return $resultArray;
378
+ }
379
+
380
+ /**
381
+ * Get full path to an object
382
+ *
383
+ * @param string $path
384
+ * @return string
385
+ */
386
+ private function _getFullPath($path)
387
+ {
388
+ return $this->_remoteDirectory . $path;
389
+ }
390
+
391
+ /**
392
+ * Get the concrete client.
393
+ * @return Zend_Service_Nirvanix
394
+ */
395
+ public function getClient()
396
+ {
397
+ return $this->_nirvanix;
398
+ }
399
+ }
lib/Zend/Cloud/StorageService/Adapter/Rackspace.php ADDED
@@ -0,0 +1,332 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * LICENSE
4
+ *
5
+ * This source file is subject to the new BSD license that is bundled
6
+ * with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://framework.zend.com/license/new-bsd
9
+ * If you did not receive a copy of the license and are unable to
10
+ * obtain it through the world-wide-web, please send an email
11
+ * to license@zend.com so we can send you a copy immediately.
12
+ *
13
+ * @category Zend
14
+ * @package Zend_Cloud_StorageService
15
+ * @subpackage Adapter
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
+ * @license http://framework.zend.com/license/new-bsd New BSD License
18
+ */
19
+
20
+ #require_once 'Zend/Cloud/StorageService/Adapter.php';
21
+ #require_once 'Zend/Cloud/StorageService/Exception.php';
22
+ #require_once 'Zend/Service/Rackspace/Files.php';
23
+ #require_once 'Zend/Service/Rackspace/Exception.php';
24
+
25
+ /**
26
+ * Adapter for Rackspace cloud storage
27
+ *
28
+ * @category Zend
29
+ * @package Zend_Cloud_StorageService
30
+ * @subpackage Adapter
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
+ * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ */
34
+ class Zend_Cloud_StorageService_Adapter_Rackspace
35
+ implements Zend_Cloud_StorageService_Adapter
36
+ {
37
+ const USER = 'user';
38
+ const API_KEY = 'key';
39
+ const REMOTE_CONTAINER = 'container';
40
+ const DELETE_METADATA_KEY = 'ZF_metadata_deleted';
41
+
42
+ /**
43
+ * The Rackspace adapter
44
+ * @var Zend_Service_Rackspace_Files
45
+ */
46
+ protected $_rackspace;
47
+
48
+ /**
49
+ * Container in which files are stored
50
+ * @var string
51
+ */
52
+ protected $_container = 'default';
53
+
54
+ /**
55
+ * Constructor
56
+ *
57
+ * @param array|Traversable $options
58
+ * @return void
59
+ */
60
+ function __construct($options = array())
61
+ {
62
+ if ($options instanceof Zend_Config) {
63
+ $options = $options->toArray();
64
+ }
65
+
66
+ if (!is_array($options) || empty($options)) {
67
+ throw new Zend_Cloud_StorageService_Exception('Invalid options provided');
68
+ }
69
+
70
+ try {
71
+ $this->_rackspace = new Zend_Service_Rackspace_Files($options[self::USER], $options[self::API_KEY]);
72
+ } catch (Zend_Service_Rackspace_Exception $e) {
73
+ throw new Zend_Cloud_StorageService_Exception('Error on create: '.$e->getMessage(), $e->getCode(), $e);
74
+ }
75
+
76
+ if (isset($options[self::HTTP_ADAPTER])) {
77
+ $this->_rackspace->getHttpClient()->setAdapter($options[self::HTTP_ADAPTER]);
78
+ }
79
+ if (!empty($options[self::REMOTE_CONTAINER])) {
80
+ $this->_container = $options[self::REMOTE_CONTAINER];
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Get an item from the storage service.
86
+ *
87
+ * @param string $path
88
+ * @param array $options
89
+ * @return mixed
90
+ */
91
+ public function fetchItem($path, $options = null)
92
+ {
93
+ $item = $this->_rackspace->getObject($this->_container,$path, $options);
94
+ if (!$this->_rackspace->isSuccessful() && ($this->_rackspace->getErrorCode()!='404')) {
95
+ throw new Zend_Cloud_StorageService_Exception('Error on fetch: '.$this->_rackspace->getErrorMsg());
96
+ }
97
+ if (!empty($item)) {
98
+ return $item->getContent();
99
+ } else {
100
+ return false;
101
+ }
102
+ }
103
+
104
+ /**
105
+ * Store an item in the storage service.
106
+ *
107
+ * @param string $destinationPath
108
+ * @param mixed $data
109
+ * @param array $options
110
+ * @return void
111
+ */
112
+ public function storeItem($destinationPath, $data, $options = null)
113
+ {
114
+ $this->_rackspace->storeObject($this->_container,$destinationPath,$data,$options);
115
+ if (!$this->_rackspace->isSuccessful()) {
116
+ throw new Zend_Cloud_StorageService_Exception('Error on store: '.$this->_rackspace->getErrorMsg());
117
+ }
118
+ }
119
+
120
+ /**
121
+ * Delete an item in the storage service.
122
+ *
123
+ * @param string $path
124
+ * @param array $options
125
+ * @return void
126
+ */
127
+ public function deleteItem($path, $options = null)
128
+ {
129
+ $this->_rackspace->deleteObject($this->_container,$path);
130
+ if (!$this->_rackspace->isSuccessful()) {
131
+ throw new Zend_Cloud_StorageService_Exception('Error on delete: '.$this->_rackspace->getErrorMsg());
132
+ }
133
+ }
134
+
135
+ /**
136
+ * Copy an item in the storage service to a given path.
137
+ *
138
+ * @param string $sourcePath
139
+ * @param string $destination path
140
+ * @param array $options
141
+ * @return void
142
+ */
143
+ public function copyItem($sourcePath, $destinationPath, $options = null)
144
+ {
145
+ $this->_rackspace->copyObject($this->_container,$sourcePath,$this->_container,$destinationPath,$options);
146
+ if (!$this->_rackspace->isSuccessful()) {
147
+ throw new Zend_Cloud_StorageService_Exception('Error on copy: '.$this->_rackspace->getErrorMsg());
148
+ }
149
+ }
150
+
151
+ /**
152
+ * Move an item in the storage service to a given path.
153
+ * WARNING: This operation is *very* expensive for services that do not
154
+ * support moving an item natively.
155
+ *
156
+ * @param string $sourcePath
157
+ * @param string $destination path
158
+ * @param array $options
159
+ * @return void
160
+ */
161
+ public function moveItem($sourcePath, $destinationPath, $options = null)
162
+ {
163
+ try {
164
+ $this->copyItem($sourcePath, $destinationPath, $options);
165
+ } catch (Zend_Service_Rackspace_Exception $e) {
166
+ throw new Zend_Cloud_StorageService_Exception('Error on move: '.$e->getMessage());
167
+ }
168
+ try {
169
+ $this->deleteItem($sourcePath);
170
+ } catch (Zend_Service_Rackspace_Exception $e) {
171
+ $this->deleteItem($destinationPath);
172
+ throw new Zend_Cloud_StorageService_Exception('Error on move: '.$e->getMessage());
173
+ }
174
+ }
175
+
176
+ /**
177
+ * Rename an item in the storage service to a given name.
178
+ *
179
+ * @param string $path
180
+ * @param string $name
181
+ * @param array $options
182
+ * @return void
183
+ */
184
+ public function renameItem($path, $name, $options = null)
185
+ {
186
+ #require_once 'Zend/Cloud/OperationNotAvailableException.php';
187
+ throw new Zend_Cloud_OperationNotAvailableException('Renaming not implemented');
188
+ }
189
+
190
+ /**
191
+ * Get a key/value array of metadata for the given path.
192
+ *
193
+ * @param string $path
194
+ * @param array $options
195
+ * @return array An associative array of key/value pairs specifying the metadata for this object.
196
+ * If no metadata exists, an empty array is returned.
197
+ */
198
+ public function fetchMetadata($path, $options = null)
199
+ {
200
+ $result = $this->_rackspace->getMetadataObject($this->_container,$path);
201
+ if (!$this->_rackspace->isSuccessful()) {
202
+ throw new Zend_Cloud_StorageService_Exception('Error on fetch metadata: '.$this->_rackspace->getErrorMsg());
203
+ }
204
+ $metadata = array();
205
+ if (isset($result['metadata'])) {
206
+ $metadata = $result['metadata'];
207
+ }
208
+ // delete the self::DELETE_METADATA_KEY - this is a trick to remove all
209
+ // the metadata information of an object (see deleteMetadata).
210
+ // Rackspace doesn't have an API to remove the metadata of an object
211
+ unset($metadata[self::DELETE_METADATA_KEY]);
212
+ return $metadata;
213
+ }
214
+
215
+ /**
216
+ * Store a key/value array of metadata at the given path.
217
+ * WARNING: This operation overwrites any metadata that is located at
218
+ * $destinationPath.
219
+ *
220
+ * @param string $destinationPath
221
+ * @param array $metadata associative array specifying the key/value pairs for the metadata.
222
+ * @param array $options
223
+ * @return void
224
+ */
225
+ public function storeMetadata($destinationPath, $metadata, $options = null)
226
+ {
227
+ $this->_rackspace->setMetadataObject($this->_container, $destinationPath, $metadata);
228
+ if (!$this->_rackspace->isSuccessful()) {
229
+ throw new Zend_Cloud_StorageService_Exception('Error on store metadata: '.$this->_rackspace->getErrorMsg());
230
+ }
231
+ }
232
+
233
+ /**
234
+ * Delete a key/value array of metadata at the given path.
235
+ *
236
+ * @param string $path
237
+ * @param array $metadata - An associative array specifying the key/value pairs for the metadata
238
+ * to be deleted. If null, all metadata associated with the object will
239
+ * be deleted.
240
+ * @param array $options
241
+ * @return void
242
+ */
243
+ public function deleteMetadata($path, $metadata = null, $options = null)
244
+ {
245
+ if (empty($metadata)) {
246
+ $newMetadata = array(self::DELETE_METADATA_KEY => true);
247
+ try {
248
+ $this->storeMetadata($path, $newMetadata);
249
+ } catch (Zend_Service_Rackspace_Exception $e) {
250
+ throw new Zend_Cloud_StorageService_Exception('Error on delete metadata: '.$e->getMessage());
251
+ }
252
+ } else {
253
+ try {
254
+ $oldMetadata = $this->fetchMetadata($path);
255
+ } catch (Zend_Service_Rackspace_Exception $e) {
256
+ throw new Zend_Cloud_StorageService_Exception('Error on delete metadata: '.$e->getMessage());
257
+ }
258
+ $newMetadata = array_diff_assoc($oldMetadata, $metadata);
259
+ try {
260
+ $this->storeMetadata($path, $newMetadata);
261
+ } catch (Zend_Service_Rackspace_Exception $e) {
262
+ throw new Zend_Cloud_StorageService_Exception('Error on delete metadata: '.$e->getMessage());
263
+ }
264
+ }
265
+ }
266
+
267
+ /*
268
+ * Recursively traverse all the folders and build an array that contains
269
+ * the path names for each folder.
270
+ *
271
+ * @param string $path folder path to get the list of folders from.
272
+ * @param array& $resultArray reference to the array that contains the path names
273
+ * for each folder.
274
+ * @return void
275
+ */
276
+ private function getAllFolders($path, &$resultArray)
277
+ {
278
+ if (!empty($path)) {
279
+ $options = array (
280
+ 'prefix' => $path
281
+ );
282
+ }
283
+ $files = $this->_rackspace->getObjects($this->_container,$options);
284
+ if (!$this->_rackspace->isSuccessful()) {
285
+ throw new Zend_Cloud_StorageService_Exception('Error on get all folders: '.$this->_rackspace->getErrorMsg());
286
+ }
287
+ $resultArray = array();
288
+ foreach ($files as $file) {
289
+ $resultArray[dirname($file->getName())] = true;
290
+ }
291
+ $resultArray = array_keys($resultArray);
292
+ }
293
+
294
+ /**
295
+ * Return an array of the items contained in the given path. The items
296
+ * returned are the files or objects that in the specified path.
297
+ *
298
+ * @param string $path
299
+ * @param array $options
300
+ * @return array
301
+ */
302
+ public function listItems($path, $options = null)
303
+ {
304
+ if (!empty($path)) {
305
+ $options = array (
306
+ 'prefix' => $path
307
+ );
308
+ }
309
+
310
+ $files = $this->_rackspace->getObjects($this->_container,$options);
311
+ if (!$this->_rackspace->isSuccessful()) {
312
+ throw new Zend_Cloud_StorageService_Exception('Error on list items: '.$this->_rackspace->getErrorMsg());
313
+ }
314
+ $resultArray = array();
315
+ if (!empty($files)) {
316
+ foreach ($files as $file) {
317
+ $resultArray[] = $file->getName();
318
+ }
319
+ }
320
+ return $resultArray;
321
+ }
322
+
323
+ /**
324
+ * Get the concrete client.
325
+ *
326
+ * @return Zend_Service_Rackspace_File
327
+ */
328
+ public function getClient()
329
+ {
330
+ return $this->_rackspace;
331
+ }
332
+ }
lib/Zend/Cloud/StorageService/Adapter/S3.php CHANGED
@@ -1,327 +1,332 @@
1
- <?php
2
- /**
3
- * LICENSE
4
- *
5
- * This source file is subject to the new BSD license that is bundled
6
- * with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://framework.zend.com/license/new-bsd
9
- * If you did not receive a copy of the license and are unable to
10
- * obtain it through the world-wide-web, please send an email
11
- * to license@zend.com so we can send you a copy immediately.
12
- *
13
- * @category Zend
14
- * @package Zend_Cloud
15
- * @subpackage StorageService
16
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
17
- * @license http://framework.zend.com/license/new-bsd New BSD License
18
- */
19
-
20
- #require_once 'Zend/Service/Amazon/S3.php';
21
- #require_once 'Zend/Cloud/StorageService/Adapter.php';
22
- #require_once 'Zend/Cloud/StorageService/Exception.php';
23
-
24
- /**
25
- * S3 adapter for unstructured cloud storage.
26
- *
27
- * @category Zend
28
- * @package Zend_Cloud
29
- * @subpackage StorageService
30
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
31
- * @license http://framework.zend.com/license/new-bsd New BSD License
32
- */
33
- class Zend_Cloud_StorageService_Adapter_S3
34
- implements Zend_Cloud_StorageService_Adapter
35
- {
36
- /*
37
- * Options array keys for the S3 adapter.
38
- */
39
- const BUCKET_NAME = 'bucket_name';
40
- const BUCKET_AS_DOMAIN = 'bucket_as_domain?';
41
- const FETCH_STREAM = 'fetch_stream';
42
- const METADATA = 'metadata';
43
-
44
- /**
45
- * AWS constants
46
- */
47
- const AWS_ACCESS_KEY = 'aws_accesskey';
48
- const AWS_SECRET_KEY = 'aws_secretkey';
49
-
50
- /**
51
- * S3 service instance.
52
- * @var Zend_Service_Amazon_S3
53
- */
54
- protected $_s3;
55
- protected $_defaultBucketName = null;
56
- protected $_defaultBucketAsDomain = false;
57
-
58
- /**
59
- * Constructor
60
- *
61
- * @param array|Zend_Config $options
62
- * @return void
63
- */
64
- public function __construct($options = array())
65
- {
66
- if ($options instanceof Zend_Config) {
67
- $options = $options->toArray();
68
- }
69
-
70
- if (!is_array($options)) {
71
- throw new Zend_Cloud_StorageService_Exception('Invalid options provided');
72
- }
73
-
74
- if (!isset($options[self::AWS_ACCESS_KEY]) || !isset($options[self::AWS_SECRET_KEY])) {
75
- throw new Zend_Cloud_StorageService_Exception('AWS keys not specified!');
76
- }
77
-
78
- try {
79
- $this->_s3 = new Zend_Service_Amazon_S3($options[self::AWS_ACCESS_KEY],
80
- $options[self::AWS_SECRET_KEY]);
81
- } catch (Zend_Service_Amazon_S3_Exception $e) {
82
- throw new Zend_Cloud_StorageService_Exception('Error on create: '.$e->getMessage(), $e->getCode(), $e);
83
- }
84
-
85
- if (isset($options[self::HTTP_ADAPTER])) {
86
- $this->_s3->getHttpClient()->setAdapter($options[self::HTTP_ADAPTER]);
87
- }
88
-
89
- if (isset($options[self::BUCKET_NAME])) {
90
- $this->_defaultBucketName = $options[self::BUCKET_NAME];
91
- }
92
-
93
- if (isset($options[self::BUCKET_AS_DOMAIN])) {
94
- $this->_defaultBucketAsDomain = $options[self::BUCKET_AS_DOMAIN];
95
- }
96
- }
97
-
98
- /**
99
- * Get an item from the storage service.
100
- *
101
- * @TODO Support streams
102
- *
103
- * @param string $path
104
- * @param array $options
105
- * @return string
106
- */
107
- public function fetchItem($path, $options = array())
108
- {
109
- $fullPath = $this->_getFullPath($path, $options);
110
- try {
111
- if (!empty($options[self::FETCH_STREAM])) {
112
- return $this->_s3->getObjectStream($fullPath, $options[self::FETCH_STREAM]);
113
- } else {
114
- return $this->_s3->getObject($fullPath);
115
- }
116
- } catch (Zend_Service_Amazon_S3_Exception $e) {
117
- throw new Zend_Cloud_StorageService_Exception('Error on fetch: '.$e->getMessage(), $e->getCode(), $e);
118
- }
119
- }
120
-
121
- /**
122
- * Store an item in the storage service.
123
- *
124
- * WARNING: This operation overwrites any item that is located at
125
- * $destinationPath.
126
- *
127
- * @TODO Support streams
128
- *
129
- * @param string $destinationPath
130
- * @param string|resource $data
131
- * @param array $options
132
- * @return void
133
- */
134
- public function storeItem($destinationPath, $data, $options = array())
135
- {
136
- try {
137
- $fullPath = $this->_getFullPath($destinationPath, $options);
138
- return $this->_s3->putObject(
139
- $fullPath,
140
- $data,
141
- empty($options[self::METADATA]) ? null : $options[self::METADATA]
142
- );
143
- } catch (Zend_Service_Amazon_S3_Exception $e) {
144
- throw new Zend_Cloud_StorageService_Exception('Error on store: '.$e->getMessage(), $e->getCode(), $e);
145
- }
146
- }
147
-
148
- /**
149
- * Delete an item in the storage service.
150
- *
151
- * @param string $path
152
- * @param array $options
153
- * @return void
154
- */
155
- public function deleteItem($path, $options = array())
156
- {
157
- try {
158
- $this->_s3->removeObject($this->_getFullPath($path, $options));
159
- } catch (Zend_Service_Amazon_S3_Exception $e) {
160
- throw new Zend_Cloud_StorageService_Exception('Error on delete: '.$e->getMessage(), $e->getCode(), $e);
161
- }
162
- }
163
-
164
- /**
165
- * Copy an item in the storage service to a given path.
166
- *
167
- * WARNING: This operation is *very* expensive for services that do not
168
- * support copying an item natively.
169
- *
170
- * @TODO Support streams for those services that don't support natively
171
- *
172
- * @param string $sourcePath
173
- * @param string $destination path
174
- * @param array $options
175
- * @return void
176
- */
177
- public function copyItem($sourcePath, $destinationPath, $options = array())
178
- {
179
- try {
180
- // TODO We *really* need to add support for object copying in the S3 adapter
181
- $item = $this->fetch($_getFullPath(sourcePath), $options);
182
- $this->storeItem($item, $destinationPath, $options);
183
- } catch (Zend_Service_Amazon_S3_Exception $e) {
184
- throw new Zend_Cloud_StorageService_Exception('Error on copy: '.$e->getMessage(), $e->getCode(), $e);
185
- }
186
- }
187
-
188
- /**
189
- * Move an item in the storage service to a given path.
190
- *
191
- * @TODO Support streams for those services that don't support natively
192
- *
193
- * @param string $sourcePath
194
- * @param string $destination path
195
- * @param array $options
196
- * @return void
197
- */
198
- public function moveItem($sourcePath, $destinationPath, $options = array())
199
- {
200
- try {
201
- $fullSourcePath = $this->_getFullPath($sourcePath, $options);
202
- $fullDestPath = $this->_getFullPath($destinationPath, $options);
203
- return $this->_s3->moveObject(
204
- $fullSourcePath,
205
- $fullDestPath,
206
- empty($options[self::METADATA]) ? null : $options[self::METADATA]
207
- );
208
- } catch (Zend_Service_Amazon_S3_Exception $e) {
209
- throw new Zend_Cloud_StorageService_Exception('Error on move: '.$e->getMessage(), $e->getCode(), $e);
210
- }
211
- }
212
-
213
- /**
214
- * Rename an item in the storage service to a given name.
215
- *
216
- *
217
- * @param string $path
218
- * @param string $name
219
- * @param array $options
220
- * @return void
221
- */
222
- public function renameItem($path, $name, $options = null)
223
- {
224
- #require_once 'Zend/Cloud/OperationNotAvailableException.php';
225
- throw new Zend_Cloud_OperationNotAvailableException('Rename not implemented');
226
- }
227
-
228
- /**
229
- * List items in the given directory in the storage service
230
- *
231
- * The $path must be a directory
232
- *
233
- *
234
- * @param string $path Must be a directory
235
- * @param array $options
236
- * @return array A list of item names
237
- */
238
- public function listItems($path, $options = null)
239
- {
240
- try {
241
- // TODO Support 'prefix' parameter for Zend_Service_Amazon_S3::getObjectsByBucket()
242
- return $this->_s3->getObjectsByBucket($this->_defaultBucketName);
243
- } catch (Zend_Service_Amazon_S3_Exception $e) {
244
- throw new Zend_Cloud_StorageService_Exception('Error on list: '.$e->getMessage(), $e->getCode(), $e);
245
- }
246
- }
247
-
248
- /**
249
- * Get a key/value array of metadata for the given path.
250
- *
251
- * @param string $path
252
- * @param array $options
253
- * @return array
254
- */
255
- public function fetchMetadata($path, $options = array())
256
- {
257
- try {
258
- return $this->_s3->getInfo($this->_getFullPath($path, $options));
259
- } catch (Zend_Service_Amazon_S3_Exception $e) {
260
- throw new Zend_Cloud_StorageService_Exception('Error on fetch: '.$e->getMessage(), $e->getCode(), $e);
261
- }
262
- }
263
-
264
- /**
265
- * Store a key/value array of metadata at the given path.
266
- * WARNING: This operation overwrites any metadata that is located at
267
- * $destinationPath.
268
- *
269
- * @param string $destinationPath
270
- * @param array $options
271
- * @return void
272
- */
273
- public function storeMetadata($destinationPath, $metadata, $options = array())
274
- {
275
- #require_once 'Zend/Cloud/OperationNotAvailableException.php';
276
- throw new Zend_Cloud_OperationNotAvailableException('Storing separate metadata is not supported, use storeItem() with \'metadata\' option key');
277
- }
278
-
279
- /**
280
- * Delete a key/value array of metadata at the given path.
281
- *
282
- * @param string $path
283
- * @param array $options
284
- * @return void
285
- */
286
- public function deleteMetadata($path)
287
- {
288
- #require_once 'Zend/Cloud/OperationNotAvailableException.php';
289
- throw new Zend_Cloud_OperationNotAvailableException('Deleting metadata not supported');
290
- }
291
-
292
- /**
293
- * Get full path, including bucket, for an object
294
- *
295
- * @param string $path
296
- * @param array $options
297
- * @return void
298
- */
299
- protected function _getFullPath($path, $options)
300
- {
301
- if (isset($options[self::BUCKET_NAME])) {
302
- $bucket = $options[self::BUCKET_NAME];
303
- } else if (isset($this->_defaultBucketName)) {
304
- $bucket = $this->_defaultBucketName;
305
- } else {
306
- #require_once 'Zend/Cloud/StorageService/Exception.php';
307
- throw new Zend_Cloud_StorageService_Exception('Bucket name must be specified for S3 adapter.');
308
- }
309
-
310
- if (isset($options[self::BUCKET_AS_DOMAIN])) {
311
- // TODO: support bucket domain names
312
- #require_once 'Zend/Cloud/StorageService/Exception.php';
313
- throw new Zend_Cloud_StorageService_Exception('The S3 adapter does not currently support buckets in domain names.');
314
- }
315
-
316
- return trim($bucket) . '/' . trim($path);
317
- }
318
-
319
- /**
320
- * Get the concrete client.
321
- * @return Zend_Service_Amazon_S3
322
- */
323
- public function getClient()
324
- {
325
- return $this->_s3;
326
- }
327
- }
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * LICENSE
4
+ *
5
+ * This source file is subject to the new BSD license that is bundled
6
+ * with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://framework.zend.com/license/new-bsd
9
+ * If you did not receive a copy of the license and are unable to
10
+ * obtain it through the world-wide-web, please send an email
11
+ * to license@zend.com so we can send you a copy immediately.
12
+ *
13
+ * @category Zend
14
+ * @package Zend_Cloud
15
+ * @subpackage StorageService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
+ * @license http://framework.zend.com/license/new-bsd New BSD License
18
+ */
19
+
20
+ #require_once 'Zend/Service/Amazon/S3.php';
21
+ #require_once 'Zend/Cloud/StorageService/Adapter.php';
22
+ #require_once 'Zend/Cloud/StorageService/Exception.php';
23
+
24
+ /**
25
+ * S3 adapter for unstructured cloud storage.
26
+ *
27
+ * @category Zend
28
+ * @package Zend_Cloud
29
+ * @subpackage StorageService
30
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31
+ * @license http://framework.zend.com/license/new-bsd New BSD License
32
+ */
33
+ class Zend_Cloud_StorageService_Adapter_S3
34
+ implements Zend_Cloud_StorageService_Adapter
35
+ {
36
+ /*
37
+ * Options array keys for the S3 adapter.
38
+ */
39
+ const BUCKET_NAME = 'bucket_name';
40
+ const BUCKET_AS_DOMAIN = 'bucket_as_domain?';
41
+ const FETCH_STREAM = 'fetch_stream';
42
+ const METADATA = 'metadata';
43
+
44
+ /**
45
+ * AWS constants
46
+ */
47
+ const AWS_ACCESS_KEY = 'aws_accesskey';
48
+ const AWS_SECRET_KEY = 'aws_secretkey';
49
+
50
+ /**
51
+ * S3 service instance.
52
+ * @var Zend_Service_Amazon_S3
53
+ */
54
+ protected $_s3;
55
+ protected $_defaultBucketName = null;
56
+ protected $_defaultBucketAsDomain = false;
57
+
58
+ /**
59
+ * Constructor
60
+ *
61
+ * @param array|Zend_Config $options
62
+ * @return void
63
+ */
64
+ public function __construct($options = array())
65
+ {
66
+ if ($options instanceof Zend_Config) {
67
+ $options = $options->toArray();
68
+ }
69
+
70
+ if (!is_array($options)) {
71
+ throw new Zend_Cloud_StorageService_Exception('Invalid options provided');
72
+ }
73
+
74
+ if (!isset($options[self::AWS_ACCESS_KEY]) || !isset($options[self::AWS_SECRET_KEY])) {
75
+ throw new Zend_Cloud_StorageService_Exception('AWS keys not specified!');
76
+ }
77
+
78
+ try {
79
+ $this->_s3 = new Zend_Service_Amazon_S3($options[self::AWS_ACCESS_KEY],
80
+ $options[self::AWS_SECRET_KEY]);
81
+ } catch (Zend_Service_Amazon_S3_Exception $e) {
82
+ throw new Zend_Cloud_StorageService_Exception('Error on create: '.$e->getMessage(), $e->getCode(), $e);
83
+ }
84
+
85
+ if (isset($options[self::HTTP_ADAPTER])) {
86
+ $this->_s3->getHttpClient()->setAdapter($options[self::HTTP_ADAPTER]);
87
+ }
88
+
89
+ if (isset($options[self::BUCKET_NAME])) {
90
+ $this->_defaultBucketName = $options[self::BUCKET_NAME];
91
+ }
92
+
93
+ if (isset($options[self::BUCKET_AS_DOMAIN])) {
94
+ $this->_defaultBucketAsDomain = $options[self::BUCKET_AS_DOMAIN];
95
+ }
96
+ }
97
+
98
+ /**
99
+ * Get an item from the storage service.
100
+ *
101
+ * @TODO Support streams
102
+ *
103
+ * @param string $path
104
+ * @param array $options
105
+ * @return string
106
+ */
107
+ public function fetchItem($path, $options = array())
108
+ {
109
+ $fullPath = $this->_getFullPath($path, $options);
110
+ try {
111
+ if (!empty($options[self::FETCH_STREAM])) {
112
+ return $this->_s3->getObjectStream($fullPath, $options[self::FETCH_STREAM]);
113
+ } else {
114
+ return $this->_s3->getObject($fullPath);
115
+ }
116
+ } catch (Zend_Service_Amazon_S3_Exception $e) {
117
+ throw new Zend_Cloud_StorageService_Exception('Error on fetch: '.$e->getMessage(), $e->getCode(), $e);
118
+ }
119
+ }
120
+
121
+ /**
122
+ * Store an item in the storage service.
123
+ *
124
+ * WARNING: This operation overwrites any item that is located at
125
+ * $destinationPath.
126
+ *
127
+ * @TODO Support streams
128
+ *
129
+ * @param string $destinationPath
130
+ * @param string|resource $data
131
+ * @param array $options
132
+ * @return void
133
+ */
134
+ public function storeItem($destinationPath, $data, $options = array())
135
+ {
136
+ try {
137
+ $fullPath = $this->_getFullPath($destinationPath, $options);
138
+ return $this->_s3->putObject(
139
+ $fullPath,
140
+ $data,
141
+ empty($options[self::METADATA]) ? null : $options[self::METADATA]
142
+ );
143
+ } catch (Zend_Service_Amazon_S3_Exception $e) {
144
+ throw new Zend_Cloud_StorageService_Exception('Error on store: '.$e->getMessage(), $e->getCode(), $e);
145
+ }
146
+ }
147
+
148
+ /**
149
+ * Delete an item in the storage service.
150
+ *
151
+ * @param string $path
152
+ * @param array $options
153
+ * @return void
154
+ */
155
+ public function deleteItem($path, $options = array())
156
+ {
157
+ try {
158
+ $this->_s3->removeObject($this->_getFullPath($path, $options));
159
+ } catch (Zend_Service_Amazon_S3_Exception $e) {
160
+ throw new Zend_Cloud_StorageService_Exception('Error on delete: '.$e->getMessage(), $e->getCode(), $e);
161
+ }
162
+ }
163
+
164
+ /**
165
+ * Copy an item in the storage service to a given path.
166
+ *
167
+ * WARNING: This operation is *very* expensive for services that do not
168
+ * support copying an item natively.
169
+ *
170
+ * @TODO Support streams for those services that don't support natively
171
+ *
172
+ * @param string $sourcePath
173
+ * @param string $destination path
174
+ * @param array $options
175
+ * @return void
176
+ */
177
+ public function copyItem($sourcePath, $destinationPath, $options = array())
178
+ {
179
+ try {
180
+ $fullSourcePath = $this->_getFullPath($sourcePath, $options);
181
+ $fullDestPath = $this->_getFullPath($destinationPath, $options);
182
+ return $this->_s3->copyObject(
183
+ $fullSourcePath,
184
+ $fullDestPath,
185
+ empty($options[self::METADATA]) ? null : $options[self::METADATA]
186
+ );
187
+
188
+ } catch (Zend_Service_Amazon_S3_Exception $e) {
189
+ throw new Zend_Cloud_StorageService_Exception('Error on copy: '.$e->getMessage(), $e->getCode(), $e);
190
+ }
191
+ }
192
+
193
+ /**
194
+ * Move an item in the storage service to a given path.
195
+ *
196
+ * @TODO Support streams for those services that don't support natively
197
+ *
198
+ * @param string $sourcePath
199
+ * @param string $destination path
200
+ * @param array $options
201
+ * @return void
202
+ */
203
+ public function moveItem($sourcePath, $destinationPath, $options = array())
204
+ {
205
+ try {
206
+ $fullSourcePath = $this->_getFullPath($sourcePath, $options);
207
+ $fullDestPath = $this->_getFullPath($destinationPath, $options);
208
+ return $this->_s3->moveObject(
209
+ $fullSourcePath,
210
+ $fullDestPath,
211
+ empty($options[self::METADATA]) ? null : $options[self::METADATA]
212
+ );
213
+ } catch (Zend_Service_Amazon_S3_Exception $e) {
214
+ throw new Zend_Cloud_StorageService_Exception('Error on move: '.$e->getMessage(), $e->getCode(), $e);
215
+ }
216
+ }
217
+
218
+ /**
219
+ * Rename an item in the storage service to a given name.
220
+ *
221
+ *
222
+ * @param string $path
223
+ * @param string $name
224
+ * @param array $options
225
+ * @return void
226
+ */
227
+ public function renameItem($path, $name, $options = null)
228
+ {
229
+ #require_once 'Zend/Cloud/OperationNotAvailableException.php';
230
+ throw new Zend_Cloud_OperationNotAvailableException('Rename not implemented');
231
+ }
232
+
233
+ /**
234
+ * List items in the given directory in the storage service
235
+ *
236
+ * The $path must be a directory
237
+ *
238
+ *
239
+ * @param string $path Must be a directory
240
+ * @param array $options
241
+ * @return array A list of item names
242
+ */
243
+ public function listItems($path, $options = null)
244
+ {
245
+ try {
246
+ // TODO Support 'prefix' parameter for Zend_Service_Amazon_S3::getObjectsByBucket()
247
+ return $this->_s3->getObjectsByBucket($this->_defaultBucketName);
248
+ } catch (Zend_Service_Amazon_S3_Exception $e) {
249
+ throw new Zend_Cloud_StorageService_Exception('Error on list: '.$e->getMessage(), $e->getCode(), $e);
250
+ }
251
+ }
252
+
253
+ /**
254
+ * Get a key/value array of metadata for the given path.
255
+ *
256
+ * @param string $path
257
+ * @param array $options
258
+ * @return array
259
+ */
260
+ public function fetchMetadata($path, $options = array())
261
+ {
262
+ try {
263
+ return $this->_s3->getInfo($this->_getFullPath($path, $options));
264
+ } catch (Zend_Service_Amazon_S3_Exception $e) {
265
+ throw new Zend_Cloud_StorageService_Exception('Error on fetch: '.$e->getMessage(), $e->getCode(), $e);
266
+ }
267
+ }
268
+
269
+ /**
270
+ * Store a key/value array of metadata at the given path.
271
+ * WARNING: This operation overwrites any metadata that is located at
272
+ * $destinationPath.
273
+ *
274
+ * @param string $destinationPath
275
+ * @param array $options
276
+ * @return void
277
+ */
278
+ public function storeMetadata($destinationPath, $metadata, $options = array())
279
+ {
280
+ #require_once 'Zend/Cloud/OperationNotAvailableException.php';
281
+ throw new Zend_Cloud_OperationNotAvailableException('Storing separate metadata is not supported, use storeItem() with \'metadata\' option key');
282
+ }
283
+
284
+ /**
285
+ * Delete a key/value array of metadata at the given path.
286
+ *
287
+ * @param string $path
288
+ * @param array $options
289
+ * @return void
290
+ */
291
+ public function deleteMetadata($path)
292
+ {
293
+ #require_once 'Zend/Cloud/OperationNotAvailableException.php';
294
+ throw new Zend_Cloud_OperationNotAvailableException('Deleting metadata not supported');
295
+ }
296
+
297
+ /**
298
+ * Get full path, including bucket, for an object
299
+ *
300
+ * @param string $path
301
+ * @param array $options
302
+ * @return void
303
+ */
304
+ protected function _getFullPath($path, $options)
305
+ {
306
+ if (isset($options[self::BUCKET_NAME])) {
307
+ $bucket = $options[self::BUCKET_NAME];
308
+ } else if (isset($this->_defaultBucketName)) {
309
+ $bucket = $this->_defaultBucketName;
310
+ } else {
311
+ #require_once 'Zend/Cloud/StorageService/Exception.php';
312
+ throw new Zend_Cloud_StorageService_Exception('Bucket name must be specified for S3 adapter.');
313
+ }
314
+
315
+ if (isset($options[self::BUCKET_AS_DOMAIN])) {
316
+ // TODO: support bucket domain names
317
+ #require_once 'Zend/Cloud/StorageService/Exception.php';
318
+ throw new Zend_Cloud_StorageService_Exception('The S3 adapter does not currently support buckets in domain names.');
319
+ }
320
+
321
+ return trim($bucket) . '/' . trim($path);
322
+ }
323
+
324
+ /**
325
+ * Get the concrete client.
326
+ * @return Zend_Service_Amazon_S3
327
+ */
328
+ public function getClient()
329
+ {
330
+ return $this->_s3;
331
+ }
332
+ }
lib/Zend/Cloud/StorageService/Adapter/WindowsAzure.php CHANGED
@@ -1,443 +1,443 @@
1
- <?php
2
- /**
3
- * LICENSE
4
- *
5
- * This source file is subject to the new BSD license that is bundled
6
- * with this package in the file LICENSE.txt.
7
- * It is also available through the world-wide-web at this URL:
8
- * http://framework.zend.com/license/new-bsd
9
- * If you did not receive a copy of the license and are unable to
10
- * obtain it through the world-wide-web, please send an email
11
- * to license@zend.com so we can send you a copy immediately.
12
- *
13
- * @category Zend
14
- * @package Zend_Cloud
15
- * @subpackage StorageService
16
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
17
- * @license http://framework.zend.com/license/new-bsd New BSD License
18
- */
19
-
20
- #require_once 'Zend/Cloud/StorageService/Adapter.php';
21
- #require_once 'Zend/Service/WindowsAzure/Storage/Blob.php';
22
- #require_once 'Zend/Cloud/StorageService/Exception.php';
23
-
24
- /**
25
- *
26
- * Windows Azure Blob Service abstraction
27
- *
28
- * @category Zend
29
- * @package Zend_Cloud
30
- * @subpackage StorageService
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
- * @license http://framework.zend.com/license/new-bsd New BSD License
33
- */
34
- class Zend_Cloud_StorageService_Adapter_WindowsAzure
35
- implements Zend_Cloud_StorageService_Adapter
36
- {
37
- const ACCOUNT_NAME = 'storage_accountname';
38
- const ACCOUNT_KEY = 'storage_accountkey';
39
- const HOST = "storage_host";
40
- const PROXY_HOST = "storage_proxy_host";
41
- const PROXY_PORT = "storage_proxy_port";
42
- const PROXY_CREDENTIALS = "storage_proxy_credentials";
43
- const CONTAINER = "storage_container";
44
- const RETURN_TYPE = 'return_type';
45
- const RETURN_PATHNAME = 'return_path';
46
- const RETURN_OPENMODE = 'return_openmode';
47
-
48
- /** return types for fetch */
49
- const RETURN_PATH = 1; // return filename
50
- const RETURN_STRING = 2; // return data as string
51
- const RETURN_STREAM = 3; // return PHP stream
52
-
53
- /** return types for list */
54
- const RETURN_LIST = 1; // return native list
55
- const RETURN_NAMES = 2; // return only names
56
-
57
- const DEFAULT_HOST = Zend_Service_WindowsAzure_Storage::URL_CLOUD_BLOB;
58
-
59
- /**
60
- * Storage container to operate on
61
- *
62
- * @var string
63
- */
64
- protected $_container;
65
-
66
- /**
67
- * Storage client
68
- *
69
- * @var Zend_Service_WindowsAzure_Storage_Blob
70
- */
71
- protected $_storageClient = null;
72
-
73
- /**
74
- * Creates a new Zend_Cloud_Storage_WindowsAzure instance
75
- *
76
- * @param array|Zend_Config $options Options for the Zend_Cloud_Storage_WindowsAzure instance
77
- */
78
- public function __construct($options = array())
79
- {
80
- if ($options instanceof Zend_Config) {
81
- $options = $options->toArray();
82
- }
83
-
84
- if (!is_array($options)) {
85
- throw new Zend_Cloud_StorageService_Exception('Invalid options provided');
86
- }
87
-
88
- // Build Zend_Service_WindowsAzure_Storage_Blob instance
89
- if (!isset($options[self::HOST])) {
90
- $host = self::DEFAULT_HOST;
91
- } else {
92
- $host = $options[self::HOST];
93
- }
94
-
95
- if (!isset($options[self::ACCOUNT_NAME])) {
96
- throw new Zend_Cloud_StorageService_Exception('No Windows Azure account name provided.');
97
- }
98
- if (!isset($options[self::ACCOUNT_KEY])) {
99
- throw new Zend_Cloud_StorageService_Exception('No Windows Azure account key provided.');
100
- }
101
-
102
- $this->_storageClient = new Zend_Service_WindowsAzure_Storage_Blob($host,
103
- $options[self::ACCOUNT_NAME], $options[self::ACCOUNT_KEY]);
104
-
105
- // Parse other options
106
- if (!empty($options[self::PROXY_HOST])) {
107
- $proxyHost = $options[self::PROXY_HOST];
108
- $proxyPort = isset($options[self::PROXY_PORT]) ? $options[self::PROXY_PORT] : 8080;
109
- $proxyCredentials = isset($options[self::PROXY_CREDENTIALS]) ? $options[self::PROXY_CREDENTIALS] : '';
110
-
111
- $this->_storageClient->setProxy(true, $proxyHost, $proxyPort, $proxyCredentials);
112
- }
113
-
114
- if (isset($options[self::HTTP_ADAPTER])) {
115
- $this->_storageClient->setHttpClientChannel($options[self::HTTP_ADAPTER]);
116
- }
117
-
118
- // Set container
119
- $this->_container = $options[self::CONTAINER];
120
-
121
- // Make sure the container exists
122
- if (!$this->_storageClient->containerExists($this->_container)) {
123
- $this->_storageClient->createContainer($this->_container);
124
- }
125
- }
126
-
127
- /**
128
- * Get an item from the storage service.
129
- *
130
- * @param string $path
131
- * @param array $options
132
- * @return mixed
133
- */
134
- public function fetchItem($path, $options = null)
135
- {
136
- // Options
137
- $returnType = self::RETURN_STRING;
138
- $returnPath = tempnam('', 'azr');
139
- $openMode = 'r';
140
-
141
- // Parse options
142
- if (is_array($options)) {
143
- if (isset($options[self::RETURN_TYPE])) {
144
- $returnType = $options[self::RETURN_TYPE];
145
- }
146
-
147
- if (isset($options[self::RETURN_PATHNAME])) {
148
- $returnPath = $options[self::RETURN_PATHNAME];
149
- }
150
-
151
- if (isset($options[self::RETURN_OPENMODE])) {
152
- $openMode = $options[self::RETURN_OPENMODE];
153
- }
154
- }
155
-
156
- // Fetch the blob
157
- try {
158
- $this->_storageClient->getBlob(
159
- $this->_container,
160
- $path,
161
- $returnPath
162
- );
163
- } catch (Zend_Service_WindowsAzure_Exception $e) {
164
- if (strpos($e->getMessage(), "does not exist") !== false) {
165
- return false;
166
- }
167
- throw new Zend_Cloud_StorageService_Exception('Error on fetch: '.$e->getMessage(), $e->getCode(), $e);
168
- }
169
-
170
- // Return value
171
- if ($returnType == self::RETURN_PATH) {
172
- return $returnPath;
173
- }
174
- if ($returnType == self::RETURN_STRING) {
175
- return file_get_contents($returnPath);
176
- }
177
- if ($returnType == self::RETURN_STREAM) {
178
- return fopen($returnPath, $openMode);
179
- }
180
- }
181
-
182
- /**
183
- * Store an item in the storage service.
184
- * WARNING: This operation overwrites any item that is located at
185
- * $destinationPath.
186
- * @param string $destinationPath
187
- * @param mixed $data
188
- * @param array $options
189
- * @return boolean
190
- */
191
- public function storeItem($destinationPath, $data, $options = null)
192
- {
193
- // Create a temporary file that will be uploaded
194
- $temporaryFilePath = '';
195
- $removeTemporaryFilePath = false;
196
-
197
- if (is_resource($data)) {
198
- $temporaryFilePath = tempnam('', 'azr');
199
- $fpDestination = fopen($temporaryFilePath, 'w');
200
-
201
- $fpSource = $data;
202
- rewind($fpSource);
203
- while (!feof($fpSource)) {
204
- fwrite($fpDestination, fread($fpSource, 8192));
205
- }
206
-
207
- fclose($fpDestination);
208
-
209
- $removeTemporaryFilePath = true;
210
- } elseif (file_exists($data)) {
211
- $temporaryFilePath = $data;
212
- $removeTemporaryFilePath = false;
213
- } else {
214
- $temporaryFilePath = tempnam('', 'azr');
215
- file_put_contents($temporaryFilePath, $data);
216
- $removeTemporaryFilePath = true;
217
- }
218
-
219
- try {
220
- // Upload data
221
- $this->_storageClient->putBlob(
222
- $this->_container,
223
- $destinationPath,
224
- $temporaryFilePath
225
- );
226
- } catch(Zend_Service_WindowsAzure_Exception $e) {
227
- @unlink($temporaryFilePath);
228
- throw new Zend_Cloud_StorageService_Exception('Error on store: '.$e->getMessage(), $e->getCode(), $e);
229
- }
230
- if ($removeTemporaryFilePath) {
231
- @unlink($temporaryFilePath);
232
- }
233
- }
234
-
235
- /**
236
- * Delete an item in the storage service.
237
- *
238
- * @param string $path
239
- * @param array $options
240
- * @return void
241
- */
242
- public function deleteItem($path, $options = null)
243
- {
244
- try {
245
- $this->_storageClient->deleteBlob(
246
- $this->_container,
247
- $path
248
- );
249
- } catch (Zend_Service_WindowsAzure_Exception $e) {
250
- throw new Zend_Cloud_StorageService_Exception('Error on delete: '.$e->getMessage(), $e->getCode(), $e);
251
- }
252
- }
253
-
254
- /**
255
- * Copy an item in the storage service to a given path.
256
- *
257
- * @param string $sourcePath
258
- * @param string $destinationPath
259
- * @param array $options
260
- * @return void
261
- */
262
- public function copyItem($sourcePath, $destinationPath, $options = null)
263
- {
264
- try {
265
- $this->_storageClient->copyBlob(
266
- $this->_container,
267
- $sourcePath,
268
- $this->_container,
269
- $destinationPath
270
- );
271
- } catch (Zend_Service_WindowsAzure_Exception $e) {
272
- throw new Zend_Cloud_StorageService_Exception('Error on copy: '.$e->getMessage(), $e->getCode(), $e);
273
- }
274
- }
275
-
276
- /**
277
- * Move an item in the storage service to a given path.
278
- *
279
- * @param string $sourcePath
280
- * @param string $destinationPath
281
- * @param array $options
282
- * @return void
283
- */
284
- public function moveItem($sourcePath, $destinationPath, $options = null)
285
- {
286
- try {
287
- $this->_storageClient->copyBlob(
288
- $this->_container,
289
- $sourcePath,
290
- $this->_container,
291
- $destinationPath
292
- );
293
-
294
- $this->_storageClient->deleteBlob(
295
- $this->_container,
296
- $sourcePath
297
- );
298
- } catch (Zend_Service_WindowsAzure_Exception $e) {
299
- throw new Zend_Cloud_StorageService_Exception('Error on move: '.$e->getMessage(), $e->getCode(), $e);
300
- }
301
-
302
- }
303
-
304
- /**
305
- * Rename an item in the storage service to a given name.
306
- *
307
- *
308
- * @param string $path
309
- * @param string $name
310
- * @param array $options
311
- * @return void
312
- */
313
- public function renameItem($path, $name, $options = null)
314
- {
315
- return $this->moveItem($path, $name, $options);
316
- }
317
-
318
- /**
319
- * List items in the given directory in the storage service
320
- *
321
- * The $path must be a directory
322
- *
323
- *
324
- * @param string $path Must be a directory
325
- * @param array $options
326
- * @return array A list of item names
327
- */
328
- public function listItems($path, $options = null)
329
- {
330
- // Options
331
- $returnType = self::RETURN_NAMES; // 1: return list of paths, 2: return raw output from underlying provider
332
-
333
- // Parse options
334
- if (is_array($options)&& isset($options[self::RETURN_TYPE])) {
335
- $returnType = $options[self::RETURN_TYPE];
336
- }
337
-
338
- try {
339
- // Fetch list
340
- $blobList = $this->_storageClient->listBlobs(
341
- $this->_container,
342
- $path
343
- );
344
- } catch (Zend_Service_WindowsAzure_Exception $e) {
345
- throw new Zend_Cloud_StorageService_Exception('Error on list: '.$e->getMessage(), $e->getCode(), $e);
346
- }
347
-
348
- // Return
349
- if ($returnType == self::RETURN_LIST) {
350
- return $blobList;
351
- }
352
-
353
- $returnValue = array();
354
- foreach ($blobList as $blob) {
355
- $returnValue[] = $blob->Name;
356
- }
357
-
358
- return $returnValue;
359
- }
360
-
361
- /**
362
- * Get a key/value array of metadata for the given path.
363
- *
364
- * @param string $path
365
- * @param array $options
366
- * @return array
367
- */
368
- public function fetchMetadata($path, $options = null)
369
- {
370
- try {
371
- return $this->_storageClient->getBlobMetaData(
372
- $this->_container,
373
- $path
374
- );
375
- } catch (Zend_Service_WindowsAzure_Exception $e) {
376
- if (strpos($e->getMessage(), "could not be accessed") !== false) {
377
- return false;
378
- }
379
- throw new Zend_Cloud_StorageService_Exception('Error on fetch: '.$e->getMessage(), $e->getCode(), $e);
380
- }
381
- }
382
-
383
- /**
384
- * Store a key/value array of metadata at the given path.
385
- * WARNING: This operation overwrites any metadata that is located at
386
- * $destinationPath.
387
- *
388
- * @param string $destinationPath
389
- * @param array $options
390
- * @return void
391
- */
392
- public function storeMetadata($destinationPath, $metadata, $options = null)
393
- {
394
- try {
395
- $this->_storageClient->setBlobMetadata($this->_container, $destinationPath, $metadata);
396
- } catch (Zend_Service_WindowsAzure_Exception $e) {
397
- if (strpos($e->getMessage(), "could not be accessed") === false) {
398
- throw new Zend_Cloud_StorageService_Exception('Error on store metadata: '.$e->getMessage(), $e->getCode(), $e);
399
- }
400
- }
401
- }
402
-
403
- /**
404
- * Delete a key/value array of metadata at the given path.
405
- *
406
- * @param string $path
407
- * @param array $options
408
- * @return void
409
- */
410
- public function deleteMetadata($path, $options = null)
411
- {
412
- try {
413
- $this->_storageClient->setBlobMetadata($this->_container, $destinationPath, array());
414
- } catch (Zend_Service_WindowsAzure_Exception $e) {
415
- if (strpos($e->getMessage(), "could not be accessed") === false) {
416
- throw new Zend_Cloud_StorageService_Exception('Error on delete metadata: '.$e->getMessage(), $e->getCode(), $e);
417
- }
418
- }
419
- }
420
-
421
- /**
422
- * Delete container
423
- *
424
- * @return void
425
- */
426
- public function deleteContainer()
427
- {
428
- try {
429
- $this->_storageClient->deleteContainer($this->_container);
430
- } catch (Zend_Service_WindowsAzure_Exception $e) {
431
- throw new Zend_Cloud_StorageService_Exception('Error on delete: '.$e->getMessage(), $e->getCode(), $e);
432
- }
433
- }
434
-
435
- /**
436
- * Get the concrete adapter.
437
- * @return Zend_Service_Azure_Storage_Blob
438
- */
439
- public function getClient()
440
- {
441
- return $this->_storageClient;
442
- }
443
- }
1
+ <?php
2
+ /**
3
+ * LICENSE
4
+ *
5
+ * This source file is subject to the new BSD license that is bundled
6
+ * with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://framework.zend.com/license/new-bsd
9
+ * If you did not receive a copy of the license and are unable to
10
+ * obtain it through the world-wide-web, please send an email
11
+ * to license@zend.com so we can send you a copy immediately.
12
+ *
13
+ * @category Zend
14
+ * @package Zend_Cloud
15
+ * @subpackage StorageService
16
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
17
+ * @license http://framework.zend.com/license/new-bsd New BSD License
18
+ */
19
+
20
+ #require_once 'Zend/Cloud/StorageService/Adapter.php';
21
+ #require_once 'Zend/Service/WindowsAzure/Storage/Blob.php';
22
+ #require_once 'Zend/Cloud/StorageService/Exception.php';
23
+
24
+ /**
25
+ *
26
+ * Windows Azure Blob Service abstraction
27
+ *
28
+ * @category Zend
29
+ * @package Zend_Cloud
30
+ * @subpackage StorageService
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
+ * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ */
34
+ class Zend_Cloud_StorageService_Adapter_WindowsAzure
35
+ implements Zend_Cloud_StorageService_Adapter
36
+ {
37
+ const ACCOUNT_NAME = 'storage_accountname';
38
+ const ACCOUNT_KEY = 'storage_accountkey';
39
+ const HOST = "storage_host";
40
+ const PROXY_HOST = "storage_proxy_host";
41
+ const PROXY_PORT = "storage_proxy_port";
42
+ const PROXY_CREDENTIALS = "storage_proxy_credentials";
43
+ const CONTAINER = "storage_container";
44
+ const RETURN_TYPE = 'return_type';
45
+ const RETURN_PATHNAME = 'return_path';
46
+ const RETURN_OPENMODE = 'return_openmode';
47
+
48
+ /** return types for fetch */
49
+ const RETURN_PATH = 1; // return filename
50
+ const RETURN_STRING = 2; // return data as string
51
+ const RETURN_STREAM = 3; // return PHP stream
52
+
53
+ /** return types for list */
54
+ const RETURN_LIST = 1; // return native list
55
+ const RETURN_NAMES = 2; // return only names
56
+
57
+ const DEFAULT_HOST = Zend_Service_WindowsAzure_Storage::URL_CLOUD_BLOB;
58
+
59
+ /**
60
+ * Storage container to operate on
61
+ *
62
+ * @var string
63
+ */
64
+ protected $_container;
65
+
66
+ /**
67
+ * Storage client
68
+ *
69
+ * @var Zend_Service_WindowsAzure_Storage_Blob
70
+ */
71
+ protected $_storageClient = null;
72
+
73
+ /**
74
+ * Creates a new Zend_Cloud_Storage_WindowsAzure instance
75
+ *
76
+ * @param array|Zend_Config $options Options for the Zend_Cloud_Storage_WindowsAzure instance
77
+ */
78
+ public function __construct($options = array())
79
+ {
80
+ if ($options instanceof Zend_Config) {
81
+ $options = $options->toArray();
82
+ }
83
+
84
+ if (!is_array($options)) {
85
+ throw new Zend_Cloud_StorageService_Exception('Invalid options provided');
86
+ }
87
+
88
+ // Build Zend_Service_WindowsAzure_Storage_Blob instance
89
+ if (!isset($options[self::HOST])) {
90
+ $host = self::DEFAULT_HOST;
91
+ } else {
92
+ $host = $options[self::HOST];
93
+ }
94
+
95
+ if (!isset($options[self::ACCOUNT_NAME])) {
96
+ throw new Zend_Cloud_StorageService_Exception('No Windows Azure account name provided.');
97
+ }
98
+ if (!isset($options[self::ACCOUNT_KEY])) {
99
+ throw new Zend_Cloud_StorageService_Exception('No Windows Azure account key provided.');
100
+ }
101
+
102
+ $this->_storageClient = new Zend_Service_WindowsAzure_Storage_Blob($host,
103
+ $options[self::ACCOUNT_NAME], $options[self::ACCOUNT_KEY]);
104
+
105
+ // Parse other options
106
+ if (!empty($options[self::PROXY_HOST])) {
107
+ $proxyHost = $options[self::PROXY_HOST];
108
+ $proxyPort = isset($options[self::PROXY_PORT]) ? $options[self::PROXY_PORT] : 8080;
109
+ $proxyCredentials = isset($options[self::PROXY_CREDENTIALS]) ? $options[self::PROXY_CREDENTIALS] : '';
110
+
111
+ $this->_storageClient->setProxy(true, $proxyHost, $proxyPort, $proxyCredentials);
112
+ }
113
+
114
+ if (isset($options[self::HTTP_ADAPTER])) {
115
+ $this->_storageClient->setHttpClientChannel($options[self::HTTP_ADAPTER]);
116
+ }
117
+
118
+ // Set container
119
+ $this->_container = $options[self::CONTAINER];
120
+
121
+ // Make sure the container exists
122
+ if (!$this->_storageClient->containerExists($this->_container)) {
123
+ $this->_storageClient->createContainer($this->_container);
124
+ }
125
+ }
126
+
127
+ /**
128
+ * Get an item from the storage service.
129
+ *
130
+ * @param string $path
131
+ * @param array $options
132
+ * @return mixed
133
+ */
134
+ public function fetchItem($path, $options = null)
135
+ {
136
+ // Options
137
+ $returnType = self::RETURN_STRING;
138
+ $returnPath = tempnam('', 'azr');
139
+ $openMode = 'r';
140
+
141
+ // Parse options
142
+ if (is_array($options)) {
143
+ if (isset($options[self::RETURN_TYPE])) {
144
+ $returnType = $options[self::RETURN_TYPE];
145
+ }
146
+
147
+ if (isset($options[self::RETURN_PATHNAME])) {
148
+ $returnPath = $options[self::RETURN_PATHNAME];
149
+ }
150
+
151
+ if (isset($options[self::RETURN_OPENMODE])) {
152
+ $openMode = $options[self::RETURN_OPENMODE];
153
+ }
154
+ }
155
+
156
+ // Fetch the blob
157
+ try {
158
+ $this->_storageClient->getBlob(
159
+ $this->_container,
160
+ $path,
161
+ $returnPath
162
+ );
163
+ } catch (Zend_Service_WindowsAzure_Exception $e) {
164
+ if (strpos($e->getMessage(), "does not exist") !== false) {
165
+ return false;
166
+ }
167
+ throw new Zend_Cloud_StorageService_Exception('Error on fetch: '.$e->getMessage(), $e->getCode(), $e);
168
+ }
169
+
170
+ // Return value
171
+ if ($returnType == self::RETURN_PATH) {
172
+ return $returnPath;
173
+ }
174
+ if ($returnType == self::RETURN_STRING) {
175
+ return file_get_contents($returnPath);
176
+ }
177
+ if ($returnType == self::RETURN_STREAM) {
178
+ return fopen($returnPath, $openMode);
179
+ }
180
+ }
181
+
182
+ /**
183
+ * Store an item in the storage service.
184
+ * WARNING: This operation overwrites any item that is located at
185
+ * $destinationPath.
186
+ * @param string $destinationPath
187
+ * @param mixed $data
188
+ * @param array $options
189
+ * @return boolean
190
+ */
191
+ public function storeItem($destinationPath, $data, $options = null)
192
+ {
193
+ // Create a temporary file that will be uploaded
194
+ $temporaryFilePath = '';
195
+ $removeTemporaryFilePath = false;
196
+
197
+ if (is_resource($data)) {
198
+ $temporaryFilePath = tempnam('', 'azr');
199
+ $fpDestination = fopen($temporaryFilePath, 'w');
200
+
201
+ $fpSource = $data;
202
+ rewind($fpSource);
203
+ while (!feof($fpSource)) {
204
+ fwrite($fpDestination, fread($fpSource, 8192));
205
+ }
206
+
207
+ fclose($fpDestination);
208
+
209
+ $removeTemporaryFilePath = true;
210
+ } elseif (file_exists($data)) {
211
+ $temporaryFilePath = $data;
212
+ $removeTemporaryFilePath = false;
213
+ } else {
214
+ $temporaryFilePath = tempnam('', 'azr');
215
+ file_put_contents($temporaryFilePath, $data);
216
+ $removeTemporaryFilePath = true;
217
+ }
218
+
219
+ try {
220
+ // Upload data
221
+ $this->_storageClient->putBlob(
222
+ $this->_container,
223
+ $destinationPath,
224
+ $temporaryFilePath
225
+ );
226
+ } catch(Zend_Service_WindowsAzure_Exception $e) {
227
+ @unlink($temporaryFilePath);
228
+ throw new Zend_Cloud_StorageService_Exception('Error on store: '.$e->getMessage(), $e->getCode(), $e);
229
+ }
230
+ if ($removeTemporaryFilePath) {
231
+ @unlink($temporaryFilePath);
232
+ }
233
+ }
234
+
235
+ /**
236
+ * Delete an item in the storage service.
237
+ *
238
+ * @param string $path
239
+ * @param array $options
240
+ * @return void
241
+ */
242
+ public function deleteItem($path, $options = null)
243
+ {
244
+ try {
245
+ $this->_storageClient->deleteBlob(
246
+ $this->_container,
247
+ $path
248
+ );
249
+ } catch (Zend_Service_WindowsAzure_Exception $e) {
250
+ throw new Zend_Cloud_StorageService_Exception('Error on delete: '.$e->getMessage(), $e->getCode(), $e);
251
+ }
252
+ }
253
+
254
+ /**
255
+ * Copy an item in the storage service to a given path.
256
+ *
257
+ * @param string $sourcePath
258
+ * @param string $destinationPath
259
+ * @param array $options
260
+ * @return void
261
+ */
262
+ public function copyItem($sourcePath, $destinationPath, $options = null)
263
+ {
264
+ try {
265
+ $this->_storageClient->copyBlob(
266
+ $this->_container,
267
+ $sourcePath,
268
+ $this->_container,
269
+ $destinationPath
270
+ );
271
+ } catch (Zend_Service_WindowsAzure_Exception $e) {
272
+ throw new Zend_Cloud_StorageService_Exception('Error on copy: '.$e->getMessage(), $e->getCode(), $e);
273
+ }
274
+ }
275
+
276
+ /**
277
+ * Move an item in the storage service to a given path.
278
+ *
279
+ * @param string $sourcePath
280
+ * @param string $destinationPath
281
+ * @param array $options
282
+ * @return void
283
+ */
284
+ public function moveItem($sourcePath, $destinationPath, $options = null)
285
+ {
286
+ try {
287
+ $this->_storageClient->copyBlob(
288
+ $this->_container,
289
+ $sourcePath,
290
+ $this->_container,
291
+ $destinationPath
292
+ );
293
+
294
+ $this->_storageClient->deleteBlob(
295
+ $this->_container,
296
+ $sourcePath
297
+ );
298
+ } catch (Zend_Service_WindowsAzure_Exception $e) {
299
+ throw new Zend_Cloud_StorageService_Exception('Error on move: '.$e->getMessage(), $e->getCode(), $e);
300
+ }
301
+
302
+ }
303
+
304
+ /**
305
+ * Rename an item in the storage service to a given name.
306
+ *
307
+ *
308
+ * @param string $path
309
+ * @param string $name
310
+ * @param array $options
311
+ * @return void
312
+ */
313
+ public function renameItem($path, $name, $options = null)
314
+ {
315
+ return $this->moveItem($path, $name, $options);
316
+ }
317
+
318
+ /**
319
+ * List items in the given directory in the storage service
320
+ *
321
+ * The $path must be a directory
322
+ *
323
+ *
324
+ * @param string $path Must be a directory
325
+ * @param array $options
326
+ * @return array A list of item names
327
+ */
328
+ public function listItems($path, $options = null)
329
+ {
330
+ // Options
331
+ $returnType = self::RETURN_NAMES; // 1: return list of paths, 2: return raw output from underlying provider
332
+
333
+ // Parse options
334
+ if (is_array($options)&& isset($options[self::RETURN_TYPE])) {
335
+ $returnType = $options[self::RETURN_TYPE];
336
+ }
337
+
338
+ try {
339
+ // Fetch list
340
+ $blobList = $this->_storageClient->listBlobs(
341
+ $this->_container,
342
+ $path
343
+ );
344
+ } catch (Zend_Service_WindowsAzure_Exception $e) {
345
+ throw new Zend_Cloud_StorageService_Exception('Error on list: '.$e->getMessage(), $e->getCode(), $e);
346
+ }
347
+
348
+ // Return
349
+ if ($returnType == self::RETURN_LIST) {
350
+ return $blobList;
351
+ }
352
+
353
+ $returnValue = array();
354
+ foreach ($blobList as $blob) {
355
+ $returnValue[] = $blob->Name;
356
+ }
357
+
358
+ return $returnValue;
359
+ }
360
+
361
+ /**
362
+ * Get a key/value array of metadata for the given path.
363
+ *
364
+ * @param string $path
365
+ * @param array $options
366
+ * @return array
367
+ */
368
+ public function fetchMetadata($path, $options = null)
369
+ {
370
+ try {
371
+ return $this->_storageClient->getBlobMetaData(
372
+ $this->_container,
373
+ $path
374
+ );
375
+ } catch (Zend_Service_WindowsAzure_Exception $e) {
376
+ if (strpos($e->getMessage(), "could not be accessed") !== false) {
377
+ return false;
378
+ }
379
+ throw new Zend_Cloud_StorageService_Exception('Error on fetch: '.$e->getMessage(), $e->getCode(), $e);
380
+ }
381
+ }
382
+
383
+ /**
384
+ * Store a key/value array of metadata at the given path.
385
+ * WARNING: This operation overwrites any metadata that is located at
386
+ * $destinationPath.
387
+ *
388
+ * @param string $destinationPath
389
+ * @param array $options
390
+ * @return void
391
+ */
392
+ public function storeMetadata($destinationPath, $metadata, $options = null)
393
+ {
394
+ try {
395
+ $this->_storageClient->setBlobMetadata($this->_container, $destinationPath, $metadata);
396
+ } catch (Zend_Service_WindowsAzure_Exception $e) {
397
+ if (strpos($e->getMessage(), "could not be accessed") === false) {
398
+ throw new Zend_Cloud_StorageService_Exception('Error on store metadata: '.$e->getMessage(), $e->getCode(), $e);
399
+ }
400
+ }
401
+ }
402
+
403
+ /**
404
+ * Delete a key/value array of metadata at the given path.
405
+ *
406
+ * @param string $path
407
+ * @param array $options
408
+ * @return void
409
+ */
410
+ public function deleteMetadata($path, $options = null)
411
+ {
412
+ try {
413
+ $this->_storageClient->setBlobMetadata($this->_container, $destinationPath, array());
414
+ } catch (Zend_Service_WindowsAzure_Exception $e) {
415
+ if (strpos($e->getMessage(), "could not be accessed") === false) {
416
+ throw new Zend_Cloud_StorageService_Exception('Error on delete metadata: '.$e->getMessage(), $e->getCode(), $e);
417
+ }
418
+ }
419
+ }
420
+
421
+ /**
422
+ * Delete container
423
+ *
424
+ * @return void
425
+ */
426
+ public function deleteContainer()
427
+ {
428
+ try {
429
+ $this->_storageClient->deleteContainer($this->_container);
430
+ } catch (Zend_Service_WindowsAzure_Exception $e) {
431
+ throw new Zend_Cloud_StorageService_Exception('Error on delete: '.$e->getMessage(), $e->getCode(), $e);
432
+ }
433
+ }
434
+
435
+ /**
436
+ * Get the concrete adapter.
437
+ * @return Zend_Service_Azure_Storage_Blob
438
+ */
439
+ public function getClient()
440
+ {
441
+ return $this->_storageClient;
442
+ }
443
+ }
lib/Zend/Cloud/StorageService/Exception.php CHANGED
@@ -1,38 +1,38 @@
1
- <?php
2
- /**
3
- * Zend Framework
4
- *
5
- * LICENSE
6
- *
7
- * This source file is subject to the new BSD license that is bundled
8
- * with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://framework.zend.com/license/new-bsd
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@zend.com so we can send you a copy immediately.
14
- *
15
- * @category Zend
16
- * @package Zend_Cloud
17
- * @subpackage StorageService
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
- * @license http://framework.zend.com/license/new-bsd New BSD License
20
- */
21
-
22
-
23
- /**
24
- * Zend_Cloud_Exception
25
- */
26
- #require_once 'Zend/Cloud/Exception.php';
27
-
28
-
29
- /**
30
- * @category Zend
31
- * @package Zend_Cloud
32
- * @subpackage StorageService
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
- * @license http://framework.zend.com/license/new-bsd New BSD License
35
- */
36
- class Zend_Cloud_StorageService_Exception extends Zend_Cloud_Exception
37
- {}
38
-
1
+ <?php
2
+ /**
3
+ * Zend Framework
4
+ *
5
+ * LICENSE
6
+ *
7
+ * This source file is subject to the new BSD license that is bundled
8
+ * with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://framework.zend.com/license/new-bsd
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@zend.com so we can send you a copy immediately.
14
+ *
15
+ * @category Zend
16
+ * @package Zend_Cloud
17
+ * @subpackage StorageService
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
+ * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ */
21
+
22
+
23
+ /**
24
+ * Zend_Cloud_Exception
25
+ */
26
+ #require_once 'Zend/Cloud/Exception.php';
27
+
28
+
29
+ /**
30
+ * @category Zend
31
+ * @package Zend_Cloud
32
+ * @subpackage StorageService
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
+ * @license http://framework.zend.com/license/new-bsd New BSD License
35
+ */
36
+ class Zend_Cloud_StorageService_Exception extends Zend_Cloud_Exception
37
+ {}
38
+
lib/Zend/Cloud/StorageService/Factory.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Cloud
17
  * @subpackage StorageService
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -25,34 +25,34 @@
25
  * @category Zend
26
  * @package Zend_Cloud
27
  * @subpackage StorageService
28
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
29
  * @license http://framework.zend.com/license/new-bsd New BSD License
30
  */
31
  class Zend_Cloud_StorageService_Factory extends Zend_Cloud_AbstractFactory
32
  {
33
  const STORAGE_ADAPTER_KEY = 'storage_adapter';
34
-
35
  /**
36
  * @var string Interface which adapter must implement to be considered valid
37
  */
38
  protected static $_adapterInterface = 'Zend_Cloud_StorageService_Adapter';
39
  /**
40
  * Constructor
41
- *
42
  * @return void
43
  */
44
  private function __construct()
45
  {
46
  // private ctor - should not be used
47
  }
48
-
49
  /**
50
  * Retrieve StorageService adapter
51
- *
52
- * @param array $options
53
- * @return void
54
  */
55
- public static function getAdapter($options = array())
56
  {
57
  $adapter = parent::_getAdapter(self::STORAGE_ADAPTER_KEY, $options);
58
  if (!$adapter) {
15
  * @category Zend
16
  * @package Zend_Cloud
17
  * @subpackage StorageService
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
25
  * @category Zend
26
  * @package Zend_Cloud
27
  * @subpackage StorageService
28
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
29
  * @license http://framework.zend.com/license/new-bsd New BSD License
30
  */
31
  class Zend_Cloud_StorageService_Factory extends Zend_Cloud_AbstractFactory
32
  {
33
  const STORAGE_ADAPTER_KEY = 'storage_adapter';
34
+
35
  /**
36
  * @var string Interface which adapter must implement to be considered valid
37
  */
38
  protected static $_adapterInterface = 'Zend_Cloud_StorageService_Adapter';
39
  /**
40
  * Constructor
41
+ *
42
  * @return void
43
  */
44
  private function __construct()
45
  {
46
  // private ctor - should not be used
47
  }
48
+
49
  /**
50
  * Retrieve StorageService adapter
51
+ *
52
+ * @param array $options
53
+ * @return Zend_Cloud_StorageService_Adapter
54
  */
55
+ public static function getAdapter($options = array())
56
  {
57
  $adapter = parent::_getAdapter(self::STORAGE_ADAPTER_KEY, $options);
58
  if (!$adapter) {
lib/Zend/CodeGenerator/Abstract.php CHANGED
@@ -15,15 +15,15 @@
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_CodeGenerator
26
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  abstract class Zend_CodeGenerator_Abstract
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_CodeGenerator
26
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  abstract class Zend_CodeGenerator_Abstract
lib/Zend/CodeGenerator/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -28,7 +28,7 @@
28
  /**
29
  * @category Zend
30
  * @package Zend_CodeGenerator
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_CodeGenerator_Exception extends Zend_Exception
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
28
  /**
29
  * @category Zend
30
  * @package Zend_CodeGenerator
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_CodeGenerator_Exception extends Zend_Exception
lib/Zend/CodeGenerator/Php/Abstract.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -28,7 +28,7 @@
28
  /**
29
  * @category Zend
30
  * @package Zend_CodeGenerator
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  abstract class Zend_CodeGenerator_Php_Abstract extends Zend_CodeGenerator_Abstract
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
28
  /**
29
  * @category Zend
30
  * @package Zend_CodeGenerator
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  abstract class Zend_CodeGenerator_Php_Abstract extends Zend_CodeGenerator_Abstract
lib/Zend/CodeGenerator/Php/Body.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Body.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -28,7 +28,7 @@
28
  /**
29
  * @category Zend
30
  * @package Zend_CodeGenerator
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_CodeGenerator_Php_Body extends Zend_CodeGenerator_Abstract
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Body.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
28
  /**
29
  * @category Zend
30
  * @package Zend_CodeGenerator
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_CodeGenerator_Php_Body extends Zend_CodeGenerator_Abstract
lib/Zend/CodeGenerator/Php/Class.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Class.php 21915 2010-04-16 20:40:15Z matthew $
21
  */
22
 
23
  /**
@@ -48,7 +48,7 @@
48
  /**
49
  * @category Zend
50
  * @package Zend_CodeGenerator
51
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
52
  * @license http://framework.zend.com/license/new-bsd New BSD License
53
  */
54
  class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
@@ -84,6 +84,11 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
84
  */
85
  protected $_properties = null;
86
 
 
 
 
 
 
87
  /**
88
  * @var array Array of methods
89
  */
@@ -156,7 +161,7 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
156
 
157
  if (is_array($docblock)) {
158
  $docblock = new Zend_CodeGenerator_Php_Docblock($docblock);
159
- } elseif (!$docblock instanceof Zend_CodeGenerator_Php_Docblock) {
160
  #require_once 'Zend/CodeGenerator/Php/Exception.php';
161
  throw new Zend_CodeGenerator_Php_Exception('setDocblock() is expecting either a string, array or an instance of Zend_CodeGenerator_Php_Docblock');
162
  }
@@ -278,6 +283,21 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
278
  return $this;
279
  }
280
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
  /**
282
  * setProperty()
283
  *
@@ -296,6 +316,9 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
296
  throw new Zend_CodeGenerator_Php_Exception('setProperty() expects either an array of property options or an instance of Zend_CodeGenerator_Php_Property');
297
  }
298
 
 
 
 
299
  if (isset($this->_properties[$propertyName])) {
300
  #require_once 'Zend/CodeGenerator/Php/Exception.php';
301
  throw new Zend_CodeGenerator_Php_Exception('A property by name ' . $propertyName . ' already exists in this class.');
@@ -305,6 +328,37 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
305
  return $this;
306
  }
307
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  /**
309
  * getProperties()
310
  *
@@ -315,6 +369,16 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
315
  return $this->_properties;
316
  }
317
 
 
 
 
 
 
 
 
 
 
 
318
  /**
319
  * getProperty()
320
  *
@@ -331,6 +395,22 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
331
  return false;
332
  }
333
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  /**
335
  * hasProperty()
336
  *
@@ -342,6 +422,17 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
342
  return isset($this->_properties[$propertyName]);
343
  }
344
 
 
 
 
 
 
 
 
 
 
 
 
345
  /**
346
  * setMethods()
347
  *
@@ -437,6 +528,12 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
437
  }
438
  }
439
 
 
 
 
 
 
 
440
  foreach ($this->_methods as $method) {
441
  if ($method->isSourceDirty()) {
442
  return true;
@@ -481,6 +578,13 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
481
 
482
  $output .= self::LINE_FEED . '{' . self::LINE_FEED . self::LINE_FEED;
483
 
 
 
 
 
 
 
 
484
  $properties = $this->getProperties();
485
  if (!empty($properties)) {
486
  foreach ($properties as $property) {
@@ -507,6 +611,7 @@ class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
507
  protected function _init()
508
  {
509
  $this->_properties = new Zend_CodeGenerator_Php_Member_Container(Zend_CodeGenerator_Php_Member_Container::TYPE_PROPERTY);
 
510
  $this->_methods = new Zend_CodeGenerator_Php_Member_Container(Zend_CodeGenerator_Php_Member_Container::TYPE_METHOD);
511
  }
512
 
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Class.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
48
  /**
49
  * @category Zend
50
  * @package Zend_CodeGenerator
51
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
52
  * @license http://framework.zend.com/license/new-bsd New BSD License
53
  */
54
  class Zend_CodeGenerator_Php_Class extends Zend_CodeGenerator_Php_Abstract
84
  */
85
  protected $_properties = null;
86
 
87
+ /**
88
+ * @var array Array of constants
89
+ */
90
+ protected $_constants = null;
91
+
92
  /**
93
  * @var array Array of methods
94
  */
161
 
162
  if (is_array($docblock)) {
163
  $docblock = new Zend_CodeGenerator_Php_Docblock($docblock);
164
+ } elseif ((!is_null($docblock)) && (!$docblock instanceof Zend_CodeGenerator_Php_Docblock)) {
165
  #require_once 'Zend/CodeGenerator/Php/Exception.php';
166
  throw new Zend_CodeGenerator_Php_Exception('setDocblock() is expecting either a string, array or an instance of Zend_CodeGenerator_Php_Docblock');
167
  }
283
  return $this;
284
  }
285
 
286
+ /**
287
+ * setConstants()
288
+ *
289
+ * @param array $constants
290
+ * @return Zend_CodeGenerator_Php_Class
291
+ */
292
+ public function setConstants(Array $constants)
293
+ {
294
+ foreach ($constants as $const) {
295
+ $this->setConstant($const);
296
+ }
297
+
298
+ return $this;
299
+ }
300
+
301
  /**
302
  * setProperty()
303
  *
316
  throw new Zend_CodeGenerator_Php_Exception('setProperty() expects either an array of property options or an instance of Zend_CodeGenerator_Php_Property');
317
  }
318
 
319
+ if ($property->isConst()) {
320
+ return $this->setConstant($property);
321
+ }
322
  if (isset($this->_properties[$propertyName])) {
323
  #require_once 'Zend/CodeGenerator/Php/Exception.php';
324
  throw new Zend_CodeGenerator_Php_Exception('A property by name ' . $propertyName . ' already exists in this class.');
328
  return $this;
329
  }
330
 
331
+ /**
332
+ * setConstant()
333
+ *
334
+ * @param array|Zend_CodeGenerator_Php_Property $const
335
+ * @return Zend_CodeGenerator_Php_Class
336
+ */
337
+ public function setConstant($const)
338
+ {
339
+ if (is_array($const)) {
340
+ $const = new Zend_CodeGenerator_Php_Property($const);
341
+ $constName = $const->getName();
342
+ } elseif ($const instanceof Zend_CodeGenerator_Php_Property) {
343
+ $constName = $const->getName();
344
+ } else {
345
+ #require_once 'Zend/CodeGenerator/Php/Exception.php';
346
+ throw new Zend_CodeGenerator_Php_Exception('setConstant() expects either an array of property options or an instance of Zend_CodeGenerator_Php_Property');
347
+ }
348
+
349
+ if (!$const->isConst()) {
350
+ #require_once 'Zend/CodeGenerator/Php/Exception.php';
351
+ throw new Zend_CodeGenerator_Php_Exception('setProperty() expects argument to define a constant');
352
+ }
353
+ if (isset($this->_constants[$constName])) {
354
+ #require_once 'Zend/CodeGenerator/Php/Exception.php';
355
+ throw new Zend_CodeGenerator_Php_Exception('A constant by name ' . $constName . ' already exists in this class.');
356
+ }
357
+
358
+ $this->_constants[$constName] = $const;
359
+ return $this;
360
+ }
361
+
362
  /**
363
  * getProperties()
364
  *
369
  return $this->_properties;
370
  }
371
 
372
+ /**
373
+ * getConstants()
374
+ *
375
+ * @return array
376
+ */
377
+ public function getConstants()
378
+ {
379
+ return $this->_constants;
380
+ }
381
+
382
  /**
383
  * getProperty()
384
  *
395
  return false;
396
  }
397
 
398
+ /**
399
+ * getConstant()
400
+ *
401
+ * @param string $constName
402
+ * @return Zend_CodeGenerator_Php_Property
403
+ */
404
+ public function getConstant($constName)
405
+ {
406
+ foreach ($this->_constants as $const) {
407
+ if ($const->getName() == $constName) {
408
+ return $const;
409
+ }
410
+ }
411
+ return false;
412
+ }
413
+
414
  /**
415
  * hasProperty()
416
  *
422
  return isset($this->_properties[$propertyName]);
423
  }
424
 
425
+ /**
426
+ * hasConstant()
427
+ *
428
+ * @param string $constName
429
+ * @return bool
430
+ */
431
+ public function hasConstant($constName)
432
+ {
433
+ return isset($this->_constants[$constName]);
434
+ }
435
+
436
  /**
437
  * setMethods()
438
  *
528
  }
529
  }
530
 
531
+ foreach ($this->_constants as $constant) {
532
+ if ($constant->isSourceDirty()) {
533
+ return true;
534
+ }
535
+ }
536
+
537
  foreach ($this->_methods as $method) {
538
  if ($method->isSourceDirty()) {
539
  return true;
578
 
579
  $output .= self::LINE_FEED . '{' . self::LINE_FEED . self::LINE_FEED;
580
 
581
+ $constants = $this->getConstants();
582
+ if (!empty($constants)) {
583
+ foreach ($constants as $const) {
584
+ $output .= $const->generate() . self::LINE_FEED . self::LINE_FEED;
585
+ }
586
+ }
587
+
588
  $properties = $this->getProperties();
589
  if (!empty($properties)) {
590
  foreach ($properties as $property) {
611
  protected function _init()
612
  {
613
  $this->_properties = new Zend_CodeGenerator_Php_Member_Container(Zend_CodeGenerator_Php_Member_Container::TYPE_PROPERTY);
614
+ $this->_constants = new Zend_CodeGenerator_Php_Member_Container(Zend_CodeGenerator_Php_Member_Container::TYPE_PROPERTY);
615
  $this->_methods = new Zend_CodeGenerator_Php_Member_Container(Zend_CodeGenerator_Php_Member_Container::TYPE_METHOD);
616
  }
617
 
lib/Zend/CodeGenerator/Php/Docblock.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Docblock.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -33,7 +33,7 @@
33
  /**
34
  * @category Zend
35
  * @package Zend_CodeGenerator
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_CodeGenerator_Php_Docblock extends Zend_CodeGenerator_Php_Abstract
@@ -211,7 +211,11 @@ class Zend_CodeGenerator_Php_Docblock extends Zend_CodeGenerator_Php_Abstract
211
  $content = wordwrap($content, 80, self::LINE_FEED);
212
  $lines = explode(self::LINE_FEED, $content);
213
  foreach ($lines as $line) {
214
- $output .= $indent . ' * ' . $line . self::LINE_FEED;
 
 
 
 
215
  }
216
  $output .= $indent . ' */' . self::LINE_FEED;
217
  return $output;
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Docblock.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
33
  /**
34
  * @category Zend
35
  * @package Zend_CodeGenerator
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_CodeGenerator_Php_Docblock extends Zend_CodeGenerator_Php_Abstract
211
  $content = wordwrap($content, 80, self::LINE_FEED);
212
  $lines = explode(self::LINE_FEED, $content);
213
  foreach ($lines as $line) {
214
+ $output .= $indent . ' *';
215
+ if ($line) {
216
+ $output .= " $line";
217
+ }
218
+ $output .= self::LINE_FEED;
219
  }
220
  $output .= $indent . ' */' . self::LINE_FEED;
221
  return $output;
lib/Zend/CodeGenerator/Php/Docblock/Tag.php CHANGED
@@ -15,30 +15,20 @@
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Tag.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
24
- * @see Zend_CodeGenerator_Abstract
25
  */
26
  #require_once 'Zend/CodeGenerator/Php/Abstract.php';
27
 
28
- /**
29
- * @see Zend_CodeGenerator_Php_Docblock_Tag_Param
30
- */
31
- #require_once 'Zend/CodeGenerator/Php/Docblock/Tag/Param.php';
32
-
33
- /**
34
- * @see Zend_CodeGenerator_Php_Docblock_Tag_Return
35
- */
36
- #require_once 'Zend/CodeGenerator/Php/Docblock/Tag/Return.php';
37
-
38
  /**
39
  * @category Zend
40
  * @package Zend_CodeGenerator
41
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
42
  * @license http://framework.zend.com/license/new-bsd New BSD License
43
  */
44
  class Zend_CodeGenerator_Php_Docblock_Tag extends Zend_CodeGenerator_Php_Abstract
@@ -178,7 +168,11 @@ class Zend_CodeGenerator_Php_Docblock_Tag extends Zend_CodeGenerator_Php_Abstrac
178
  */
179
  public function generate()
180
  {
181
- return '@' . $this->_name . ' ' . $this->_description;
 
 
 
 
182
  }
183
 
184
- }
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Tag.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
24
+ * @see Zend_CodeGenerator_Php_Abstract
25
  */
26
  #require_once 'Zend/CodeGenerator/Php/Abstract.php';
27
 
 
 
 
 
 
 
 
 
 
 
28
  /**
29
  * @category Zend
30
  * @package Zend_CodeGenerator
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_CodeGenerator_Php_Docblock_Tag extends Zend_CodeGenerator_Php_Abstract
168
  */
169
  public function generate()
170
  {
171
+ $tag = '@' . $this->_name;
172
+ if ($this->_description) {
173
+ $tag .= ' ' . $this->_description;
174
+ }
175
+ return $tag;
176
  }
177
 
178
+ }
lib/Zend/CodeGenerator/Php/Docblock/Tag/License.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: License.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -28,7 +28,7 @@
28
  /**
29
  * @category Zend
30
  * @package Zend_CodeGenerator
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_CodeGenerator_Php_Docblock_Tag_License extends Zend_CodeGenerator_Php_Docblock_Tag
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: License.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
28
  /**
29
  * @category Zend
30
  * @package Zend_CodeGenerator
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_CodeGenerator_Php_Docblock_Tag_License extends Zend_CodeGenerator_Php_Docblock_Tag
lib/Zend/CodeGenerator/Php/Docblock/Tag/Param.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Param.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -28,7 +28,7 @@
28
  /**
29
  * @category Zend
30
  * @package Zend_CodeGenerator
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_CodeGenerator_Php_Docblock_Tag_Param extends Zend_CodeGenerator_Php_Docblock_Tag
@@ -53,7 +53,7 @@ class Zend_CodeGenerator_Php_Docblock_Tag_Param extends Zend_CodeGenerator_Php_D
53
  * fromReflection()
54
  *
55
  * @param Zend_Reflection_Docblock_Tag $reflectionTagParam
56
- * @return Zend_CodeGenerator_Php_Docblock_Tag_Param
57
  */
58
  public static function fromReflection(Zend_Reflection_Docblock_Tag $reflectionTagParam)
59
  {
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Param.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
28
  /**
29
  * @category Zend
30
  * @package Zend_CodeGenerator
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_CodeGenerator_Php_Docblock_Tag_Param extends Zend_CodeGenerator_Php_Docblock_Tag
53
  * fromReflection()
54
  *
55
  * @param Zend_Reflection_Docblock_Tag $reflectionTagParam
56
+ * @return Zend_CodeGenerator_Php_Docblock_Tag
57
  */
58
  public static function fromReflection(Zend_Reflection_Docblock_Tag $reflectionTagParam)
59
  {
lib/Zend/CodeGenerator/Php/Docblock/Tag/Return.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Return.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -28,7 +28,7 @@
28
  /**
29
  * @category Zend
30
  * @package Zend_CodeGenerator
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_CodeGenerator_Php_Docblock_Tag_Return extends Zend_CodeGenerator_Php_Docblock_Tag
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Return.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
28
  /**
29
  * @category Zend
30
  * @package Zend_CodeGenerator
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_CodeGenerator_Php_Docblock_Tag_Return extends Zend_CodeGenerator_Php_Docblock_Tag
lib/Zend/CodeGenerator/Php/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -28,7 +28,7 @@
28
  /**
29
  * @category Zend
30
  * @package Zend_CodeGenerator
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_CodeGenerator_Php_Exception extends Zend_CodeGenerator_Exception
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
28
  /**
29
  * @category Zend
30
  * @package Zend_CodeGenerator
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_CodeGenerator_Php_Exception extends Zend_CodeGenerator_Exception
lib/Zend/CodeGenerator/Php/File.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: File.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -33,7 +33,7 @@
33
  /**
34
  * @category Zend
35
  * @package Zend_CodeGenerator
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
@@ -97,7 +97,7 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
97
  }
98
 
99
  /**
100
- * fromReflectedFilePath() - use this if you intend on generating code generation objects based on the same file.
101
  * This will keep previous changes to the file in tact during the same PHP process
102
  *
103
  * @param string $filePath
@@ -110,7 +110,7 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
110
  $realpath = realpath($filePath);
111
 
112
  if ($realpath === false) {
113
- if ( ($realpath = Zend_Reflection_file::findRealpathInIncludePath($filePath)) === false) {
114
  #require_once 'Zend/CodeGenerator/Php/Exception.php';
115
  throw new Zend_CodeGenerator_Php_Exception('No file for ' . $realpath . ' was found.');
116
  }
@@ -394,7 +394,7 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
394
 
395
  // if there are markers, put the body into the output
396
  $body = $this->getBody();
397
- if (preg_match('#/\* Zend_CodeGenerator_Php_File-(.*?)Marker:#', $body)) {
398
  $output .= $body;
399
  $body = '';
400
  }
@@ -428,6 +428,9 @@ class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
428
  $classes = $this->getClasses();
429
  if (!empty($classes)) {
430
  foreach ($classes as $class) {
 
 
 
431
  $regex = str_replace('?', $class->getName(), self::$_markerClass);
432
  $regex = preg_quote($regex, '#');
433
  if (preg_match('#'.$regex.'#', $output)) {
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: File.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
33
  /**
34
  * @category Zend
35
  * @package Zend_CodeGenerator
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_CodeGenerator_Php_File extends Zend_CodeGenerator_Php_Abstract
97
  }
98
 
99
  /**
100
+ * fromReflectedFileName() - use this if you intend on generating code generation objects based on the same file.
101
  * This will keep previous changes to the file in tact during the same PHP process
102
  *
103
  * @param string $filePath
110
  $realpath = realpath($filePath);
111
 
112
  if ($realpath === false) {
113
+ if ( ($realpath = Zend_Reflection_File::findRealpathInIncludePath($filePath)) === false) {
114
  #require_once 'Zend/CodeGenerator/Php/Exception.php';
115
  throw new Zend_CodeGenerator_Php_Exception('No file for ' . $realpath . ' was found.');
116
  }
394
 
395
  // if there are markers, put the body into the output
396
  $body = $this->getBody();
397
+ if (preg_match('#/\* Zend_CodeGenerator_Php_File-(.*?)Marker#', $body)) {
398
  $output .= $body;
399
  $body = '';
400
  }
428
  $classes = $this->getClasses();
429
  if (!empty($classes)) {
430
  foreach ($classes as $class) {
431
+ if($this->getDocblock() == $class->getDocblock()) {
432
+ $class->setDocblock(null);
433
+ }
434
  $regex = str_replace('?', $class->getName(), self::$_markerClass);
435
  $regex = preg_quote($regex, '#');
436
  if (preg_match('#'.$regex.'#', $output)) {
lib/Zend/CodeGenerator/Php/Member/Abstract.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -33,7 +33,7 @@
33
  /**
34
  * @category Zend
35
  * @package Zend_CodeGenerator
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  abstract class Zend_CodeGenerator_Php_Member_Abstract extends Zend_CodeGenerator_Php_Abstract
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
33
  /**
34
  * @category Zend
35
  * @package Zend_CodeGenerator
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  abstract class Zend_CodeGenerator_Php_Member_Abstract extends Zend_CodeGenerator_Php_Abstract
lib/Zend/CodeGenerator/Php/Member/Container.php CHANGED
@@ -15,15 +15,15 @@
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Container.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_CodeGenerator
26
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  class Zend_CodeGenerator_Php_Member_Container extends ArrayObject
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Container.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_CodeGenerator
26
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  class Zend_CodeGenerator_Php_Member_Container extends ArrayObject
lib/Zend/CodeGenerator/Php/Method.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Method.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -38,7 +38,7 @@
38
  /**
39
  * @category Zend
40
  * @package Zend_CodeGenerator
41
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
42
  * @license http://framework.zend.com/license/new-bsd New BSD License
43
  */
44
  class Zend_CodeGenerator_Php_Method extends Zend_CodeGenerator_Php_Member_Abstract
@@ -220,10 +220,12 @@ class Zend_CodeGenerator_Php_Method extends Zend_CodeGenerator_Php_Member_Abstra
220
 
221
  $output .= ')' . self::LINE_FEED . $indent . '{' . self::LINE_FEED;
222
 
223
- if ($this->_body) {
224
  $output .= ' '
225
  . str_replace(self::LINE_FEED, self::LINE_FEED . $indent . $indent, trim($this->_body))
226
  . self::LINE_FEED;
 
 
227
  }
228
 
229
  $output .= $indent . '}' . self::LINE_FEED;
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Method.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
38
  /**
39
  * @category Zend
40
  * @package Zend_CodeGenerator
41
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
42
  * @license http://framework.zend.com/license/new-bsd New BSD License
43
  */
44
  class Zend_CodeGenerator_Php_Method extends Zend_CodeGenerator_Php_Member_Abstract
220
 
221
  $output .= ')' . self::LINE_FEED . $indent . '{' . self::LINE_FEED;
222
 
223
+ if ($this->_body && $this->isSourceDirty()) {
224
  $output .= ' '
225
  . str_replace(self::LINE_FEED, self::LINE_FEED . $indent . $indent, trim($this->_body))
226
  . self::LINE_FEED;
227
+ } elseif ($this->_body) {
228
+ $output .= $this->_body . self::LINE_FEED;
229
  }
230
 
231
  $output .= $indent . '}' . self::LINE_FEED;
lib/Zend/CodeGenerator/Php/Parameter.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Parameter.php 21889 2010-04-16 18:40:50Z juokaz $
21
  */
22
 
23
  /**
@@ -33,7 +33,7 @@
33
  /**
34
  * @category Zend
35
  * @package Zend_CodeGenerator
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_CodeGenerator_Php_Parameter extends Zend_CodeGenerator_Php_Abstract
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Parameter.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
33
  /**
34
  * @category Zend
35
  * @package Zend_CodeGenerator
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_CodeGenerator_Php_Parameter extends Zend_CodeGenerator_Php_Abstract
lib/Zend/CodeGenerator/Php/Parameter/DefaultValue.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage Php
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: DefaultValue.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -26,7 +26,7 @@
26
  * @category Zend
27
  * @package Zend_CodeGenerator
28
  * @subpackage Php
29
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  class Zend_CodeGenerator_Php_Parameter_DefaultValue
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage Php
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: DefaultValue.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
26
  * @category Zend
27
  * @package Zend_CodeGenerator
28
  * @subpackage Php
29
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  class Zend_CodeGenerator_Php_Parameter_DefaultValue
lib/Zend/CodeGenerator/Php/Property.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Property.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -33,7 +33,7 @@
33
  /**
34
  * @category Zend
35
  * @package Zend_CodeGenerator
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_CodeGenerator_Php_Property extends Zend_CodeGenerator_Php_Member_Abstract
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Property.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
33
  /**
34
  * @category Zend
35
  * @package Zend_CodeGenerator
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_CodeGenerator_Php_Property extends Zend_CodeGenerator_Php_Member_Abstract
lib/Zend/CodeGenerator/Php/Property/DefaultValue.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: DefaultValue.php 21979 2010-04-24 11:07:11Z jan $
21
  */
22
 
23
  /**
@@ -28,7 +28,7 @@
28
  /**
29
  * @category Zend
30
  * @package Zend_CodeGenerator
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_CodeGenerator_Php_Property_DefaultValue extends Zend_CodeGenerator_Php_Abstract
15
  * @category Zend
16
  * @package Zend_CodeGenerator
17
  * @subpackage PHP
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: DefaultValue.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
28
  /**
29
  * @category Zend
30
  * @package Zend_CodeGenerator
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_CodeGenerator_Php_Property_DefaultValue extends Zend_CodeGenerator_Php_Abstract
lib/Zend/Config.php CHANGED
@@ -14,16 +14,16 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Config
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Config.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_Config
26
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  class Zend_Config implements Countable, Iterator
14
  *
15
  * @category Zend
16
  * @package Zend_Config
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Config.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_Config
26
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  class Zend_Config implements Countable, Iterator
lib/Zend/Config/Exception.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Config
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /**
@@ -27,7 +27,7 @@
27
  /**
28
  * @category Zend
29
  * @package Zend_Config
30
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Config_Exception extends Zend_Exception {}
14
  *
15
  * @category Zend
16
  * @package Zend_Config
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /**
27
  /**
28
  * @category Zend
29
  * @package Zend_Config
30
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Config_Exception extends Zend_Exception {}
lib/Zend/Config/Ini.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Config
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Ini.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
 
@@ -29,7 +29,7 @@
29
  /**
30
  * @category Zend
31
  * @package Zend_Config
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Config_Ini extends Zend_Config
@@ -83,16 +83,17 @@ class Zend_Config_Ini extends Zend_Config
83
  *
84
  * The $options parameter may be provided as either a boolean or an array.
85
  * If provided as a boolean, this sets the $allowModifications option of
86
- * Zend_Config. If provided as an array, there are two configuration
87
  * directives that may be set. For example:
88
  *
89
  * $options = array(
90
  * 'allowModifications' => false,
91
- * 'nestSeparator' => '->'
 
92
  * );
93
  *
94
  * @param string $filename
95
- * @param string|null $section
96
  * @param boolean|array $options
97
  * @throws Zend_Config_Exception
98
  * @return void
@@ -157,11 +158,11 @@ class Zend_Config_Ini extends Zend_Config
157
 
158
  $this->_loadedSection = $section;
159
  }
160
-
161
  /**
162
  * Load the INI file from disk using parse_ini_file(). Use a private error
163
  * handler to convert any loading errors into a Zend_Config_Exception
164
- *
165
  * @param string $filename
166
  * @throws Zend_Config_Exception
167
  * @return array
@@ -171,7 +172,7 @@ class Zend_Config_Ini extends Zend_Config
171
  set_error_handler(array($this, '_loadFileErrorHandler'));
172
  $iniArray = parse_ini_file($filename, true); // Warnings and errors are suppressed
173
  restore_error_handler();
174
-
175
  // Check if there was a error while loading file
176
  if ($this->_loadFileErrorStr !== null) {
177
  /**
@@ -180,7 +181,7 @@ class Zend_Config_Ini extends Zend_Config
180
  #require_once 'Zend/Config/Exception.php';
181
  throw new Zend_Config_Exception($this->_loadFileErrorStr);
182
  }
183
-
184
  return $iniArray;
185
  }
186
 
14
  *
15
  * @category Zend
16
  * @package Zend_Config
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Ini.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
 
29
  /**
30
  * @category Zend
31
  * @package Zend_Config
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Config_Ini extends Zend_Config
83
  *
84
  * The $options parameter may be provided as either a boolean or an array.
85
  * If provided as a boolean, this sets the $allowModifications option of
86
+ * Zend_Config. If provided as an array, there are three configuration
87
  * directives that may be set. For example:
88
  *
89
  * $options = array(
90
  * 'allowModifications' => false,
91
+ * 'nestSeparator' => ':',
92
+ * 'skipExtends' => false,
93
  * );
94
  *
95
  * @param string $filename
96
+ * @param mixed $section
97
  * @param boolean|array $options
98
  * @throws Zend_Config_Exception
99
  * @return void
158
 
159
  $this->_loadedSection = $section;
160
  }
161
+
162
  /**
163
  * Load the INI file from disk using parse_ini_file(). Use a private error
164
  * handler to convert any loading errors into a Zend_Config_Exception
165
+ *
166
  * @param string $filename
167
  * @throws Zend_Config_Exception
168
  * @return array
172
  set_error_handler(array($this, '_loadFileErrorHandler'));
173
  $iniArray = parse_ini_file($filename, true); // Warnings and errors are suppressed
174
  restore_error_handler();
175
+
176
  // Check if there was a error while loading file
177
  if ($this->_loadFileErrorStr !== null) {
178
  /**
181
  #require_once 'Zend/Config/Exception.php';
182
  throw new Zend_Config_Exception($this->_loadFileErrorStr);
183
  }
184
+
185
  return $iniArray;
186
  }
187
 
lib/Zend/Config/Json.php CHANGED
@@ -16,7 +16,7 @@
16
  * @package Zend_Config
17
  * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Json.php 23294 2010-11-05 00:27:34Z ramon $
20
  */
21
 
22
  /**
@@ -220,7 +220,9 @@ class Zend_Config_Json extends Zend_Config
220
  {
221
  foreach ($this->_getConstants() as $constant) {
222
  if (strstr($value, $constant)) {
223
- $value = str_replace($constant, constant($constant), $value);
 
 
224
  }
225
  }
226
  return $value;
16
  * @package Zend_Config
17
  * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Json.php 24810 2012-05-17 21:20:12Z rob $
20
  */
21
 
22
  /**
220
  {
221
  foreach ($this->_getConstants() as $constant) {
222
  if (strstr($value, $constant)) {
223
+ // handle backslashes that may represent windows path names for instance
224
+ $replacement = str_replace('\\', '\\\\', constant($constant));
225
+ $value = str_replace($constant, $replacement, $value);
226
  }
227
  }
228
  return $value;
lib/Zend/Config/Writer.php CHANGED
@@ -14,15 +14,15 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Config
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Writer.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /**
23
  * @category Zend
24
  * @package Zend_Config
25
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
26
  * @license http://framework.zend.com/license/new-bsd New BSD License
27
  */
28
  abstract class Zend_Config_Writer
14
  *
15
  * @category Zend
16
  * @package Zend_Config
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Writer.php 25024 2012-07-30 15:08:15Z rob $
20
  */
21
 
22
  /**
23
  * @category Zend
24
  * @package Zend_Config
25
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
26
  * @license http://framework.zend.com/license/new-bsd New BSD License
27
  */
28
  abstract class Zend_Config_Writer
lib/Zend/Config/Writer/Array.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Config
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Array.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /**
@@ -27,7 +27,7 @@
27
  /**
28
  * @category Zend
29
  * @package Zend_Config
30
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Config_Writer_Array extends Zend_Config_Writer_FileAbstract
14
  *
15
  * @category Zend
16
  * @package Zend_Config
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Array.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /**
27
  /**
28
  * @category Zend
29
  * @package Zend_Config
30
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Config_Writer_Array extends Zend_Config_Writer_FileAbstract
lib/Zend/Config/Writer/FileAbstract.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Config
17
  * @package Writer
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -26,9 +26,9 @@
26
  *
27
  * @category Zend
28
  * @package Zend_package
29
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
- * @version $Id: FileAbstract.php 20096 2010-01-06 02:05:09Z bkarwin $
32
  */
33
  class Zend_Config_Writer_FileAbstract extends Zend_Config_Writer
34
  {
15
  * @category Zend
16
  * @package Zend_Config
17
  * @package Writer
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
26
  *
27
  * @category Zend
28
  * @package Zend_package
29
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
+ * @version $Id: FileAbstract.php 24593 2012-01-05 20:35:02Z matthew $
32
  */
33
  class Zend_Config_Writer_FileAbstract extends Zend_Config_Writer
34
  {
lib/Zend/Config/Writer/Ini.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Config
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Ini.php 21983 2010-04-25 08:09:09Z jan $
20
  */
21
 
22
  /**
@@ -27,7 +27,7 @@
27
  /**
28
  * @category Zend
29
  * @package Zend_Config
30
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Config_Writer_Ini extends Zend_Config_Writer_FileAbstract
@@ -161,11 +161,11 @@ class Zend_Config_Writer_Ini extends Zend_Config_Writer_FileAbstract
161
  throw new Zend_Config_Exception('Value can not contain double quotes "');
162
  }
163
  }
164
-
165
  /**
166
  * Root elements that are not assigned to any section needs to be
167
  * on the top of config.
168
- *
169
  * @see http://framework.zend.com/issues/browse/ZF-6289
170
  * @param Zend_Config
171
  * @return Zend_Config
@@ -174,7 +174,7 @@ class Zend_Config_Writer_Ini extends Zend_Config_Writer_FileAbstract
174
  {
175
  $configArray = $config->toArray();
176
  $sections = array();
177
-
178
  // remove sections from config array
179
  foreach ($configArray as $key => $value) {
180
  if (is_array($value)) {
@@ -182,12 +182,12 @@ class Zend_Config_Writer_Ini extends Zend_Config_Writer_FileAbstract
182
  unset($configArray[$key]);
183
  }
184
  }
185
-
186
  // readd sections to the end
187
  foreach ($sections as $key => $value) {
188
  $configArray[$key] = $value;
189
  }
190
-
191
  return new Zend_Config($configArray);
192
  }
193
  }
14
  *
15
  * @category Zend
16
  * @package Zend_Config
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Ini.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /**
27
  /**
28
  * @category Zend
29
  * @package Zend_Config
30
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Config_Writer_Ini extends Zend_Config_Writer_FileAbstract
161
  throw new Zend_Config_Exception('Value can not contain double quotes "');
162
  }
163
  }
164
+
165
  /**
166
  * Root elements that are not assigned to any section needs to be
167
  * on the top of config.
168
+ *
169
  * @see http://framework.zend.com/issues/browse/ZF-6289
170
  * @param Zend_Config
171
  * @return Zend_Config
174
  {
175
  $configArray = $config->toArray();
176
  $sections = array();
177
+
178
  // remove sections from config array
179
  foreach ($configArray as $key => $value) {
180
  if (is_array($value)) {
182
  unset($configArray[$key]);
183
  }
184
  }
185
+
186
  // readd sections to the end
187
  foreach ($sections as $key => $value) {
188
  $configArray[$key] = $value;
189
  }
190
+
191
  return new Zend_Config($configArray);
192
  }
193
  }
lib/Zend/Config/Writer/Json.php CHANGED
@@ -16,7 +16,7 @@
16
  * @package Zend_Config
17
  * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Json.php 23294 2010-11-05 00:27:34Z ramon $
20
  */
21
 
22
  /**
16
  * @package Zend_Config
17
  * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Json.php 23293 2010-11-04 23:40:23Z ramon $
20
  */
21
 
22
  /**
lib/Zend/Config/Writer/Xml.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Config
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Xml.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /**
@@ -32,7 +32,7 @@
32
  /**
33
  * @category Zend
34
  * @package Zend_Config
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Config_Writer_Xml extends Zend_Config_Writer_FileAbstract
14
  *
15
  * @category Zend
16
  * @package Zend_Config
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Xml.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /**
32
  /**
33
  * @category Zend
34
  * @package Zend_Config
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Config_Writer_Xml extends Zend_Config_Writer_FileAbstract
lib/Zend/Config/Writer/Yaml.php CHANGED
@@ -16,7 +16,7 @@
16
  * @package Zend_Config
17
  * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Yaml.php 23294 2010-11-05 00:27:34Z ramon $
20
  */
21
 
22
  /**
@@ -57,7 +57,7 @@ class Zend_Config_Writer_Yaml extends Zend_Config_Writer_FileAbstract
57
  /**
58
  * Set callback for decoding YAML
59
  *
60
- * @param $yamlEncoder the decoder to set
61
  * @return Zend_Config_Yaml
62
  */
63
  public function setYamlEncoder($yamlEncoder)
16
  * @package Zend_Config
17
  * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Yaml.php 23650 2011-01-21 21:32:57Z mikaelkael $
20
  */
21
 
22
  /**
57
  /**
58
  * Set callback for decoding YAML
59
  *
60
+ * @param callable $yamlEncoder the decoder to set
61
  * @return Zend_Config_Yaml
62
  */
63
  public function setYamlEncoder($yamlEncoder)
lib/Zend/Config/Xml.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Config
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Xml.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /**
@@ -29,7 +29,7 @@
29
  *
30
  * @category Zend
31
  * @package Zend_Config
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Config_Xml extends Zend_Config
@@ -58,10 +58,20 @@ class Zend_Config_Xml extends Zend_Config
58
  *
59
  * Note that the keys in $section will override any keys of the same
60
  * name in the sections that have been included via "extends".
 
 
 
 
 
61
  *
62
- * @param string $xml XML file or string to process
63
- * @param mixed $section Section to process
64
- * @param boolean $options Whether modifications are allowed at runtime
 
 
 
 
 
65
  * @throws Zend_Config_Exception When xml is not set or cannot be loaded
66
  * @throws Zend_Config_Exception When section $sectionName cannot be found in $xml
67
  */
14
  *
15
  * @category Zend
16
  * @package Zend_Config
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Xml.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /**
29
  *
30
  * @category Zend
31
  * @package Zend_Config
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Config_Xml extends Zend_Config
58
  *
59
  * Note that the keys in $section will override any keys of the same
60
  * name in the sections that have been included via "extends".
61
+ *
62
+ * The $options parameter may be provided as either a boolean or an array.
63
+ * If provided as a boolean, this sets the $allowModifications option of
64
+ * Zend_Config. If provided as an array, there are two configuration
65
+ * directives that may be set. For example:
66
  *
67
+ * $options = array(
68
+ * 'allowModifications' => false,
69
+ * 'skipExtends' => false
70
+ * );
71
+ *
72
+ * @param string $xml XML file or string to process
73
+ * @param mixed $section Section to process
74
+ * @param array|boolean $options
75
  * @throws Zend_Config_Exception When xml is not set or cannot be loaded
76
  * @throws Zend_Config_Exception When section $sectionName cannot be found in $xml
77
  */
lib/Zend/Config/Yaml.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Config
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Yaml.php 23294 2010-11-05 00:27:34Z ramon $
20
  */
21
 
22
  /**
@@ -29,7 +29,7 @@
29
  *
30
  * @category Zend
31
  * @package Zend_Config
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Config_Yaml extends Zend_Config
@@ -93,7 +93,7 @@ class Zend_Config_Yaml extends Zend_Config
93
  /**
94
  * Set callback for decoding YAML
95
  *
96
- * @param $yamlDecoder the decoder to set
97
  * @return Zend_Config_Yaml
98
  */
99
  public function setYamlDecoder($yamlDecoder)
@@ -124,9 +124,9 @@ class Zend_Config_Yaml extends Zend_Config
124
  * - skip_extends: whether or not to skip processing of parent configuration
125
  * - yaml_decoder: a callback to use to decode the Yaml source
126
  *
127
- * @param string $yaml YAML file to process
128
- * @param mixed $section Section to process
129
- * @param boolean $options Whether modifiacations are allowed at runtime
130
  */
131
  public function __construct($yaml, $section = null, $options = false)
132
  {
@@ -201,7 +201,10 @@ class Zend_Config_Yaml extends Zend_Config
201
  foreach ($section as $sectionName) {
202
  if (!isset($config[$sectionName])) {
203
  #require_once 'Zend/Config/Exception.php';
204
- throw new Zend_Config_Exception(sprintf('Section "%s" cannot be found', $section));
 
 
 
205
  }
206
 
207
  $dataArray = array_merge($this->_processExtends($config, $sectionName), $dataArray);
@@ -210,7 +213,10 @@ class Zend_Config_Yaml extends Zend_Config
210
  } else {
211
  if (!isset($config[$section])) {
212
  #require_once 'Zend/Config/Exception.php';
213
- throw new Zend_Config_Exception(sprintf('Section "%s" cannot be found', $section));
 
 
 
214
  }
215
 
216
  $dataArray = $this->_processExtends($config, $section);
@@ -284,14 +290,13 @@ class Zend_Config_Yaml extends Zend_Config
284
  $config = array();
285
  $inIndent = false;
286
  while (list($n, $line) = each($lines)) {
287
- $lineno = $n+1;
 
 
288
  if (strlen($line) == 0) {
289
  continue;
290
  }
291
- if ($line[0] == '#') {
292
- // comment
293
- continue;
294
- }
295
  $indent = strspn($line, " ");
296
 
297
  // line without the spaces
@@ -311,20 +316,12 @@ class Zend_Config_Yaml extends Zend_Config
311
  $inIndent = true;
312
  }
313
 
314
- if (preg_match("/(\w+):\s*(.*)/", $line, $m)) {
315
  // key: value
316
- if ($m[2]) {
317
  // simple key: value
318
- $value = $m[2];
319
- // Check for booleans and constants
320
- if (preg_match('/^(t(rue)?|on|y(es)?)$/i', $value)) {
321
- $value = true;
322
- } elseif (preg_match('/^(f(alse)?|off|n(o)?)$/i', $value)) {
323
- $value = false;
324
- } elseif (!self::$_ignoreConstants) {
325
- // test for constants
326
- $value = self::_replaceConstants($value);
327
- }
328
  } else {
329
  // key: and then values on new lines
330
  $value = self::_decodeYaml($currentIndent + 1, $lines);
@@ -337,7 +334,9 @@ class Zend_Config_Yaml extends Zend_Config
337
  // item in the list:
338
  // - FOO
339
  if (strlen($line) > 2) {
340
- $config[] = substr($line, 2);
 
 
341
  } else {
342
  $config[] = self::_decodeYaml($currentIndent + 1, $lines);
343
  }
@@ -352,6 +351,40 @@ class Zend_Config_Yaml extends Zend_Config
352
  return $config;
353
  }
354
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
355
  /**
356
  * Replace any constants referenced in a string with their values
357
  *
14
  *
15
  * @category Zend
16
  * @package Zend_Config
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Yaml.php 25169 2012-12-22 12:23:11Z rob $
20
  */
21
 
22
  /**
29
  *
30
  * @category Zend
31
  * @package Zend_Config
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Config_Yaml extends Zend_Config
93
  /**
94
  * Set callback for decoding YAML
95
  *
96
+ * @param callable $yamlDecoder the decoder to set
97
  * @return Zend_Config_Yaml
98
  */
99
  public function setYamlDecoder($yamlDecoder)
124
  * - skip_extends: whether or not to skip processing of parent configuration
125
  * - yaml_decoder: a callback to use to decode the Yaml source
126
  *
127
+ * @param string $yaml YAML file to process
128
+ * @param mixed $section Section to process
129
+ * @param array|boolean $options
130
  */
131
  public function __construct($yaml, $section = null, $options = false)
132
  {
201
  foreach ($section as $sectionName) {
202
  if (!isset($config[$sectionName])) {
203
  #require_once 'Zend/Config/Exception.php';
204
+ throw new Zend_Config_Exception(sprintf(
205
+ 'Section "%s" cannot be found',
206
+ implode(' ', (array)$section)
207
+ ));
208
  }
209
 
210
  $dataArray = array_merge($this->_processExtends($config, $sectionName), $dataArray);
213
  } else {
214
  if (!isset($config[$section])) {
215
  #require_once 'Zend/Config/Exception.php';
216
+ throw new Zend_Config_Exception(sprintf(
217
+ 'Section "%s" cannot be found',
218
+ implode(' ', (array)$section)
219
+ ));
220
  }
221
 
222
  $dataArray = $this->_processExtends($config, $section);
290
  $config = array();
291
  $inIndent = false;
292
  while (list($n, $line) = each($lines)) {
293
+ $lineno = $n + 1;
294
+
295
+ $line = rtrim(preg_replace("/#.*$/", "", $line));
296
  if (strlen($line) == 0) {
297
  continue;
298
  }
299
+
 
 
 
300
  $indent = strspn($line, " ");
301
 
302
  // line without the spaces
316
  $inIndent = true;
317
  }
318
 
319
+ if (preg_match("/(?!-)([\w\-]+):\s*(.*)/", $line, $m)) {
320
  // key: value
321
+ if (strlen($m[2])) {
322
  // simple key: value
323
+ $value = preg_replace("/#.*$/", "", $m[2]);
324
+ $value = self::_parseValue($value);
 
 
 
 
 
 
 
 
325
  } else {
326
  // key: and then values on new lines
327
  $value = self::_decodeYaml($currentIndent + 1, $lines);
334
  // item in the list:
335
  // - FOO
336
  if (strlen($line) > 2) {
337
+ $value = substr($line, 2);
338
+
339
+ $config[] = self::_parseValue($value);
340
  } else {
341
  $config[] = self::_decodeYaml($currentIndent + 1, $lines);
342
  }
351
  return $config;
352
  }
353
 
354
+ /**
355
+ * Parse values
356
+ *
357
+ * @param string $value
358
+ * @return string
359
+ */
360
+ protected static function _parseValue($value)
361
+ {
362
+ $value = trim($value);
363
+
364
+ // remove quotes from string.
365
+ if ('"' == $value['0']) {
366
+ if ('"' == $value[count($value) -1]) {
367
+ $value = substr($value, 1, -1);
368
+ }
369
+ } elseif ('\'' == $value['0'] && '\'' == $value[count($value) -1]) {
370
+ $value = strtr($value, array("''" => "'", "'" => ''));
371
+ }
372
+
373
+ // Check for booleans and constants
374
+ if (preg_match('/^(t(rue)?|on|y(es)?)$/i', $value)) {
375
+ $value = true;
376
+ } elseif (preg_match('/^(f(alse)?|off|n(o)?)$/i', $value)) {
377
+ $value = false;
378
+ } elseif (strcasecmp($value, 'null') === 0) {
379
+ $value = null;
380
+ } elseif (!self::$_ignoreConstants) {
381
+ // test for constants
382
+ $value = self::_replaceConstants($value);
383
+ }
384
+
385
+ return $value;
386
+ }
387
+
388
  /**
389
  * Replace any constants referenced in a string with their values
390
  *
lib/Zend/Console/Getopt.php CHANGED
@@ -15,9 +15,9 @@
15
  *
16
  * @category Zend
17
  * @package Zend_Console_Getopt
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Getopt.php 22191 2010-05-17 21:50:14Z jan $
21
  */
22
 
23
  /**
@@ -80,7 +80,7 @@
80
  *
81
  * @category Zend
82
  * @package Zend_Console_Getopt
83
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
84
  * @license http://framework.zend.com/license/new-bsd New BSD License
85
  * @version Release: @package_version@
86
  * @since Class available since Release 0.6.0
15
  *
16
  * @category Zend
17
  * @package Zend_Console_Getopt
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Getopt.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
80
  *
81
  * @category Zend
82
  * @package Zend_Console_Getopt
83
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
84
  * @license http://framework.zend.com/license/new-bsd New BSD License
85
  * @version Release: @package_version@
86
  * @since Class available since Release 0.6.0
lib/Zend/Console/Getopt/Exception.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Console_Getopt
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
 
@@ -29,7 +29,7 @@
29
  /**
30
  * @category Zend
31
  * @package Zend_Console_Getopt
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Console_Getopt_Exception extends Zend_Exception
14
  *
15
  * @category Zend
16
  * @package Zend_Console_Getopt
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
 
29
  /**
30
  * @category Zend
31
  * @package Zend_Console_Getopt
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Console_Getopt_Exception extends Zend_Exception
lib/Zend/Controller/Action.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Action.php 22792 2010-08-05 18:30:27Z matthew $
20
  */
21
 
22
  /**
@@ -37,7 +37,7 @@
37
  /**
38
  * @category Zend
39
  * @package Zend_Controller
40
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
41
  * @license http://framework.zend.com/license/new-bsd New BSD License
42
  */
43
  abstract class Zend_Controller_Action implements Zend_Controller_Action_Interface
@@ -505,14 +505,18 @@ abstract class Zend_Controller_Action implements Zend_Controller_Action_Interfac
505
  $this->_classMethods = get_class_methods($this);
506
  }
507
 
508
- // preDispatch() didn't change the action, so we can continue
509
- if ($this->getInvokeArg('useCaseSensitiveActions') || in_array($action, $this->_classMethods)) {
510
- if ($this->getInvokeArg('useCaseSensitiveActions')) {
511
- trigger_error('Using case sensitive actions without word separators is deprecated; please do not rely on this "feature"');
 
 
 
 
 
 
 
512
  }
513
- $this->$action();
514
- } else {
515
- $this->__call($action, array());
516
  }
517
  $this->postDispatch();
518
  }
@@ -578,9 +582,25 @@ abstract class Zend_Controller_Action implements Zend_Controller_Action_Interfac
578
  * @return mixed
579
  */
580
  protected function _getParam($paramName, $default = null)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
581
  {
582
  $value = $this->getRequest()->getParam($paramName);
583
- if ((null === $value || '' === $value) && (null !== $default)) {
584
  $value = $default;
585
  }
586
 
@@ -593,8 +613,22 @@ abstract class Zend_Controller_Action implements Zend_Controller_Action_Interfac
593
  * @param string $paramName
594
  * @param mixed $value
595
  * @return Zend_Controller_Action
 
 
596
  */
597
  protected function _setParam($paramName, $value)
 
 
 
 
 
 
 
 
 
 
 
 
598
  {
599
  $this->getRequest()->setParam($paramName, $value);
600
 
@@ -607,8 +641,22 @@ abstract class Zend_Controller_Action implements Zend_Controller_Action_Interfac
607
  *
608
  * @param string $paramName
609
  * @return boolean
 
 
610
  */
611
  protected function _hasParam($paramName)
 
 
 
 
 
 
 
 
 
 
 
 
612
  {
613
  return null !== $this->getRequest()->getParam($paramName);
614
  }
@@ -618,8 +666,21 @@ abstract class Zend_Controller_Action implements Zend_Controller_Action_Interfac
618
  * as an associative array.
619
  *
620
  * @return array
 
 
621
  */
622
  protected function _getAllParams()
 
 
 
 
 
 
 
 
 
 
 
623
  {
624
  return $this->getRequest()->getParams();
625
  }
@@ -650,8 +711,41 @@ abstract class Zend_Controller_Action implements Zend_Controller_Action_Interfac
650
  * @param string $module
651
  * @param array $params
652
  * @return void
 
 
653
  */
654
  final protected function _forward($action, $controller = null, $module = null, array $params = null)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
655
  {
656
  $request = $this->getRequest();
657
 
@@ -680,8 +774,24 @@ abstract class Zend_Controller_Action implements Zend_Controller_Action_Interfac
680
  * @param string $url
681
  * @param array $options Options to be used when redirecting
682
  * @return void
 
 
683
  */
684
  protected function _redirect($url, array $options = array())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
685
  {
686
  $this->_helper->redirector->gotoUrl($url, $options);
687
  }
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Action.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /**
37
  /**
38
  * @category Zend
39
  * @package Zend_Controller
40
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
41
  * @license http://framework.zend.com/license/new-bsd New BSD License
42
  */
43
  abstract class Zend_Controller_Action implements Zend_Controller_Action_Interface
505
  $this->_classMethods = get_class_methods($this);
506
  }
507
 
508
+ // If pre-dispatch hooks introduced a redirect then stop dispatch
509
+ // @see ZF-7496
510
+ if (!($this->getResponse()->isRedirect())) {
511
+ // preDispatch() didn't change the action, so we can continue
512
+ if ($this->getInvokeArg('useCaseSensitiveActions') || in_array($action, $this->_classMethods)) {
513
+ if ($this->getInvokeArg('useCaseSensitiveActions')) {
514
+ trigger_error('Using case sensitive actions without word separators is deprecated; please do not rely on this "feature"');
515
+ }
516
+ $this->$action();
517
+ } else {
518
+ $this->__call($action, array());
519
  }
 
 
 
520
  }
521
  $this->postDispatch();
522
  }
582
  * @return mixed
583
  */
584
  protected function _getParam($paramName, $default = null)
585
+ {
586
+ return $this->getParam($paramName, $default);
587
+ }
588
+
589
+ /**
590
+ * Gets a parameter from the {@link $_request Request object}. If the
591
+ * parameter does not exist, NULL will be returned.
592
+ *
593
+ * If the parameter does not exist and $default is set, then
594
+ * $default will be returned instead of NULL.
595
+ *
596
+ * @param string $paramName
597
+ * @param mixed $default
598
+ * @return mixed
599
+ */
600
+ public function getParam($paramName, $default = null)
601
  {
602
  $value = $this->getRequest()->getParam($paramName);
603
+ if ((null === $value || '' === $value) && (null !== $default)) {
604
  $value = $default;
605
  }
606
 
613
  * @param string $paramName
614
  * @param mixed $value
615
  * @return Zend_Controller_Action
616
+ * @deprecated Deprecated as of Zend Framework 1.7. Use
617
+ * setParam() instead.
618
  */
619
  protected function _setParam($paramName, $value)
620
+ {
621
+ return $this->setParam($paramName, $value);
622
+ }
623
+
624
+ /**
625
+ * Set a parameter in the {@link $_request Request object}.
626
+ *
627
+ * @param string $paramName
628
+ * @param mixed $value
629
+ * @return Zend_Controller_Action
630
+ */
631
+ public function setParam($paramName, $value)
632
  {
633
  $this->getRequest()->setParam($paramName, $value);
634
 
641
  *
642
  * @param string $paramName
643
  * @return boolean
644
+ * @deprecated Deprecated as of Zend Framework 1.7. Use
645
+ * hasParam() instead.
646
  */
647
  protected function _hasParam($paramName)
648
+ {
649
+ return $this->hasParam($paramName);
650
+ }
651
+
652
+ /**
653
+ * Determine whether a given parameter exists in the
654
+ * {@link $_request Request object}.
655
+ *
656
+ * @param string $paramName
657
+ * @return boolean
658
+ */
659
+ public function hasParam($paramName)
660
  {
661
  return null !== $this->getRequest()->getParam($paramName);
662
  }
666
  * as an associative array.
667
  *
668
  * @return array
669
+ * @deprecated Deprecated as of Zend Framework 1.7. Use
670
+ * getAllParams() instead.
671
  */
672
  protected function _getAllParams()
673
+ {
674
+ return $this->getAllParams();
675
+ }
676
+
677
+ /**
678
+ * Return all parameters in the {@link $_request Request object}
679
+ * as an associative array.
680
+ *
681
+ * @return array
682
+ */
683
+ public function getAllParams()
684
  {
685
  return $this->getRequest()->getParams();
686
  }
711
  * @param string $module
712
  * @param array $params
713
  * @return void
714
+ * @deprecated Deprecated as of Zend Framework 1.7. Use
715
+ * forward() instead.
716
  */
717
  final protected function _forward($action, $controller = null, $module = null, array $params = null)
718
+ {
719
+ $this->forward($action, $controller, $module, $params);
720
+ }
721
+
722
+ /**
723
+ * Forward to another controller/action.
724
+ *
725
+ * It is important to supply the unformatted names, i.e. "article"
726
+ * rather than "ArticleController". The dispatcher will do the
727
+ * appropriate formatting when the request is received.
728
+ *
729
+ * If only an action name is provided, forwards to that action in this
730
+ * controller.
731
+ *
732
+ * If an action and controller are specified, forwards to that action and
733
+ * controller in this module.
734
+ *
735
+ * Specifying an action, controller, and module is the most specific way to
736
+ * forward.
737
+ *
738
+ * A fourth argument, $params, will be used to set the request parameters.
739
+ * If either the controller or module are unnecessary for forwarding,
740
+ * simply pass null values for them before specifying the parameters.
741
+ *
742
+ * @param string $action
743
+ * @param string $controller
744
+ * @param string $module
745
+ * @param array $params
746
+ * @return void
747
+ */
748
+ final public function forward($action, $controller = null, $module = null, array $params = null)
749
  {
750
  $request = $this->getRequest();
751
 
774
  * @param string $url
775
  * @param array $options Options to be used when redirecting
776
  * @return void
777
+ * @deprecated Deprecated as of Zend Framework 1.7. Use
778
+ * redirect() instead.
779
  */
780
  protected function _redirect($url, array $options = array())
781
+ {
782
+ $this->redirect($url, $options);
783
+ }
784
+
785
+ /**
786
+ * Redirect to another URL
787
+ *
788
+ * Proxies to {@link Zend_Controller_Action_Helper_Redirector::gotoUrl()}.
789
+ *
790
+ * @param string $url
791
+ * @param array $options Options to be used when redirecting
792
+ * @return void
793
+ */
794
+ public function redirect($url, array $options = array())
795
  {
796
  $this->_helper->redirector->gotoUrl($url, $options);
797
  }
lib/Zend/Controller/Action/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -31,7 +31,7 @@
31
  * @category Zend
32
  * @package Zend_Controller
33
  * @subpackage Zend_Controller_Action
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Controller_Action_Exception extends Zend_Controller_Exception
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
31
  * @category Zend
32
  * @package Zend_Controller
33
  * @subpackage Zend_Controller_Action
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Controller_Action_Exception extends Zend_Controller_Exception
lib/Zend/Controller/Action/Helper/Abstract.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Abstract.php 20261 2010-01-13 18:55:25Z matthew $
21
  */
22
 
23
  /**
@@ -29,7 +29,7 @@
29
  * @category Zend
30
  * @package Zend_Controller
31
  * @subpackage Zend_Controller_Action_Helper
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  abstract class Zend_Controller_Action_Helper_Abstract
@@ -142,13 +142,15 @@ abstract class Zend_Controller_Action_Helper_Abstract
142
  */
143
  public function getName()
144
  {
145
- $full_class_name = get_class($this);
146
-
147
- if (strpos($full_class_name, '_') !== false) {
148
- $helper_name = strrchr($full_class_name, '_');
149
- return ltrim($helper_name, '_');
 
 
150
  } else {
151
- return $full_class_name;
152
  }
153
  }
154
  }
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
29
  * @category Zend
30
  * @package Zend_Controller
31
  * @subpackage Zend_Controller_Action_Helper
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  abstract class Zend_Controller_Action_Helper_Abstract
142
  */
143
  public function getName()
144
  {
145
+ $fullClassName = get_class($this);
146
+ if (strpos($fullClassName, '_') !== false) {
147
+ $helperName = strrchr($fullClassName, '_');
148
+ return ltrim($helperName, '_');
149
+ } elseif (strpos($fullClassName, '\\') !== false) {
150
+ $helperName = strrchr($fullClassName, '\\');
151
+ return ltrim($helperName, '\\');
152
  } else {
153
+ return $fullClassName;
154
  }
155
  }
156
  }
lib/Zend/Controller/Action/Helper/ActionStack.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: ActionStack.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -32,7 +32,7 @@
32
  * @category Zend
33
  * @package Zend_Controller
34
  * @subpackage Zend_Controller_Action_Helper
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Controller_Action_Helper_ActionStack extends Zend_Controller_Action_Helper_Abstract
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: ActionStack.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
32
  * @category Zend
33
  * @package Zend_Controller
34
  * @subpackage Zend_Controller_Action_Helper
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Controller_Action_Helper_ActionStack extends Zend_Controller_Action_Helper_Abstract
lib/Zend/Controller/Action/Helper/AjaxContext.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: AjaxContext.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -32,7 +32,7 @@
32
  * @category Zend
33
  * @package Zend_Controller
34
  * @subpackage Zend_Controller_Action_Helper
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Controller_Action_Helper_AjaxContext extends Zend_Controller_Action_Helper_ContextSwitch
@@ -68,7 +68,10 @@ class Zend_Controller_Action_Helper_AjaxContext extends Zend_Controller_Action_H
68
  {
69
  $this->_currentContext = null;
70
 
71
- if (!$this->getRequest()->isXmlHttpRequest()) {
 
 
 
72
  return;
73
  }
74
 
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: AjaxContext.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
32
  * @category Zend
33
  * @package Zend_Controller
34
  * @subpackage Zend_Controller_Action_Helper
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Controller_Action_Helper_AjaxContext extends Zend_Controller_Action_Helper_ContextSwitch
68
  {
69
  $this->_currentContext = null;
70
 
71
+ $request = $this->getRequest();
72
+ if (!method_exists($request, 'isXmlHttpRequest') ||
73
+ !$this->getRequest()->isXmlHttpRequest())
74
+ {
75
  return;
76
  }
77
 
lib/Zend/Controller/Action/Helper/AutoComplete/Abstract.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -32,7 +32,7 @@
32
  * @category Zend
33
  * @package Zend_Controller
34
  * @subpackage Zend_Controller_Action_Helper
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  abstract class Zend_Controller_Action_Helper_AutoComplete_Abstract extends Zend_Controller_Action_Helper_Abstract
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
32
  * @category Zend
33
  * @package Zend_Controller
34
  * @subpackage Zend_Controller_Action_Helper
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  abstract class Zend_Controller_Action_Helper_AutoComplete_Abstract extends Zend_Controller_Action_Helper_Abstract
lib/Zend/Controller/Action/Helper/AutoCompleteDojo.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: AutoCompleteDojo.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -32,7 +32,7 @@
32
  * @category Zend
33
  * @package Zend_Controller
34
  * @subpackage Zend_Controller_Action_Helper
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Controller_Action_Helper_AutoCompleteDojo extends Zend_Controller_Action_Helper_AutoComplete_Abstract
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: AutoCompleteDojo.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
32
  * @category Zend
33
  * @package Zend_Controller
34
  * @subpackage Zend_Controller_Action_Helper
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Controller_Action_Helper_AutoCompleteDojo extends Zend_Controller_Action_Helper_AutoComplete_Abstract
lib/Zend/Controller/Action/Helper/AutoCompleteScriptaculous.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: AutoCompleteScriptaculous.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -32,7 +32,7 @@
32
  * @category Zend
33
  * @package Zend_Controller
34
  * @subpackage Zend_Controller_Action_Helper
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Controller_Action_Helper_AutoCompleteScriptaculous extends Zend_Controller_Action_Helper_AutoComplete_Abstract
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: AutoCompleteScriptaculous.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
32
  * @category Zend
33
  * @package Zend_Controller
34
  * @subpackage Zend_Controller_Action_Helper
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Controller_Action_Helper_AutoCompleteScriptaculous extends Zend_Controller_Action_Helper_AutoComplete_Abstract
lib/Zend/Controller/Action/Helper/Cache.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Cache.php 22662 2010-07-24 17:37:36Z mabe $
20
  */
21
 
22
  /**
@@ -37,7 +37,7 @@
37
  /**
38
  * @category Zend
39
  * @package Zend_Controller
40
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
41
  * @license http://framework.zend.com/license/new-bsd New BSD License
42
  */
43
  class Zend_Controller_Action_Helper_Cache
@@ -64,7 +64,7 @@ class Zend_Controller_Action_Helper_Cache
64
  * @var array
65
  */
66
  protected $_tags = array();
67
-
68
  /**
69
  * Indexed map of Extensions by Controller and Action
70
  *
@@ -130,16 +130,26 @@ class Zend_Controller_Action_Helper_Cache
130
  public function removePage($relativeUrl, $recursive = false)
131
  {
132
  $cache = $this->getCache(Zend_Cache_Manager::PAGECACHE);
 
 
133
  if ($recursive) {
134
  $backend = $cache->getBackend();
135
  if (($backend instanceof Zend_Cache_Backend)
136
  && method_exists($backend, 'removeRecursively')
137
  ) {
138
- return $backend->removeRecursively($relativeUrl);
 
 
 
 
139
  }
140
  }
141
 
142
- return $cache->remove($relativeUrl);
 
 
 
 
143
  }
144
 
145
  /**
@@ -189,7 +199,7 @@ class Zend_Controller_Action_Helper_Cache
189
  ->start($this->_encodeCacheId($reqUri), $tags, $extension);
190
  }
191
  }
192
-
193
  /**
194
  * Encode a Cache ID as hexadecimal. This is a workaround because Backend ID validation
195
  * is trapped in the Frontend classes. Will try to get this reversed for ZF 2.0
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Cache.php 24853 2012-05-31 23:19:27Z adamlundrigan $
20
  */
21
 
22
  /**
37
  /**
38
  * @category Zend
39
  * @package Zend_Controller
40
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
41
  * @license http://framework.zend.com/license/new-bsd New BSD License
42
  */
43
  class Zend_Controller_Action_Helper_Cache
64
  * @var array
65
  */
66
  protected $_tags = array();
67
+
68
  /**
69
  * Indexed map of Extensions by Controller and Action
70
  *
130
  public function removePage($relativeUrl, $recursive = false)
131
  {
132
  $cache = $this->getCache(Zend_Cache_Manager::PAGECACHE);
133
+ $encodedCacheId = $this->_encodeCacheId($relativeUrl);
134
+
135
  if ($recursive) {
136
  $backend = $cache->getBackend();
137
  if (($backend instanceof Zend_Cache_Backend)
138
  && method_exists($backend, 'removeRecursively')
139
  ) {
140
+ $result = $backend->removeRecursively($encodedCacheId);
141
+ if (is_null($result) ) {
142
+ $result = $backend->removeRecursively($relativeUrl);
143
+ }
144
+ return $result;
145
  }
146
  }
147
 
148
+ $result = $cache->remove($encodedCacheId);
149
+ if (is_null($result) ) {
150
+ $result = $cache->remove($relativeUrl);
151
+ }
152
+ return $result;
153
  }
154
 
155
  /**
199
  ->start($this->_encodeCacheId($reqUri), $tags, $extension);
200
  }
201
  }
202
+
203
  /**
204
  * Encode a Cache ID as hexadecimal. This is a workaround because Backend ID validation
205
  * is trapped in the Frontend classes. Will try to get this reversed for ZF 2.0
lib/Zend/Controller/Action/Helper/ContextSwitch.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: ContextSwitch.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -32,7 +32,7 @@
32
  * @category Zend
33
  * @package Zend_Controller
34
  * @subpackage Zend_Controller_Action_Helper
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Controller_Action_Helper_ContextSwitch extends Zend_Controller_Action_Helper_Abstract
@@ -1304,7 +1304,6 @@ class Zend_Controller_Action_Helper_ContextSwitch extends Zend_Controller_Action
1304
  if (null === $controller) {
1305
  return array();
1306
  }
1307
- $action = (string) $action;
1308
  $contextKey = $this->_contextKey;
1309
 
1310
  if (!isset($controller->$contextKey)) {
@@ -1312,6 +1311,7 @@ class Zend_Controller_Action_Helper_ContextSwitch extends Zend_Controller_Action
1312
  }
1313
 
1314
  if (null !== $action) {
 
1315
  if (isset($controller->{$contextKey}[$action])) {
1316
  return $controller->{$contextKey}[$action];
1317
  } else {
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: ContextSwitch.php 24864 2012-06-02 00:51:50Z adamlundrigan $
21
  */
22
 
23
  /**
32
  * @category Zend
33
  * @package Zend_Controller
34
  * @subpackage Zend_Controller_Action_Helper
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Controller_Action_Helper_ContextSwitch extends Zend_Controller_Action_Helper_Abstract
1304
  if (null === $controller) {
1305
  return array();
1306
  }
 
1307
  $contextKey = $this->_contextKey;
1308
 
1309
  if (!isset($controller->$contextKey)) {
1311
  }
1312
 
1313
  if (null !== $action) {
1314
+ $action = (string) $action;
1315
  if (isset($controller->{$contextKey}[$action])) {
1316
  return $controller->{$contextKey}[$action];
1317
  } else {
lib/Zend/Controller/Action/Helper/FlashMessenger.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -36,9 +36,9 @@
36
  * @category Zend
37
  * @package Zend_Controller
38
  * @subpackage Zend_Controller_Action_Helper
39
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
40
  * @license http://framework.zend.com/license/new-bsd New BSD License
41
- * @version $Id: FlashMessenger.php 20096 2010-01-06 02:05:09Z bkarwin $
42
  */
43
  class Zend_Controller_Action_Helper_FlashMessenger extends Zend_Controller_Action_Helper_Abstract implements IteratorAggregate, Countable
44
  {
@@ -112,6 +112,16 @@ class Zend_Controller_Action_Helper_FlashMessenger extends Zend_Controller_Actio
112
  $this->_namespace = $namespace;
113
  return $this;
114
  }
 
 
 
 
 
 
 
 
 
 
115
 
116
  /**
117
  * resetNamespace() - reset the namespace to the default
@@ -130,17 +140,22 @@ class Zend_Controller_Action_Helper_FlashMessenger extends Zend_Controller_Actio
130
  * @param string $message
131
  * @return Zend_Controller_Action_Helper_FlashMessenger Provides a fluent interface
132
  */
133
- public function addMessage($message)
134
  {
 
 
 
 
135
  if (self::$_messageAdded === false) {
136
  self::$_session->setExpirationHops(1, null, true);
137
  }
138
 
139
  if (!is_array(self::$_session->{$this->_namespace})) {
140
- self::$_session->{$this->_namespace} = array();
141
  }
142
 
143
- self::$_session->{$this->_namespace}[] = $message;
 
144
 
145
  return $this;
146
  }
@@ -150,9 +165,13 @@ class Zend_Controller_Action_Helper_FlashMessenger extends Zend_Controller_Actio
150
  *
151
  * @return boolean
152
  */
153
- public function hasMessages()
154
  {
155
- return isset(self::$_messages[$this->_namespace]);
 
 
 
 
156
  }
157
 
158
  /**
@@ -160,10 +179,14 @@ class Zend_Controller_Action_Helper_FlashMessenger extends Zend_Controller_Actio
160
  *
161
  * @return array
162
  */
163
- public function getMessages()
164
  {
165
- if ($this->hasMessages()) {
166
- return self::$_messages[$this->_namespace];
 
 
 
 
167
  }
168
 
169
  return array();
@@ -174,10 +197,14 @@ class Zend_Controller_Action_Helper_FlashMessenger extends Zend_Controller_Actio
174
  *
175
  * @return boolean True if messages were cleared, false if none existed
176
  */
177
- public function clearMessages()
178
  {
179
- if ($this->hasMessages()) {
180
- unset(self::$_messages[$this->_namespace]);
 
 
 
 
181
  return true;
182
  }
183
 
@@ -190,9 +217,13 @@ class Zend_Controller_Action_Helper_FlashMessenger extends Zend_Controller_Actio
190
  *
191
  * @return boolean
192
  */
193
- public function hasCurrentMessages()
194
  {
195
- return isset(self::$_session->{$this->_namespace});
 
 
 
 
196
  }
197
 
198
  /**
@@ -201,10 +232,14 @@ class Zend_Controller_Action_Helper_FlashMessenger extends Zend_Controller_Actio
201
  *
202
  * @return array
203
  */
204
- public function getCurrentMessages()
205
  {
206
- if ($this->hasCurrentMessages()) {
207
- return self::$_session->{$this->_namespace};
 
 
 
 
208
  }
209
 
210
  return array();
@@ -215,10 +250,14 @@ class Zend_Controller_Action_Helper_FlashMessenger extends Zend_Controller_Actio
215
  *
216
  * @return boolean
217
  */
218
- public function clearCurrentMessages()
219
  {
 
 
 
 
220
  if ($this->hasCurrentMessages()) {
221
- unset(self::$_session->{$this->_namespace});
222
  return true;
223
  }
224
 
@@ -230,10 +269,14 @@ class Zend_Controller_Action_Helper_FlashMessenger extends Zend_Controller_Actio
230
  *
231
  * @return ArrayObject
232
  */
233
- public function getIterator()
234
  {
235
- if ($this->hasMessages()) {
236
- return new ArrayObject($this->getMessages());
 
 
 
 
237
  }
238
 
239
  return new ArrayObject();
@@ -244,10 +287,14 @@ class Zend_Controller_Action_Helper_FlashMessenger extends Zend_Controller_Actio
244
  *
245
  * @return int
246
  */
247
- public function count()
248
  {
249
- if ($this->hasMessages()) {
250
- return count($this->getMessages());
 
 
 
 
251
  }
252
 
253
  return 0;
@@ -259,8 +306,8 @@ class Zend_Controller_Action_Helper_FlashMessenger extends Zend_Controller_Actio
259
  * @param string $message
260
  * @return void
261
  */
262
- public function direct($message)
263
  {
264
- return $this->addMessage($message);
265
  }
266
  }
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
36
  * @category Zend
37
  * @package Zend_Controller
38
  * @subpackage Zend_Controller_Action_Helper
39
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
40
  * @license http://framework.zend.com/license/new-bsd New BSD License
41
+ * @version $Id: FlashMessenger.php 24813 2012-05-22 16:49:24Z adamlundrigan $
42
  */
43
  class Zend_Controller_Action_Helper_FlashMessenger extends Zend_Controller_Action_Helper_Abstract implements IteratorAggregate, Countable
44
  {
112
  $this->_namespace = $namespace;
113
  return $this;
114
  }
115
+
116
+ /**
117
+ * getNamespace() - return the current namepsace
118
+ *
119
+ * @return string
120
+ */
121
+ public function getNamespace()
122
+ {
123
+ return $this->_namespace;
124
+ }
125
 
126
  /**
127
  * resetNamespace() - reset the namespace to the default
140
  * @param string $message
141
  * @return Zend_Controller_Action_Helper_FlashMessenger Provides a fluent interface
142
  */
143
+ public function addMessage($message, $namespace = null)
144
  {
145
+ if (!is_string($namespace) || $namespace == '') {
146
+ $namespace = $this->getNamespace();
147
+ }
148
+
149
  if (self::$_messageAdded === false) {
150
  self::$_session->setExpirationHops(1, null, true);
151
  }
152
 
153
  if (!is_array(self::$_session->{$this->_namespace})) {
154
+ self::$_session->{$namespace} = array();
155
  }
156
 
157
+ self::$_session->{$namespace}[] = $message;
158
+ self::$_messageAdded = true;
159
 
160
  return $this;
161
  }
165
  *
166
  * @return boolean
167
  */
168
+ public function hasMessages($namespace = null)
169
  {
170
+ if (!is_string($namespace) || $namespace == '') {
171
+ $namespace = $this->getNamespace();
172
+ }
173
+
174
+ return isset(self::$_messages[$namespace]);
175
  }
176
 
177
  /**
179
  *
180
  * @return array
181
  */
182
+ public function getMessages($namespace = null)
183
  {
184
+ if (!is_string($namespace) || $namespace == '') {
185
+ $namespace = $this->getNamespace();
186
+ }
187
+
188
+ if ($this->hasMessages($namespace)) {
189
+ return self::$_messages[$namespace];
190
  }
191
 
192
  return array();
197
  *
198
  * @return boolean True if messages were cleared, false if none existed
199
  */
200
+ public function clearMessages($namespace = null)
201
  {
202
+ if (!is_string($namespace) || $namespace == '') {
203
+ $namespace = $this->getNamespace();
204
+ }
205
+
206
+ if ($this->hasMessages($namespace)) {
207
+ unset(self::$_messages[$namespace]);
208
  return true;
209
  }
210
 
217
  *
218
  * @return boolean
219
  */
220
+ public function hasCurrentMessages($namespace = null)
221
  {
222
+ if (!is_string($namespace) || $namespace == '') {
223
+ $namespace = $this->getNamespace();
224
+ }
225
+
226
+ return isset(self::$_session->{$namespace});
227
  }
228
 
229
  /**
232
  *
233
  * @return array
234
  */
235
+ public function getCurrentMessages($namespace = null)
236
  {
237
+ if (!is_string($namespace) || $namespace == '') {
238
+ $namespace = $this->getNamespace();
239
+ }
240
+
241
+ if ($this->hasCurrentMessages($namespace)) {
242
+ return self::$_session->{$namespace};
243
  }
244
 
245
  return array();
250
  *
251
  * @return boolean
252
  */
253
+ public function clearCurrentMessages($namespace = null)
254
  {
255
+ if (!is_string($namespace) || $namespace == '') {
256
+ $namespace = $this->getNamespace();
257
+ }
258
+
259
  if ($this->hasCurrentMessages()) {
260
+ unset(self::$_session->{$namespace});
261
  return true;
262
  }
263
 
269
  *
270
  * @return ArrayObject
271
  */
272
+ public function getIterator($namespace = null)
273
  {
274
+ if (!is_string($namespace) || $namespace == '') {
275
+ $namespace = $this->getNamespace();
276
+ }
277
+
278
+ if ($this->hasMessages($namespace)) {
279
+ return new ArrayObject($this->getMessages($namespace));
280
  }
281
 
282
  return new ArrayObject();
287
  *
288
  * @return int
289
  */
290
+ public function count($namespace = null)
291
  {
292
+ if (!is_string($namespace) || $namespace == '') {
293
+ $namespace = $this->getNamespace();
294
+ }
295
+
296
+ if ($this->hasMessages($namespace)) {
297
+ return count($this->getMessages($namespace));
298
  }
299
 
300
  return 0;
306
  * @param string $message
307
  * @return void
308
  */
309
+ public function direct($message, $namespace=NULL)
310
  {
311
+ return $this->addMessage($message, $namespace);
312
  }
313
  }
lib/Zend/Controller/Action/Helper/Json.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Json.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -32,7 +32,7 @@
32
  * @category Zend
33
  * @package Zend_Controller
34
  * @subpackage Zend_Controller_Action_Helper
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Controller_Action_Helper_Json extends Zend_Controller_Action_Helper_Abstract
@@ -53,23 +53,24 @@ class Zend_Controller_Action_Helper_Json extends Zend_Controller_Action_Helper_A
53
  * @param mixed $data
54
  * @param boolean $keepLayouts
55
  * @param boolean|array $keepLayouts
 
56
  * NOTE: if boolean, establish $keepLayouts to true|false
57
  * if array, admit params for Zend_Json::encode as enableJsonExprFinder=>true|false
58
  * if $keepLayouts and parmas for Zend_Json::encode are required
59
- * then, the array can contains a 'keepLayout'=>true|false
60
  * that will not be passed to Zend_Json::encode method but will be passed
61
  * to Zend_View_Helper_Json
62
  * @throws Zend_Controller_Action_Helper_Json
63
  * @return string
64
  */
65
- public function encodeJson($data, $keepLayouts = false)
66
  {
67
  /**
68
  * @see Zend_View_Helper_Json
69
  */
70
  #require_once 'Zend/View/Helper/Json.php';
71
  $jsonHelper = new Zend_View_Helper_Json();
72
- $data = $jsonHelper->json($data, $keepLayouts);
73
 
74
  if (!$keepLayouts) {
75
  /**
@@ -87,17 +88,18 @@ class Zend_Controller_Action_Helper_Json extends Zend_Controller_Action_Helper_A
87
  *
88
  * @param mixed $data
89
  * @param boolean|array $keepLayouts
 
90
  * NOTE: if boolean, establish $keepLayouts to true|false
91
  * if array, admit params for Zend_Json::encode as enableJsonExprFinder=>true|false
92
  * if $keepLayouts and parmas for Zend_Json::encode are required
93
- * then, the array can contains a 'keepLayout'=>true|false
94
  * that will not be passed to Zend_Json::encode method but will be passed
95
  * to Zend_View_Helper_Json
96
  * @return string|void
97
  */
98
- public function sendJson($data, $keepLayouts = false)
99
  {
100
- $data = $this->encodeJson($data, $keepLayouts);
101
  $response = $this->getResponse();
102
  $response->setBody($data);
103
 
@@ -118,13 +120,14 @@ class Zend_Controller_Action_Helper_Json extends Zend_Controller_Action_Helper_A
118
  * @param mixed $data
119
  * @param boolean $sendNow
120
  * @param boolean $keepLayouts
 
121
  * @return string|void
122
  */
123
- public function direct($data, $sendNow = true, $keepLayouts = false)
124
  {
125
  if ($sendNow) {
126
- return $this->sendJson($data, $keepLayouts);
127
  }
128
- return $this->encodeJson($data, $keepLayouts);
129
  }
130
  }
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Json.php 24829 2012-05-30 12:31:39Z adamlundrigan $
21
  */
22
 
23
  /**
32
  * @category Zend
33
  * @package Zend_Controller
34
  * @subpackage Zend_Controller_Action_Helper
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Controller_Action_Helper_Json extends Zend_Controller_Action_Helper_Abstract
53
  * @param mixed $data
54
  * @param boolean $keepLayouts
55
  * @param boolean|array $keepLayouts
56
+ * @param boolean $encodeData Provided data is already JSON
57
  * NOTE: if boolean, establish $keepLayouts to true|false
58
  * if array, admit params for Zend_Json::encode as enableJsonExprFinder=>true|false
59
  * if $keepLayouts and parmas for Zend_Json::encode are required
60
+ * then, the array can contains a 'keepLayout'=>true|false and/or 'encodeData'=>true|false
61
  * that will not be passed to Zend_Json::encode method but will be passed
62
  * to Zend_View_Helper_Json
63
  * @throws Zend_Controller_Action_Helper_Json
64
  * @return string
65
  */
66
+ public function encodeJson($data, $keepLayouts = false, $encodeData = true)
67
  {
68
  /**
69
  * @see Zend_View_Helper_Json
70
  */
71
  #require_once 'Zend/View/Helper/Json.php';
72
  $jsonHelper = new Zend_View_Helper_Json();
73
+ $data = $jsonHelper->json($data, $keepLayouts, $encodeData);
74
 
75
  if (!$keepLayouts) {
76
  /**
88
  *
89
  * @param mixed $data
90
  * @param boolean|array $keepLayouts
91
+ * @param $encodeData Encode $data as JSON?
92
  * NOTE: if boolean, establish $keepLayouts to true|false
93
  * if array, admit params for Zend_Json::encode as enableJsonExprFinder=>true|false
94
  * if $keepLayouts and parmas for Zend_Json::encode are required
95
+ * then, the array can contains a 'keepLayout'=>true|false and/or 'encodeData'=>true|false
96
  * that will not be passed to Zend_Json::encode method but will be passed
97
  * to Zend_View_Helper_Json
98
  * @return string|void
99
  */
100
+ public function sendJson($data, $keepLayouts = false, $encodeData = true)
101
  {
102
+ $data = $this->encodeJson($data, $keepLayouts, $encodeData);
103
  $response = $this->getResponse();
104
  $response->setBody($data);
105
 
120
  * @param mixed $data
121
  * @param boolean $sendNow
122
  * @param boolean $keepLayouts
123
+ * @param boolean $encodeData Encode $data as JSON?
124
  * @return string|void
125
  */
126
+ public function direct($data, $sendNow = true, $keepLayouts = false, $encodeData = true)
127
  {
128
  if ($sendNow) {
129
+ return $this->sendJson($data, $keepLayouts, $encodeData);
130
  }
131
+ return $this->encodeJson($data, $keepLayouts, $encodeData);
132
  }
133
  }
lib/Zend/Controller/Action/Helper/Redirector.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Redirector.php 23248 2010-10-26 12:45:52Z matthew $
21
  */
22
 
23
  /**
@@ -29,7 +29,7 @@
29
  * @category Zend
30
  * @package Zend_Controller
31
  * @subpackage Zend_Controller_Action_Helper
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Controller_Action_Helper_Redirector extends Zend_Controller_Action_Helper_Abstract
@@ -100,7 +100,7 @@ class Zend_Controller_Action_Helper_Redirector extends Zend_Controller_Action_He
100
  }
101
 
102
  /**
103
- * Retrieve HTTP status code for {@link _redirect()} behaviour
104
  *
105
  * @param int $code
106
  * @return Zend_Controller_Action_Helper_Redirector Provides a fluent interface
@@ -123,7 +123,7 @@ class Zend_Controller_Action_Helper_Redirector extends Zend_Controller_Action_He
123
  }
124
 
125
  /**
126
- * Retrieve exit flag for {@link _redirect()} behaviour
127
  *
128
  * @param boolean $flag
129
  * @return Zend_Controller_Action_Helper_Redirector Provides a fluent interface
@@ -146,7 +146,7 @@ class Zend_Controller_Action_Helper_Redirector extends Zend_Controller_Action_He
146
  }
147
 
148
  /**
149
- * Retrieve 'prepend base' flag for {@link _redirect()} behaviour
150
  *
151
  * @param boolean $flag
152
  * @return Zend_Controller_Action_Helper_Redirector Provides a fluent interface
@@ -294,9 +294,9 @@ class Zend_Controller_Action_Helper_Redirector extends Zend_Controller_Action_He
294
  }
295
  }
296
 
297
- $params['module'] = $module;
298
- $params['controller'] = $controller;
299
- $params['action'] = $action;
300
 
301
  $router = $this->getFrontController()->getRouter();
302
  $url = $router->assemble($params, 'default', true);
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Redirector.php 24843 2012-05-31 18:43:18Z rob $
21
  */
22
 
23
  /**
29
  * @category Zend
30
  * @package Zend_Controller
31
  * @subpackage Zend_Controller_Action_Helper
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Controller_Action_Helper_Redirector extends Zend_Controller_Action_Helper_Abstract
100
  }
101
 
102
  /**
103
+ * Set HTTP status code for {@link _redirect()} behaviour
104
  *
105
  * @param int $code
106
  * @return Zend_Controller_Action_Helper_Redirector Provides a fluent interface
123
  }
124
 
125
  /**
126
+ * Set exit flag for {@link _redirect()} behaviour
127
  *
128
  * @param boolean $flag
129
  * @return Zend_Controller_Action_Helper_Redirector Provides a fluent interface
146
  }
147
 
148
  /**
149
+ * Set 'prepend base' flag for {@link _redirect()} behaviour
150
  *
151
  * @param boolean $flag
152
  * @return Zend_Controller_Action_Helper_Redirector Provides a fluent interface
294
  }
295
  }
296
 
297
+ $params[$request->getModuleKey()] = $module;
298
+ $params[$request->getControllerKey()] = $controller;
299
+ $params[$request->getActionKey()] = $action;
300
 
301
  $router = $this->getFrontController()->getRouter();
302
  $url = $router->assemble($params, 'default', true);
lib/Zend/Controller/Action/Helper/Url.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Url.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -32,7 +32,7 @@
32
  * @category Zend
33
  * @package Zend_Controller
34
  * @subpackage Zend_Controller_Action_Helper
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Controller_Action_Helper_Url extends Zend_Controller_Action_Helper_Abstract
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Url.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
32
  * @category Zend
33
  * @package Zend_Controller
34
  * @subpackage Zend_Controller_Action_Helper
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Controller_Action_Helper_Url extends Zend_Controller_Action_Helper_Abstract
lib/Zend/Controller/Action/Helper/ViewRenderer.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: ViewRenderer.php 20261 2010-01-13 18:55:25Z matthew $
21
  */
22
 
23
  /**
@@ -68,7 +68,7 @@
68
  * @uses Zend_Controller_Action_Helper_Abstract
69
  * @package Zend_Controller
70
  * @subpackage Zend_Controller_Action_Helper
71
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
72
  * @license http://framework.zend.com/license/new-bsd New BSD License
73
  */
74
  class Zend_Controller_Action_Helper_ViewRenderer extends Zend_Controller_Action_Helper_Abstract
@@ -626,6 +626,9 @@ class Zend_Controller_Action_Helper_ViewRenderer extends Zend_Controller_Action_
626
  } elseif (null !== $action) {
627
  $vars['action'] = $action;
628
  }
 
 
 
629
 
630
  $inflector = $this->getInflector();
631
  if ($this->getNoController() || $this->getNeverController()) {
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action_Helper
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: ViewRenderer.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
68
  * @uses Zend_Controller_Action_Helper_Abstract
69
  * @package Zend_Controller
70
  * @subpackage Zend_Controller_Action_Helper
71
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
72
  * @license http://framework.zend.com/license/new-bsd New BSD License
73
  */
74
  class Zend_Controller_Action_Helper_ViewRenderer extends Zend_Controller_Action_Helper_Abstract
626
  } elseif (null !== $action) {
627
  $vars['action'] = $action;
628
  }
629
+
630
+ $replacePattern = array('/[^a-z0-9]+$/i', '/^[^a-z0-9]+/i');
631
+ $vars['action'] = preg_replace($replacePattern, '', $vars['action']);
632
 
633
  $inflector = $this->getInflector();
634
  if ($this->getNoController() || $this->getNeverController()) {
lib/Zend/Controller/Action/HelperBroker.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: HelperBroker.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -34,7 +34,7 @@
34
  * @category Zend
35
  * @package Zend_Controller
36
  * @subpackage Zend_Controller_Action
37
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Controller_Action_HelperBroker
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: HelperBroker.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
34
  * @category Zend
35
  * @package Zend_Controller
36
  * @subpackage Zend_Controller_Action
37
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Controller_Action_HelperBroker
lib/Zend/Controller/Action/HelperBroker/PriorityStack.php CHANGED
@@ -15,16 +15,16 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: PriorityStack.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_Controller
26
  * @subpackage Zend_Controller_Action
27
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
  class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggregate, ArrayAccess, Countable
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: PriorityStack.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_Controller
26
  * @subpackage Zend_Controller_Action
27
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
  class Zend_Controller_Action_HelperBroker_PriorityStack implements IteratorAggregate, ArrayAccess, Countable
lib/Zend/Controller/Action/Interface.php CHANGED
@@ -15,16 +15,16 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_Controller
26
  * @subpackage Zend_Controller_Action
27
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
  interface Zend_Controller_Action_Interface
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Action
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_Controller
26
  * @subpackage Zend_Controller_Action
27
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
  interface Zend_Controller_Action_Interface
lib/Zend/Controller/Dispatcher/Abstract.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Dispatcher
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Controller_Dispatcher_Interface */
@@ -27,7 +27,7 @@
27
  * @category Zend
28
  * @package Zend_Controller
29
  * @subpackage Dispatcher
30
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  abstract class Zend_Controller_Dispatcher_Abstract implements Zend_Controller_Dispatcher_Interface
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Dispatcher
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Controller_Dispatcher_Interface */
27
  * @category Zend
28
  * @package Zend_Controller
29
  * @subpackage Dispatcher
30
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  abstract class Zend_Controller_Dispatcher_Abstract implements Zend_Controller_Dispatcher_Interface
lib/Zend/Controller/Dispatcher/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Dispatcher
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -29,7 +29,7 @@
29
  * @category Zend
30
  * @package Zend_Controller
31
  * @subpackage Dispatcher
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Controller_Dispatcher_Exception extends Zend_Controller_Exception
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Dispatcher
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
29
  * @category Zend
30
  * @package Zend_Controller
31
  * @subpackage Dispatcher
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Controller_Dispatcher_Exception extends Zend_Controller_Exception
lib/Zend/Controller/Dispatcher/Interface.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Dispatcher
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -33,7 +33,7 @@
33
  /**
34
  * @package Zend_Controller
35
  * @subpackage Dispatcher
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  interface Zend_Controller_Dispatcher_Interface
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Dispatcher
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
33
  /**
34
  * @package Zend_Controller
35
  * @subpackage Dispatcher
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  interface Zend_Controller_Dispatcher_Interface
lib/Zend/Controller/Dispatcher/Standard.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Dispatcher
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Standard.php 22038 2010-04-28 18:54:22Z matthew $
21
  */
22
 
23
  /** Zend_Loader */
@@ -30,7 +30,7 @@
30
  * @category Zend
31
  * @package Zend_Controller
32
  * @subpackage Dispatcher
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Controller_Dispatcher_Standard extends Zend_Controller_Dispatcher_Abstract
@@ -256,6 +256,19 @@ class Zend_Controller_Dispatcher_Standard extends Zend_Controller_Dispatcher_Abs
256
  }
257
  }
258
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  /**
260
  * Load the controller class file
261
  */
@@ -265,12 +278,12 @@ class Zend_Controller_Dispatcher_Standard extends Zend_Controller_Dispatcher_Abs
265
  * Instantiate controller with request, response, and invocation
266
  * arguments; throw exception if it's not an action controller
267
  */
268
- $controller = new $className($request, $this->getResponse(), $this->getParams());
269
  if (!($controller instanceof Zend_Controller_Action_Interface) &&
270
  !($controller instanceof Zend_Controller_Action)) {
271
  #require_once 'Zend/Controller/Dispatcher/Exception.php';
272
  throw new Zend_Controller_Dispatcher_Exception(
273
- 'Controller "' . $className . '" is not an instance of Zend_Controller_Action_Interface'
274
  );
275
  }
276
 
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Dispatcher
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Standard.php 24861 2012-06-01 23:40:13Z adamlundrigan $
21
  */
22
 
23
  /** Zend_Loader */
30
  * @category Zend
31
  * @package Zend_Controller
32
  * @subpackage Dispatcher
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Controller_Dispatcher_Standard extends Zend_Controller_Dispatcher_Abstract
256
  }
257
  }
258
 
259
+ /**
260
+ * If we're in a module or prefixDefaultModule is on, we must add the module name
261
+ * prefix to the contents of $className, as getControllerClass does not do that automatically.
262
+ * We must keep a separate variable because modules are not strictly PSR-0: We need the no-module-prefix
263
+ * class name to do the class->file mapping, but the full class name to insantiate the controller
264
+ */
265
+ $moduleClassName = $className;
266
+ if (($this->_defaultModule != $this->_curModule)
267
+ || $this->getParam('prefixDefaultModule'))
268
+ {
269
+ $moduleClassName = $this->formatClassName($this->_curModule, $className);
270
+ }
271
+
272
  /**
273
  * Load the controller class file
274
  */
278
  * Instantiate controller with request, response, and invocation
279
  * arguments; throw exception if it's not an action controller
280
  */
281
+ $controller = new $moduleClassName($request, $this->getResponse(), $this->getParams());
282
  if (!($controller instanceof Zend_Controller_Action_Interface) &&
283
  !($controller instanceof Zend_Controller_Action)) {
284
  #require_once 'Zend/Controller/Dispatcher/Exception.php';
285
  throw new Zend_Controller_Dispatcher_Exception(
286
+ 'Controller "' . $moduleClassName . '" is not an instance of Zend_Controller_Action_Interface'
287
  );
288
  }
289
 
lib/Zend/Controller/Exception.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
 
@@ -27,7 +27,7 @@
27
  /**
28
  * @category Zend
29
  * @package Zend_Controller
30
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Controller_Exception extends Zend_Exception
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
 
27
  /**
28
  * @category Zend
29
  * @package Zend_Controller
30
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Controller_Exception extends Zend_Exception
lib/Zend/Controller/Front.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Front.php 20246 2010-01-12 21:36:08Z dasprid $
20
  */
21
 
22
 
@@ -32,7 +32,7 @@
32
  /**
33
  * @category Zend
34
  * @package Zend_Controller
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Controller_Front
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Front.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
 
32
  /**
33
  * @category Zend
34
  * @package Zend_Controller
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Controller_Front
lib/Zend/Controller/Plugin/Abstract.php CHANGED
@@ -15,16 +15,16 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Plugins
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_Controller
26
  * @subpackage Plugins
27
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
  abstract class Zend_Controller_Plugin_Abstract
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Plugins
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_Controller
26
  * @subpackage Plugins
27
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
  abstract class Zend_Controller_Plugin_Abstract
lib/Zend/Controller/Plugin/ActionStack.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Plugins
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -32,9 +32,9 @@
32
  * @category Zend
33
  * @package Zend_Controller
34
  * @subpackage Plugins
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
- * @version $Id: ActionStack.php 20096 2010-01-06 02:05:09Z bkarwin $
38
  */
39
  class Zend_Controller_Plugin_ActionStack extends Zend_Controller_Plugin_Abstract
40
  {
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Plugins
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
32
  * @category Zend
33
  * @package Zend_Controller
34
  * @subpackage Plugins
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
+ * @version $Id: ActionStack.php 24593 2012-01-05 20:35:02Z matthew $
38
  */
39
  class Zend_Controller_Plugin_ActionStack extends Zend_Controller_Plugin_Abstract
40
  {
lib/Zend/Controller/Plugin/Broker.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Plugins
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Broker.php 20255 2010-01-13 13:23:36Z matthew $
21
  */
22
 
23
  /** Zend_Controller_Plugin_Abstract */
@@ -27,7 +27,7 @@
27
  * @category Zend
28
  * @package Zend_Controller
29
  * @subpackage Plugins
30
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Controller_Plugin_Broker extends Zend_Controller_Plugin_Abstract
@@ -237,7 +237,7 @@ class Zend_Controller_Plugin_Broker extends Zend_Controller_Plugin_Abstract
237
  $plugin->routeStartup($request);
238
  } catch (Exception $e) {
239
  if (Zend_Controller_Front::getInstance()->throwExceptions()) {
240
- throw $e;
241
  } else {
242
  $this->getResponse()->setException($e);
243
  }
@@ -260,7 +260,7 @@ class Zend_Controller_Plugin_Broker extends Zend_Controller_Plugin_Abstract
260
  $plugin->routeShutdown($request);
261
  } catch (Exception $e) {
262
  if (Zend_Controller_Front::getInstance()->throwExceptions()) {
263
- throw $e;
264
  } else {
265
  $this->getResponse()->setException($e);
266
  }
@@ -287,7 +287,7 @@ class Zend_Controller_Plugin_Broker extends Zend_Controller_Plugin_Abstract
287
  $plugin->dispatchLoopStartup($request);
288
  } catch (Exception $e) {
289
  if (Zend_Controller_Front::getInstance()->throwExceptions()) {
290
- throw $e;
291
  } else {
292
  $this->getResponse()->setException($e);
293
  }
@@ -309,9 +309,11 @@ class Zend_Controller_Plugin_Broker extends Zend_Controller_Plugin_Abstract
309
  $plugin->preDispatch($request);
310
  } catch (Exception $e) {
311
  if (Zend_Controller_Front::getInstance()->throwExceptions()) {
312
- throw $e;
313
  } else {
314
  $this->getResponse()->setException($e);
 
 
315
  }
316
  }
317
  }
@@ -331,7 +333,7 @@ class Zend_Controller_Plugin_Broker extends Zend_Controller_Plugin_Abstract
331
  $plugin->postDispatch($request);
332
  } catch (Exception $e) {
333
  if (Zend_Controller_Front::getInstance()->throwExceptions()) {
334
- throw $e;
335
  } else {
336
  $this->getResponse()->setException($e);
337
  }
@@ -353,7 +355,7 @@ class Zend_Controller_Plugin_Broker extends Zend_Controller_Plugin_Abstract
353
  $plugin->dispatchLoopShutdown();
354
  } catch (Exception $e) {
355
  if (Zend_Controller_Front::getInstance()->throwExceptions()) {
356
- throw $e;
357
  } else {
358
  $this->getResponse()->setException($e);
359
  }
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Plugins
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Broker.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Controller_Plugin_Abstract */
27
  * @category Zend
28
  * @package Zend_Controller
29
  * @subpackage Plugins
30
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Controller_Plugin_Broker extends Zend_Controller_Plugin_Abstract
237
  $plugin->routeStartup($request);
238
  } catch (Exception $e) {
239
  if (Zend_Controller_Front::getInstance()->throwExceptions()) {
240
+ throw new Zend_Controller_Exception($e->getMessage() . $e->getTraceAsString(), $e->getCode(), $e);
241
  } else {
242
  $this->getResponse()->setException($e);
243
  }
260
  $plugin->routeShutdown($request);
261
  } catch (Exception $e) {
262
  if (Zend_Controller_Front::getInstance()->throwExceptions()) {
263
+ throw new Zend_Controller_Exception($e->getMessage() . $e->getTraceAsString(), $e->getCode(), $e);
264
  } else {
265
  $this->getResponse()->setException($e);
266
  }
287
  $plugin->dispatchLoopStartup($request);
288
  } catch (Exception $e) {
289
  if (Zend_Controller_Front::getInstance()->throwExceptions()) {
290
+ throw new Zend_Controller_Exception($e->getMessage() . $e->getTraceAsString(), $e->getCode(), $e);
291
  } else {
292
  $this->getResponse()->setException($e);
293
  }
309
  $plugin->preDispatch($request);
310
  } catch (Exception $e) {
311
  if (Zend_Controller_Front::getInstance()->throwExceptions()) {
312
+ throw new Zend_Controller_Exception($e->getMessage() . $e->getTraceAsString(), $e->getCode(), $e);
313
  } else {
314
  $this->getResponse()->setException($e);
315
+ // skip rendering of normal dispatch give the error handler a try
316
+ $this->getRequest()->setDispatched(false);
317
  }
318
  }
319
  }
333
  $plugin->postDispatch($request);
334
  } catch (Exception $e) {
335
  if (Zend_Controller_Front::getInstance()->throwExceptions()) {
336
+ throw new Zend_Controller_Exception($e->getMessage() . $e->getTraceAsString(), $e->getCode(), $e);
337
  } else {
338
  $this->getResponse()->setException($e);
339
  }
355
  $plugin->dispatchLoopShutdown();
356
  } catch (Exception $e) {
357
  if (Zend_Controller_Front::getInstance()->throwExceptions()) {
358
+ throw new Zend_Controller_Exception($e->getMessage() . $e->getTraceAsString(), $e->getCode(), $e);
359
  } else {
360
  $this->getResponse()->setException($e);
361
  }
lib/Zend/Controller/Plugin/ErrorHandler.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Plugins
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -30,9 +30,9 @@
30
  * @category Zend
31
  * @package Zend_Controller
32
  * @subpackage Plugins
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
- * @version $Id: ErrorHandler.php 20246 2010-01-12 21:36:08Z dasprid $
36
  */
37
  class Zend_Controller_Plugin_ErrorHandler extends Zend_Controller_Plugin_Abstract
38
  {
@@ -193,14 +193,25 @@ class Zend_Controller_Plugin_ErrorHandler extends Zend_Controller_Plugin_Abstrac
193
 
194
  /**
195
  * Route shutdown hook -- Ccheck for router exceptions
196
- *
197
- * @param Zend_Controller_Request_Abstract $request
198
  */
199
  public function routeShutdown(Zend_Controller_Request_Abstract $request)
200
  {
201
  $this->_handleError($request);
202
  }
203
 
 
 
 
 
 
 
 
 
 
 
 
204
  /**
205
  * Post dispatch hook -- check for exceptions and dispatch error handler if
206
  * necessary
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Plugins
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
30
  * @category Zend
31
  * @package Zend_Controller
32
  * @subpackage Plugins
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
+ * @version $Id: ErrorHandler.php 24593 2012-01-05 20:35:02Z matthew $
36
  */
37
  class Zend_Controller_Plugin_ErrorHandler extends Zend_Controller_Plugin_Abstract
38
  {
193
 
194
  /**
195
  * Route shutdown hook -- Ccheck for router exceptions
196
+ *
197
+ * @param Zend_Controller_Request_Abstract $request
198
  */
199
  public function routeShutdown(Zend_Controller_Request_Abstract $request)
200
  {
201
  $this->_handleError($request);
202
  }
203
 
204
+ /**
205
+ * Pre dispatch hook -- check for exceptions and dispatch error handler if
206
+ * necessary
207
+ *
208
+ * @param Zend_Controller_Request_Abstract $request
209
+ */
210
+ public function preDispatch(Zend_Controller_Request_Abstract $request)
211
+ {
212
+ $this->_handleError($request);
213
+ }
214
+
215
  /**
216
  * Post dispatch hook -- check for exceptions and dispatch error handler if
217
  * necessary
lib/Zend/Controller/Plugin/PutHandler.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Plugin
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: PutHandler.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -35,7 +35,7 @@
35
  *
36
  * @package Zend_Controller
37
  * @subpackage Zend_Controller_Plugin
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Controller_Plugin_PutHandler extends Zend_Controller_Plugin_Abstract
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Zend_Controller_Plugin
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: PutHandler.php 25024 2012-07-30 15:08:15Z rob $
21
  */
22
 
23
  /**
35
  *
36
  * @package Zend_Controller
37
  * @subpackage Zend_Controller_Plugin
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Controller_Plugin_PutHandler extends Zend_Controller_Plugin_Abstract
lib/Zend/Controller/Request/Abstract.php CHANGED
@@ -14,15 +14,15 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /**
23
  * @category Zend
24
  * @package Zend_Controller
25
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
26
  * @license http://framework.zend.com/license/new-bsd New BSD License
27
  */
28
  abstract class Zend_Controller_Request_Abstract
@@ -312,7 +312,7 @@ abstract class Zend_Controller_Request_Abstract
312
  {
313
  $this->_params = $this->_params + (array) $array;
314
 
315
- foreach ($this->_params as $key => $value) {
316
  if (null === $value) {
317
  unset($this->_params[$key]);
318
  }
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /**
23
  * @category Zend
24
  * @package Zend_Controller
25
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
26
  * @license http://framework.zend.com/license/new-bsd New BSD License
27
  */
28
  abstract class Zend_Controller_Request_Abstract
312
  {
313
  $this->_params = $this->_params + (array) $array;
314
 
315
+ foreach ($array as $key => $value) {
316
  if (null === $value) {
317
  unset($this->_params[$key]);
318
  }
lib/Zend/Controller/Request/Apache404.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Apache404.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /** Zend_Controller_Request_Http */
@@ -50,8 +50,8 @@ class Zend_Controller_Request_Apache404 extends Zend_Controller_Request_Http
50
  $requestUri = $_SERVER['HTTP_X_REWRITE_URL'];
51
  } elseif (isset($_SERVER['REDIRECT_URL'])) { // Check if using mod_rewrite
52
  $requestUri = $_SERVER['REDIRECT_URL'];
53
- if (isset($_SERVER['REDIRECT_QUERYSTRING'])) {
54
- $parseUriGetVars = $_SERVER['REDIRECT_QUERYSTRING'];
55
  }
56
  } elseif (isset($_SERVER['REQUEST_URI'])) {
57
  $requestUri = $_SERVER['REQUEST_URI'];
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Apache404.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /** Zend_Controller_Request_Http */
50
  $requestUri = $_SERVER['HTTP_X_REWRITE_URL'];
51
  } elseif (isset($_SERVER['REDIRECT_URL'])) { // Check if using mod_rewrite
52
  $requestUri = $_SERVER['REDIRECT_URL'];
53
+ if (isset($_SERVER['REDIRECT_QUERY_STRING'])) {
54
+ $parseUriGetVars = $_SERVER['REDIRECT_QUERY_STRING'];
55
  }
56
  } elseif (isset($_SERVER['REQUEST_URI'])) {
57
  $requestUri = $_SERVER['REQUEST_URI'];
lib/Zend/Controller/Request/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Request
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -29,7 +29,7 @@
29
  * @category Zend
30
  * @package Zend_Controller
31
  * @subpackage Request
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Controller_Request_Exception extends Zend_Controller_Exception
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Request
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
29
  * @category Zend
30
  * @package Zend_Controller
31
  * @subpackage Request
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Controller_Request_Exception extends Zend_Controller_Exception
lib/Zend/Controller/Request/Http.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Http.php 23414 2010-11-20 10:56:11Z bittarman $
20
  */
21
 
22
  /** @see Zend_Controller_Request_Abstract */
@@ -390,7 +390,11 @@ class Zend_Controller_Request_Http extends Zend_Controller_Request_Abstract
390
  public function setRequestUri($requestUri = null)
391
  {
392
  if ($requestUri === null) {
393
- if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { // check this first so IIS will catch
 
 
 
 
394
  $requestUri = $_SERVER['HTTP_X_REWRITE_URL'];
395
  } elseif (
396
  // IIS7 with URL Rewrite: make sure we get the unencoded url (double slash problem)
@@ -545,13 +549,13 @@ class Zend_Controller_Request_Http extends Zend_Controller_Request_Abstract
545
  *
546
  * @return string
547
  */
548
- public function getBaseUrl()
549
  {
550
  if (null === $this->_baseUrl) {
551
  $this->setBaseUrl();
552
  }
553
 
554
- return urldecode($this->_baseUrl);
555
  }
556
 
557
  /**
@@ -612,31 +616,33 @@ class Zend_Controller_Request_Http extends Zend_Controller_Request_Abstract
612
  public function setPathInfo($pathInfo = null)
613
  {
614
  if ($pathInfo === null) {
615
- $baseUrl = $this->getBaseUrl();
616
-
 
 
617
  if (null === ($requestUri = $this->getRequestUri())) {
618
  return $this;
619
  }
620
-
621
  // Remove the query string from REQUEST_URI
622
  if ($pos = strpos($requestUri, '?')) {
623
  $requestUri = substr($requestUri, 0, $pos);
624
  }
625
 
626
- $requestUri = urldecode($requestUri);
627
-
628
- if (null !== $baseUrl
629
- && ((!empty($baseUrl) && 0 === strpos($requestUri, $baseUrl))
630
- || empty($baseUrl))
631
- && false === ($pathInfo = substr($requestUri, strlen($baseUrl)))
632
- ){
633
- // If substr() returns false then PATH_INFO is set to an empty string
634
- $pathInfo = '';
635
- } elseif (null === $baseUrl
636
- || (!empty($baseUrl) && false === strpos($requestUri, $baseUrl))
637
- ) {
638
- $pathInfo = $requestUri;
639
  }
 
640
  }
641
 
642
  $this->_pathInfo = (string) $pathInfo;
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Http.php 24842 2012-05-31 18:31:28Z rob $
20
  */
21
 
22
  /** @see Zend_Controller_Request_Abstract */
390
  public function setRequestUri($requestUri = null)
391
  {
392
  if ($requestUri === null) {
393
+ if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) {
394
+ // IIS with Microsoft Rewrite Module
395
+ $requestUri = $_SERVER['HTTP_X_ORIGINAL_URL'];
396
+ } elseif (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
397
+ // IIS with ISAPI_Rewrite
398
  $requestUri = $_SERVER['HTTP_X_REWRITE_URL'];
399
  } elseif (
400
  // IIS7 with URL Rewrite: make sure we get the unencoded url (double slash problem)
549
  *
550
  * @return string
551
  */
552
+ public function getBaseUrl($raw = false)
553
  {
554
  if (null === $this->_baseUrl) {
555
  $this->setBaseUrl();
556
  }
557
 
558
+ return (($raw == false) ? urldecode($this->_baseUrl) : $this->_baseUrl);
559
  }
560
 
561
  /**
616
  public function setPathInfo($pathInfo = null)
617
  {
618
  if ($pathInfo === null) {
619
+ $baseUrl = $this->getBaseUrl(); // this actually calls setBaseUrl() & setRequestUri()
620
+ $baseUrlRaw = $this->getBaseUrl(false);
621
+ $baseUrlEncoded = urlencode($baseUrlRaw);
622
+
623
  if (null === ($requestUri = $this->getRequestUri())) {
624
  return $this;
625
  }
626
+
627
  // Remove the query string from REQUEST_URI
628
  if ($pos = strpos($requestUri, '?')) {
629
  $requestUri = substr($requestUri, 0, $pos);
630
  }
631
 
632
+ if (!empty($baseUrl) || !empty($baseUrlRaw)) {
633
+ if (strpos($requestUri, $baseUrl) === 0) {
634
+ $pathInfo = substr($requestUri, strlen($baseUrl));
635
+ } elseif (strpos($requestUri, $baseUrlRaw) === 0) {
636
+ $pathInfo = substr($requestUri, strlen($baseUrlRaw));
637
+ } elseif (strpos($requestUri, $baseUrlEncoded) === 0) {
638
+ $pathInfo = substr($requestUri, strlen($baseUrlEncoded));
639
+ } else {
640
+ $pathInfo = $requestUri;
641
+ }
642
+ } else {
643
+ $pathInfo = $requestUri;
 
644
  }
645
+
646
  }
647
 
648
  $this->_pathInfo = (string) $pathInfo;
lib/Zend/Controller/Request/HttpTestCase.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: HttpTestCase.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /**
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: HttpTestCase.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /**
lib/Zend/Controller/Request/Simple.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Request
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Simple.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Controller_Request_Abstract */
@@ -27,7 +27,7 @@
27
  * @category Zend
28
  * @package Zend_Controller
29
  * @subpackage Request
30
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Controller_Request_Simple extends Zend_Controller_Request_Abstract
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Request
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Simple.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Controller_Request_Abstract */
27
  * @category Zend
28
  * @package Zend_Controller
29
  * @subpackage Request
30
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Controller_Request_Simple extends Zend_Controller_Request_Abstract
lib/Zend/Controller/Response/Abstract.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Abstract.php 21301 2010-03-02 23:01:19Z yoshida@zend.co.jp $
20
  */
21
 
22
  /**
@@ -26,7 +26,7 @@
26
  *
27
  * @package Zend_Controller
28
  * @subpackage Response
29
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  abstract class Zend_Controller_Response_Abstract
@@ -257,7 +257,9 @@ abstract class Zend_Controller_Response_Abstract
257
  }
258
 
259
  $key = array_search($headerRaw, $this->_headersRaw);
260
- unset($this->_headersRaw[$key]);
 
 
261
 
262
  return $this;
263
  }
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /**
26
  *
27
  * @package Zend_Controller
28
  * @subpackage Response
29
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  abstract class Zend_Controller_Response_Abstract
257
  }
258
 
259
  $key = array_search($headerRaw, $this->_headersRaw);
260
+ if ($key !== false) {
261
+ unset($this->_headersRaw[$key]);
262
+ }
263
 
264
  return $this;
265
  }
lib/Zend/Controller/Response/Cli.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Cli.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
 
@@ -32,7 +32,7 @@
32
  * @uses Zend_Controller_Response_Abstract
33
  * @package Zend_Controller
34
  * @subpackage Response
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Controller_Response_Cli extends Zend_Controller_Response_Abstract
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Cli.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
 
32
  * @uses Zend_Controller_Response_Abstract
33
  * @package Zend_Controller
34
  * @subpackage Response
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Controller_Response_Cli extends Zend_Controller_Response_Abstract
lib/Zend/Controller/Response/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Request
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -28,7 +28,7 @@
28
  /**
29
  * @package Zend_Controller
30
  * @subpackage Response
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Controller_Response_Exception extends Zend_Controller_Exception
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Request
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
28
  /**
29
  * @package Zend_Controller
30
  * @subpackage Response
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Controller_Response_Exception extends Zend_Controller_Exception
lib/Zend/Controller/Response/Http.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Http.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
 
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Http.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
 
lib/Zend/Controller/Response/HttpTestCase.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: HttpTestCase.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /**
14
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: HttpTestCase.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /**
lib/Zend/Controller/Router/Abstract.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -31,11 +31,16 @@
31
  * @category Zend
32
  * @package Zend_Controller
33
  * @subpackage Router
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  abstract class Zend_Controller_Router_Abstract implements Zend_Controller_Router_Interface
38
  {
 
 
 
 
 
39
  /**
40
  * Front controller instance
41
  * @var Zend_Controller_Front
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
31
  * @category Zend
32
  * @package Zend_Controller
33
  * @subpackage Router
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  abstract class Zend_Controller_Router_Abstract implements Zend_Controller_Router_Interface
38
  {
39
+ /**
40
+ * URI delimiter
41
+ */
42
+ const URI_DELIMITER = '/';
43
+
44
  /**
45
  * Front controller instance
46
  * @var Zend_Controller_Front
lib/Zend/Controller/Router/Exception.php CHANGED
@@ -15,8 +15,8 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
@@ -28,7 +28,7 @@
28
  /**
29
  * @package Zend_Controller
30
  * @subpackage Router
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Controller_Router_Exception extends Zend_Controller_Exception
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
28
  /**
29
  * @package Zend_Controller
30
  * @subpackage Router
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Controller_Router_Exception extends Zend_Controller_Exception
lib/Zend/Controller/Router/Interface.php CHANGED
@@ -15,15 +15,15 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
24
  * @package Zend_Controller
25
  * @subpackage Router
26
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  interface Zend_Controller_Router_Interface
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
24
  * @package Zend_Controller
25
  * @subpackage Router
26
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  interface Zend_Controller_Router_Interface
lib/Zend/Controller/Router/Rewrite.php CHANGED
@@ -15,8 +15,8 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
- * @version $Id: Rewrite.php 23362 2010-11-18 17:22:41Z bittarman $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
@@ -31,7 +31,7 @@
31
  *
32
  * @package Zend_Controller
33
  * @subpackage Router
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  * @see http://manuals.rubyonrails.com/read/chapter/65
37
  */
@@ -381,7 +381,7 @@ class Zend_Controller_Router_Rewrite extends Zend_Controller_Router_Abstract
381
 
382
  // Find the matching route
383
  $routeMatched = false;
384
-
385
  foreach (array_reverse($this->_routes, true) as $name => $route) {
386
  // TODO: Should be an interface method. Hack for 1.0 BC
387
  if (method_exists($route, 'isAbstract') && $route->isAbstract()) {
@@ -450,6 +450,11 @@ class Zend_Controller_Router_Rewrite extends Zend_Controller_Router_Abstract
450
  */
451
  public function assemble($userParams, $name = null, $reset = false, $encode = true)
452
  {
 
 
 
 
 
453
  if ($name == null) {
454
  try {
455
  $name = $this->getCurrentRouteName();
@@ -458,14 +463,14 @@ class Zend_Controller_Router_Rewrite extends Zend_Controller_Router_Abstract
458
  }
459
  }
460
 
461
- // Use UNION (+) in order to preserve numeric keys
462
  $params = $userParams + $this->_globalParams;
463
 
464
  $route = $this->getRoute($name);
465
  $url = $route->assemble($params, $reset, $encode);
466
 
467
  if (!preg_match('|^[a-z]+://|', $url)) {
468
- $url = rtrim($this->getFrontController()->getBaseUrl(), '/') . '/' . $url;
469
  }
470
 
471
  return $url;
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
+ * @version $Id: Rewrite.php 24593 2012-01-05 20:35:02Z matthew $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
31
  *
32
  * @package Zend_Controller
33
  * @subpackage Router
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  * @see http://manuals.rubyonrails.com/read/chapter/65
37
  */
381
 
382
  // Find the matching route
383
  $routeMatched = false;
384
+
385
  foreach (array_reverse($this->_routes, true) as $name => $route) {
386
  // TODO: Should be an interface method. Hack for 1.0 BC
387
  if (method_exists($route, 'isAbstract') && $route->isAbstract()) {
450
  */
451
  public function assemble($userParams, $name = null, $reset = false, $encode = true)
452
  {
453
+ if (!is_array($userParams)) {
454
+ #require_once 'Zend/Controller/Router/Exception.php';
455
+ throw new Zend_Controller_Router_Exception('userParams must be an array');
456
+ }
457
+
458
  if ($name == null) {
459
  try {
460
  $name = $this->getCurrentRouteName();
463
  }
464
  }
465
 
466
+ // Use UNION (+) in order to preserve numeric keys
467
  $params = $userParams + $this->_globalParams;
468
 
469
  $route = $this->getRoute($name);
470
  $url = $route->assemble($params, $reset, $encode);
471
 
472
  if (!preg_match('|^[a-z]+://|', $url)) {
473
+ $url = rtrim($this->getFrontController()->getBaseUrl(), self::URI_DELIMITER) . self::URI_DELIMITER . $url;
474
  }
475
 
476
  return $url;
lib/Zend/Controller/Router/Route.php CHANGED
@@ -15,8 +15,8 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
- * @version $Id: Route.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
@@ -28,7 +28,7 @@
28
  *
29
  * @package Zend_Controller
30
  * @subpackage Router
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  * @see http://manuals.rubyonrails.com/read/chapter/65
34
  */
@@ -77,7 +77,7 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
77
  protected $_translatable = array();
78
 
79
  protected $_urlVariable = ':';
80
- protected $_urlDelimiter = '/';
81
  protected $_regexDelimiter = '#';
82
  protected $_defaultRegex = null;
83
 
@@ -294,6 +294,9 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
294
  foreach ($this->_variables as $var) {
295
  if (!array_key_exists($var, $return)) {
296
  return false;
 
 
 
297
  }
298
  }
299
 
@@ -344,7 +347,7 @@ class Zend_Controller_Router_Route extends Zend_Controller_Router_Route_Abstract
344
  $value = $this->_values[$name];
345
  } elseif (!$reset && !$useDefault && isset($this->_wildcardData[$name])) {
346
  $value = $this->_wildcardData[$name];
347
- } elseif (isset($this->_defaults[$name])) {
348
  $value = $this->_defaults[$name];
349
  } else {
350
  #require_once 'Zend/Controller/Router/Exception.php';
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
+ * @version $Id: Route.php 24593 2012-01-05 20:35:02Z matthew $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
28
  *
29
  * @package Zend_Controller
30
  * @subpackage Router
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  * @see http://manuals.rubyonrails.com/read/chapter/65
34
  */
77
  protected $_translatable = array();
78
 
79
  protected $_urlVariable = ':';
80
+ protected $_urlDelimiter = self::URI_DELIMITER;
81
  protected $_regexDelimiter = '#';
82
  protected $_defaultRegex = null;
83
 
294
  foreach ($this->_variables as $var) {
295
  if (!array_key_exists($var, $return)) {
296
  return false;
297
+ } elseif ($return[$var] == '' || $return[$var] === null) {
298
+ // Empty variable? Replace with the default value.
299
+ $return[$var] = $this->_defaults[$var];
300
  }
301
  }
302
 
347
  $value = $this->_values[$name];
348
  } elseif (!$reset && !$useDefault && isset($this->_wildcardData[$name])) {
349
  $value = $this->_wildcardData[$name];
350
+ } elseif (array_key_exists($name, $this->_defaults)) {
351
  $value = $this->_defaults[$name];
352
  } else {
353
  #require_once 'Zend/Controller/Router/Exception.php';
lib/Zend/Controller/Router/Route/Abstract.php CHANGED
@@ -15,8 +15,8 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
- * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
@@ -32,11 +32,16 @@
32
  *
33
  * @package Zend_Controller
34
  * @subpackage Router
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  abstract class Zend_Controller_Router_Route_Abstract implements Zend_Controller_Router_Route_Interface
39
  {
 
 
 
 
 
40
  /**
41
  * Wether this route is abstract or not
42
  *
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
+ * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
32
  *
33
  * @package Zend_Controller
34
  * @subpackage Router
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  abstract class Zend_Controller_Router_Route_Abstract implements Zend_Controller_Router_Route_Interface
39
  {
40
+ /**
41
+ * URI delimiter
42
+ */
43
+ const URI_DELIMITER = '/';
44
+
45
  /**
46
  * Wether this route is abstract or not
47
  *
lib/Zend/Controller/Router/Route/Chain.php CHANGED
@@ -15,8 +15,8 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
- * @version $Id: Chain.php 23187 2010-10-20 18:42:37Z matthew $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
@@ -28,7 +28,7 @@
28
  *
29
  * @package Zend_Controller
30
  * @subpackage Router
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Abstract
@@ -39,7 +39,8 @@ class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Ab
39
  /**
40
  * Instantiates route based on passed Zend_Config structure
41
  *
42
- * @param Zend_Config $config Configuration object
 
43
  */
44
  public static function getInstance(Zend_Config $config)
45
  {
@@ -54,7 +55,7 @@ class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Ab
54
  * @param string $separator
55
  * @return Zend_Controller_Router_Route_Chain
56
  */
57
- public function chain(Zend_Controller_Router_Route_Abstract $route, $separator = '/')
58
  {
59
  $this->_routes[] = $route;
60
  $this->_separators[] = $separator;
@@ -68,18 +69,21 @@ class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Ab
68
  * Assigns and returns an array of defaults on a successful match.
69
  *
70
  * @param Zend_Controller_Request_Http $request Request to get the path info from
 
71
  * @return array|false An array of assigned values or a false on a mismatch
72
  */
73
  public function match($request, $partial = null)
74
  {
75
- $path = trim($request->getPathInfo(), '/');
76
- $subPath = $path;
77
- $values = array();
 
 
78
 
79
  foreach ($this->_routes as $key => $route) {
80
- if ($key > 0
81
- && $matchedPath !== null
82
- && $subPath !== ''
83
  && $subPath !== false
84
  ) {
85
  $separator = substr($subPath, 0, strlen($this->_separators[$key]));
@@ -99,7 +103,7 @@ class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Ab
99
  $match = $request;
100
  }
101
 
102
- $res = $route->match($match, true);
103
  if ($res === false) {
104
  return false;
105
  }
@@ -126,7 +130,9 @@ class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Ab
126
  /**
127
  * Assembles a URL path defined by this route
128
  *
129
- * @param array $data An array of variable and value pairs used as parameters
 
 
130
  * @return string Route path with user submitted parameters
131
  */
132
  public function assemble($data = array(), $reset = false, $encode = false)
@@ -169,5 +175,42 @@ class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Ab
169
  }
170
  }
171
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
 
173
- }
 
 
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
+ * @version $Id: Chain.php 25249 2013-02-06 09:54:24Z frosch $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
28
  *
29
  * @package Zend_Controller
30
  * @subpackage Router
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Controller_Router_Route_Chain extends Zend_Controller_Router_Route_Abstract
39
  /**
40
  * Instantiates route based on passed Zend_Config structure
41
  *
42
+ * @param Zend_Config $config Configuration object
43
+ * @return Zend_Controller_Router_Route_Chain
44
  */
45
  public static function getInstance(Zend_Config $config)
46
  {
55
  * @param string $separator
56
  * @return Zend_Controller_Router_Route_Chain
57
  */
58
+ public function chain(Zend_Controller_Router_Route_Abstract $route, $separator = self::URI_DELIMITER)
59
  {
60
  $this->_routes[] = $route;
61
  $this->_separators[] = $separator;
69
  * Assigns and returns an array of defaults on a successful match.
70
  *
71
  * @param Zend_Controller_Request_Http $request Request to get the path info from
72
+ * @param null $partial
73
  * @return array|false An array of assigned values or a false on a mismatch
74
  */
75
  public function match($request, $partial = null)
76
  {
77
+ $path = trim($request->getPathInfo(), self::URI_DELIMITER);
78
+ $subPath = $path;
79
+ $values = array();
80
+ $numRoutes = count($this->_routes);
81
+ $matchedPath = null;
82
 
83
  foreach ($this->_routes as $key => $route) {
84
+ if ($key > 0
85
+ && $matchedPath !== null
86
+ && $subPath !== ''
87
  && $subPath !== false
88
  ) {
89
  $separator = substr($subPath, 0, strlen($this->_separators[$key]));
103
  $match = $request;
104
  }
105
 
106
+ $res = $route->match($match, true, ($key == $numRoutes - 1));
107
  if ($res === false) {
108
  return false;
109
  }
130
  /**
131
  * Assembles a URL path defined by this route
132
  *
133
+ * @param array $data An array of variable and value pairs used as parameters
134
+ * @param bool $reset
135
+ * @param bool $encode
136
  * @return string Route path with user submitted parameters
137
  */
138
  public function assemble($data = array(), $reset = false, $encode = false)
175
  }
176
  }
177
  }
178
+
179
+ /**
180
+ * Return a single parameter of route's defaults
181
+ *
182
+ * @param string $name Array key of the parameter
183
+ * @return string Previously set default
184
+ */
185
+ public function getDefault($name)
186
+ {
187
+ $default = null;
188
+ foreach ($this->_routes as $route) {
189
+ if (method_exists($route, 'getDefault')) {
190
+ $current = $route->getDefault($name);
191
+ if (null !== $current) {
192
+ $default = $current;
193
+ }
194
+ }
195
+ }
196
+
197
+ return $default;
198
+ }
199
+
200
+ /**
201
+ * Return an array of defaults
202
+ *
203
+ * @return array Route defaults
204
+ */
205
+ public function getDefaults()
206
+ {
207
+ $defaults = array();
208
+ foreach ($this->_routes as $route) {
209
+ if (method_exists($route, 'getDefaults')) {
210
+ $defaults = array_merge($defaults, $route->getDefaults());
211
+ }
212
+ }
213
 
214
+ return $defaults;
215
+ }
216
+ }
lib/Zend/Controller/Router/Route/Hostname.php CHANGED
@@ -15,8 +15,8 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
- * @version $Id: Hostname.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
@@ -28,7 +28,7 @@
28
  *
29
  * @package Zend_Controller
30
  * @subpackage Router
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  * @see http://manuals.rubyonrails.com/read/chapter/65
34
  */
@@ -302,7 +302,6 @@ class Zend_Controller_Router_Route_Hostname extends Zend_Controller_Router_Route
302
  }
303
  }
304
 
305
- $hostname = implode('.', $host);
306
  $url = $scheme . '://' . $url;
307
 
308
  return $url;
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
+ * @version $Id: Hostname.php 24593 2012-01-05 20:35:02Z matthew $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
28
  *
29
  * @package Zend_Controller
30
  * @subpackage Router
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  * @see http://manuals.rubyonrails.com/read/chapter/65
34
  */
302
  }
303
  }
304
 
 
305
  $url = $scheme . '://' . $url;
306
 
307
  return $url;
lib/Zend/Controller/Router/Route/Interface.php CHANGED
@@ -15,8 +15,8 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
- * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
@@ -26,7 +26,7 @@
26
  /**
27
  * @package Zend_Controller
28
  * @subpackage Router
29
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  interface Zend_Controller_Router_Route_Interface {
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
+ * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
26
  /**
27
  * @package Zend_Controller
28
  * @subpackage Router
29
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  interface Zend_Controller_Router_Route_Interface {
lib/Zend/Controller/Router/Route/Module.php CHANGED
@@ -15,8 +15,8 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
- * @version $Id: Module.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
@@ -30,17 +30,12 @@
30
  *
31
  * @package Zend_Controller
32
  * @subpackage Router
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  * @see http://manuals.rubyonrails.com/read/chapter/65
36
  */
37
  class Zend_Controller_Router_Route_Module extends Zend_Controller_Router_Route_Abstract
38
  {
39
- /**
40
- * URI delimiter
41
- */
42
- const URI_DELIMITER = '/';
43
-
44
  /**
45
  * Default values for the route (ie. module, controller, action, params)
46
  * @var array
@@ -237,29 +232,29 @@ class Zend_Controller_Router_Route_Module extends Zend_Controller_Router_Route_A
237
  if (is_array($value)) {
238
  foreach ($value as $arrayValue) {
239
  $arrayValue = ($encode) ? urlencode($arrayValue) : $arrayValue;
240
- $url .= '/' . $key;
241
- $url .= '/' . $arrayValue;
242
  }
243
  } else {
244
  if ($encode) $value = urlencode($value);
245
- $url .= '/' . $key;
246
- $url .= '/' . $value;
247
  }
248
  }
249
 
250
  if (!empty($url) || $action !== $this->_defaults[$this->_actionKey]) {
251
  if ($encode) $action = urlencode($action);
252
- $url = '/' . $action . $url;
253
  }
254
 
255
  if (!empty($url) || $controller !== $this->_defaults[$this->_controllerKey]) {
256
  if ($encode) $controller = urlencode($controller);
257
- $url = '/' . $controller . $url;
258
  }
259
 
260
  if (isset($module)) {
261
  if ($encode) $module = urlencode($module);
262
- $url = '/' . $module . $url;
263
  }
264
 
265
  return ltrim($url, self::URI_DELIMITER);
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
+ * @version $Id: Module.php 24593 2012-01-05 20:35:02Z matthew $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
30
  *
31
  * @package Zend_Controller
32
  * @subpackage Router
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  * @see http://manuals.rubyonrails.com/read/chapter/65
36
  */
37
  class Zend_Controller_Router_Route_Module extends Zend_Controller_Router_Route_Abstract
38
  {
 
 
 
 
 
39
  /**
40
  * Default values for the route (ie. module, controller, action, params)
41
  * @var array
232
  if (is_array($value)) {
233
  foreach ($value as $arrayValue) {
234
  $arrayValue = ($encode) ? urlencode($arrayValue) : $arrayValue;
235
+ $url .= self::URI_DELIMITER . $key;
236
+ $url .= self::URI_DELIMITER . $arrayValue;
237
  }
238
  } else {
239
  if ($encode) $value = urlencode($value);
240
+ $url .= self::URI_DELIMITER . $key;
241
+ $url .= self::URI_DELIMITER . $value;
242
  }
243
  }
244
 
245
  if (!empty($url) || $action !== $this->_defaults[$this->_actionKey]) {
246
  if ($encode) $action = urlencode($action);
247
+ $url = self::URI_DELIMITER . $action . $url;
248
  }
249
 
250
  if (!empty($url) || $controller !== $this->_defaults[$this->_controllerKey]) {
251
  if ($encode) $controller = urlencode($controller);
252
+ $url = self::URI_DELIMITER . $controller . $url;
253
  }
254
 
255
  if (isset($module)) {
256
  if ($encode) $module = urlencode($module);
257
+ $url = self::URI_DELIMITER . $module . $url;
258
  }
259
 
260
  return ltrim($url, self::URI_DELIMITER);
lib/Zend/Controller/Router/Route/Regex.php CHANGED
@@ -15,8 +15,8 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
- * @version $Id: Regex.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
@@ -28,7 +28,7 @@
28
  *
29
  * @package Zend_Controller
30
  * @subpackage Router
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Controller_Router_Route_Regex extends Zend_Controller_Router_Route_Abstract
@@ -74,7 +74,7 @@ class Zend_Controller_Router_Route_Regex extends Zend_Controller_Router_Route_Ab
74
  public function match($path, $partial = false)
75
  {
76
  if (!$partial) {
77
- $path = trim(urldecode($path), '/');
78
  $regex = '#^' . $this->_regex . '$#i';
79
  } else {
80
  $regex = '#^' . $this->_regex . '#i';
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
+ * @version $Id: Regex.php 24593 2012-01-05 20:35:02Z matthew $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
28
  *
29
  * @package Zend_Controller
30
  * @subpackage Router
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Controller_Router_Route_Regex extends Zend_Controller_Router_Route_Abstract
74
  public function match($path, $partial = false)
75
  {
76
  if (!$partial) {
77
+ $path = trim(urldecode($path), self::URI_DELIMITER);
78
  $regex = '#^' . $this->_regex . '$#i';
79
  } else {
80
  $regex = '#^' . $this->_regex . '#i';
lib/Zend/Controller/Router/Route/Static.php CHANGED
@@ -15,8 +15,8 @@
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
- * @version $Id: Static.php 23210 2010-10-21 16:10:55Z matthew $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
@@ -30,7 +30,7 @@
30
  *
31
  * @package Zend_Controller
32
  * @subpackage Router
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Controller_Router_Route_Static extends Zend_Controller_Router_Route_Abstract
@@ -62,7 +62,7 @@ class Zend_Controller_Router_Route_Static extends Zend_Controller_Router_Route_A
62
  */
63
  public function __construct($route, $defaults = array())
64
  {
65
- $this->_route = trim($route, '/');
66
  $this->_defaults = (array) $defaults;
67
  }
68
 
@@ -83,7 +83,7 @@ class Zend_Controller_Router_Route_Static extends Zend_Controller_Router_Route_A
83
  return $this->_defaults;
84
  }
85
  } else {
86
- if (trim($path, '/') == $this->_route) {
87
  return $this->_defaults;
88
  }
89
  }
15
  * @category Zend
16
  * @package Zend_Controller
17
  * @subpackage Router
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
+ * @version $Id: Static.php 24593 2012-01-05 20:35:02Z matthew $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
30
  *
31
  * @package Zend_Controller
32
  * @subpackage Router
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Controller_Router_Route_Static extends Zend_Controller_Router_Route_Abstract
62
  */
63
  public function __construct($route, $defaults = array())
64
  {
65
+ $this->_route = trim($route, self::URI_DELIMITER);
66
  $this->_defaults = (array) $defaults;
67
  }
68
 
83
  return $this->_defaults;
84
  }
85
  } else {
86
+ if (trim($path, self::URI_DELIMITER) == $this->_route) {
87
  return $this->_defaults;
88
  }
89
  }
lib/Zend/Crypt.php CHANGED
@@ -14,15 +14,15 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Crypt
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Crypt.php 23089 2010-10-12 17:05:31Z padraic $
20
  */
21
 
22
  /**
23
  * @category Zend
24
  * @package Zend_Crypt
25
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
26
  * @license http://framework.zend.com/license/new-bsd New BSD License
27
  */
28
  class Zend_Crypt
14
  *
15
  * @category Zend
16
  * @package Zend_Crypt
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Crypt.php 25024 2012-07-30 15:08:15Z rob $
20
  */
21
 
22
  /**
23
  * @category Zend
24
  * @package Zend_Crypt
25
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
26
  * @license http://framework.zend.com/license/new-bsd New BSD License
27
  */
28
  class Zend_Crypt
lib/Zend/Crypt/DiffieHellman.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage DiffieHellman
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: DiffieHellman.php 22662 2010-07-24 17:37:36Z mabe $
21
  */
22
 
23
  /**
@@ -27,7 +27,7 @@
27
  *
28
  * @category Zend
29
  * @package Zend_Crypt
30
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Crypt_DiffieHellman
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage DiffieHellman
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: DiffieHellman.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
27
  *
28
  * @category Zend
29
  * @package Zend_Crypt
30
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Crypt_DiffieHellman
lib/Zend/Crypt/DiffieHellman/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage DiffieHellman
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -28,7 +28,7 @@
28
  /**
29
  * @category Zend
30
  * @package Zend_Crypt
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Crypt_DiffieHellman_Exception extends Zend_Crypt_Exception
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage DiffieHellman
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
28
  /**
29
  * @category Zend
30
  * @package Zend_Crypt
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Crypt_DiffieHellman_Exception extends Zend_Crypt_Exception
lib/Zend/Crypt/Exception.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Crypt
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /**
@@ -27,7 +27,7 @@
27
  /**
28
  * @category Zend
29
  * @package Zend_Crypt
30
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Crypt_Exception extends Zend_Exception
14
  *
15
  * @category Zend
16
  * @package Zend_Crypt
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /**
27
  /**
28
  * @category Zend
29
  * @package Zend_Crypt
30
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Crypt_Exception extends Zend_Exception
lib/Zend/Crypt/Hmac.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Hmac
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Hmac.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -33,7 +33,7 @@
33
  * @todo Check if mhash() is a required alternative (will be PECL-only soon)
34
  * @category Zend
35
  * @package Zend_Crypt
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Crypt_Hmac extends Zend_Crypt
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Hmac
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Hmac.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
33
  * @todo Check if mhash() is a required alternative (will be PECL-only soon)
34
  * @category Zend
35
  * @package Zend_Crypt
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Crypt_Hmac extends Zend_Crypt
lib/Zend/Crypt/Hmac/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Hmac
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -28,7 +28,7 @@
28
  /**
29
  * @category Zend
30
  * @package Zend_Crypt
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Crypt_Hmac_Exception extends Zend_Crypt_Exception
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Hmac
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
28
  /**
29
  * @category Zend
30
  * @package Zend_Crypt
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Crypt_Hmac_Exception extends Zend_Crypt_Exception
lib/Zend/Crypt/Math.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Math
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Math.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -28,7 +28,7 @@
28
  /**
29
  * @category Zend
30
  * @package Zend_Crypt
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Crypt_Math extends Zend_Crypt_Math_BigInteger
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Math
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Math.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
28
  /**
29
  * @category Zend
30
  * @package Zend_Crypt
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Crypt_Math extends Zend_Crypt_Math_BigInteger
lib/Zend/Crypt/Math/BigInteger.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Math
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: BigInteger.php 23439 2010-11-23 21:10:14Z alexander $
21
  */
22
 
23
  /**
@@ -38,7 +38,7 @@
38
  *
39
  * @category Zend
40
  * @package Zend_Crypt
41
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
42
  * @license http://framework.zend.com/license/new-bsd New BSD License
43
  */
44
  class Zend_Crypt_Math_BigInteger
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Math
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: BigInteger.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
38
  *
39
  * @category Zend
40
  * @package Zend_Crypt
41
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
42
  * @license http://framework.zend.com/license/new-bsd New BSD License
43
  */
44
  class Zend_Crypt_Math_BigInteger
lib/Zend/Crypt/Math/BigInteger/Bcmath.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Math
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Bcmath.php 22653 2010-07-22 18:41:39Z mabe $
21
  */
22
 
23
  /**
@@ -33,7 +33,7 @@
33
  *
34
  * @category Zend
35
  * @package Zend_Crypt
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Crypt_Math_BigInteger_Bcmath implements Zend_Crypt_Math_BigInteger_Interface
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Math
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Bcmath.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
33
  *
34
  * @category Zend
35
  * @package Zend_Crypt
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Crypt_Math_BigInteger_Bcmath implements Zend_Crypt_Math_BigInteger_Interface
lib/Zend/Crypt/Math/BigInteger/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Math
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -28,7 +28,7 @@
28
  /**
29
  * @category Zend
30
  * @package Zend_Crypt
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Crypt_Math_BigInteger_Exception extends Zend_Crypt_Math_Exception
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Math
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
28
  /**
29
  * @category Zend
30
  * @package Zend_Crypt
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Crypt_Math_BigInteger_Exception extends Zend_Crypt_Math_Exception
lib/Zend/Crypt/Math/BigInteger/Gmp.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Math
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Gmp.php 23439 2010-11-23 21:10:14Z alexander $
21
  */
22
 
23
  /**
@@ -33,7 +33,7 @@
33
  *
34
  * @category Zend
35
  * @package Zend_Crypt
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Crypt_Math_BigInteger_Gmp implements Zend_Crypt_Math_BigInteger_Interface
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Math
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Gmp.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
33
  *
34
  * @category Zend
35
  * @package Zend_Crypt
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Crypt_Math_BigInteger_Gmp implements Zend_Crypt_Math_BigInteger_Interface
lib/Zend/Crypt/Math/BigInteger/Interface.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Math
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -28,7 +28,7 @@
28
  *
29
  * @category Zend
30
  * @package Zend_Crypt
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  interface Zend_Crypt_Math_BigInteger_Interface
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Math
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
28
  *
29
  * @category Zend
30
  * @package Zend_Crypt
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  interface Zend_Crypt_Math_BigInteger_Interface
lib/Zend/Crypt/Math/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Math
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -28,7 +28,7 @@
28
  /**
29
  * @category Zend
30
  * @package Zend_Crypt
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Crypt_Math_Exception extends Zend_Crypt_Exception
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Math
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
28
  /**
29
  * @category Zend
30
  * @package Zend_Crypt
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Crypt_Math_Exception extends Zend_Crypt_Exception
lib/Zend/Crypt/Rsa.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Rsa
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Rsa.php 23439 2010-11-23 21:10:14Z alexander $
21
  */
22
 
23
  /**
@@ -33,7 +33,7 @@
33
  /**
34
  * @category Zend
35
  * @package Zend_Crypt
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Crypt_Rsa
@@ -71,7 +71,7 @@ class Zend_Crypt_Rsa
71
  {
72
  if (!extension_loaded('openssl')) {
73
  #require_once 'Zend/Crypt/Rsa/Exception.php';
74
- throw new Zend_Crypt_Rsa_Exception('Zend_Crypt_Rsa requires openssl extention to be loaded.');
75
  }
76
 
77
  // Set _hashAlgorithm property when we are sure, that openssl extension is loaded
@@ -201,6 +201,13 @@ class Zend_Crypt_Rsa
201
  return $decrypted;
202
  }
203
 
 
 
 
 
 
 
 
204
  public function generateKeys(array $configargs = null)
205
  {
206
  $config = null;
@@ -215,6 +222,10 @@ class Zend_Crypt_Rsa
215
  $privateKey = null;
216
  $publicKey = null;
217
  $resource = openssl_pkey_new($config);
 
 
 
 
218
  // above fails on PHP 5.3
219
  openssl_pkey_export($resource, $private, $passPhrase);
220
  $privateKey = new Zend_Crypt_Rsa_Key_Private($private, $passPhrase);
@@ -312,6 +323,9 @@ class Zend_Crypt_Rsa
312
  protected function _parseConfigArgs(array $config = null)
313
  {
314
  $configs = array();
 
 
 
315
  if (isset($config['privateKeyBits'])) {
316
  $configs['private_key_bits'] = $config['privateKeyBits'];
317
  }
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Rsa
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Rsa.php 24808 2012-05-17 19:56:09Z rob $
21
  */
22
 
23
  /**
33
  /**
34
  * @category Zend
35
  * @package Zend_Crypt
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Crypt_Rsa
71
  {
72
  if (!extension_loaded('openssl')) {
73
  #require_once 'Zend/Crypt/Rsa/Exception.php';
74
+ throw new Zend_Crypt_Rsa_Exception('Zend_Crypt_Rsa requires openssl extension to be loaded.');
75
  }
76
 
77
  // Set _hashAlgorithm property when we are sure, that openssl extension is loaded
201
  return $decrypted;
202
  }
203
 
204
+ /**
205
+ * @param array $configargs
206
+ *
207
+ * @throws Zend_Crypt_Rsa_Exception
208
+ *
209
+ * @return ArrayObject
210
+ */
211
  public function generateKeys(array $configargs = null)
212
  {
213
  $config = null;
222
  $privateKey = null;
223
  $publicKey = null;
224
  $resource = openssl_pkey_new($config);
225
+ if (!$resource) {
226
+ #require_once 'Zend/Crypt/Rsa/Exception.php';
227
+ throw new Zend_Crypt_Rsa_Exception('Failed to generate a new private key');
228
+ }
229
  // above fails on PHP 5.3
230
  openssl_pkey_export($resource, $private, $passPhrase);
231
  $privateKey = new Zend_Crypt_Rsa_Key_Private($private, $passPhrase);
323
  protected function _parseConfigArgs(array $config = null)
324
  {
325
  $configs = array();
326
+ if (isset($config['private_key_bits'])) {
327
+ $configs['private_key_bits'] = $config['private_key_bits'];
328
+ }
329
  if (isset($config['privateKeyBits'])) {
330
  $configs['private_key_bits'] = $config['privateKeyBits'];
331
  }
lib/Zend/Crypt/Rsa/Exception.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Math
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
@@ -28,7 +28,7 @@
28
  /**
29
  * @category Zend
30
  * @package Zend_Crypt
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Crypt_Rsa_Exception extends Zend_Crypt_Exception
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Math
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
28
  /**
29
  * @category Zend
30
  * @package Zend_Crypt
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Crypt_Rsa_Exception extends Zend_Crypt_Exception
lib/Zend/Crypt/Rsa/Key.php CHANGED
@@ -15,15 +15,15 @@
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Rsa
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Key.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_Crypt
26
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  class Zend_Crypt_Rsa_Key implements Countable
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Rsa
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Key.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_Crypt
26
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  class Zend_Crypt_Rsa_Key implements Countable
lib/Zend/Crypt/Rsa/Key/Private.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Rsa
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Private.php 22662 2010-07-24 17:37:36Z mabe $
21
  */
22
 
23
  /**
@@ -28,7 +28,7 @@
28
  /**
29
  * @category Zend
30
  * @package Zend_Crypt
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Crypt_Rsa_Key_Private extends Zend_Crypt_Rsa_Key
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Rsa
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Private.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
28
  /**
29
  * @category Zend
30
  * @package Zend_Crypt
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Crypt_Rsa_Key_Private extends Zend_Crypt_Rsa_Key
lib/Zend/Crypt/Rsa/Key/Public.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Rsa
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Public.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -28,7 +28,7 @@
28
  /**
29
  * @category Zend
30
  * @package Zend_Crypt
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Crypt_Rsa_Key_Public extends Zend_Crypt_Rsa_Key
15
  * @category Zend
16
  * @package Zend_Crypt
17
  * @subpackage Rsa
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Public.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
28
  /**
29
  * @category Zend
30
  * @package Zend_Crypt
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Crypt_Rsa_Key_Public extends Zend_Crypt_Rsa_Key
lib/Zend/Currency.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Currency
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Currency.php 22708 2010-07-28 07:25:16Z thomas $
20
  */
21
 
22
  /**
@@ -31,7 +31,7 @@
31
  *
32
  * @category Zend
33
  * @package Zend_Currency
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Currency
@@ -91,6 +91,11 @@ class Zend_Currency
91
  */
92
  public function __construct($options = null, $locale = null)
93
  {
 
 
 
 
 
94
  if (is_array($options)) {
95
  $this->setLocale($locale);
96
  $this->setFormat($options);
@@ -120,10 +125,13 @@ class Zend_Currency
120
  }
121
 
122
  // Get the format
123
- if (!empty($this->_options['symbol'])) {
124
- $this->_options['display'] = self::USE_SYMBOL;
125
- } else if (!empty($this->_options['currency'])) {
126
- $this->_options['display'] = self::USE_SHORTNAME;
 
 
 
127
  }
128
  }
129
 
@@ -794,7 +802,7 @@ class Zend_Currency
794
  if (!class_exists($service)) {
795
  $file = str_replace('_', DIRECTORY_SEPARATOR, $service) . '.php';
796
  if (Zend_Loader::isReadable($file)) {
797
- Zend_Loader::loadClass($class);
798
  }
799
  }
800
 
14
  *
15
  * @category Zend
16
  * @package Zend_Currency
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Currency.php 24855 2012-06-01 00:12:25Z adamlundrigan $
20
  */
21
 
22
  /**
31
  *
32
  * @category Zend
33
  * @package Zend_Currency
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Currency
91
  */
92
  public function __construct($options = null, $locale = null)
93
  {
94
+ $calloptions = $options;
95
+ if (is_array($options) && isset($options['display'])) {
96
+ $this->_options['display'] = $options['display'];
97
+ }
98
+
99
  if (is_array($options)) {
100
  $this->setLocale($locale);
101
  $this->setFormat($options);
125
  }
126
 
127
  // Get the format
128
+ if ((is_array($calloptions) && !isset($calloptions['display']))
129
+ || (!is_array($calloptions) && $this->_options['display'] == self::NO_SYMBOL)) {
130
+ if (!empty($this->_options['symbol'])) {
131
+ $this->_options['display'] = self::USE_SYMBOL;
132
+ } else if (!empty($this->_options['currency'])) {
133
+ $this->_options['display'] = self::USE_SHORTNAME;
134
+ }
135
  }
136
  }
137
 
802
  if (!class_exists($service)) {
803
  $file = str_replace('_', DIRECTORY_SEPARATOR, $service) . '.php';
804
  if (Zend_Loader::isReadable($file)) {
805
+ Zend_Loader::loadClass($service);
806
  }
807
  }
808
 
lib/Zend/Currency/CurrencyInterface.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Currency
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: CurrencyInterface.php 20785 2010-01-31 09:43:03Z mikaelkael $
20
  */
21
 
22
  /**
@@ -24,7 +24,7 @@
24
  *
25
  * @category Zend
26
  * @package Zend_Currency
27
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
  interface Zend_Currency_CurrencyInterface
14
  *
15
  * @category Zend
16
  * @package Zend_Currency
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: CurrencyInterface.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /**
24
  *
25
  * @category Zend
26
  * @package Zend_Currency
27
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
  interface Zend_Currency_CurrencyInterface
lib/Zend/Currency/Exception.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Currency
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /**
@@ -29,7 +29,7 @@
29
  *
30
  * @category Zend
31
  * @package Zend_Currency
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Currency_Exception extends Zend_Exception
14
  *
15
  * @category Zend
16
  * @package Zend_Currency
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /**
29
  *
30
  * @category Zend
31
  * @package Zend_Currency
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Currency_Exception extends Zend_Exception
lib/Zend/Date.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Date
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Date.php 22713 2010-07-29 11:41:56Z thomas $
20
  */
21
 
22
  /**
@@ -30,7 +30,7 @@
30
  /**
31
  * @category Zend
32
  * @package Zend_Date
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Date extends Zend_Date_DateObject
@@ -1201,7 +1201,7 @@ class Zend_Date extends Zend_Date_DateObject
1201
  }
1202
 
1203
  preg_match('/([+-]\d{2}):{0,1}\d{2}/', $zone, $match);
1204
- if (!empty($match) and ($match[count($match) - 1] <= 12) and ($match[count($match) - 1] >= -12)) {
1205
  $zone = "Etc/GMT";
1206
  $zone .= ($match[count($match) - 1] < 0) ? "+" : "-";
1207
  $zone .= (int) abs($match[count($match) - 1]);
@@ -2107,7 +2107,10 @@ class Zend_Date extends Zend_Date_DateObject
2107
  break;
2108
 
2109
  case self::RFC_2822:
2110
- $result = preg_match('/^\w{3},\s(\d{1,2})\s(\w{3})\s(\d{4})\s(\d{2}):(\d{2}):{0,1}(\d{0,2})\s([+-]{1}\d{4})$/', $date, $match);
 
 
 
2111
  if (!$result) {
2112
  #require_once 'Zend/Date/Exception.php';
2113
  throw new Zend_Date_Exception("no RFC 2822 format ($date)", 0, null, $date);
@@ -2641,10 +2644,8 @@ class Zend_Date extends Zend_Date_DateObject
2641
  $parsed['day'] = 0;
2642
  }
2643
 
2644
- if (isset($parsed['year'])) {
2645
- $parsed['year'] -= 1970;
2646
- } else {
2647
- $parsed['year'] = 0;
2648
  }
2649
  }
2650
 
@@ -2654,7 +2655,7 @@ class Zend_Date extends Zend_Date_DateObject
2654
  isset($parsed['second']) ? $parsed['second'] : 0,
2655
  isset($parsed['month']) ? (1 + $parsed['month']) : 1,
2656
  isset($parsed['day']) ? (1 + $parsed['day']) : 1,
2657
- isset($parsed['year']) ? (1970 + $parsed['year']) : 1970,
2658
  false), $this->getUnixTimestamp(), false);
2659
  } catch (Zend_Locale_Exception $e) {
2660
  if (!is_numeric($date)) {
@@ -3238,7 +3239,7 @@ class Zend_Date extends Zend_Date_DateObject
3238
  /**
3239
  * Check if location is supported
3240
  *
3241
- * @param $location array - locations array
3242
  * @return $horizon float
3243
  */
3244
  private function _checkLocation($location)
@@ -3281,7 +3282,7 @@ class Zend_Date extends Zend_Date_DateObject
3281
  * Returns the time of sunrise for this date and a given location as new date object
3282
  * For a list of cities and correct locations use the class Zend_Date_Cities
3283
  *
3284
- * @param $location array - location of sunrise
3285
  * ['horizon'] -> civil, nautic, astronomical, effective (default)
3286
  * ['longitude'] -> longitude of location
3287
  * ['latitude'] -> latitude of location
@@ -3301,7 +3302,7 @@ class Zend_Date extends Zend_Date_DateObject
3301
  * Returns the time of sunset for this date and a given location as new date object
3302
  * For a list of cities and correct locations use the class Zend_Date_Cities
3303
  *
3304
- * @param $location array - location of sunset
3305
  * ['horizon'] -> civil, nautic, astronomical, effective (default)
3306
  * ['longitude'] -> longitude of location
3307
  * ['latitude'] -> latitude of location
@@ -3321,7 +3322,7 @@ class Zend_Date extends Zend_Date_DateObject
3321
  * Returns an array with the sunset and sunrise dates for all horizon types
3322
  * For a list of cities and correct locations use the class Zend_Date_Cities
3323
  *
3324
- * @param $location array - location of suninfo
3325
  * ['horizon'] -> civil, nautic, astronomical, effective (default)
3326
  * ['longitude'] -> longitude of location
3327
  * ['latitude'] -> latitude of location
@@ -3786,7 +3787,7 @@ class Zend_Date extends Zend_Date_DateObject
3786
  * Returns the day as new date object
3787
  * Example: 20.May.1986 -> 20.Jan.1970 00:00:00
3788
  *
3789
- * @param $locale string|Zend_Locale OPTIONAL Locale for parsing input
3790
  * @return Zend_Date
3791
  */
3792
  public function getDay($locale = null)
@@ -3798,9 +3799,9 @@ class Zend_Date extends Zend_Date_DateObject
3798
  /**
3799
  * Returns the calculated day
3800
  *
3801
- * @param $calc string Type of calculation to make
3802
- * @param $day string|integer|Zend_Date Day to calculate, when null the actual day is calculated
3803
- * @param $locale string|Zend_Locale Locale for parsing input
3804
  * @return Zend_Date|integer
3805
  */
3806
  private function _day($calc, $day, $locale)
@@ -3929,7 +3930,7 @@ class Zend_Date extends Zend_Date_DateObject
3929
  * Weekday is always from 1-7
3930
  * Example: 09-Jan-2007 -> 2 = Tuesday -> 02-Jan-1970 (when 02.01.1970 is also Tuesday)
3931
  *
3932
- * @param $locale string|Zend_Locale OPTIONAL Locale for parsing input
3933
  * @return Zend_Date
3934
  */
3935
  public function getWeekday($locale = null)
@@ -3947,9 +3948,9 @@ class Zend_Date extends Zend_Date_DateObject
3947
  /**
3948
  * Returns the calculated weekday
3949
  *
3950
- * @param $calc string Type of calculation to make
3951
- * @param $weekday string|integer|array|Zend_Date Weekday to calculate, when null the actual weekday is calculated
3952
- * @param $locale string|Zend_Locale Locale for parsing input
3953
  * @return Zend_Date|integer
3954
  * @throws Zend_Date_Exception
3955
  */
@@ -4166,7 +4167,7 @@ class Zend_Date extends Zend_Date_DateObject
4166
  * Returns the hour as new date object
4167
  * Example: 02.Feb.1986 10:30:25 -> 01.Jan.1970 10:00:00
4168
  *
4169
- * @param $locale string|Zend_Locale OPTIONAL Locale for parsing input
4170
  * @return Zend_Date
4171
  */
4172
  public function getHour($locale = null)
@@ -4617,7 +4618,7 @@ class Zend_Date extends Zend_Date_DateObject
4617
  * Returns the week as new date object using monday as begining of the week
4618
  * Example: 12.Jan.2007 -> 08.Jan.1970 00:00:00
4619
  *
4620
- * @param $locale string|Zend_Locale OPTIONAL Locale for parsing input
4621
  * @return Zend_Date
4622
  */
4623
  public function getWeek($locale = null)
14
  *
15
  * @category Zend
16
  * @package Zend_Date
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Date.php 24880 2012-06-12 20:35:18Z matthew $
20
  */
21
 
22
  /**
30
  /**
31
  * @category Zend
32
  * @package Zend_Date
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Date extends Zend_Date_DateObject
1201
  }
1202
 
1203
  preg_match('/([+-]\d{2}):{0,1}\d{2}/', $zone, $match);
1204
+ if (!empty($match) and ($match[count($match) - 1] <= 14) and ($match[count($match) - 1] >= -12)) {
1205
  $zone = "Etc/GMT";
1206
  $zone .= ($match[count($match) - 1] < 0) ? "+" : "-";
1207
  $zone .= (int) abs($match[count($match) - 1]);
2107
  break;
2108
 
2109
  case self::RFC_2822:
2110
+ $result = preg_match('/^\w{3},\s(\d{1,2})\s(\w{3})\s(\d{4})\s'
2111
+ . '(\d{2}):(\d{2}):{0,1}(\d{0,2})\s([+-]'
2112
+ . '{1}\d{4}|\w{1,20})$/', $date, $match);
2113
+
2114
  if (!$result) {
2115
  #require_once 'Zend/Date/Exception.php';
2116
  throw new Zend_Date_Exception("no RFC 2822 format ($date)", 0, null, $date);
2644
  $parsed['day'] = 0;
2645
  }
2646
 
2647
+ if (!isset($parsed['year'])) {
2648
+ $parsed['year'] = 1970;
 
 
2649
  }
2650
  }
2651
 
2655
  isset($parsed['second']) ? $parsed['second'] : 0,
2656
  isset($parsed['month']) ? (1 + $parsed['month']) : 1,
2657
  isset($parsed['day']) ? (1 + $parsed['day']) : 1,
2658
+ $parsed['year'],
2659
  false), $this->getUnixTimestamp(), false);
2660
  } catch (Zend_Locale_Exception $e) {
2661
  if (!is_numeric($date)) {
3239
  /**
3240
  * Check if location is supported
3241
  *
3242
+ * @param array $location locations array
3243
  * @return $horizon float
3244
  */
3245
  private function _checkLocation($location)
3282
  * Returns the time of sunrise for this date and a given location as new date object
3283
  * For a list of cities and correct locations use the class Zend_Date_Cities
3284
  *
3285
+ * @param array $location location of sunrise
3286
  * ['horizon'] -> civil, nautic, astronomical, effective (default)
3287
  * ['longitude'] -> longitude of location
3288
  * ['latitude'] -> latitude of location
3302
  * Returns the time of sunset for this date and a given location as new date object
3303
  * For a list of cities and correct locations use the class Zend_Date_Cities
3304
  *
3305
+ * @param array $location location of sunset
3306
  * ['horizon'] -> civil, nautic, astronomical, effective (default)
3307
  * ['longitude'] -> longitude of location
3308
  * ['latitude'] -> latitude of location
3322
  * Returns an array with the sunset and sunrise dates for all horizon types
3323
  * For a list of cities and correct locations use the class Zend_Date_Cities
3324
  *
3325
+ * @param array $location location of suninfo
3326
  * ['horizon'] -> civil, nautic, astronomical, effective (default)
3327
  * ['longitude'] -> longitude of location
3328
  * ['latitude'] -> latitude of location
3787
  * Returns the day as new date object
3788
  * Example: 20.May.1986 -> 20.Jan.1970 00:00:00
3789
  *
3790
+ * @param Zend_Locale $locale OPTIONAL Locale for parsing input
3791
  * @return Zend_Date
3792
  */
3793
  public function getDay($locale = null)
3799
  /**
3800
  * Returns the calculated day
3801
  *
3802
+ * @param string $calc Type of calculation to make
3803
+ * @param Zend_Date $day Day to calculate, when null the actual day is calculated
3804
+ * @param Zend_Locale $locale Locale for parsing input
3805
  * @return Zend_Date|integer
3806
  */
3807
  private function _day($calc, $day, $locale)
3930
  * Weekday is always from 1-7
3931
  * Example: 09-Jan-2007 -> 2 = Tuesday -> 02-Jan-1970 (when 02.01.1970 is also Tuesday)
3932
  *
3933
+ * @param Zend_Locale $locale OPTIONAL Locale for parsing input
3934
  * @return Zend_Date
3935
  */
3936
  public function getWeekday($locale = null)
3948
  /**
3949
  * Returns the calculated weekday
3950
  *
3951
+ * @param string $calc Type of calculation to make
3952
+ * @param Zend_Date $weekday Weekday to calculate, when null the actual weekday is calculated
3953
+ * @param Zend_Locale $locale Locale for parsing input
3954
  * @return Zend_Date|integer
3955
  * @throws Zend_Date_Exception
3956
  */
4167
  * Returns the hour as new date object
4168
  * Example: 02.Feb.1986 10:30:25 -> 01.Jan.1970 10:00:00
4169
  *
4170
+ * @param Zend_Locale $locale OPTIONAL Locale for parsing input
4171
  * @return Zend_Date
4172
  */
4173
  public function getHour($locale = null)
4618
  * Returns the week as new date object using monday as begining of the week
4619
  * Example: 12.Jan.2007 -> 08.Jan.1970 00:00:00
4620
  *
4621
+ * @param Zend_Locale $locale OPTIONAL Locale for parsing input
4622
  * @return Zend_Date
4623
  */
4624
  public function getWeek($locale = null)
lib/Zend/Date/Cities.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Date
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Cities.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /**
@@ -28,7 +28,7 @@
28
  * @category Zend
29
  * @package Zend_Date
30
  * @subpackage Zend_Date_Cities
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Date_Cities
14
  *
15
  * @category Zend
16
  * @package Zend_Date
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Cities.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /**
28
  * @category Zend
29
  * @package Zend_Date
30
  * @subpackage Zend_Date_Cities
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Date_Cities
lib/Zend/Date/DateObject.php CHANGED
@@ -14,8 +14,8 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Date
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
- * @version $Id: DateObject.php 22712 2010-07-29 08:24:28Z thomas $
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -23,7 +23,7 @@
23
  * @category Zend
24
  * @package Zend_Date
25
  * @subpackage Zend_Date_DateObject
26
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  abstract class Zend_Date_DateObject {
@@ -312,6 +312,13 @@ abstract class Zend_Date_DateObject {
312
  }
313
 
314
  if (abs($timestamp) <= 0x7FFFFFFF) {
 
 
 
 
 
 
 
315
  $result = ($gmt) ? @gmdate($format, $timestamp) : @date($format, $timestamp);
316
  date_default_timezone_set($oldzone);
317
  return $result;
14
  *
15
  * @category Zend
16
  * @package Zend_Date
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
+ * @version $Id: DateObject.php 24880 2012-06-12 20:35:18Z matthew $
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
23
  * @category Zend
24
  * @package Zend_Date
25
  * @subpackage Zend_Date_DateObject
26
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  abstract class Zend_Date_DateObject {
312
  }
313
 
314
  if (abs($timestamp) <= 0x7FFFFFFF) {
315
+ // See ZF-11992
316
+ // "o" will sometimes resolve to the previous year (see
317
+ // http://php.net/date ; it's part of the ISO 8601
318
+ // standard). However, this is not desired, so replacing
319
+ // all occurrences of "o" not preceded by a backslash
320
+ // with "Y"
321
+ $format = preg_replace('/(?<!\\\\)o\b/', 'Y', $format);
322
  $result = ($gmt) ? @gmdate($format, $timestamp) : @date($format, $timestamp);
323
  date_default_timezone_set($oldzone);
324
  return $result;
lib/Zend/Date/Exception.php CHANGED
@@ -14,8 +14,8 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Date
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
- * @version $Id: Exception.php 20279 2010-01-14 15:21:47Z thomas $
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -29,7 +29,7 @@
29
  /**
30
  * @category Zend
31
  * @package Zend_Date
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Date_Exception extends Zend_Exception
14
  *
15
  * @category Zend
16
  * @package Zend_Date
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
29
  /**
30
  * @category Zend
31
  * @package Zend_Date
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Date_Exception extends Zend_Exception
lib/Zend/Db.php CHANGED
@@ -15,9 +15,9 @@
15
  *
16
  * @category Zend
17
  * @package Zend_Db
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Db.php 23405 2010-11-19 19:46:10Z bittarman $
21
  */
22
 
23
 
@@ -26,7 +26,7 @@
26
  *
27
  * @category Zend
28
  * @package Zend_Db
29
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  class Zend_Db
@@ -90,6 +90,9 @@ class Zend_Db
90
  * 'NULL_TO_STRING', 'ERR_NONE', 'FETCH_ORI_NEXT',
91
  * 'FETCH_ORI_PRIOR', 'FETCH_ORI_FIRST', 'FETCH_ORI_LAST',
92
  * 'FETCH_ORI_ABS', 'FETCH_ORI_REL', 'CURSOR_FWDONLY', 'CURSOR_SCROLL',
 
 
 
93
  * );
94
  *
95
  * $const = array();
@@ -122,7 +125,17 @@ class Zend_Db
122
  const CASE_UPPER = 1;
123
  const CURSOR_FWDONLY = 0;
124
  const CURSOR_SCROLL = 1;
 
 
 
 
 
 
125
  const ERR_NONE = '00000';
 
 
 
 
126
  const ERRMODE_EXCEPTION = 2;
127
  const ERRMODE_SILENT = 0;
128
  const ERRMODE_WARNING = 1;
15
  *
16
  * @category Zend
17
  * @package Zend_Db
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Db.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
26
  *
27
  * @category Zend
28
  * @package Zend_Db
29
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  class Zend_Db
90
  * 'NULL_TO_STRING', 'ERR_NONE', 'FETCH_ORI_NEXT',
91
  * 'FETCH_ORI_PRIOR', 'FETCH_ORI_FIRST', 'FETCH_ORI_LAST',
92
  * 'FETCH_ORI_ABS', 'FETCH_ORI_REL', 'CURSOR_FWDONLY', 'CURSOR_SCROLL',
93
+ * 'ERR_CANT_MAP', 'ERR_SYNTAX', 'ERR_CONSTRAINT', 'ERR_NOT_FOUND',
94
+ * 'ERR_ALREADY_EXISTS', 'ERR_NOT_IMPLEMENTED', 'ERR_MISMATCH',
95
+ * 'ERR_TRUNCATED', 'ERR_DISCONNECTED', 'ERR_NO_PERM',
96
  * );
97
  *
98
  * $const = array();
125
  const CASE_UPPER = 1;
126
  const CURSOR_FWDONLY = 0;
127
  const CURSOR_SCROLL = 1;
128
+ const ERR_ALREADY_EXISTS = NULL;
129
+ const ERR_CANT_MAP = NULL;
130
+ const ERR_CONSTRAINT = NULL;
131
+ const ERR_DISCONNECTED = NULL;
132
+ const ERR_MISMATCH = NULL;
133
+ const ERR_NO_PERM = NULL;
134
  const ERR_NONE = '00000';
135
+ const ERR_NOT_FOUND = NULL;
136
+ const ERR_NOT_IMPLEMENTED = NULL;
137
+ const ERR_SYNTAX = NULL;
138
+ const ERR_TRUNCATED = NULL;
139
  const ERRMODE_EXCEPTION = 2;
140
  const ERRMODE_SILENT = 0;
141
  const ERRMODE_WARNING = 1;
lib/Zend/Db/Adapter/Abstract.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Abstract.php 23252 2010-10-26 12:48:32Z matthew $
21
  */
22
 
23
 
@@ -37,7 +37,7 @@
37
  * @category Zend
38
  * @package Zend_Db
39
  * @subpackage Adapter
40
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
41
  * @license http://framework.zend.com/license/new-bsd New BSD License
42
  */
43
  abstract class Zend_Db_Adapter_Abstract
@@ -156,6 +156,7 @@ abstract class Zend_Db_Adapter_Abstract
156
  * persistent => (boolean) Whether to use a persistent connection or not, defaults to false
157
  * protocol => (string) The network protocol, defaults to TCPIP
158
  * caseFolding => (int) style of case-alteration used for identifiers
 
159
  *
160
  * @param array|Zend_Config $config An array or instance of Zend_Config having configuration data
161
  * @throws Zend_Db_Adapter_Exception
@@ -531,6 +532,7 @@ abstract class Zend_Db_Adapter_Abstract
531
  * @param mixed $table The table to insert data into.
532
  * @param array $bind Column-value pairs.
533
  * @return int The number of affected rows.
 
534
  */
535
  public function insert($table, array $bind)
536
  {
@@ -583,6 +585,7 @@ abstract class Zend_Db_Adapter_Abstract
583
  * @param array $bind Column-value pairs.
584
  * @param mixed $where UPDATE WHERE clause(s).
585
  * @return int The number of affected rows.
 
586
  */
587
  public function update($table, array $bind, $where = '')
588
  {
@@ -743,7 +746,7 @@ abstract class Zend_Db_Adapter_Abstract
743
  * @param string|Zend_Db_Select $sql An SQL SELECT statement.
744
  * @param mixed $bind Data to bind into SELECT placeholders.
745
  * @param mixed $fetchMode Override current fetch mode.
746
- * @return array
747
  */
748
  public function fetchRow($sql, $bind = array(), $fetchMode = null)
749
  {
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Abstract.php 25229 2013-01-18 08:17:21Z frosch $
21
  */
22
 
23
 
37
  * @category Zend
38
  * @package Zend_Db
39
  * @subpackage Adapter
40
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
41
  * @license http://framework.zend.com/license/new-bsd New BSD License
42
  */
43
  abstract class Zend_Db_Adapter_Abstract
156
  * persistent => (boolean) Whether to use a persistent connection or not, defaults to false
157
  * protocol => (string) The network protocol, defaults to TCPIP
158
  * caseFolding => (int) style of case-alteration used for identifiers
159
+ * socket => (string) The socket or named pipe that should be used
160
  *
161
  * @param array|Zend_Config $config An array or instance of Zend_Config having configuration data
162
  * @throws Zend_Db_Adapter_Exception
532
  * @param mixed $table The table to insert data into.
533
  * @param array $bind Column-value pairs.
534
  * @return int The number of affected rows.
535
+ * @throws Zend_Db_Adapter_Exception
536
  */
537
  public function insert($table, array $bind)
538
  {
585
  * @param array $bind Column-value pairs.
586
  * @param mixed $where UPDATE WHERE clause(s).
587
  * @return int The number of affected rows.
588
+ * @throws Zend_Db_Adapter_Exception
589
  */
590
  public function update($table, array $bind, $where = '')
591
  {
746
  * @param string|Zend_Db_Select $sql An SQL SELECT statement.
747
  * @param mixed $bind Data to bind into SELECT placeholders.
748
  * @param mixed $fetchMode Override current fetch mode.
749
+ * @return mixed Array, object, or scalar depending on fetch mode.
750
  */
751
  public function fetchRow($sql, $bind = array(), $fetchMode = null)
752
  {
lib/Zend/Db/Adapter/Db2.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Db2.php 23199 2010-10-21 14:27:06Z ralph $
21
  *
22
  */
23
 
@@ -39,7 +39,7 @@
39
 
40
  /**
41
  * @package Zend_Db
42
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
43
  * @license http://framework.zend.com/license/new-bsd New BSD License
44
  */
45
 
@@ -161,7 +161,7 @@ class Zend_Db_Adapter_Db2 extends Zend_Db_Adapter_Abstract
161
  $this->_config['driver_options']['i5_naming'] = DB2_I5_NAMING_OFF;
162
  }
163
  }
164
-
165
  if ($this->_config['host'] !== 'localhost' && !$this->_isI5) {
166
  // if the host isn't localhost, use extended connection params
167
  $dbname = 'DRIVER={IBM DB2 ODBC DRIVER}' .
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Db2.php 24593 2012-01-05 20:35:02Z matthew $
21
  *
22
  */
23
 
39
 
40
  /**
41
  * @package Zend_Db
42
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
43
  * @license http://framework.zend.com/license/new-bsd New BSD License
44
  */
45
 
161
  $this->_config['driver_options']['i5_naming'] = DB2_I5_NAMING_OFF;
162
  }
163
  }
164
+
165
  if ($this->_config['host'] !== 'localhost' && !$this->_isI5) {
166
  // if the host isn't localhost, use extended connection params
167
  $dbname = 'DRIVER={IBM DB2 ODBC DRIVER}' .
lib/Zend/Db/Adapter/Db2/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -30,7 +30,7 @@
30
  *
31
  * @package Zend_Db
32
  * @subpackage Adapter
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Db_Adapter_Db2_Exception extends Zend_Db_Adapter_Exception
@@ -38,7 +38,7 @@ class Zend_Db_Adapter_Db2_Exception extends Zend_Db_Adapter_Exception
38
  protected $code = '00000';
39
  protected $message = 'unknown exception';
40
 
41
- function __construct($message = 'unknown exception', $code = '00000', Exception $e = null)
42
  {
43
  parent::__construct($message, $code, $e);
44
  }
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
30
  *
31
  * @package Zend_Db
32
  * @subpackage Adapter
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Db_Adapter_Db2_Exception extends Zend_Db_Adapter_Exception
38
  protected $code = '00000';
39
  protected $message = 'unknown exception';
40
 
41
+ function __construct($message = 'unknown exception', $code = '00000', Exception $e = null)
42
  {
43
  parent::__construct($message, $code, $e);
44
  }
lib/Zend/Db/Adapter/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -29,7 +29,7 @@
29
  * @category Zend
30
  * @package Zend_Db
31
  * @subpackage Adapter
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Db_Adapter_Exception extends Zend_Db_Exception
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
29
  * @category Zend
30
  * @package Zend_Db
31
  * @subpackage Adapter
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Db_Adapter_Exception extends Zend_Db_Exception
lib/Zend/Db/Adapter/Mysqli.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Mysqli.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -46,7 +46,7 @@
46
  * @category Zend
47
  * @package Zend_Db
48
  * @subpackage Adapter
49
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
50
  * @license http://framework.zend.com/license/new-bsd New BSD License
51
  */
52
  class Zend_Db_Adapter_Mysqli extends Zend_Db_Adapter_Abstract
@@ -297,6 +297,12 @@ class Zend_Db_Adapter_Mysqli extends Zend_Db_Adapter_Abstract
297
  $port = null;
298
  }
299
 
 
 
 
 
 
 
300
  $this->_connection = mysqli_init();
301
 
302
  if(!empty($this->_config['driver_options'])) {
@@ -320,7 +326,8 @@ class Zend_Db_Adapter_Mysqli extends Zend_Db_Adapter_Abstract
320
  $this->_config['username'],
321
  $this->_config['password'],
322
  $this->_config['dbname'],
323
- $port
 
324
  );
325
 
326
  if ($_isConnected === false || mysqli_connect_errno()) {
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Mysqli.php 25229 2013-01-18 08:17:21Z frosch $
21
  */
22
 
23
 
46
  * @category Zend
47
  * @package Zend_Db
48
  * @subpackage Adapter
49
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
50
  * @license http://framework.zend.com/license/new-bsd New BSD License
51
  */
52
  class Zend_Db_Adapter_Mysqli extends Zend_Db_Adapter_Abstract
297
  $port = null;
298
  }
299
 
300
+ if (isset($this->_config['socket'])) {
301
+ $socket = $this->_config['socket'];
302
+ } else {
303
+ $socket = null;
304
+ }
305
+
306
  $this->_connection = mysqli_init();
307
 
308
  if(!empty($this->_config['driver_options'])) {
326
  $this->_config['username'],
327
  $this->_config['password'],
328
  $this->_config['dbname'],
329
+ $port,
330
+ $socket
331
  );
332
 
333
  if ($_isConnected === false || mysqli_connect_errno()) {
lib/Zend/Db/Adapter/Mysqli/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  *
22
  */
23
 
@@ -32,7 +32,7 @@
32
  * @category Zend
33
  * @package Zend_Db
34
  * @subpackage Adapter
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Db_Adapter_Mysqli_Exception extends Zend_Db_Adapter_Exception
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  *
22
  */
23
 
32
  * @category Zend
33
  * @package Zend_Db
34
  * @subpackage Adapter
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Db_Adapter_Mysqli_Exception extends Zend_Db_Adapter_Exception
lib/Zend/Db/Adapter/Oracle.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Oracle.php 21108 2010-02-19 22:36:08Z mikaelkael $
21
  */
22
 
23
  /**
@@ -34,7 +34,7 @@
34
  * @category Zend
35
  * @package Zend_Db
36
  * @subpackage Adapter
37
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Db_Adapter_Oracle extends Zend_Db_Adapter_Abstract
@@ -147,8 +147,9 @@ class Zend_Db_Adapter_Oracle extends Zend_Db_Adapter_Abstract
147
  public function isConnected()
148
  {
149
  return ((bool) (is_resource($this->_connection)
150
- && get_resource_type($this->_connection) == 'oci8 connection'));
151
- }
 
152
 
153
  /**
154
  * Force the connection to close.
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Oracle.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
34
  * @category Zend
35
  * @package Zend_Db
36
  * @subpackage Adapter
37
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Db_Adapter_Oracle extends Zend_Db_Adapter_Abstract
147
  public function isConnected()
148
  {
149
  return ((bool) (is_resource($this->_connection)
150
+ && (get_resource_type($this->_connection) == 'oci8 connection'
151
+ || get_resource_type($this->_connection) == 'oci8 persistent connection')));
152
+ }
153
 
154
  /**
155
  * Force the connection to close.
lib/Zend/Db/Adapter/Oracle/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -31,7 +31,7 @@
31
  * @category Zend
32
  * @package Zend_Db
33
  * @subpackage Adapter
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Db_Adapter_Oracle_Exception extends Zend_Db_Adapter_Exception
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
31
  * @category Zend
32
  * @package Zend_Db
33
  * @subpackage Adapter
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Db_Adapter_Oracle_Exception extends Zend_Db_Adapter_Exception
lib/Zend/Db/Adapter/Pdo/Abstract.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -39,7 +39,7 @@
39
  * @category Zend
40
  * @package Zend_Db
41
  * @subpackage Adapter
42
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
43
  * @license http://framework.zend.com/license/new-bsd New BSD License
44
  */
45
  abstract class Zend_Db_Adapter_Pdo_Abstract extends Zend_Db_Adapter_Abstract
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
39
  * @category Zend
40
  * @package Zend_Db
41
  * @subpackage Adapter
42
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
43
  * @license http://framework.zend.com/license/new-bsd New BSD License
44
  */
45
  abstract class Zend_Db_Adapter_Pdo_Abstract extends Zend_Db_Adapter_Abstract
lib/Zend/Db/Adapter/Pdo/Ibm.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Ibm.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -38,7 +38,7 @@
38
  * @category Zend
39
  * @package Zend_Db
40
  * @subpackage Adapter
41
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
42
  * @license http://framework.zend.com/license/new-bsd New BSD License
43
  */
44
  class Zend_Db_Adapter_Pdo_Ibm extends Zend_Db_Adapter_Pdo_Abstract
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Ibm.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
38
  * @category Zend
39
  * @package Zend_Db
40
  * @subpackage Adapter
41
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
42
  * @license http://framework.zend.com/license/new-bsd New BSD License
43
  */
44
  class Zend_Db_Adapter_Pdo_Ibm extends Zend_Db_Adapter_Pdo_Abstract
lib/Zend/Db/Adapter/Pdo/Ibm/Db2.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Db2.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -32,7 +32,7 @@
32
  * @category Zend
33
  * @package Zend_Db
34
  * @subpackage Adapter
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Db_Adapter_Pdo_Ibm_Db2
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Db2.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
32
  * @category Zend
33
  * @package Zend_Db
34
  * @subpackage Adapter
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Db_Adapter_Pdo_Ibm_Db2
lib/Zend/Db/Adapter/Pdo/Ibm/Ids.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Ids.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -32,7 +32,7 @@
32
  * @category Zend
33
  * @package Zend_Db
34
  * @subpackage Adapter
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Db_Adapter_Pdo_Ibm_Ids
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Ids.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
32
  * @category Zend
33
  * @package Zend_Db
34
  * @subpackage Adapter
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Db_Adapter_Pdo_Ibm_Ids
lib/Zend/Db/Adapter/Pdo/Mssql.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Mssql.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -33,7 +33,7 @@
33
  * @category Zend
34
  * @package Zend_Db
35
  * @subpackage Adapter
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Db_Adapter_Pdo_Mssql extends Zend_Db_Adapter_Pdo_Abstract
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Mssql.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
33
  * @category Zend
34
  * @package Zend_Db
35
  * @subpackage Adapter
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Db_Adapter_Pdo_Mssql extends Zend_Db_Adapter_Pdo_Abstract
lib/Zend/Db/Adapter/Pdo/Mysql.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Mysql.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -33,7 +33,7 @@
33
  * @category Zend
34
  * @package Zend_Db
35
  * @subpackage Adapter
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Db_Adapter_Pdo_Mysql extends Zend_Db_Adapter_Pdo_Abstract
@@ -76,6 +76,19 @@ class Zend_Db_Adapter_Pdo_Mysql extends Zend_Db_Adapter_Pdo_Abstract
76
  'FLOAT' => Zend_Db::FLOAT_TYPE
77
  );
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  /**
80
  * Creates a PDO object and connects to the database.
81
  *
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Mysql.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
33
  * @category Zend
34
  * @package Zend_Db
35
  * @subpackage Adapter
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Db_Adapter_Pdo_Mysql extends Zend_Db_Adapter_Pdo_Abstract
76
  'FLOAT' => Zend_Db::FLOAT_TYPE
77
  );
78
 
79
+ /**
80
+ * Override _dsn() and ensure that charset is incorporated in mysql
81
+ * @see Zend_Db_Adapter_Pdo_Abstract::_dsn()
82
+ */
83
+ protected function _dsn()
84
+ {
85
+ $dsn = parent::_dsn();
86
+ if (isset($this->_config['charset'])) {
87
+ $dsn .= ';charset=' . $this->_config['charset'];
88
+ }
89
+ return $dsn;
90
+ }
91
+
92
  /**
93
  * Creates a PDO object and connects to the database.
94
  *
lib/Zend/Db/Adapter/Pdo/Oci.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Oci.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -33,7 +33,7 @@
33
  * @category Zend
34
  * @package Zend_Db
35
  * @subpackage Adapter
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Db_Adapter_Pdo_Oci extends Zend_Db_Adapter_Pdo_Abstract
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Oci.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
33
  * @category Zend
34
  * @package Zend_Db
35
  * @subpackage Adapter
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Db_Adapter_Pdo_Oci extends Zend_Db_Adapter_Pdo_Abstract
lib/Zend/Db/Adapter/Pdo/Pgsql.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Pgsql.php 22788 2010-08-03 18:29:55Z ramon $
21
  */
22
 
23
 
@@ -33,7 +33,7 @@
33
  * @category Zend
34
  * @package Zend_Db
35
  * @subpackage Adapter
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Db_Adapter_Pdo_Pgsql extends Zend_Db_Adapter_Pdo_Abstract
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Pgsql.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
33
  * @category Zend
34
  * @package Zend_Db
35
  * @subpackage Adapter
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Db_Adapter_Pdo_Pgsql extends Zend_Db_Adapter_Pdo_Abstract
lib/Zend/Db/Adapter/Pdo/Sqlite.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Sqlite.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -33,7 +33,7 @@
33
  * @category Zend
34
  * @package Zend_Db
35
  * @subpackage Adapter
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Db_Adapter_Pdo_Sqlite extends Zend_Db_Adapter_Pdo_Abstract
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Sqlite.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
33
  * @category Zend
34
  * @package Zend_Db
35
  * @subpackage Adapter
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Db_Adapter_Pdo_Sqlite extends Zend_Db_Adapter_Pdo_Abstract
lib/Zend/Db/Adapter/Sqlsrv.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Sqlsrv.php 21885 2010-04-16 15:13:40Z juokaz $
21
  */
22
 
23
  /**
@@ -34,7 +34,7 @@
34
  * @category Zend
35
  * @package Zend_Db
36
  * @subpackage Adapter
37
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Db_Adapter_Sqlsrv extends Zend_Db_Adapter_Abstract
@@ -437,10 +437,10 @@ class Zend_Db_Adapter_Sqlsrv extends Zend_Db_Adapter_Abstract
437
  $sql = "exec sp_columns @table_name = " . $this->quoteIdentifier($tableName, true);
438
  $stmt = $this->query($sql);
439
  $result = $stmt->fetchAll(Zend_Db::FETCH_NUM);
440
-
441
- // ZF-7698
442
- $stmt->closeCursor();
443
 
 
 
 
444
  if (count($result) == 0) {
445
  return array();
446
  }
@@ -622,17 +622,22 @@ class Zend_Db_Adapter_Sqlsrv extends Zend_Db_Adapter_Abstract
622
  } else {
623
  $over = preg_replace('/\"[^,]*\".\"([^,]*)\"/i', '"inner_tbl"."$1"', $orderby);
624
  }
625
-
626
  // Remove ORDER BY clause from $sql
627
  $sql = preg_replace('/\s+ORDER BY(.*)/', '', $sql);
628
-
629
  // Add ORDER BY clause as an argument for ROW_NUMBER()
630
  $sql = "SELECT ROW_NUMBER() OVER ($over) AS \"ZEND_DB_ROWNUM\", * FROM ($sql) AS inner_tbl";
631
-
632
  $start = $offset + 1;
633
- $end = $offset + $count;
634
 
635
- $sql = "WITH outer_tbl AS ($sql) SELECT * FROM outer_tbl WHERE \"ZEND_DB_ROWNUM\" BETWEEN $start AND $end";
 
 
 
 
 
 
636
  }
637
 
638
  return $sql;
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Sqlsrv.php 25077 2012-11-06 20:06:24Z rob $
21
  */
22
 
23
  /**
34
  * @category Zend
35
  * @package Zend_Db
36
  * @subpackage Adapter
37
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Db_Adapter_Sqlsrv extends Zend_Db_Adapter_Abstract
437
  $sql = "exec sp_columns @table_name = " . $this->quoteIdentifier($tableName, true);
438
  $stmt = $this->query($sql);
439
  $result = $stmt->fetchAll(Zend_Db::FETCH_NUM);
 
 
 
440
 
441
+ // ZF-7698
442
+ $stmt->closeCursor();
443
+
444
  if (count($result) == 0) {
445
  return array();
446
  }
622
  } else {
623
  $over = preg_replace('/\"[^,]*\".\"([^,]*)\"/i', '"inner_tbl"."$1"', $orderby);
624
  }
625
+
626
  // Remove ORDER BY clause from $sql
627
  $sql = preg_replace('/\s+ORDER BY(.*)/', '', $sql);
628
+
629
  // Add ORDER BY clause as an argument for ROW_NUMBER()
630
  $sql = "SELECT ROW_NUMBER() OVER ($over) AS \"ZEND_DB_ROWNUM\", * FROM ($sql) AS inner_tbl";
631
+
632
  $start = $offset + 1;
 
633
 
634
+ if ($count == PHP_INT_MAX) {
635
+ $sql = "WITH outer_tbl AS ($sql) SELECT * FROM outer_tbl WHERE \"ZEND_DB_ROWNUM\" >= $start";
636
+ }
637
+ else {
638
+ $end = $offset + $count;
639
+ $sql = "WITH outer_tbl AS ($sql) SELECT * FROM outer_tbl WHERE \"ZEND_DB_ROWNUM\" BETWEEN $start AND $end";
640
+ }
641
  }
642
 
643
  return $sql;
lib/Zend/Db/Adapter/Sqlsrv/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20625 2010-01-25 21:03:53Z ralph $
21
  */
22
 
23
  /**
@@ -31,7 +31,7 @@
31
  * @category Zend
32
  * @package Zend_Db
33
  * @subpackage Adapter
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Db_Adapter_Sqlsrv_Exception extends Zend_Db_Adapter_Exception
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Adapter
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
31
  * @category Zend
32
  * @package Zend_Db
33
  * @subpackage Adapter
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Db_Adapter_Sqlsrv_Exception extends Zend_Db_Adapter_Exception
lib/Zend/Db/Exception.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Db
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /**
@@ -27,7 +27,7 @@
27
  /**
28
  * @category Zend
29
  * @package Zend_Db
30
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Db_Exception extends Zend_Exception
14
  *
15
  * @category Zend
16
  * @package Zend_Db
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /**
27
  /**
28
  * @category Zend
29
  * @package Zend_Db
30
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Db_Exception extends Zend_Exception
lib/Zend/Db/Expr.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Expr
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Expr.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -43,7 +43,7 @@
43
  * @category Zend
44
  * @package Zend_Db
45
  * @subpackage Expr
46
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
47
  * @license http://framework.zend.com/license/new-bsd New BSD License
48
  */
49
  class Zend_Db_Expr
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Expr
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Expr.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
43
  * @category Zend
44
  * @package Zend_Db
45
  * @subpackage Expr
46
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
47
  * @license http://framework.zend.com/license/new-bsd New BSD License
48
  */
49
  class Zend_Db_Expr
lib/Zend/Db/Profiler.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Profiler
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Profiler.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -25,7 +25,7 @@
25
  * @category Zend
26
  * @package Zend_Db
27
  * @subpackage Profiler
28
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
29
  * @license http://framework.zend.com/license/new-bsd New BSD License
30
  */
31
  class Zend_Db_Profiler
@@ -225,7 +225,9 @@ class Zend_Db_Profiler
225
  }
226
 
227
  /**
228
- * @param integer $queryId
 
 
229
  * @return integer or null
230
  */
231
  public function queryClone(Zend_Db_Profiler_Query $query)
@@ -287,12 +289,12 @@ class Zend_Db_Profiler
287
  }
288
 
289
  /**
290
- * Ends a query. Pass it the handle that was returned by queryStart().
291
  * This will mark the query as ended and save the time.
292
  *
293
  * @param integer $queryId
294
  * @throws Zend_Db_Profiler_Exception
295
- * @return void
296
  */
297
  public function queryEnd($queryId)
298
  {
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Profiler
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Profiler.php 25127 2012-11-16 15:17:42Z rob $
21
  */
22
 
23
 
25
  * @category Zend
26
  * @package Zend_Db
27
  * @subpackage Profiler
28
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
29
  * @license http://framework.zend.com/license/new-bsd New BSD License
30
  */
31
  class Zend_Db_Profiler
225
  }
226
 
227
  /**
228
+ * Clone a profiler query
229
+ *
230
+ * @param Zend_Db_Profiler_Query $query
231
  * @return integer or null
232
  */
233
  public function queryClone(Zend_Db_Profiler_Query $query)
289
  }
290
 
291
  /**
292
+ * Ends a query. Pass it the handle that was returned by queryStart().
293
  * This will mark the query as ended and save the time.
294
  *
295
  * @param integer $queryId
296
  * @throws Zend_Db_Profiler_Exception
297
+ * @return string Inform that a query is stored or ignored.
298
  */
299
  public function queryEnd($queryId)
300
  {
lib/Zend/Db/Profiler/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Profiler
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -31,7 +31,7 @@
31
  * @category Zend
32
  * @package Zend_Db
33
  * @subpackage Profiler
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Db_Profiler_Exception extends Zend_Db_Exception
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Profiler
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
31
  * @category Zend
32
  * @package Zend_Db
33
  * @subpackage Profiler
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Db_Profiler_Exception extends Zend_Db_Exception
lib/Zend/Db/Profiler/Firebug.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Profiler
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Firebug.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Db_Profiler */
@@ -35,7 +35,7 @@
35
  * @category Zend
36
  * @package Zend_Db
37
  * @subpackage Profiler
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Db_Profiler_Firebug extends Zend_Db_Profiler
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Profiler
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Firebug.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Db_Profiler */
35
  * @category Zend
36
  * @package Zend_Db
37
  * @subpackage Profiler
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Db_Profiler_Firebug extends Zend_Db_Profiler
lib/Zend/Db/Profiler/Query.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Profiler
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Query.php 23382 2010-11-18 22:50:50Z bittarman $
21
  */
22
 
23
 
@@ -25,7 +25,7 @@
25
  * @category Zend
26
  * @package Zend_Db
27
  * @subpackage Profiler
28
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
29
  * @license http://framework.zend.com/license/new-bsd New BSD License
30
  */
31
  class Zend_Db_Profiler_Query
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Profiler
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Query.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
25
  * @category Zend
26
  * @package Zend_Db
27
  * @subpackage Profiler
28
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
29
  * @license http://framework.zend.com/license/new-bsd New BSD License
30
  */
31
  class Zend_Db_Profiler_Query
lib/Zend/Db/Select.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Select
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Select.php 23254 2010-10-26 12:49:23Z matthew $
21
  */
22
 
23
 
@@ -38,7 +38,7 @@
38
  * @category Zend
39
  * @package Zend_Db
40
  * @subpackage Select
41
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
42
  * @license http://framework.zend.com/license/new-bsd New BSD License
43
  */
44
  class Zend_Db_Select
@@ -207,8 +207,8 @@ class Zend_Db_Select
207
  * The first parameter $name can be a simple string, in which case the
208
  * correlation name is generated automatically. If you want to specify
209
  * the correlation name, the first parameter must be an associative
210
- * array in which the key is the physical table name, and the value is
211
- * the correlation name. For example, array('table' => 'alias').
212
  * The correlation name is prepended to all columns fetched for this
213
  * table.
214
  *
@@ -219,8 +219,8 @@ class Zend_Db_Select
219
  * no correlation name is generated or prepended to the columns named
220
  * in the second parameter.
221
  *
222
- * @param array|string|Zend_Db_Expr $name The table name or an associative array relating table name to
223
- * correlation name.
224
  * @param array|string|Zend_Db_Expr $cols The columns to select from this table.
225
  * @param string $schema The schema name to specify, if any.
226
  * @return Zend_Db_Select This Zend_Db_Select object.
@@ -880,9 +880,13 @@ class Zend_Db_Select
880
  $join = $this->_adapter->quoteIdentifier(key($this->_parts[self::FROM]), true);
881
  $from = $this->_adapter->quoteIdentifier($this->_uniqueCorrelation($name), true);
882
 
883
- $cond1 = $from . '.' . $cond;
884
- $cond2 = $join . '.' . $cond;
885
- $cond = $cond1 . ' = ' . $cond2;
 
 
 
 
886
 
887
  return $this->_join($type, $name, $cond, $cols, $schema);
888
  }
@@ -896,7 +900,8 @@ class Zend_Db_Select
896
  private function _uniqueCorrelation($name)
897
  {
898
  if (is_array($name)) {
899
- $c = end($name);
 
900
  } else {
901
  // Extract just the last name of a qualified table name
902
  $dot = strrpos($name,'.');
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Select
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Select.php 24833 2012-05-30 13:29:41Z adamlundrigan $
21
  */
22
 
23
 
38
  * @category Zend
39
  * @package Zend_Db
40
  * @subpackage Select
41
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
42
  * @license http://framework.zend.com/license/new-bsd New BSD License
43
  */
44
  class Zend_Db_Select
207
  * The first parameter $name can be a simple string, in which case the
208
  * correlation name is generated automatically. If you want to specify
209
  * the correlation name, the first parameter must be an associative
210
+ * array in which the key is the correlation name, and the value is
211
+ * the physical table name. For example, array('alias' => 'table').
212
  * The correlation name is prepended to all columns fetched for this
213
  * table.
214
  *
219
  * no correlation name is generated or prepended to the columns named
220
  * in the second parameter.
221
  *
222
+ * @param array|string|Zend_Db_Expr $name The table name or an associative array
223
+ * relating correlation name to table name.
224
  * @param array|string|Zend_Db_Expr $cols The columns to select from this table.
225
  * @param string $schema The schema name to specify, if any.
226
  * @return Zend_Db_Select This Zend_Db_Select object.
880
  $join = $this->_adapter->quoteIdentifier(key($this->_parts[self::FROM]), true);
881
  $from = $this->_adapter->quoteIdentifier($this->_uniqueCorrelation($name), true);
882
 
883
+ $joinCond = array();
884
+ foreach ((array)$cond as $fieldName) {
885
+ $cond1 = $from . '.' . $fieldName;
886
+ $cond2 = $join . '.' . $fieldName;
887
+ $joinCond[] = $cond1 . ' = ' . $cond2;
888
+ }
889
+ $cond = implode(' '.self::SQL_AND.' ', $joinCond);
890
 
891
  return $this->_join($type, $name, $cond, $cols, $schema);
892
  }
900
  private function _uniqueCorrelation($name)
901
  {
902
  if (is_array($name)) {
903
+ $k = key($name);
904
+ $c = is_string($k) ? $k : end($name);
905
  } else {
906
  // Extract just the last name of a qualified table name
907
  $dot = strrpos($name,'.');
lib/Zend/Db/Select/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Select
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -29,7 +29,7 @@
29
  * @category Zend
30
  * @package Zend_Db
31
  * @subpackage Select
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
 
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Select
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
29
  * @category Zend
30
  * @package Zend_Db
31
  * @subpackage Select
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
 
lib/Zend/Db/Statement.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Statement.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -36,7 +36,7 @@
36
  * @category Zend
37
  * @package Zend_Db
38
  * @subpackage Statement
39
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
40
  * @license http://framework.zend.com/license/new-bsd New BSD License
41
  */
42
  abstract class Zend_Db_Statement implements Zend_Db_Statement_Interface
@@ -176,37 +176,40 @@ abstract class Zend_Db_Statement implements Zend_Db_Statement_Interface
176
  */
177
  protected function _stripQuoted($sql)
178
  {
179
- // get the character for delimited id quotes,
180
- // this is usually " but in MySQL is `
181
- $d = $this->_adapter->quoteIdentifier('a');
182
- $d = $d[0];
183
-
184
- // get the value used as an escaped delimited id quote,
185
- // e.g. \" or "" or \`
186
- $de = $this->_adapter->quoteIdentifier($d);
187
- $de = substr($de, 1, 2);
188
- $de = str_replace('\\', '\\\\', $de);
189
 
190
  // get the character for value quoting
191
  // this should be '
192
  $q = $this->_adapter->quote('a');
193
- $q = $q[0];
194
-
195
  // get the value used as an escaped quote,
196
  // e.g. \' or ''
197
  $qe = $this->_adapter->quote($q);
198
  $qe = substr($qe, 1, 2);
199
- $qe = str_replace('\\', '\\\\', $qe);
200
-
201
- // get a version of the SQL statement with all quoted
202
- // values and delimited identifiers stripped out
203
- // remove "foo\"bar"
204
- $sql = preg_replace("/$q($qe|\\\\{2}|[^$q])*$q/", '', $sql);
205
  // remove 'foo\'bar'
206
  if (!empty($q)) {
207
- $sql = preg_replace("/$q($qe|[^$q])*$q/", '', $sql);
 
 
208
  }
 
 
 
 
 
209
 
 
 
 
 
 
 
 
 
 
 
 
210
  return $sql;
211
  }
212
 
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Statement.php 24790 2012-05-10 12:28:51Z mcleod@spaceweb.nl $
21
  */
22
 
23
  /**
36
  * @category Zend
37
  * @package Zend_Db
38
  * @subpackage Statement
39
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
40
  * @license http://framework.zend.com/license/new-bsd New BSD License
41
  */
42
  abstract class Zend_Db_Statement implements Zend_Db_Statement_Interface
176
  */
177
  protected function _stripQuoted($sql)
178
  {
 
 
 
 
 
 
 
 
 
 
179
 
180
  // get the character for value quoting
181
  // this should be '
182
  $q = $this->_adapter->quote('a');
183
+ $q = $q[0];
 
184
  // get the value used as an escaped quote,
185
  // e.g. \' or ''
186
  $qe = $this->_adapter->quote($q);
187
  $qe = substr($qe, 1, 2);
188
+ $qe = preg_quote($qe);
189
+ $escapeChar = substr($qe,0,1);
 
 
 
 
190
  // remove 'foo\'bar'
191
  if (!empty($q)) {
192
+ $escapeChar = preg_quote($escapeChar);
193
+ // this segfaults only after 65,000 characters instead of 9,000
194
+ $sql = preg_replace("/$q([^$q{$escapeChar}]*|($qe)*)*$q/s", '', $sql);
195
  }
196
+
197
+ // get a version of the SQL statement with all quoted
198
+ // values and delimited identifiers stripped out
199
+ // remove "foo\"bar"
200
+ $sql = preg_replace("/\"(\\\\\"|[^\"])*\"/Us", '', $sql);
201
 
202
+ // get the character for delimited id quotes,
203
+ // this is usually " but in MySQL is `
204
+ $d = $this->_adapter->quoteIdentifier('a');
205
+ $d = $d[0];
206
+ // get the value used as an escaped delimited id quote,
207
+ // e.g. \" or "" or \`
208
+ $de = $this->_adapter->quoteIdentifier($d);
209
+ $de = substr($de, 1, 2);
210
+ $de = preg_quote($de);
211
+ // Note: $de and $d where never used..., now they are:
212
+ $sql = preg_replace("/$d($de|\\\\{2}|[^$d])*$d/Us", '', $sql);
213
  return $sql;
214
  }
215
 
lib/Zend/Db/Statement/Db2.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Db2.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -30,7 +30,7 @@
30
  *
31
  * @package Zend_Db
32
  * @subpackage Statement
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Db_Statement_Db2 extends Zend_Db_Statement
@@ -96,7 +96,7 @@ class Zend_Db_Statement_Db2 extends Zend_Db_Statement
96
  $datatype = DB2_CHAR;
97
  }
98
 
99
- if (!db2_bind_param($this->_stmt, $position, "variable", $type, $datatype)) {
100
  /**
101
  * @see Zend_Db_Statement_Db2_Exception
102
  */
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Db2.php 24625 2012-02-22 21:53:40Z adamlundrigan $
21
  */
22
 
23
  /**
30
  *
31
  * @package Zend_Db
32
  * @subpackage Statement
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Db_Statement_Db2 extends Zend_Db_Statement
96
  $datatype = DB2_CHAR;
97
  }
98
 
99
+ if (!db2_bind_param($this->_stmt, $parameter, "variable", $type, $datatype)) {
100
  /**
101
  * @see Zend_Db_Statement_Db2_Exception
102
  */
lib/Zend/Db/Statement/Db2/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -28,7 +28,7 @@
28
  /**
29
  * @package Zend_Db
30
  * @subpackage Statement
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
 
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
28
  /**
29
  * @package Zend_Db
30
  * @subpackage Statement
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
 
lib/Zend/Db/Statement/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20513 2010-01-22 07:55:48Z ralph $
21
  */
22
 
23
  /**
@@ -31,7 +31,7 @@
31
  * @category Zend
32
  * @package Zend_Db
33
  * @subpackage Statement
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Db_Statement_Exception extends Zend_Db_Exception
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
31
  * @category Zend
32
  * @package Zend_Db
33
  * @subpackage Statement
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Db_Statement_Exception extends Zend_Db_Exception
lib/Zend/Db/Statement/Interface.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -26,7 +26,7 @@
26
  * @category Zend
27
  * @package Zend_Db
28
  * @subpackage Statement
29
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  interface Zend_Db_Statement_Interface
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
26
  * @category Zend
27
  * @package Zend_Db
28
  * @subpackage Statement
29
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  interface Zend_Db_Statement_Interface
lib/Zend/Db/Statement/Mysqli.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Mysqli.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -33,7 +33,7 @@
33
  * @category Zend
34
  * @package Zend_Db
35
  * @subpackage Statement
36
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Db_Statement_Mysqli extends Zend_Db_Statement
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Mysqli.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
33
  * @category Zend
34
  * @package Zend_Db
35
  * @subpackage Statement
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
  * @license http://framework.zend.com/license/new-bsd New BSD License
38
  */
39
  class Zend_Db_Statement_Mysqli extends Zend_Db_Statement
lib/Zend/Db/Statement/Mysqli/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -28,7 +28,7 @@
28
  /**
29
  * @package Zend_Db
30
  * @subpackage Statement
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
 
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
28
  /**
29
  * @package Zend_Db
30
  * @subpackage Statement
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
 
lib/Zend/Db/Statement/Oracle.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Oracle.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -31,7 +31,7 @@
31
  * @category Zend
32
  * @package Zend_Db
33
  * @subpackage Statement
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Db_Statement_Oracle extends Zend_Db_Statement
@@ -87,7 +87,7 @@ class Zend_Db_Statement_Oracle extends Zend_Db_Statement
87
  protected function _prepare($sql)
88
  {
89
  $connection = $this->_adapter->getConnection();
90
- $this->_stmt = oci_parse($connection, $sql);
91
  if (!$this->_stmt) {
92
  /**
93
  * @see Zend_Db_Statement_Oracle_Exception
@@ -240,7 +240,7 @@ class Zend_Db_Statement_Oracle extends Zend_Db_Statement
240
  }
241
  $error = false;
242
  foreach (array_keys($params) as $name) {
243
- if (!@oci_bind_by_name($this->_stmt, $name, $params[$name], -1)) {
244
  $error = true;
245
  break;
246
  }
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Oracle.php 24863 2012-06-02 00:22:47Z adamlundrigan $
21
  */
22
 
23
  /**
31
  * @category Zend
32
  * @package Zend_Db
33
  * @subpackage Statement
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Db_Statement_Oracle extends Zend_Db_Statement
87
  protected function _prepare($sql)
88
  {
89
  $connection = $this->_adapter->getConnection();
90
+ $this->_stmt = @oci_parse($connection, $sql);
91
  if (!$this->_stmt) {
92
  /**
93
  * @see Zend_Db_Statement_Oracle_Exception
240
  }
241
  $error = false;
242
  foreach (array_keys($params) as $name) {
243
+ if (!$this->bindParam($name, $params[$name], null, -1)) {
244
  $error = true;
245
  break;
246
  }
lib/Zend/Db/Statement/Oracle/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -29,7 +29,7 @@
29
  * @category Zend
30
  * @package Zend_Db
31
  * @subpackage Statement
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
 
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
29
  * @category Zend
30
  * @package Zend_Db
31
  * @subpackage Statement
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
 
lib/Zend/Db/Statement/Pdo.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Pdo.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -34,7 +34,7 @@
34
  * @category Zend
35
  * @package Zend_Db
36
  * @subpackage Statement
37
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggregate
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Pdo.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
34
  * @category Zend
35
  * @package Zend_Db
36
  * @subpackage Statement
37
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Db_Statement_Pdo extends Zend_Db_Statement implements IteratorAggregate
lib/Zend/Db/Statement/Pdo/Ibm.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Ibm.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -34,7 +34,7 @@
34
  * @category Zend
35
  * @package Zend_Db
36
  * @subpackage Statement
37
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Db_Statement_Pdo_Ibm extends Zend_Db_Statement_Pdo
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Ibm.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
34
  * @category Zend
35
  * @package Zend_Db
36
  * @subpackage Statement
37
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Db_Statement_Pdo_Ibm extends Zend_Db_Statement_Pdo
lib/Zend/Db/Statement/Pdo/Oci.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Oci.php 21104 2010-02-19 21:26:36Z mikaelkael $
21
  */
22
 
23
  /**
@@ -34,7 +34,7 @@
34
  * @category Zend
35
  * @package Zend_Db
36
  * @subpackage Statement
37
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Db_Statement_Pdo_Oci extends Zend_Db_Statement_Pdo
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Oci.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
34
  * @category Zend
35
  * @package Zend_Db
36
  * @subpackage Statement
37
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Db_Statement_Pdo_Oci extends Zend_Db_Statement_Pdo
lib/Zend/Db/Statement/Sqlsrv.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Sqlsrv.php 21887 2010-04-16 18:28:10Z juokaz $
21
  */
22
 
23
  /**
@@ -31,7 +31,7 @@
31
  * @category Zend
32
  * @package Zend_Db
33
  * @subpackage Statement
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Db_Statement_Sqlsrv extends Zend_Db_Statement
@@ -376,11 +376,11 @@ class Zend_Db_Statement_Sqlsrv extends Zend_Db_Statement
376
  #require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
377
  throw new Zend_Db_Statement_Sqlsrv_Exception(sqlsrv_errors());
378
  }
379
-
380
- // reset column keys
381
- $this->_keys = null;
382
 
383
- return true;
384
  }
385
 
386
  /**
@@ -411,8 +411,8 @@ class Zend_Db_Statement_Sqlsrv extends Zend_Db_Statement
411
 
412
  return $num_rows;
413
  }
414
-
415
- /**
416
  * Returns an array containing all of the result set rows.
417
  *
418
  * @param int $style OPTIONAL Fetch mode.
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Sqlsrv.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
31
  * @category Zend
32
  * @package Zend_Db
33
  * @subpackage Statement
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Db_Statement_Sqlsrv extends Zend_Db_Statement
376
  #require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
377
  throw new Zend_Db_Statement_Sqlsrv_Exception(sqlsrv_errors());
378
  }
379
+
380
+ // reset column keys
381
+ $this->_keys = null;
382
 
383
+ return true;
384
  }
385
 
386
  /**
411
 
412
  return $num_rows;
413
  }
414
+
415
+ /**
416
  * Returns an array containing all of the result set rows.
417
  *
418
  * @param int $style OPTIONAL Fetch mode.
lib/Zend/Db/Statement/Sqlsrv/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -28,7 +28,7 @@
28
  /**
29
  * @package Zend_Db
30
  * @subpackage Statement
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Db_Statement_Sqlsrv_Exception extends Zend_Db_Statement_Exception
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Statement
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
28
  /**
29
  * @package Zend_Db
30
  * @subpackage Statement
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
  */
34
  class Zend_Db_Statement_Sqlsrv_Exception extends Zend_Db_Statement_Exception
lib/Zend/Db/Table.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Table
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Table.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -36,7 +36,7 @@
36
  * @category Zend
37
  * @package Zend_Db
38
  * @subpackage Table
39
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
40
  * @license http://framework.zend.com/license/new-bsd New BSD License
41
  */
42
  class Zend_Db_Table extends Zend_Db_Table_Abstract
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Table
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Table.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
36
  * @category Zend
37
  * @package Zend_Db
38
  * @subpackage Table
39
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
40
  * @license http://framework.zend.com/license/new-bsd New BSD License
41
  */
42
  class Zend_Db_Table extends Zend_Db_Table_Abstract
lib/Zend/Db/Table/Abstract.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Table
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Abstract.php 21078 2010-02-18 18:07:16Z tech13 $
21
  */
22
 
23
  /**
@@ -41,7 +41,7 @@
41
  * @category Zend
42
  * @package Zend_Db
43
  * @subpackage Table
44
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
45
  * @license http://framework.zend.com/license/new-bsd New BSD License
46
  */
47
  abstract class Zend_Db_Table_Abstract
@@ -70,6 +70,7 @@ abstract class Zend_Db_Table_Abstract
70
  const ON_UPDATE = 'onUpdate';
71
 
72
  const CASCADE = 'cascade';
 
73
  const RESTRICT = 'restrict';
74
  const SET_NULL = 'setNull';
75
 
@@ -744,6 +745,7 @@ abstract class Zend_Db_Table_Abstract
744
  * Initialize database adapter.
745
  *
746
  * @return void
 
747
  */
748
  protected function _setupDatabaseAdapter()
749
  {
@@ -807,12 +809,23 @@ abstract class Zend_Db_Table_Abstract
807
  //get db configuration
808
  $dbConfig = $this->_db->getConfig();
809
 
 
 
 
 
 
 
 
 
 
 
 
 
810
  // Define the cache identifier where the metadata are saved
811
  $cacheId = md5( // port:host/dbname:schema.table (based on availabilty)
812
- (isset($dbConfig['options']['port']) ? ':'.$dbConfig['options']['port'] : null)
813
- . (isset($dbConfig['options']['host']) ? ':'.$dbConfig['options']['host'] : null)
814
- . '/'.$dbConfig['dbname'].':'.$this->_schema.'.'.$this->_name
815
- );
816
  }
817
 
818
  // If $this has no metadata cache or metadata cache misses
@@ -873,7 +886,7 @@ abstract class Zend_Db_Table_Abstract
873
  // then throw an exception.
874
  if (empty($this->_primary)) {
875
  #require_once 'Zend/Db/Table/Exception.php';
876
- throw new Zend_Db_Table_Exception('A table must have a primary key, but none was found');
877
  }
878
  } else if (!is_array($this->_primary)) {
879
  $this->_primary = array(1 => $this->_primary);
@@ -961,8 +974,9 @@ abstract class Zend_Db_Table_Abstract
961
  * You can elect to return only a part of this information by supplying its key name,
962
  * otherwise all information is returned as an array.
963
  *
964
- * @param $key The specific info part to return OPTIONAL
965
  * @return mixed
 
966
  */
967
  public function info($key = null)
968
  {
@@ -1035,14 +1049,24 @@ abstract class Zend_Db_Table_Abstract
1035
  */
1036
  if (is_string($this->_sequence) && !isset($data[$pkIdentity])) {
1037
  $data[$pkIdentity] = $this->_db->nextSequenceId($this->_sequence);
 
1038
  }
1039
 
1040
  /**
1041
  * If the primary key can be generated automatically, and no value was
1042
  * specified in the user-supplied data, then omit it from the tuple.
 
 
 
 
1043
  */
1044
- if (array_key_exists($pkIdentity, $data) && $data[$pkIdentity] === null) {
1045
- unset($data[$pkIdentity]);
 
 
 
 
 
1046
  }
1047
 
1048
  /**
@@ -1157,6 +1181,22 @@ abstract class Zend_Db_Table_Abstract
1157
  */
1158
  public function delete($where)
1159
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1160
  $tableSpec = ($this->_schema ? $this->_schema . '.' : '') . $this->_name;
1161
  return $this->_db->delete($tableSpec, $where);
1162
  }
@@ -1170,27 +1210,56 @@ abstract class Zend_Db_Table_Abstract
1170
  */
1171
  public function _cascadeDelete($parentTableClassname, array $primaryKey)
1172
  {
 
1173
  $this->_setupMetadata();
 
 
 
 
 
 
 
1174
  $rowsAffected = 0;
 
1175
  foreach ($this->_getReferenceMapNormalized() as $map) {
1176
  if ($map[self::REF_TABLE_CLASS] == $parentTableClassname && isset($map[self::ON_DELETE])) {
1177
- switch ($map[self::ON_DELETE]) {
1178
- case self::CASCADE:
1179
- $where = array();
1180
- for ($i = 0; $i < count($map[self::COLUMNS]); ++$i) {
1181
- $col = $this->_db->foldCase($map[self::COLUMNS][$i]);
1182
- $refCol = $this->_db->foldCase($map[self::REF_COLUMNS][$i]);
1183
- $type = $this->_metadata[$col]['DATA_TYPE'];
1184
- $where[] = $this->_db->quoteInto(
1185
- $this->_db->quoteIdentifier($col, true) . ' = ?',
1186
- $primaryKey[$refCol], $type);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1187
  }
1188
- $rowsAffected += $this->delete($where);
1189
- break;
1190
- default:
1191
- // no action
1192
- break;
1193
  }
 
 
 
 
 
 
1194
  }
1195
  }
1196
  return $rowsAffected;
@@ -1342,10 +1411,11 @@ abstract class Zend_Db_Table_Abstract
1342
  *
1343
  * @param string|array|Zend_Db_Table_Select $where OPTIONAL An SQL WHERE clause or Zend_Db_Table_Select object.
1344
  * @param string|array $order OPTIONAL An SQL ORDER clause.
 
1345
  * @return Zend_Db_Table_Row_Abstract|null The row results per the
1346
  * Zend_Db_Adapter fetch mode, or null if no row found.
1347
  */
1348
- public function fetchRow($where = null, $order = null)
1349
  {
1350
  if (!($where instanceof Zend_Db_Table_Select)) {
1351
  $select = $this->select();
@@ -1358,10 +1428,10 @@ abstract class Zend_Db_Table_Abstract
1358
  $this->_order($select, $order);
1359
  }
1360
 
1361
- $select->limit(1);
1362
 
1363
  } else {
1364
- $select = $where->limit(1);
1365
  }
1366
 
1367
  $rows = $this->_fetch($select);
@@ -1507,4 +1577,38 @@ abstract class Zend_Db_Table_Abstract
1507
  return $data;
1508
  }
1509
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1510
  }
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Table
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Abstract.php 24958 2012-06-15 13:44:04Z adamlundrigan $
21
  */
22
 
23
  /**
41
  * @category Zend
42
  * @package Zend_Db
43
  * @subpackage Table
44
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
45
  * @license http://framework.zend.com/license/new-bsd New BSD License
46
  */
47
  abstract class Zend_Db_Table_Abstract
70
  const ON_UPDATE = 'onUpdate';
71
 
72
  const CASCADE = 'cascade';
73
+ const CASCADE_RECURSE = 'cascadeRecurse';
74
  const RESTRICT = 'restrict';
75
  const SET_NULL = 'setNull';
76
 
745
  * Initialize database adapter.
746
  *
747
  * @return void
748
+ * @throws Zend_Db_Table_Exception
749
  */
750
  protected function _setupDatabaseAdapter()
751
  {
809
  //get db configuration
810
  $dbConfig = $this->_db->getConfig();
811
 
812
+ $port = isset($dbConfig['options']['port'])
813
+ ? ':'.$dbConfig['options']['port']
814
+ : (isset($dbConfig['port'])
815
+ ? ':'.$dbConfig['port']
816
+ : null);
817
+
818
+ $host = isset($dbConfig['options']['host'])
819
+ ? ':'.$dbConfig['options']['host']
820
+ : (isset($dbConfig['host'])
821
+ ? ':'.$dbConfig['host']
822
+ : null);
823
+
824
  // Define the cache identifier where the metadata are saved
825
  $cacheId = md5( // port:host/dbname:schema.table (based on availabilty)
826
+ $port . $host . '/'. $dbConfig['dbname'] . ':'
827
+ . $this->_schema. '.' . $this->_name
828
+ );
 
829
  }
830
 
831
  // If $this has no metadata cache or metadata cache misses
886
  // then throw an exception.
887
  if (empty($this->_primary)) {
888
  #require_once 'Zend/Db/Table/Exception.php';
889
+ throw new Zend_Db_Table_Exception("A table must have a primary key, but none was found for table '{$this->_name}'");
890
  }
891
  } else if (!is_array($this->_primary)) {
892
  $this->_primary = array(1 => $this->_primary);
974
  * You can elect to return only a part of this information by supplying its key name,
975
  * otherwise all information is returned as an array.
976
  *
977
+ * @param string $key The specific info part to return OPTIONAL
978
  * @return mixed
979
+ * @throws Zend_Db_Table_Exception
980
  */
981
  public function info($key = null)
982
  {
1049
  */
1050
  if (is_string($this->_sequence) && !isset($data[$pkIdentity])) {
1051
  $data[$pkIdentity] = $this->_db->nextSequenceId($this->_sequence);
1052
+ $pkSuppliedBySequence = true;
1053
  }
1054
 
1055
  /**
1056
  * If the primary key can be generated automatically, and no value was
1057
  * specified in the user-supplied data, then omit it from the tuple.
1058
+ *
1059
+ * Note: this checks for sensible values in the supplied primary key
1060
+ * position of the data. The following values are considered empty:
1061
+ * null, false, true, '', array()
1062
  */
1063
+ if (!isset($pkSuppliedBySequence) && array_key_exists($pkIdentity, $data)) {
1064
+ if ($data[$pkIdentity] === null // null
1065
+ || $data[$pkIdentity] === '' // empty string
1066
+ || is_bool($data[$pkIdentity]) // boolean
1067
+ || (is_array($data[$pkIdentity]) && empty($data[$pkIdentity]))) { // empty array
1068
+ unset($data[$pkIdentity]);
1069
+ }
1070
  }
1071
 
1072
  /**
1181
  */
1182
  public function delete($where)
1183
  {
1184
+ $depTables = $this->getDependentTables();
1185
+ if (!empty($depTables)) {
1186
+ $resultSet = $this->fetchAll($where);
1187
+ if (count($resultSet) > 0 ) {
1188
+ foreach ($resultSet as $row) {
1189
+ /**
1190
+ * Execute cascading deletes against dependent tables
1191
+ */
1192
+ foreach ($depTables as $tableClass) {
1193
+ $t = self::getTableFromString($tableClass, $this);
1194
+ $t->_cascadeDelete($tableClass, $row->getPrimaryKey());
1195
+ }
1196
+ }
1197
+ }
1198
+ }
1199
+
1200
  $tableSpec = ($this->_schema ? $this->_schema . '.' : '') . $this->_name;
1201
  return $this->_db->delete($tableSpec, $where);
1202
  }
1210
  */
1211
  public function _cascadeDelete($parentTableClassname, array $primaryKey)
1212
  {
1213
+ // setup metadata
1214
  $this->_setupMetadata();
1215
+
1216
+ // get this class name
1217
+ $thisClass = get_class($this);
1218
+ if ($thisClass === 'Zend_Db_Table') {
1219
+ $thisClass = $this->_definitionConfigName;
1220
+ }
1221
+
1222
  $rowsAffected = 0;
1223
+
1224
  foreach ($this->_getReferenceMapNormalized() as $map) {
1225
  if ($map[self::REF_TABLE_CLASS] == $parentTableClassname && isset($map[self::ON_DELETE])) {
1226
+
1227
+ $where = array();
1228
+
1229
+ // CASCADE or CASCADE_RECURSE
1230
+ if (in_array($map[self::ON_DELETE], array(self::CASCADE, self::CASCADE_RECURSE))) {
1231
+ for ($i = 0; $i < count($map[self::COLUMNS]); ++$i) {
1232
+ $col = $this->_db->foldCase($map[self::COLUMNS][$i]);
1233
+ $refCol = $this->_db->foldCase($map[self::REF_COLUMNS][$i]);
1234
+ $type = $this->_metadata[$col]['DATA_TYPE'];
1235
+ $where[] = $this->_db->quoteInto(
1236
+ $this->_db->quoteIdentifier($col, true) . ' = ?',
1237
+ $primaryKey[$refCol], $type);
1238
+ }
1239
+ }
1240
+
1241
+ // CASCADE_RECURSE
1242
+ if ($map[self::ON_DELETE] == self::CASCADE_RECURSE) {
1243
+
1244
+ /**
1245
+ * Execute cascading deletes against dependent tables
1246
+ */
1247
+ $depTables = $this->getDependentTables();
1248
+ if (!empty($depTables)) {
1249
+ foreach ($depTables as $tableClass) {
1250
+ $t = self::getTableFromString($tableClass, $this);
1251
+ foreach ($this->fetchAll($where) as $depRow) {
1252
+ $rowsAffected += $t->_cascadeDelete($thisClass, $depRow->getPrimaryKey());
1253
+ }
1254
  }
1255
+ }
 
 
 
 
1256
  }
1257
+
1258
+ // CASCADE or CASCADE_RECURSE
1259
+ if (in_array($map[self::ON_DELETE], array(self::CASCADE, self::CASCADE_RECURSE))) {
1260
+ $rowsAffected += $this->delete($where);
1261
+ }
1262
+
1263
  }
1264
  }
1265
  return $rowsAffected;
1411
  *
1412
  * @param string|array|Zend_Db_Table_Select $where OPTIONAL An SQL WHERE clause or Zend_Db_Table_Select object.
1413
  * @param string|array $order OPTIONAL An SQL ORDER clause.
1414
+ * @param int $offset OPTIONAL An SQL OFFSET value.
1415
  * @return Zend_Db_Table_Row_Abstract|null The row results per the
1416
  * Zend_Db_Adapter fetch mode, or null if no row found.
1417
  */
1418
+ public function fetchRow($where = null, $order = null, $offset = null)
1419
  {
1420
  if (!($where instanceof Zend_Db_Table_Select)) {
1421
  $select = $this->select();
1428
  $this->_order($select, $order);
1429
  }
1430
 
1431
+ $select->limit(1, ((is_numeric($offset)) ? (int) $offset : null));
1432
 
1433
  } else {
1434
+ $select = $where->limit(1, $where->getPart(Zend_Db_Select::LIMIT_OFFSET));
1435
  }
1436
 
1437
  $rows = $this->_fetch($select);
1577
  return $data;
1578
  }
1579
 
1580
+ public static function getTableFromString($tableName, Zend_Db_Table_Abstract $referenceTable = null)
1581
+ {
1582
+ if ($referenceTable instanceof Zend_Db_Table_Abstract) {
1583
+ $tableDefinition = $referenceTable->getDefinition();
1584
+
1585
+ if ($tableDefinition !== null && $tableDefinition->hasTableConfig($tableName)) {
1586
+ return new Zend_Db_Table($tableName, $tableDefinition);
1587
+ }
1588
+ }
1589
+
1590
+ // assume the tableName is the class name
1591
+ if (!class_exists($tableName)) {
1592
+ try {
1593
+ #require_once 'Zend/Loader.php';
1594
+ Zend_Loader::loadClass($tableName);
1595
+ } catch (Zend_Exception $e) {
1596
+ #require_once 'Zend/Db/Table/Row/Exception.php';
1597
+ throw new Zend_Db_Table_Row_Exception($e->getMessage(), $e->getCode(), $e);
1598
+ }
1599
+ }
1600
+
1601
+ $options = array();
1602
+
1603
+ if ($referenceTable instanceof Zend_Db_Table_Abstract) {
1604
+ $options['db'] = $referenceTable->getAdapter();
1605
+ }
1606
+
1607
+ if (isset($tableDefinition) && $tableDefinition !== null) {
1608
+ $options[Zend_Db_Table_Abstract::DEFINITION] = $tableDefinition;
1609
+ }
1610
+
1611
+ return new $tableName($options);
1612
+ }
1613
+
1614
  }
lib/Zend/Db/Table/Definition.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Table
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Definition.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -26,7 +26,7 @@
26
  * @category Zend
27
  * @package Zend_Db
28
  * @subpackage Table
29
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  class Zend_Db_Table_Definition
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Table
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Definition.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
26
  * @category Zend
27
  * @package Zend_Db
28
  * @subpackage Table
29
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  class Zend_Db_Table_Definition
lib/Zend/Db/Table/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Table
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -29,7 +29,7 @@
29
  * @category Zend
30
  * @package Zend_Db
31
  * @subpackage Table
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Db_Table_Exception extends Zend_Db_Exception
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Table
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
29
  * @category Zend
30
  * @package Zend_Db
31
  * @subpackage Table
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Db_Table_Exception extends Zend_Db_Exception
lib/Zend/Db/Table/Row.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Table
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Row.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
 
@@ -34,7 +34,7 @@
34
  * @category Zend
35
  * @package Zend_Db
36
  * @subpackage Table
37
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Db_Table_Row extends Zend_Db_Table_Row_Abstract
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Table
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Row.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
 
34
  * @category Zend
35
  * @package Zend_Db
36
  * @subpackage Table
37
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Db_Table_Row extends Zend_Db_Table_Row_Abstract
lib/Zend/Db/Table/Row/Abstract.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Table
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Abstract.php 22229 2010-05-21 20:55:01Z ralph $
21
  */
22
 
23
  /**
@@ -29,7 +29,7 @@
29
  * @category Zend
30
  * @package Zend_Db
31
  * @subpackage Table
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess, IteratorAggregate
@@ -646,7 +646,7 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess, IteratorAggreg
646
  {
647
  return new ArrayIterator((array) $this->_data);
648
  }
649
-
650
  /**
651
  * Returns the column/value data as an array.
652
  *
@@ -724,6 +724,17 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess, IteratorAggreg
724
  return $array;
725
  }
726
 
 
 
 
 
 
 
 
 
 
 
 
727
  /**
728
  * Constructs where statement for retrieving row(s).
729
  *
@@ -1167,37 +1178,7 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess, IteratorAggreg
1167
  */
1168
  protected function _getTableFromString($tableName)
1169
  {
1170
-
1171
- if ($this->_table instanceof Zend_Db_Table_Abstract) {
1172
- $tableDefinition = $this->_table->getDefinition();
1173
-
1174
- if ($tableDefinition !== null && $tableDefinition->hasTableConfig($tableName)) {
1175
- return new Zend_Db_Table($tableName, $tableDefinition);
1176
- }
1177
- }
1178
-
1179
- // assume the tableName is the class name
1180
- if (!class_exists($tableName)) {
1181
- try {
1182
- #require_once 'Zend/Loader.php';
1183
- Zend_Loader::loadClass($tableName);
1184
- } catch (Zend_Exception $e) {
1185
- #require_once 'Zend/Db/Table/Row/Exception.php';
1186
- throw new Zend_Db_Table_Row_Exception($e->getMessage(), $e->getCode(), $e);
1187
- }
1188
- }
1189
-
1190
- $options = array();
1191
-
1192
- if (($table = $this->_getTable())) {
1193
- $options['db'] = $table->getAdapter();
1194
- }
1195
-
1196
- if (isset($tableDefinition) && $tableDefinition !== null) {
1197
- $options[Zend_Db_Table_Abstract::DEFINITION] = $tableDefinition;
1198
- }
1199
-
1200
- return new $tableName($options);
1201
  }
1202
 
1203
  }
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Table
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Abstract.php 24831 2012-05-30 12:52:25Z rob $
21
  */
22
 
23
  /**
29
  * @category Zend
30
  * @package Zend_Db
31
  * @subpackage Table
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess, IteratorAggregate
646
  {
647
  return new ArrayIterator((array) $this->_data);
648
  }
649
+
650
  /**
651
  * Returns the column/value data as an array.
652
  *
724
  return $array;
725
  }
726
 
727
+ /**
728
+ * Retrieves an associative array of primary keys.
729
+ *
730
+ * @param bool $useDirty
731
+ * @return array
732
+ */
733
+ public function getPrimaryKey($useDirty = true)
734
+ {
735
+ return $this->_getPrimaryKey($useDirty);
736
+ }
737
+
738
  /**
739
  * Constructs where statement for retrieving row(s).
740
  *
1178
  */
1179
  protected function _getTableFromString($tableName)
1180
  {
1181
+ return Zend_Db_Table_Abstract::getTableFromString($tableName, $this->_table);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1182
  }
1183
 
1184
  }
lib/Zend/Db/Table/Row/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Table
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -29,7 +29,7 @@
29
  * @category Zend
30
  * @package Zend_Db
31
  * @subpackage Table
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Db_Table_Row_Exception extends Zend_Db_Table_Exception
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Table
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
29
  * @category Zend
30
  * @package Zend_Db
31
  * @subpackage Table
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Db_Table_Row_Exception extends Zend_Db_Table_Exception
lib/Zend/Db/Table/Rowset.php CHANGED
@@ -16,9 +16,9 @@
16
  * @category Zend
17
  * @package Zend_Db
18
  * @subpackage Table
19
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
- * @version $Id: Rowset.php 20096 2010-01-06 02:05:09Z bkarwin $
22
  */
23
 
24
 
@@ -35,7 +35,7 @@
35
  * @category Zend
36
  * @package Zend_Db
37
  * @subpackage Table
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Db_Table_Rowset extends Zend_Db_Table_Rowset_Abstract
16
  * @category Zend
17
  * @package Zend_Db
18
  * @subpackage Table
19
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
+ * @version $Id: Rowset.php 24593 2012-01-05 20:35:02Z matthew $
22
  */
23
 
24
 
35
  * @category Zend
36
  * @package Zend_Db
37
  * @subpackage Table
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
  */
41
  class Zend_Db_Table_Rowset extends Zend_Db_Table_Rowset_Abstract
lib/Zend/Db/Table/Rowset/Abstract.php CHANGED
@@ -15,16 +15,16 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Table
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Abstract.php 23380 2010-11-18 22:22:28Z ralph $
21
  */
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_Db
26
  * @subpackage Table
27
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
  abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Countable, ArrayAccess
@@ -384,11 +384,11 @@ abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Counta
384
  #require_once 'Zend/Db/Table/Rowset/Exception.php';
385
  throw new Zend_Db_Table_Rowset_Exception('No row could be found at position ' . (int) $position, 0, $e);
386
  }
387
-
388
  if ($seek == true) {
389
  $this->seek($position);
390
  }
391
-
392
  return $row;
393
  }
394
 
@@ -408,14 +408,14 @@ abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Counta
408
  }
409
  return $this->_data;
410
  }
411
-
412
  protected function _loadAndReturnRow($position)
413
  {
414
  if (!isset($this->_data[$position])) {
415
  #require_once 'Zend/Db/Table/Rowset/Exception.php';
416
  throw new Zend_Db_Table_Rowset_Exception("Data for provided position does not exist");
417
  }
418
-
419
  // do we already have a row object for this position?
420
  if (empty($this->_rows[$position])) {
421
  $this->_rows[$position] = new $this->_rowClass(
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Table
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
24
  * @category Zend
25
  * @package Zend_Db
26
  * @subpackage Table
27
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
  abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Countable, ArrayAccess
384
  #require_once 'Zend/Db/Table/Rowset/Exception.php';
385
  throw new Zend_Db_Table_Rowset_Exception('No row could be found at position ' . (int) $position, 0, $e);
386
  }
387
+
388
  if ($seek == true) {
389
  $this->seek($position);
390
  }
391
+
392
  return $row;
393
  }
394
 
408
  }
409
  return $this->_data;
410
  }
411
+
412
  protected function _loadAndReturnRow($position)
413
  {
414
  if (!isset($this->_data[$position])) {
415
  #require_once 'Zend/Db/Table/Rowset/Exception.php';
416
  throw new Zend_Db_Table_Rowset_Exception("Data for provided position does not exist");
417
  }
418
+
419
  // do we already have a row object for this position?
420
  if (empty($this->_rows[$position])) {
421
  $this->_rows[$position] = new $this->_rowClass(
lib/Zend/Db/Table/Rowset/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Table
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -29,7 +29,7 @@
29
  * @category Zend
30
  * @package Zend_Db
31
  * @subpackage Table
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Db_Table_Rowset_Exception extends Zend_Db_Table_Exception
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Table
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
29
  * @category Zend
30
  * @package Zend_Db
31
  * @subpackage Table
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Db_Table_Rowset_Exception extends Zend_Db_Table_Exception
lib/Zend/Db/Table/Select.php CHANGED
@@ -16,9 +16,9 @@
16
  * @category Zend
17
  * @package Zend_Db
18
  * @subpackage Select
19
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
- * @version $Id: Select.php 20096 2010-01-06 02:05:09Z bkarwin $
22
  */
23
 
24
 
@@ -40,7 +40,7 @@
40
  * @category Zend
41
  * @package Zend_Db
42
  * @subpackage Table
43
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
44
  * @license http://framework.zend.com/license/new-bsd New BSD License
45
  */
46
  class Zend_Db_Table_Select extends Zend_Db_Select
16
  * @category Zend
17
  * @package Zend_Db
18
  * @subpackage Select
19
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
+ * @version $Id: Select.php 24593 2012-01-05 20:35:02Z matthew $
22
  */
23
 
24
 
40
  * @category Zend
41
  * @package Zend_Db
42
  * @subpackage Table
43
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
44
  * @license http://framework.zend.com/license/new-bsd New BSD License
45
  */
46
  class Zend_Db_Table_Select extends Zend_Db_Select
lib/Zend/Db/Table/Select/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Select
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -29,7 +29,7 @@
29
  * @category Zend
30
  * @package Zend_Db
31
  * @subpackage Table
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
 
15
  * @category Zend
16
  * @package Zend_Db
17
  * @subpackage Select
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
29
  * @category Zend
30
  * @package Zend_Db
31
  * @subpackage Table
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
 
lib/Zend/Debug.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Debug
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Debug.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /**
@@ -24,7 +24,7 @@
24
  *
25
  * @category Zend
26
  * @package Zend_Debug
27
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
 
@@ -90,7 +90,12 @@ class Zend_Debug
90
  . PHP_EOL;
91
  } else {
92
  if(!extension_loaded('xdebug')) {
93
- $output = htmlspecialchars($output, ENT_QUOTES);
 
 
 
 
 
94
  }
95
 
96
  $output = '<pre>'
14
  *
15
  * @category Zend
16
  * @package Zend_Debug
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Debug.php 25095 2012-11-07 20:11:07Z rob $
20
  */
21
 
22
  /**
24
  *
25
  * @category Zend
26
  * @package Zend_Debug
27
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
  */
30
 
90
  . PHP_EOL;
91
  } else {
92
  if(!extension_loaded('xdebug')) {
93
+ $flags = ENT_QUOTES;
94
+ // PHP 5.4.0+
95
+ if (defined('ENT_SUBSTITUTE')) {
96
+ $flags = ENT_QUOTES | ENT_SUBSTITUTE;
97
+ }
98
+ $output = htmlspecialchars($output, $flags);
99
  }
100
 
101
  $output = '<pre>'
lib/Zend/Dojo.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Dojo
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
@@ -22,9 +22,9 @@
22
  * Enable Dojo components
23
  *
24
  * @package Zend_Dojo
25
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
26
  * @license http://framework.zend.com/license/new-bsd New BSD License
27
- * @version $Id: Dojo.php 20096 2010-01-06 02:05:09Z bkarwin $
28
  */
29
  class Zend_Dojo
30
  {
14
  *
15
  * @category Zend
16
  * @package Zend_Dojo
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
22
  * Enable Dojo components
23
  *
24
  * @package Zend_Dojo
25
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
26
  * @license http://framework.zend.com/license/new-bsd New BSD License
27
+ * @version $Id: Dojo.php 24593 2012-01-05 20:35:02Z matthew $
28
  */
29
  class Zend_Dojo
30
  {
lib/Zend/Dojo/BuildLayer.php CHANGED
@@ -14,16 +14,16 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Dojo
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: BuildLayer.php 22280 2010-05-24 20:39:45Z matthew $
20
  */
21
 
22
  /**
23
  * Dojo module layer and custom build profile generation support
24
  *
25
  * @package Zend_Dojo
26
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  class Zend_Dojo_BuildLayer
14
  *
15
  * @category Zend
16
  * @package Zend_Dojo
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: BuildLayer.php 25024 2012-07-30 15:08:15Z rob $
20
  */
21
 
22
  /**
23
  * Dojo module layer and custom build profile generation support
24
  *
25
  * @package Zend_Dojo
26
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
  */
29
  class Zend_Dojo_BuildLayer
lib/Zend/Dojo/Data.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Dojo
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Data.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /**
@@ -26,7 +26,7 @@
26
  * @uses Iterator
27
  * @uses Countable
28
  * @package Zend_Dojo
29
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  class Zend_Dojo_Data implements ArrayAccess,Iterator,Countable
14
  *
15
  * @category Zend
16
  * @package Zend_Dojo
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Data.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /**
26
  * @uses Iterator
27
  * @uses Countable
28
  * @package Zend_Dojo
29
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
30
  * @license http://framework.zend.com/license/new-bsd New BSD License
31
  */
32
  class Zend_Dojo_Data implements ArrayAccess,Iterator,Countable
lib/Zend/Dojo/Exception.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Dojo
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /** Zend_Exception */
@@ -27,7 +27,7 @@
27
  *
28
  * @uses Zend_Exception
29
  * @package Zend_Dojo
30
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Dojo_Exception extends Zend_Exception
14
  *
15
  * @category Zend
16
  * @package Zend_Dojo
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /** Zend_Exception */
27
  *
28
  * @uses Zend_Exception
29
  * @package Zend_Dojo
30
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Dojo_Exception extends Zend_Exception
lib/Zend/Dojo/Form.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -28,9 +28,9 @@
28
  * @uses Zend_Form
29
  * @package Zend_Dojo
30
  * @subpackage Form
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
- * @version $Id: Form.php 20096 2010-01-06 02:05:09Z bkarwin $
34
  */
35
  class Zend_Dojo_Form extends Zend_Form
36
  {
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
28
  * @uses Zend_Form
29
  * @package Zend_Dojo
30
  * @subpackage Form
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ * @version $Id: Form.php 24593 2012-01-05 20:35:02Z matthew $
34
  */
35
  class Zend_Dojo_Form extends Zend_Form
36
  {
lib/Zend/Dojo/Form/Decorator/AccordionContainer.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Form
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
@@ -29,9 +29,9 @@
29
  * @uses Zend_Dojo_Form_Decorator_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage Form_Decorator
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
- * @version $Id: AccordionContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
35
  */
36
  class Zend_Dojo_Form_Decorator_AccordionContainer extends Zend_Dojo_Form_Decorator_DijitContainer
37
  {
14
  *
15
  * @category Zend
16
  * @package Zend_Form
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
29
  * @uses Zend_Dojo_Form_Decorator_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage Form_Decorator
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
+ * @version $Id: AccordionContainer.php 24593 2012-01-05 20:35:02Z matthew $
35
  */
36
  class Zend_Dojo_Form_Decorator_AccordionContainer extends Zend_Dojo_Form_Decorator_DijitContainer
37
  {
lib/Zend/Dojo/Form/Decorator/AccordionPane.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Form
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
@@ -29,9 +29,9 @@
29
  * @uses Zend_Dojo_Form_Decorator_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage Form_Decorator
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
- * @version $Id: AccordionPane.php 20096 2010-01-06 02:05:09Z bkarwin $
35
  */
36
  class Zend_Dojo_Form_Decorator_AccordionPane extends Zend_Dojo_Form_Decorator_DijitContainer
37
  {
14
  *
15
  * @category Zend
16
  * @package Zend_Form
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
29
  * @uses Zend_Dojo_Form_Decorator_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage Form_Decorator
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
+ * @version $Id: AccordionPane.php 24593 2012-01-05 20:35:02Z matthew $
35
  */
36
  class Zend_Dojo_Form_Decorator_AccordionPane extends Zend_Dojo_Form_Decorator_DijitContainer
37
  {
lib/Zend/Dojo/Form/Decorator/BorderContainer.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Form
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
@@ -29,9 +29,9 @@
29
  * @uses Zend_Dojo_Form_Decorator_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage Form_Decorator
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
- * @version $Id: BorderContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
35
  */
36
  class Zend_Dojo_Form_Decorator_BorderContainer extends Zend_Dojo_Form_Decorator_DijitContainer
37
  {
14
  *
15
  * @category Zend
16
  * @package Zend_Form
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
29
  * @uses Zend_Dojo_Form_Decorator_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage Form_Decorator
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
+ * @version $Id: BorderContainer.php 24593 2012-01-05 20:35:02Z matthew $
35
  */
36
  class Zend_Dojo_Form_Decorator_BorderContainer extends Zend_Dojo_Form_Decorator_DijitContainer
37
  {
lib/Zend/Dojo/Form/Decorator/ContentPane.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Form
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
@@ -29,9 +29,9 @@
29
  * @uses Zend_Dojo_Form_Decorator_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage Form_Decorator
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
- * @version $Id: ContentPane.php 20096 2010-01-06 02:05:09Z bkarwin $
35
  */
36
  class Zend_Dojo_Form_Decorator_ContentPane extends Zend_Dojo_Form_Decorator_DijitContainer
37
  {
14
  *
15
  * @category Zend
16
  * @package Zend_Form
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
29
  * @uses Zend_Dojo_Form_Decorator_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage Form_Decorator
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
+ * @version $Id: ContentPane.php 24593 2012-01-05 20:35:02Z matthew $
35
  */
36
  class Zend_Dojo_Form_Decorator_ContentPane extends Zend_Dojo_Form_Decorator_DijitContainer
37
  {
lib/Zend/Dojo/Form/Decorator/DijitContainer.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Form
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
@@ -35,9 +35,9 @@
35
  * @uses Zend_Form_Decorator_Abstract
36
  * @package Zend_Dojo
37
  * @subpackage Form_Decorator
38
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
- * @version $Id: DijitContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
41
  */
42
  abstract class Zend_Dojo_Form_Decorator_DijitContainer extends Zend_Form_Decorator_Abstract
43
  {
14
  *
15
  * @category Zend
16
  * @package Zend_Form
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
35
  * @uses Zend_Form_Decorator_Abstract
36
  * @package Zend_Dojo
37
  * @subpackage Form_Decorator
38
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
39
  * @license http://framework.zend.com/license/new-bsd New BSD License
40
+ * @version $Id: DijitContainer.php 24593 2012-01-05 20:35:02Z matthew $
41
  */
42
  abstract class Zend_Dojo_Form_Decorator_DijitContainer extends Zend_Form_Decorator_Abstract
43
  {
lib/Zend/Dojo/Form/Decorator/DijitElement.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Form
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
@@ -36,9 +36,9 @@
36
  *
37
  * @package Zend_Dojo
38
  * @subpackage Form_Decorator
39
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
40
  * @license http://framework.zend.com/license/new-bsd New BSD License
41
- * @version $Id: DijitElement.php 20621 2010-01-25 20:25:23Z matthew $
42
  */
43
  class Zend_Dojo_Form_Decorator_DijitElement extends Zend_Form_Decorator_ViewHelper
44
  {
14
  *
15
  * @category Zend
16
  * @package Zend_Form
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
36
  *
37
  * @package Zend_Dojo
38
  * @subpackage Form_Decorator
39
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
40
  * @license http://framework.zend.com/license/new-bsd New BSD License
41
+ * @version $Id: DijitElement.php 24593 2012-01-05 20:35:02Z matthew $
42
  */
43
  class Zend_Dojo_Form_Decorator_DijitElement extends Zend_Form_Decorator_ViewHelper
44
  {
lib/Zend/Dojo/Form/Decorator/DijitForm.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Form
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
@@ -31,9 +31,9 @@
31
  *
32
  * @package Zend_Dojo
33
  * @subpackage Form_Decorator
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
- * @version $Id: DijitForm.php 20096 2010-01-06 02:05:09Z bkarwin $
37
  */
38
  class Zend_Dojo_Form_Decorator_DijitForm extends Zend_Dojo_Form_Decorator_DijitContainer
39
  {
@@ -56,6 +56,11 @@ class Zend_Dojo_Form_Decorator_DijitForm extends Zend_Dojo_Form_Decorator_DijitC
56
  $dijitParams = $this->getDijitParams();
57
  $attribs = array_merge($this->getAttribs(), $this->getOptions());
58
 
 
 
 
 
 
59
  return $view->form($element->getName(), $attribs, $content);
60
  }
61
  }
14
  *
15
  * @category Zend
16
  * @package Zend_Form
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
31
  *
32
  * @package Zend_Dojo
33
  * @subpackage Form_Decorator
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
+ * @version $Id: DijitForm.php 24593 2012-01-05 20:35:02Z matthew $
37
  */
38
  class Zend_Dojo_Form_Decorator_DijitForm extends Zend_Dojo_Form_Decorator_DijitContainer
39
  {
56
  $dijitParams = $this->getDijitParams();
57
  $attribs = array_merge($this->getAttribs(), $this->getOptions());
58
 
59
+ // Enforce id attribute of form for dojo events
60
+ if (!isset($attribs['name']) || !$attribs['name']) {
61
+ $element->setName(get_class($element) . '_' . uniqid());
62
+ }
63
+
64
  return $view->form($element->getName(), $attribs, $content);
65
  }
66
  }
lib/Zend/Dojo/Form/Decorator/SplitContainer.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Form
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
@@ -29,9 +29,9 @@
29
  * @uses Zend_Dojo_Form_Decorator_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage Form_Decorator
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
- * @version $Id: SplitContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
35
  */
36
  class Zend_Dojo_Form_Decorator_SplitContainer extends Zend_Dojo_Form_Decorator_DijitContainer
37
  {
14
  *
15
  * @category Zend
16
  * @package Zend_Form
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
29
  * @uses Zend_Dojo_Form_Decorator_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage Form_Decorator
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
+ * @version $Id: SplitContainer.php 24593 2012-01-05 20:35:02Z matthew $
35
  */
36
  class Zend_Dojo_Form_Decorator_SplitContainer extends Zend_Dojo_Form_Decorator_DijitContainer
37
  {
lib/Zend/Dojo/Form/Decorator/StackContainer.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Form
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
@@ -29,9 +29,9 @@
29
  * @uses Zend_Dojo_Form_Decorator_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage Form_Decorator
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
- * @version $Id: StackContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
35
  */
36
  class Zend_Dojo_Form_Decorator_StackContainer extends Zend_Dojo_Form_Decorator_DijitContainer
37
  {
14
  *
15
  * @category Zend
16
  * @package Zend_Form
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
29
  * @uses Zend_Dojo_Form_Decorator_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage Form_Decorator
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
+ * @version $Id: StackContainer.php 24593 2012-01-05 20:35:02Z matthew $
35
  */
36
  class Zend_Dojo_Form_Decorator_StackContainer extends Zend_Dojo_Form_Decorator_DijitContainer
37
  {
lib/Zend/Dojo/Form/Decorator/TabContainer.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Form
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
@@ -29,9 +29,9 @@
29
  * @uses Zend_Dojo_Form_Decorator_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage Form_Decorator
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
- * @version $Id: TabContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
35
  */
36
  class Zend_Dojo_Form_Decorator_TabContainer extends Zend_Dojo_Form_Decorator_DijitContainer
37
  {
14
  *
15
  * @category Zend
16
  * @package Zend_Form
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
29
  * @uses Zend_Dojo_Form_Decorator_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage Form_Decorator
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
+ * @version $Id: TabContainer.php 24593 2012-01-05 20:35:02Z matthew $
35
  */
36
  class Zend_Dojo_Form_Decorator_TabContainer extends Zend_Dojo_Form_Decorator_DijitContainer
37
  {
lib/Zend/Dojo/Form/DisplayGroup.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -28,9 +28,9 @@
28
  * @uses Zend_Form_DisplayGroup
29
  * @package Zend_Dojo
30
  * @subpackage Form
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
- * @version $Id: DisplayGroup.php 20096 2010-01-06 02:05:09Z bkarwin $
34
  */
35
  class Zend_Dojo_Form_DisplayGroup extends Zend_Form_DisplayGroup
36
  {
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
28
  * @uses Zend_Form_DisplayGroup
29
  * @package Zend_Dojo
30
  * @subpackage Form
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ * @version $Id: DisplayGroup.php 24593 2012-01-05 20:35:02Z matthew $
34
  */
35
  class Zend_Dojo_Form_DisplayGroup extends Zend_Form_DisplayGroup
36
  {
lib/Zend/Dojo/Form/Element/Button.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -28,9 +28,9 @@
28
  * @category Zend
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
- * @version $Id: Button.php 20096 2010-01-06 02:05:09Z bkarwin $
34
  */
35
  class Zend_Dojo_Form_Element_Button extends Zend_Dojo_Form_Element_Dijit
36
  {
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
28
  * @category Zend
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ * @version $Id: Button.php 24593 2012-01-05 20:35:02Z matthew $
34
  */
35
  class Zend_Dojo_Form_Element_Button extends Zend_Dojo_Form_Element_Dijit
36
  {
lib/Zend/Dojo/Form/Element/CheckBox.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -30,9 +30,9 @@
30
  * @uses Zend_Dojo_Form_Element_Dijit
31
  * @package Zend_Dojo
32
  * @subpackage Form_Element
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
- * @version $Id: CheckBox.php 20096 2010-01-06 02:05:09Z bkarwin $
36
  */
37
  class Zend_Dojo_Form_Element_CheckBox extends Zend_Dojo_Form_Element_Dijit
38
  {
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
30
  * @uses Zend_Dojo_Form_Element_Dijit
31
  * @package Zend_Dojo
32
  * @subpackage Form_Element
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
+ * @version $Id: CheckBox.php 24593 2012-01-05 20:35:02Z matthew $
36
  */
37
  class Zend_Dojo_Form_Element_CheckBox extends Zend_Dojo_Form_Element_Dijit
38
  {
lib/Zend/Dojo/Form/Element/ComboBox.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -28,9 +28,9 @@
28
  * @uses Zend_Dojo_Form_Element_DijitMulti
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
- * @version $Id: ComboBox.php 20096 2010-01-06 02:05:09Z bkarwin $
34
  */
35
  class Zend_Dojo_Form_Element_ComboBox extends Zend_Dojo_Form_Element_DijitMulti
36
  {
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
28
  * @uses Zend_Dojo_Form_Element_DijitMulti
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ * @version $Id: ComboBox.php 24593 2012-01-05 20:35:02Z matthew $
34
  */
35
  class Zend_Dojo_Form_Element_ComboBox extends Zend_Dojo_Form_Element_DijitMulti
36
  {
lib/Zend/Dojo/Form/Element/CurrencyTextBox.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -28,9 +28,9 @@
28
  * @uses Zend_Dojo_Form_Element_NumberTextBox
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
- * @version $Id: CurrencyTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
34
  */
35
  class Zend_Dojo_Form_Element_CurrencyTextBox extends Zend_Dojo_Form_Element_NumberTextBox
36
  {
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
28
  * @uses Zend_Dojo_Form_Element_NumberTextBox
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ * @version $Id: CurrencyTextBox.php 24593 2012-01-05 20:35:02Z matthew $
34
  */
35
  class Zend_Dojo_Form_Element_CurrencyTextBox extends Zend_Dojo_Form_Element_NumberTextBox
36
  {
lib/Zend/Dojo/Form/Element/DateTextBox.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -28,9 +28,9 @@
28
  * @uses Zend_Dojo_Form_Element_ValidationTextBox
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
- * @version $Id: DateTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
34
  */
35
  class Zend_Dojo_Form_Element_DateTextBox extends Zend_Dojo_Form_Element_ValidationTextBox
36
  {
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
28
  * @uses Zend_Dojo_Form_Element_ValidationTextBox
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ * @version $Id: DateTextBox.php 24593 2012-01-05 20:35:02Z matthew $
34
  */
35
  class Zend_Dojo_Form_Element_DateTextBox extends Zend_Dojo_Form_Element_ValidationTextBox
36
  {
lib/Zend/Dojo/Form/Element/Dijit.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -28,9 +28,9 @@
28
  * @category Zend
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
- * @version $Id: Dijit.php 20096 2010-01-06 02:05:09Z bkarwin $
34
  */
35
  abstract class Zend_Dojo_Form_Element_Dijit extends Zend_Form_Element
36
  {
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
28
  * @category Zend
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ * @version $Id: Dijit.php 24593 2012-01-05 20:35:02Z matthew $
34
  */
35
  abstract class Zend_Dojo_Form_Element_Dijit extends Zend_Form_Element
36
  {
lib/Zend/Dojo/Form/Element/DijitMulti.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -30,9 +30,9 @@
30
  * @uses Zend_Dojo_Form_Element_Dijit
31
  * @package Zend_Dojo
32
  * @subpackage Form_Element
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
- * @version $Id: DijitMulti.php 22322 2010-05-30 11:12:57Z thomas $
36
  */
37
  abstract class Zend_Dojo_Form_Element_DijitMulti extends Zend_Dojo_Form_Element_Dijit
38
  {
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
30
  * @uses Zend_Dojo_Form_Element_Dijit
31
  * @package Zend_Dojo
32
  * @subpackage Form_Element
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
+ * @version $Id: DijitMulti.php 24593 2012-01-05 20:35:02Z matthew $
36
  */
37
  abstract class Zend_Dojo_Form_Element_DijitMulti extends Zend_Dojo_Form_Element_Dijit
38
  {
lib/Zend/Dojo/Form/Element/Editor.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Editor.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_Form_Element_Dijit */
@@ -30,7 +30,7 @@
30
  * @category Zend
31
  * @package Zend_Dojo
32
  * @subpackage Form_Element
33
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Dojo_Form_Element_Editor extends Zend_Dojo_Form_Element_Dijit
@@ -247,7 +247,7 @@ class Zend_Dojo_Form_Element_Editor extends Zend_Dojo_Form_Element_Dijit
247
  {
248
  $plugin = (string) $plugin;
249
  $plugins = $this->getPlugins();
250
- if (in_array($plugin, $plugins)) {
251
  return $this;
252
  }
253
 
@@ -446,11 +446,11 @@ class Zend_Dojo_Form_Element_Editor extends Zend_Dojo_Form_Element_Dijit
446
  */
447
  public function setMinHeight($minHeight)
448
  {
449
- if (!preg_match('/^\d+(em)?$/i', $minHeight)) {
450
  #require_once 'Zend/Form/Element/Exception.php';
451
  throw new Zend_Form_Element_Exception('Invalid minHeight provided; must be integer or CSS measurement');
452
  }
453
- if ('em' != substr($minHeight, -2)) {
454
  $minHeight .= 'em';
455
  }
456
  return $this->setDijitParam('minHeight', $minHeight);
@@ -596,4 +596,102 @@ class Zend_Dojo_Form_Element_Editor extends Zend_Dojo_Form_Element_Dijit
596
  }
597
  return $this->getDijitParam('updateInterval');
598
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
599
  }
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Editor.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_Form_Element_Dijit */
30
  * @category Zend
31
  * @package Zend_Dojo
32
  * @subpackage Form_Element
33
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
34
  * @license http://framework.zend.com/license/new-bsd New BSD License
35
  */
36
  class Zend_Dojo_Form_Element_Editor extends Zend_Dojo_Form_Element_Dijit
247
  {
248
  $plugin = (string) $plugin;
249
  $plugins = $this->getPlugins();
250
+ if (in_array($plugin, $plugins) && $plugin !== '|') {
251
  return $this;
252
  }
253
 
446
  */
447
  public function setMinHeight($minHeight)
448
  {
449
+ if (!preg_match('/^\d+(em|px|%)?$/i', $minHeight)) {
450
  #require_once 'Zend/Form/Element/Exception.php';
451
  throw new Zend_Form_Element_Exception('Invalid minHeight provided; must be integer or CSS measurement');
452
  }
453
+ if (!preg_match('/(em|px|%)$/', $minHeight)) {
454
  $minHeight .= 'em';
455
  }
456
  return $this->setDijitParam('minHeight', $minHeight);
596
  }
597
  return $this->getDijitParam('updateInterval');
598
  }
599
+
600
+ /**
601
+ * Add a single editor extra plugin.
602
+ *
603
+ * @param string $plugin
604
+ * @return Zend_Dojo_Form_Element_Editor
605
+ */
606
+ public function addExtraPlugin($plugin)
607
+ {
608
+ $plugin = (string) $plugin;
609
+ $extraPlugins = $this->getExtraPlugins();
610
+ if (in_array($plugin, $extraPlugins)) {
611
+ return $this;
612
+ }
613
+
614
+ $extraPlugins[] = (string) $plugin;
615
+ $this->setDijitParam('extraPlugins', $extraPlugins);
616
+ return $this;
617
+ }
618
+
619
+ /**
620
+ * Add multiple extra plugins.
621
+ *
622
+ * @param array $extraPlugins
623
+ * @return Zend_Dojo_Form_Element_Editor
624
+ */
625
+ public function addExtraPlugins(array $plugins)
626
+ {
627
+ foreach ($plugins as $plugin) {
628
+ $this->addExtraPlugin($plugin);
629
+ }
630
+ return $this;
631
+ }
632
+
633
+ /**
634
+ * Overwrite many extra plugins at once.
635
+ *
636
+ * @param array $plugins
637
+ * @return Zend_Dojo_Form_Element_Editor
638
+ */
639
+ public function setExtraPlugins(array $plugins)
640
+ {
641
+ $this->clearExtraPlugins();
642
+ $this->addExtraPlugins($plugins);
643
+ return $this;
644
+ }
645
+
646
+ /**
647
+ * Get all extra plugins.
648
+ *
649
+ * @return array
650
+ */
651
+ public function getExtraPlugins()
652
+ {
653
+ if (!$this->hasDijitParam('extraPlugins')) {
654
+ return array();
655
+ }
656
+ return $this->getDijitParam('extraPlugins');
657
+ }
658
+
659
+ /**
660
+ * Is a given extra plugin registered?
661
+ *
662
+ * @param string $plugin
663
+ * @return bool
664
+ */
665
+ public function hasExtraPlugin($plugin)
666
+ {
667
+ $extraPlugins = $this->getExtraPlugins();
668
+ return in_array((string) $plugin, $extraPlugins);
669
+ }
670
+
671
+ /**
672
+ * Remove a given extra plugin.
673
+ *
674
+ * @param string $plugin
675
+ * @return Zend_Dojo_Form_Element_Editor
676
+ */
677
+ public function removeExtraPlugin($plugin)
678
+ {
679
+ $extraPlugins = $this->getExtraPlugins();
680
+ if (false === ($index = array_search($plugin, $extraPlugins))) {
681
+ return $this;
682
+ }
683
+ unset($extraPlugins[$index]);
684
+ $this->setDijitParam('extraPlugins', $extraPlugins);
685
+ return $this;
686
+ }
687
+
688
+ /**
689
+ * Clear all extra plugins.
690
+ *
691
+ * @return Zend_Dojo_Form_Element_Editor
692
+ */
693
+ public function clearExtraPlugins()
694
+ {
695
+ return $this->removeDijitParam('extraPlugins');
696
+ }
697
  }
lib/Zend/Dojo/Form/Element/FilteringSelect.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -28,9 +28,9 @@
28
  * @uses Zend_Dojo_Form_Element_ComboBox
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
- * @version $Id: FilteringSelect.php 20096 2010-01-06 02:05:09Z bkarwin $
34
  */
35
  class Zend_Dojo_Form_Element_FilteringSelect extends Zend_Dojo_Form_Element_ComboBox
36
  {
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
28
  * @uses Zend_Dojo_Form_Element_ComboBox
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ * @version $Id: FilteringSelect.php 24593 2012-01-05 20:35:02Z matthew $
34
  */
35
  class Zend_Dojo_Form_Element_FilteringSelect extends Zend_Dojo_Form_Element_ComboBox
36
  {
lib/Zend/Dojo/Form/Element/HorizontalSlider.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -28,9 +28,9 @@
28
  * @uses Zend_Dojo_Form_Element_Slider
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
- * @version $Id: HorizontalSlider.php 20096 2010-01-06 02:05:09Z bkarwin $
34
  */
35
  class Zend_Dojo_Form_Element_HorizontalSlider extends Zend_Dojo_Form_Element_Slider
36
  {
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
28
  * @uses Zend_Dojo_Form_Element_Slider
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ * @version $Id: HorizontalSlider.php 24593 2012-01-05 20:35:02Z matthew $
34
  */
35
  class Zend_Dojo_Form_Element_HorizontalSlider extends Zend_Dojo_Form_Element_Slider
36
  {
lib/Zend/Dojo/Form/Element/NumberSpinner.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -28,9 +28,9 @@
28
  * @uses Zend_Dojo_Form_Element_ValidationTextBox
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
- * @version $Id: NumberSpinner.php 20096 2010-01-06 02:05:09Z bkarwin $
34
  */
35
  class Zend_Dojo_Form_Element_NumberSpinner extends Zend_Dojo_Form_Element_ValidationTextBox
36
  {
@@ -92,7 +92,7 @@ class Zend_Dojo_Form_Element_NumberSpinner extends Zend_Dojo_Form_Element_Valida
92
  */
93
  public function setLargeDelta($delta)
94
  {
95
- $this->setDijitParam('largeDelta', (int) $delta);
96
  return $this;
97
  }
98
 
@@ -114,7 +114,7 @@ class Zend_Dojo_Form_Element_NumberSpinner extends Zend_Dojo_Form_Element_Valida
114
  */
115
  public function setSmallDelta($delta)
116
  {
117
- $this->setDijitParam('smallDelta', (int) $delta);
118
  return $this;
119
  }
120
 
@@ -187,7 +187,7 @@ class Zend_Dojo_Form_Element_NumberSpinner extends Zend_Dojo_Form_Element_Valida
187
  if ($this->hasDijitParam('constraints')) {
188
  $constraints = $this->getDijitParam('constraints');
189
  }
190
- $constraints['min'] = (int) $value;
191
  $this->setDijitParam('constraints', $constraints);
192
  return $this;
193
  }
@@ -221,7 +221,7 @@ class Zend_Dojo_Form_Element_NumberSpinner extends Zend_Dojo_Form_Element_Valida
221
  if ($this->hasDijitParam('constraints')) {
222
  $constraints = $this->getDijitParam('constraints');
223
  }
224
- $constraints['max'] = (int) $value;
225
  $this->setDijitParam('constraints', $constraints);
226
  return $this;
227
  }
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
28
  * @uses Zend_Dojo_Form_Element_ValidationTextBox
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ * @version $Id: NumberSpinner.php 24593 2012-01-05 20:35:02Z matthew $
34
  */
35
  class Zend_Dojo_Form_Element_NumberSpinner extends Zend_Dojo_Form_Element_ValidationTextBox
36
  {
92
  */
93
  public function setLargeDelta($delta)
94
  {
95
+ $this->setDijitParam('largeDelta', (float) $delta);
96
  return $this;
97
  }
98
 
114
  */
115
  public function setSmallDelta($delta)
116
  {
117
+ $this->setDijitParam('smallDelta', (float) $delta);
118
  return $this;
119
  }
120
 
187
  if ($this->hasDijitParam('constraints')) {
188
  $constraints = $this->getDijitParam('constraints');
189
  }
190
+ $constraints['min'] = (float) $value;
191
  $this->setDijitParam('constraints', $constraints);
192
  return $this;
193
  }
221
  if ($this->hasDijitParam('constraints')) {
222
  $constraints = $this->getDijitParam('constraints');
223
  }
224
+ $constraints['max'] = (float) $value;
225
  $this->setDijitParam('constraints', $constraints);
226
  return $this;
227
  }
lib/Zend/Dojo/Form/Element/NumberTextBox.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -28,9 +28,9 @@
28
  * @uses Zend_Dojo_Form_Element_ValidationTextBox
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
- * @version $Id: NumberTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
34
  */
35
  class Zend_Dojo_Form_Element_NumberTextBox extends Zend_Dojo_Form_Element_ValidationTextBox
36
  {
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
28
  * @uses Zend_Dojo_Form_Element_ValidationTextBox
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ * @version $Id: NumberTextBox.php 24593 2012-01-05 20:35:02Z matthew $
34
  */
35
  class Zend_Dojo_Form_Element_NumberTextBox extends Zend_Dojo_Form_Element_ValidationTextBox
36
  {
lib/Zend/Dojo/Form/Element/PasswordTextBox.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -28,9 +28,9 @@
28
  * @uses Zend_Dojo_Form_Element_ValidationTextBox
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
- * @version $Id: PasswordTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
34
  */
35
  class Zend_Dojo_Form_Element_PasswordTextBox extends Zend_Dojo_Form_Element_ValidationTextBox
36
  {
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
28
  * @uses Zend_Dojo_Form_Element_ValidationTextBox
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ * @version $Id: PasswordTextBox.php 24593 2012-01-05 20:35:02Z matthew $
34
  */
35
  class Zend_Dojo_Form_Element_PasswordTextBox extends Zend_Dojo_Form_Element_ValidationTextBox
36
  {
lib/Zend/Dojo/Form/Element/RadioButton.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -28,9 +28,9 @@
28
  * @uses Zend_Dojo_Form_Element_DijitMulti
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
- * @version $Id: RadioButton.php 20096 2010-01-06 02:05:09Z bkarwin $
34
  */
35
  class Zend_Dojo_Form_Element_RadioButton extends Zend_Dojo_Form_Element_DijitMulti
36
  {
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
28
  * @uses Zend_Dojo_Form_Element_DijitMulti
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ * @version $Id: RadioButton.php 24593 2012-01-05 20:35:02Z matthew $
34
  */
35
  class Zend_Dojo_Form_Element_RadioButton extends Zend_Dojo_Form_Element_DijitMulti
36
  {
lib/Zend/Dojo/Form/Element/SimpleTextarea.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -29,9 +29,9 @@
29
  * @category Zend
30
  * @package Zend_Dojo
31
  * @subpackage Form_Element
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
- * @version $Id: SimpleTextarea.php 20096 2010-01-06 02:05:09Z bkarwin $
35
  */
36
  class Zend_Dojo_Form_Element_SimpleTextarea extends Zend_Dojo_Form_Element_Dijit
37
  {
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
29
  * @category Zend
30
  * @package Zend_Dojo
31
  * @subpackage Form_Element
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
+ * @version $Id: SimpleTextarea.php 24593 2012-01-05 20:35:02Z matthew $
35
  */
36
  class Zend_Dojo_Form_Element_SimpleTextarea extends Zend_Dojo_Form_Element_Dijit
37
  {
lib/Zend/Dojo/Form/Element/Slider.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -28,9 +28,9 @@
28
  * @uses Zend_Dojo_Form_Element_Dijit
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
- * @version $Id: Slider.php 20096 2010-01-06 02:05:09Z bkarwin $
34
  */
35
  abstract class Zend_Dojo_Form_Element_Slider extends Zend_Dojo_Form_Element_Dijit
36
  {
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
28
  * @uses Zend_Dojo_Form_Element_Dijit
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ * @version $Id: Slider.php 24593 2012-01-05 20:35:02Z matthew $
34
  */
35
  abstract class Zend_Dojo_Form_Element_Slider extends Zend_Dojo_Form_Element_Dijit
36
  {
lib/Zend/Dojo/Form/Element/SubmitButton.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -28,9 +28,9 @@
28
  * @category Zend
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
- * @version $Id: SubmitButton.php 20096 2010-01-06 02:05:09Z bkarwin $
34
  */
35
  class Zend_Dojo_Form_Element_SubmitButton extends Zend_Dojo_Form_Element_Button
36
  {
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
28
  * @category Zend
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ * @version $Id: SubmitButton.php 24593 2012-01-05 20:35:02Z matthew $
34
  */
35
  class Zend_Dojo_Form_Element_SubmitButton extends Zend_Dojo_Form_Element_Button
36
  {
lib/Zend/Dojo/Form/Element/TextBox.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -28,9 +28,9 @@
28
  * @category Zend
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
- * @version $Id: TextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
34
  */
35
  class Zend_Dojo_Form_Element_TextBox extends Zend_Dojo_Form_Element_Dijit
36
  {
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
28
  * @category Zend
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ * @version $Id: TextBox.php 24593 2012-01-05 20:35:02Z matthew $
34
  */
35
  class Zend_Dojo_Form_Element_TextBox extends Zend_Dojo_Form_Element_Dijit
36
  {
lib/Zend/Dojo/Form/Element/Textarea.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -28,9 +28,9 @@
28
  * @category Zend
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
- * @version $Id: Textarea.php 20096 2010-01-06 02:05:09Z bkarwin $
34
  */
35
  class Zend_Dojo_Form_Element_Textarea extends Zend_Dojo_Form_Element_Dijit
36
  {
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
28
  * @category Zend
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ * @version $Id: Textarea.php 24593 2012-01-05 20:35:02Z matthew $
34
  */
35
  class Zend_Dojo_Form_Element_Textarea extends Zend_Dojo_Form_Element_Dijit
36
  {
lib/Zend/Dojo/Form/Element/TimeTextBox.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -28,9 +28,9 @@
28
  * @uses Zend_Dojo_Form_Element_DateTextBox
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
- * @version $Id: TimeTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
34
  */
35
  class Zend_Dojo_Form_Element_TimeTextBox extends Zend_Dojo_Form_Element_DateTextBox
36
  {
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
28
  * @uses Zend_Dojo_Form_Element_DateTextBox
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ * @version $Id: TimeTextBox.php 24593 2012-01-05 20:35:02Z matthew $
34
  */
35
  class Zend_Dojo_Form_Element_TimeTextBox extends Zend_Dojo_Form_Element_DateTextBox
36
  {
lib/Zend/Dojo/Form/Element/ValidationTextBox.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -28,9 +28,9 @@
28
  * @uses Zend_Dojo_Form_Element_TextBox
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
- * @version $Id: ValidationTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
34
  */
35
  class Zend_Dojo_Form_Element_ValidationTextBox extends Zend_Dojo_Form_Element_TextBox
36
  {
@@ -132,6 +132,8 @@ class Zend_Dojo_Form_Element_ValidationTextBox extends Zend_Dojo_Form_Element_Te
132
  */
133
  public function setConstraints(array $constraints)
134
  {
 
 
135
  array_walk_recursive($constraints, array($this, '_castBoolToString'));
136
  $this->setDijitParam('constraints', $constraints);
137
  return $this;
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
28
  * @uses Zend_Dojo_Form_Element_TextBox
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ * @version $Id: ValidationTextBox.php 24593 2012-01-05 20:35:02Z matthew $
34
  */
35
  class Zend_Dojo_Form_Element_ValidationTextBox extends Zend_Dojo_Form_Element_TextBox
36
  {
132
  */
133
  public function setConstraints(array $constraints)
134
  {
135
+ $tmp = $this->getConstraints();
136
+ $constraints = array_merge($tmp, $constraints);
137
  array_walk_recursive($constraints, array($this, '_castBoolToString'));
138
  $this->setDijitParam('constraints', $constraints);
139
  return $this;
lib/Zend/Dojo/Form/Element/VerticalSlider.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -28,9 +28,9 @@
28
  * @uses Zend_Dojo_Form_Element_Slider
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
- * @version $Id: VerticalSlider.php 20096 2010-01-06 02:05:09Z bkarwin $
34
  */
35
  class Zend_Dojo_Form_Element_VerticalSlider extends Zend_Dojo_Form_Element_Slider
36
  {
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form_Element
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
28
  * @uses Zend_Dojo_Form_Element_Slider
29
  * @package Zend_Dojo
30
  * @subpackage Form_Element
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ * @version $Id: VerticalSlider.php 24593 2012-01-05 20:35:02Z matthew $
34
  */
35
  class Zend_Dojo_Form_Element_VerticalSlider extends Zend_Dojo_Form_Element_Slider
36
  {
lib/Zend/Dojo/Form/SubForm.php CHANGED
@@ -15,7 +15,7 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
@@ -28,9 +28,9 @@
28
  * @uses Zend_Form_SubForm
29
  * @package Zend_Dojo
30
  * @subpackage Form
31
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
- * @version $Id: SubForm.php 20096 2010-01-06 02:05:09Z bkarwin $
34
  */
35
  class Zend_Dojo_Form_SubForm extends Zend_Form_SubForm
36
  {
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage Form
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
  */
21
 
28
  * @uses Zend_Form_SubForm
29
  * @package Zend_Dojo
30
  * @subpackage Form
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
  * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ * @version $Id: SubForm.php 24593 2012-01-05 20:35:02Z matthew $
34
  */
35
  class Zend_Dojo_Form_SubForm extends Zend_Form_SubForm
36
  {
lib/Zend/Dojo/View/Exception.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /**
@@ -29,7 +29,7 @@
29
  * @category Zend
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Exception extends Zend_Dojo_Exception
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /**
29
  * @category Zend
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Exception extends Zend_Dojo_Exception
lib/Zend/Dojo/View/Helper/AccordionContainer.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: AccordionContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_DijitContainer */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_AccordionContainer extends Zend_Dojo_View_Helper_DijitContainer
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: AccordionContainer.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_DijitContainer */
29
  * @uses Zend_Dojo_View_Helper_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_AccordionContainer extends Zend_Dojo_View_Helper_DijitContainer
lib/Zend/Dojo/View/Helper/AccordionPane.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: AccordionPane.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_DijitContainer */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_AccordionPane extends Zend_Dojo_View_Helper_DijitContainer
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: AccordionPane.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_DijitContainer */
29
  * @uses Zend_Dojo_View_Helper_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_AccordionPane extends Zend_Dojo_View_Helper_DijitContainer
lib/Zend/Dojo/View/Helper/BorderContainer.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: BorderContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_DijitContainer */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_BorderContainer extends Zend_Dojo_View_Helper_DijitContainer
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: BorderContainer.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_DijitContainer */
29
  * @uses Zend_Dojo_View_Helper_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_BorderContainer extends Zend_Dojo_View_Helper_DijitContainer
lib/Zend/Dojo/View/Helper/Button.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Button.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_Button extends Zend_Dojo_View_Helper_Dijit
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Button.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_Button extends Zend_Dojo_View_Helper_Dijit
lib/Zend/Dojo/View/Helper/CheckBox.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: CheckBox.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_CheckBox extends Zend_Dojo_View_Helper_Dijit
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: CheckBox.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_CheckBox extends Zend_Dojo_View_Helper_Dijit
lib/Zend/Dojo/View/Helper/ComboBox.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: ComboBox.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_ComboBox extends Zend_Dojo_View_Helper_Dijit
@@ -100,6 +100,10 @@ class Zend_Dojo_View_Helper_ComboBox extends Zend_Dojo_View_Helper_Dijit
100
  return $html;
101
  }
102
 
 
 
 
 
103
  // do as normal select
104
  $attribs = $this->_prepareDijit($attribs, $params, 'element');
105
  return $this->view->formSelect($id, $value, $attribs, $options);
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: ComboBox.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_ComboBox extends Zend_Dojo_View_Helper_Dijit
100
  return $html;
101
  }
102
 
103
+ // required for correct type casting in declerative mode
104
+ if (isset($params['autocomplete'])) {
105
+ $params['autocomplete'] = ($params['autocomplete']) ? 'true' : 'false';
106
+ }
107
  // do as normal select
108
  $attribs = $this->_prepareDijit($attribs, $params, 'element');
109
  return $this->view->formSelect($id, $value, $attribs, $options);
lib/Zend/Dojo/View/Helper/ContentPane.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: ContentPane.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_DijitContainer */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_ContentPane extends Zend_Dojo_View_Helper_DijitContainer
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: ContentPane.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_DijitContainer */
29
  * @uses Zend_Dojo_View_Helper_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_ContentPane extends Zend_Dojo_View_Helper_DijitContainer
lib/Zend/Dojo/View/Helper/CurrencyTextBox.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: CurrencyTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_CurrencyTextBox extends Zend_Dojo_View_Helper_Dijit
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: CurrencyTextBox.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_CurrencyTextBox extends Zend_Dojo_View_Helper_Dijit
lib/Zend/Dojo/View/Helper/CustomDijit.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: CustomDijit.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_DijitContainer */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_CustomDijit extends Zend_Dojo_View_Helper_DijitContainer
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: CustomDijit.php 25024 2012-07-30 15:08:15Z rob $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_DijitContainer */
29
  * @uses Zend_Dojo_View_Helper_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_CustomDijit extends Zend_Dojo_View_Helper_DijitContainer
lib/Zend/Dojo/View/Helper/DateTextBox.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: DateTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_DateTextBox extends Zend_Dojo_View_Helper_Dijit
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: DateTextBox.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_DateTextBox extends Zend_Dojo_View_Helper_Dijit
lib/Zend/Dojo/View/Helper/Dijit.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Dijit.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_View_Helper_HtmlElement */
@@ -29,7 +29,7 @@
29
  * @uses Zend_View_Helper_Abstract
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  abstract class Zend_Dojo_View_Helper_Dijit extends Zend_View_Helper_HtmlElement
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Dijit.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_View_Helper_HtmlElement */
29
  * @uses Zend_View_Helper_Abstract
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  abstract class Zend_Dojo_View_Helper_Dijit extends Zend_View_Helper_HtmlElement
lib/Zend/Dojo/View/Helper/DijitContainer.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: DijitContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  abstract class Zend_Dojo_View_Helper_DijitContainer extends Zend_Dojo_View_Helper_Dijit
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: DijitContainer.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  abstract class Zend_Dojo_View_Helper_DijitContainer extends Zend_Dojo_View_Helper_Dijit
lib/Zend/Dojo/View/Helper/Dojo.php CHANGED
@@ -15,8 +15,8 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
- * @version $Id: Dojo.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
@@ -31,7 +31,7 @@
31
  *
32
  * @package Zend_Dojo
33
  * @subpackage View
34
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Dojo_View_Helper_Dojo
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
+ * @version $Id: Dojo.php 24593 2012-01-05 20:35:02Z matthew $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
31
  *
32
  * @package Zend_Dojo
33
  * @subpackage View
34
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
35
  * @license http://framework.zend.com/license/new-bsd New BSD License
36
  */
37
  class Zend_Dojo_View_Helper_Dojo
lib/Zend/Dojo/View/Helper/Dojo/Container.php CHANGED
@@ -15,8 +15,8 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
- * @version $Id: Container.php 23368 2010-11-18 19:56:30Z bittarman $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
@@ -29,7 +29,7 @@
29
  *
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_Dojo_Container
@@ -882,7 +882,7 @@ EOJ;
882
  */
883
  public function addJavascript($js)
884
  {
885
- $js = preg_replace('/^\s*(.*?)\s*$/s', '$1', $js);
886
  if (!in_array(substr($js, -1), array(';', '}'))) {
887
  $js .= ';';
888
  }
@@ -1136,7 +1136,7 @@ EOJ;
1136
  }
1137
 
1138
  $onLoadActions = array();
1139
- // Get Zend specific onLoad actions; these will always be first to
1140
  // ensure that dijits are created in the correct order
1141
  foreach ($this->_getZendLoadActions() as $callback) {
1142
  $onLoadActions[] = 'dojo.addOnLoad(' . $callback . ');';
@@ -1177,12 +1177,12 @@ EOJ;
1177
  /**
1178
  * Add an onLoad action related to ZF dijit creation
1179
  *
1180
- * This method is public, but prefixed with an underscore to indicate that
1181
  * it should not normally be called by userland code. It is pertinent to
1182
- * ensuring that the correct order of operations occurs during dijit
1183
  * creation.
1184
- *
1185
- * @param string $callback
1186
  * @return Zend_Dojo_View_Helper_Dojo_Container
1187
  */
1188
  public function _addZendLoad($callback)
@@ -1195,7 +1195,7 @@ EOJ;
1195
 
1196
  /**
1197
  * Retrieve all ZF dijit callbacks
1198
- *
1199
  * @return array
1200
  */
1201
  public function _getZendLoadActions()
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
+ * @version $Id: Container.php 24593 2012-01-05 20:35:02Z matthew $
20
  * @license http://framework.zend.com/license/new-bsd New BSD License
21
  */
22
 
29
  *
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_Dojo_Container
882
  */
883
  public function addJavascript($js)
884
  {
885
+ $js = trim($js);
886
  if (!in_array(substr($js, -1), array(';', '}'))) {
887
  $js .= ';';
888
  }
1136
  }
1137
 
1138
  $onLoadActions = array();
1139
+ // Get Zend specific onLoad actions; these will always be first to
1140
  // ensure that dijits are created in the correct order
1141
  foreach ($this->_getZendLoadActions() as $callback) {
1142
  $onLoadActions[] = 'dojo.addOnLoad(' . $callback . ');';
1177
  /**
1178
  * Add an onLoad action related to ZF dijit creation
1179
  *
1180
+ * This method is public, but prefixed with an underscore to indicate that
1181
  * it should not normally be called by userland code. It is pertinent to
1182
+ * ensuring that the correct order of operations occurs during dijit
1183
  * creation.
1184
+ *
1185
+ * @param string $callback
1186
  * @return Zend_Dojo_View_Helper_Dojo_Container
1187
  */
1188
  public function _addZendLoad($callback)
1195
 
1196
  /**
1197
  * Retrieve all ZF dijit callbacks
1198
+ *
1199
  * @return array
1200
  */
1201
  public function _getZendLoadActions()
lib/Zend/Dojo/View/Helper/Editor.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Editor.php 20116 2010-01-07 14:18:34Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
@@ -32,7 +32,7 @@
32
  * @uses Zend_Dojo_View_Helper_Textarea
33
  * @package Zend_Dojo
34
  * @subpackage View
35
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Dojo_View_Helper_Editor extends Zend_Dojo_View_Helper_Dijit
@@ -57,14 +57,21 @@ class Zend_Dojo_View_Helper_Editor extends Zend_Dojo_View_Helper_Dijit
57
  'fontSize' => 'FontChoice',
58
  'formatBlock' => 'FontChoice',
59
  'foreColor' => 'TextColor',
60
- 'hiliteColor' => 'TextColor'
 
 
 
 
 
 
 
61
  );
62
 
63
  /**
64
  * JSON-encoded parameters
65
  * @var array
66
  */
67
- protected $_jsonParams = array('captureEvents', 'events', 'plugins');
68
 
69
  /**
70
  * dijit.Editor
@@ -83,8 +90,8 @@ class Zend_Dojo_View_Helper_Editor extends Zend_Dojo_View_Helper_Dijit
83
  }
84
  }
85
 
86
- // Previous versions allowed specifying "degrade" to allow using a
87
- // textarea instead of a div -- but this is insecure. Removing the
88
  // parameter if set to prevent its injection in the dijit.
89
  if (isset($params['degrade'])) {
90
  unset($params['degrade']);
@@ -114,17 +121,18 @@ class Zend_Dojo_View_Helper_Editor extends Zend_Dojo_View_Helper_Dijit
114
 
115
  $attribs = $this->_prepareDijit($attribs, $params, 'textarea');
116
 
117
- $html = '<input' . $this->_htmlAttribs($hiddenAttribs) . $this->getClosingBracket();
118
- $html .= '<div' . $this->_htmlAttribs($attribs) . '>'
119
  . $value
120
  . "</div>\n";
121
 
122
- // Embed a textarea in a <noscript> tag to allow for graceful
123
  // degradation
124
  $html .= '<noscript>'
125
  . $this->view->formTextarea($hiddenId, $value, $attribs)
126
  . '</noscript>';
127
 
 
 
128
  return $html;
129
  }
130
 
@@ -178,7 +186,11 @@ class Zend_Dojo_View_Helper_Editor extends Zend_Dojo_View_Helper_Dijit
178
  function() {
179
  var form = zend.findParentForm(dojo.byId('$hiddenId'));
180
  dojo.connect(form, 'submit', function(e) {
181
- dojo.byId('$hiddenId').value = dijit.byId('$editorId').getValue(false);
 
 
 
 
182
  });
183
  }
184
  EOJ;
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Editor.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
32
  * @uses Zend_Dojo_View_Helper_Textarea
33
  * @package Zend_Dojo
34
  * @subpackage View
35
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
36
  * @license http://framework.zend.com/license/new-bsd New BSD License
37
  */
38
  class Zend_Dojo_View_Helper_Editor extends Zend_Dojo_View_Helper_Dijit
57
  'fontSize' => 'FontChoice',
58
  'formatBlock' => 'FontChoice',
59
  'foreColor' => 'TextColor',
60
+ 'hiliteColor' => 'TextColor',
61
+ 'enterKeyHandling' => 'EnterKeyHandling',
62
+ 'fullScreen' => 'FullScreen',
63
+ 'newPage' => 'NewPage',
64
+ 'print' => 'Print',
65
+ 'tabIndent' => 'TabIndent',
66
+ 'toggleDir' => 'ToggleDir',
67
+ 'viewSource' => 'ViewSource'
68
  );
69
 
70
  /**
71
  * JSON-encoded parameters
72
  * @var array
73
  */
74
+ protected $_jsonParams = array('captureEvents', 'events', 'plugins', 'extraPlugins');
75
 
76
  /**
77
  * dijit.Editor
90
  }
91
  }
92
 
93
+ // Previous versions allowed specifying "degrade" to allow using a
94
+ // textarea instead of a div -- but this is insecure. Removing the
95
  // parameter if set to prevent its injection in the dijit.
96
  if (isset($params['degrade'])) {
97
  unset($params['degrade']);
121
 
122
  $attribs = $this->_prepareDijit($attribs, $params, 'textarea');
123
 
124
+ $html = '<div' . $this->_htmlAttribs($attribs) . '>'
 
125
  . $value
126
  . "</div>\n";
127
 
128
+ // Embed a textarea in a <noscript> tag to allow for graceful
129
  // degradation
130
  $html .= '<noscript>'
131
  . $this->view->formTextarea($hiddenId, $value, $attribs)
132
  . '</noscript>';
133
 
134
+ $html .= '<input' . $this->_htmlAttribs($hiddenAttribs) . $this->getClosingBracket();
135
+
136
  return $html;
137
  }
138
 
186
  function() {
187
  var form = zend.findParentForm(dojo.byId('$hiddenId'));
188
  dojo.connect(form, 'submit', function(e) {
189
+ var value = dijit.byId('$editorId').getValue(false);
190
+ if(dojo.isFF) {
191
+ value = value.replace(/<br _moz_editor_bogus_node="TRUE" \/>/, '');
192
+ }
193
+ dojo.byId('$hiddenId').value = value;
194
  });
195
  }
196
  EOJ;
lib/Zend/Dojo/View/Helper/FilteringSelect.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: FilteringSelect.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_ComboBox */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_ComboBox
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_FilteringSelect extends Zend_Dojo_View_Helper_ComboBox
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: FilteringSelect.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_ComboBox */
29
  * @uses Zend_Dojo_View_Helper_ComboBox
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_FilteringSelect extends Zend_Dojo_View_Helper_ComboBox
lib/Zend/Dojo/View/Helper/Form.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Form.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_Form extends Zend_Dojo_View_Helper_Dijit
@@ -70,10 +70,6 @@ class Zend_Dojo_View_Helper_Form extends Zend_Dojo_View_Helper_Dijit
70
  $attribs['id'] = $id;
71
  }
72
 
73
- if (false === $content) {
74
- $content = '';
75
- }
76
-
77
  $attribs = $this->_prepareDijit($attribs, array(), 'layout');
78
 
79
  return $this->getFormHelper()->form($id, $attribs, $content);
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Form.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_Form extends Zend_Dojo_View_Helper_Dijit
70
  $attribs['id'] = $id;
71
  }
72
 
 
 
 
 
73
  $attribs = $this->_prepareDijit($attribs, array(), 'layout');
74
 
75
  return $this->getFormHelper()->form($id, $attribs, $content);
lib/Zend/Dojo/View/Helper/HorizontalSlider.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: HorizontalSlider.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Slider */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_Slider
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_HorizontalSlider extends Zend_Dojo_View_Helper_Slider
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: HorizontalSlider.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Slider */
29
  * @uses Zend_Dojo_View_Helper_Slider
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_HorizontalSlider extends Zend_Dojo_View_Helper_Slider
lib/Zend/Dojo/View/Helper/NumberSpinner.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: NumberSpinner.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_NumberSpinner extends Zend_Dojo_View_Helper_Dijit
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: NumberSpinner.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_NumberSpinner extends Zend_Dojo_View_Helper_Dijit
lib/Zend/Dojo/View/Helper/NumberTextBox.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: NumberTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_NumberTextBox extends Zend_Dojo_View_Helper_Dijit
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: NumberTextBox.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_NumberTextBox extends Zend_Dojo_View_Helper_Dijit
lib/Zend/Dojo/View/Helper/PasswordTextBox.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: PasswordTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_ValidationTextBox */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_PasswordTextBox extends Zend_Dojo_View_Helper_ValidationTextBox
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: PasswordTextBox.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_ValidationTextBox */
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_PasswordTextBox extends Zend_Dojo_View_Helper_ValidationTextBox
lib/Zend/Dojo/View/Helper/RadioButton.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: RadioButton.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_RadioButton extends Zend_Dojo_View_Helper_Dijit
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: RadioButton.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_RadioButton extends Zend_Dojo_View_Helper_Dijit
lib/Zend/Dojo/View/Helper/SimpleTextarea.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: SimpleTextarea.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
@@ -29,9 +29,9 @@
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
- * @version $Id: SimpleTextarea.php 20096 2010-01-06 02:05:09Z bkarwin $
35
  */
36
  class Zend_Dojo_View_Helper_SimpleTextarea extends Zend_Dojo_View_Helper_Dijit
37
  {
@@ -65,7 +65,6 @@ class Zend_Dojo_View_Helper_SimpleTextarea extends Zend_Dojo_View_Helper_Dijit
65
  $attribs['id'] = $id;
66
  }
67
  $attribs['name'] = $id;
68
- $attribs['type'] = $this->_elementType;
69
 
70
  $attribs = $this->_prepareDijit($attribs, $params, 'textarea');
71
 
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: SimpleTextarea.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
+ * @version $Id: SimpleTextarea.php 24593 2012-01-05 20:35:02Z matthew $
35
  */
36
  class Zend_Dojo_View_Helper_SimpleTextarea extends Zend_Dojo_View_Helper_Dijit
37
  {
65
  $attribs['id'] = $id;
66
  }
67
  $attribs['name'] = $id;
 
68
 
69
  $attribs = $this->_prepareDijit($attribs, $params, 'textarea');
70
 
lib/Zend/Dojo/View/Helper/Slider.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Slider.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  abstract class Zend_Dojo_View_Helper_Slider extends Zend_Dojo_View_Helper_Dijit
@@ -77,7 +77,7 @@ abstract class Zend_Dojo_View_Helper_Slider extends Zend_Dojo_View_Helper_Dijit
77
  }
78
 
79
  $content = '';
80
- $params['value'] = $value;
81
 
82
  if (!array_key_exists('onChange', $attribs)) {
83
  $attribs['onChange'] = "dojo.byId('" . $id . "').value = arguments[0];";
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Slider.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  abstract class Zend_Dojo_View_Helper_Slider extends Zend_Dojo_View_Helper_Dijit
77
  }
78
 
79
  $content = '';
80
+ $attribs['value'] = $value;
81
 
82
  if (!array_key_exists('onChange', $attribs)) {
83
  $attribs['onChange'] = "dojo.byId('" . $id . "').value = arguments[0];";
lib/Zend/Dojo/View/Helper/SplitContainer.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: SplitContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_DijitContainer */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_SplitContainer extends Zend_Dojo_View_Helper_DijitContainer
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: SplitContainer.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_DijitContainer */
29
  * @uses Zend_Dojo_View_Helper_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_SplitContainer extends Zend_Dojo_View_Helper_DijitContainer
lib/Zend/Dojo/View/Helper/StackContainer.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: StackContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_DijitContainer */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_StackContainer extends Zend_Dojo_View_Helper_DijitContainer
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: StackContainer.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_DijitContainer */
29
  * @uses Zend_Dojo_View_Helper_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_StackContainer extends Zend_Dojo_View_Helper_DijitContainer
lib/Zend/Dojo/View/Helper/SubmitButton.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: SubmitButton.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Button */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_Button
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_SubmitButton extends Zend_Dojo_View_Helper_Button
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: SubmitButton.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Button */
29
  * @uses Zend_Dojo_View_Helper_Button
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_SubmitButton extends Zend_Dojo_View_Helper_Button
lib/Zend/Dojo/View/Helper/TabContainer.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: TabContainer.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_DijitContainer */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_TabContainer extends Zend_Dojo_View_Helper_DijitContainer
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: TabContainer.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_DijitContainer */
29
  * @uses Zend_Dojo_View_Helper_DijitContainer
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_TabContainer extends Zend_Dojo_View_Helper_DijitContainer
lib/Zend/Dojo/View/Helper/TextBox.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: TextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_TextBox extends Zend_Dojo_View_Helper_Dijit
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: TextBox.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_TextBox extends Zend_Dojo_View_Helper_Dijit
lib/Zend/Dojo/View/Helper/Textarea.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: Textarea.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_Textarea extends Zend_Dojo_View_Helper_Dijit
@@ -67,7 +67,6 @@ class Zend_Dojo_View_Helper_Textarea extends Zend_Dojo_View_Helper_Dijit
67
  $attribs['id'] = $id;
68
  }
69
  $attribs['name'] = $id;
70
- $attribs['type'] = $this->_elementType;
71
 
72
  $attribs = $this->_prepareDijit($attribs, $params, 'textarea');
73
 
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: Textarea.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_Textarea extends Zend_Dojo_View_Helper_Dijit
67
  $attribs['id'] = $id;
68
  }
69
  $attribs['name'] = $id;
 
70
 
71
  $attribs = $this->_prepareDijit($attribs, $params, 'textarea');
72
 
lib/Zend/Dojo/View/Helper/TimeTextBox.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: TimeTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_TimeTextBox extends Zend_Dojo_View_Helper_Dijit
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: TimeTextBox.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_TimeTextBox extends Zend_Dojo_View_Helper_Dijit
lib/Zend/Dojo/View/Helper/ValidationTextBox.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: ValidationTextBox.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_ValidationTextBox extends Zend_Dojo_View_Helper_Dijit
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: ValidationTextBox.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Dijit */
29
  * @uses Zend_Dojo_View_Helper_Dijit
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_ValidationTextBox extends Zend_Dojo_View_Helper_Dijit
lib/Zend/Dojo/View/Helper/VerticalSlider.php CHANGED
@@ -15,9 +15,9 @@
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
- * @version $Id: VerticalSlider.php 20096 2010-01-06 02:05:09Z bkarwin $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Slider */
@@ -29,7 +29,7 @@
29
  * @uses Zend_Dojo_View_Helper_Slider
30
  * @package Zend_Dojo
31
  * @subpackage View
32
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_VerticalSlider extends Zend_Dojo_View_Helper_Slider
15
  * @category Zend
16
  * @package Zend_Dojo
17
  * @subpackage View
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
  * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ * @version $Id: VerticalSlider.php 24593 2012-01-05 20:35:02Z matthew $
21
  */
22
 
23
  /** Zend_Dojo_View_Helper_Slider */
29
  * @uses Zend_Dojo_View_Helper_Slider
30
  * @package Zend_Dojo
31
  * @subpackage View
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
  * @license http://framework.zend.com/license/new-bsd New BSD License
34
  */
35
  class Zend_Dojo_View_Helper_VerticalSlider extends Zend_Dojo_View_Helper_Slider
lib/Zend/Dom/Exception.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Dom
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
20
  */
21
 
22
  /** Zend_Exception */
@@ -27,7 +27,7 @@
27
  *
28
  * @category Zend
29
  * @package Zend_Dom
30
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Dom_Exception extends Zend_Exception
14
  *
15
  * @category Zend
16
  * @package Zend_Dom
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $
20
  */
21
 
22
  /** Zend_Exception */
27
  *
28
  * @category Zend
29
  * @package Zend_Dom
30
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31
  * @license http://framework.zend.com/license/new-bsd New BSD License
32
  */
33
  class Zend_Dom_Exception extends Zend_Exception
lib/Zend/Dom/Query.php CHANGED
@@ -14,9 +14,9 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Dom
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
- * @version $Id: Query.php 23062 2010-10-08 14:05:45Z matthew $
20
  */
21
 
22
  /**
@@ -34,7 +34,7 @@
34
  *
35
  * @package Zend_Dom
36
  * @subpackage Query
37
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Dom_Query
@@ -90,8 +90,8 @@ class Zend_Dom_Query
90
 
91
  /**
92
  * Set document encoding
93
- *
94
- * @param string $encoding
95
  * @return Zend_Dom_Query
96
  */
97
  public function setEncoding($encoding)
@@ -102,7 +102,7 @@ class Zend_Dom_Query
102
 
103
  /**
104
  * Get document encoding
105
- *
106
  * @return null|string
107
  */
108
  public function getEncoding()
@@ -124,6 +124,10 @@ class Zend_Dom_Query
124
  }
125
  // breaking XML declaration to make syntax highlighting work
126
  if ('<' . '?xml' == substr(trim($document), 0, 5)) {
 
 
 
 
127
  return $this->setDocumentXml($document, $encoding);
128
  }
129
  if (strstr($document, 'DTD XHTML')) {
@@ -205,7 +209,7 @@ class Zend_Dom_Query
205
 
206
  /**
207
  * Get any DOMDocument errors found
208
- *
209
  * @return false|array
210
  */
211
  public function getDocumentErrors()
@@ -241,6 +245,7 @@ class Zend_Dom_Query
241
 
242
  $encoding = $this->getEncoding();
243
  libxml_use_internal_errors(true);
 
244
  if (null === $encoding) {
245
  $domDoc = new DOMDocument('1.0');
246
  } else {
@@ -250,6 +255,14 @@ class Zend_Dom_Query
250
  switch ($type) {
251
  case self::DOC_XML:
252
  $success = $domDoc->loadXML($document);
 
 
 
 
 
 
 
 
253
  break;
254
  case self::DOC_HTML:
255
  case self::DOC_XHTML:
@@ -262,6 +275,7 @@ class Zend_Dom_Query
262
  $this->_documentErrors = $errors;
263
  libxml_clear_errors();
264
  }
 
265
  libxml_use_internal_errors(false);
266
 
267
  if (!$success) {
14
  *
15
  * @category Zend
16
  * @package Zend_Dom
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ * @version $Id: Query.php 25033 2012-08-17 19:50:08Z matthew $
20
  */
21
 
22
  /**
34
  *
35
  * @package Zend_Dom
36
  * @subpackage Query
37
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
38
  * @license http://framework.zend.com/license/new-bsd New BSD License
39
  */
40
  class Zend_Dom_Query
90
 
91
  /**
92
  * Set document encoding
93
+ *
94
+ * @param string $encoding
95
  * @return Zend_Dom_Query
96
  */
97
  public function setEncoding($encoding)
102
 
103
  /**
104
  * Get document encoding
105
+ *
106
  * @return null|string
107
  */
108
  public function getEncoding()
124
  }
125
  // breaking XML declaration to make syntax highlighting work
126
  if ('<' . '?xml' == substr(trim($document), 0, 5)) {
127
+ if (preg_match('/<html[^>]*xmlns="([^"]+)"[^>]*>/i', $document, $matches)) {
128
+ $this->_xpathNamespaces[] = $matches[1];
129
+ return $this->setDocumentXhtml($document, $encoding);
130
+ }
131
  return $this->setDocumentXml($document, $encoding);
132
  }
133
  if (strstr($document, 'DTD XHTML')) {
209
 
210
  /**
211
  * Get any DOMDocument errors found
212
+ *
213
  * @return false|array
214
  */
215
  public function getDocumentErrors()
245
 
246
  $encoding = $this->getEncoding();
247
  libxml_use_internal_errors(true);
248
+ libxml_disable_entity_loader(true);
249
  if (null === $encoding) {
250
  $domDoc = new DOMDocument('1.0');
251
  } else {
255
  switch ($type) {
256
  case self::DOC_XML:
257
  $success = $domDoc->loadXML($document);
258
+ foreach ($domDoc->childNodes as $child) {
259
+ if ($child->nodeType === XML_DOCUMENT_TYPE_NODE) {
260
+ #require_once 'Zend/Dom/Exception.php';
261
+ throw new Zend_Dom_Exception(
262
+ 'Invalid XML: Detected use of illegal DOCTYPE'
263
+ );
264
+ }
265
+ }
266
  break;
267
  case self::DOC_HTML:
268
  case self::DOC_XHTML:
275
  $this->_documentErrors = $errors;
276
  libxml_clear_errors();
277
  }
278
+ libxml_disable_entity_loader(false);
279
  libxml_use_internal_errors(false);
280
 
281
  if (!$success) {
lib/Zend/Dom/Query/Css2Xpath.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Dom
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
@@ -23,9 +23,9 @@
23
  *
24
  * @package Zend_Dom
25
  * @subpackage Query
26
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
- * @version $Id: Css2Xpath.php 22044 2010-04-28 19:58:29Z matthew $
29
  */
30
  class Zend_Dom_Query_Css2Xpath
31
  {
@@ -121,8 +121,8 @@ class Zend_Dom_Query_Css2Xpath
121
 
122
  // Classes
123
  $expression = preg_replace(
124
- '|\.([a-z][a-z0-9_-]*)|i',
125
- "[contains(concat(' ', normalize-space(@class), ' '), ' \$1 ')]",
126
  $expression
127
  );
128
 
@@ -134,8 +134,8 @@ class Zend_Dom_Query_Css2Xpath
134
 
135
  /**
136
  * Callback for creating equality expressions
137
- *
138
- * @param array $matches
139
  * @return string
140
  */
141
  protected static function _createEqualityExpression($matches)
@@ -145,25 +145,25 @@ class Zend_Dom_Query_Css2Xpath
145
 
146
  /**
147
  * Callback for creating expressions to match one or more attribute values
148
- *
149
- * @param array $matches
150
  * @return string
151
  */
152
  protected static function _normalizeSpaceAttribute($matches)
153
  {
154
- return "[contains(concat(' ', normalize-space(@" . strtolower($matches[1]) . "), ' '), ' "
155
  . $matches[2] . " ')]";
156
  }
157
 
158
  /**
159
  * Callback for creating a strict "contains" expression
160
- *
161
- * @param array $matches
162
  * @return string
163
  */
164
  protected static function _createContainsExpression($matches)
165
  {
166
- return "[contains(@" . strtolower($matches[1]) . ", '"
167
  . $matches[2] . "')]";
168
  }
169
  }
14
  *
15
  * @category Zend
16
  * @package Zend_Dom
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
23
  *
24
  * @package Zend_Dom
25
  * @subpackage Query
26
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27
  * @license http://framework.zend.com/license/new-bsd New BSD License
28
+ * @version $Id: Css2Xpath.php 24593 2012-01-05 20:35:02Z matthew $
29
  */
30
  class Zend_Dom_Query_Css2Xpath
31
  {
121
 
122
  // Classes
123
  $expression = preg_replace(
124
+ '|\.([a-z][a-z0-9_-]*)|i',
125
+ "[contains(concat(' ', normalize-space(@class), ' '), ' \$1 ')]",
126
  $expression
127
  );
128
 
134
 
135
  /**
136
  * Callback for creating equality expressions
137
+ *
138
+ * @param array $matches
139
  * @return string
140
  */
141
  protected static function _createEqualityExpression($matches)
145
 
146
  /**
147
  * Callback for creating expressions to match one or more attribute values
148
+ *
149
+ * @param array $matches
150
  * @return string
151
  */
152
  protected static function _normalizeSpaceAttribute($matches)
153
  {
154
+ return "[contains(concat(' ', normalize-space(@" . strtolower($matches[1]) . "), ' '), ' "
155
  . $matches[2] . " ')]";
156
  }
157
 
158
  /**
159
  * Callback for creating a strict "contains" expression
160
+ *
161
+ * @param array $matches
162
  * @return string
163
  */
164
  protected static function _createContainsExpression($matches)
165
  {
166
+ return "[contains(@" . strtolower($matches[1]) . ", '"
167
  . $matches[2] . "')]";
168
  }
169
  }
lib/Zend/Dom/Query/Result.php CHANGED
@@ -14,7 +14,7 @@
14
  *
15
  * @category Zend
16
  * @package Zend_Dom
17
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
@@ -24,9 +24,9 @@
24
  * @package Zend_Dom
25
  * @subpackage Query
26
  * @uses Iterator
27
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
- * @version $Id: Result.php 20096 2010-01-06 02:05:09Z bkarwin $
30
  */
31
  class Zend_Dom_Query_Result implements Iterator,Countable
32
  {
14
  *
15
  * @category Zend
16
  * @package Zend_Dom
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
  * @license http://framework.zend.com/license/new-bsd New BSD License
19
  */
20
 
24
  * @package Zend_Dom
25
  * @subpackage Query
26
  * @uses Iterator
27
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
28
  * @license http://framework.zend.com/license/new-bsd New BSD License
29
+ * @version $Id: Result.php 24593 2012-01-05 20:35:02Z matthew $
30
  */
31
  class Zend_Dom_Query_Result implements Iterator,Countable
32
  {
lib/Zend/EventManager/Event.php ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zend Framework
4
+ *
5
+ * LICENSE
6
+ *
7
+ * This source file is subject to the new BSD license that is bundled
8
+ * with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://framework.zend.com/license/new-bsd
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@zend.com so we can send you a copy immediately.
14
+ *
15
+ * @category Zend
16
+ * @package Zend_EventManager
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
+ * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ */
20
+
21
+ #require_once 'Zend/EventManager/EventDescription.php';
22
+
23
+ /**
24
+ * Representation of an event
25
+ *
26
+ * Encapsulates the target context and parameters passed, and provides some
27
+ * behavior for interacting with the event manager.
28
+ *
29
+ * @category Zend
30
+ * @package Zend_EventManager
31
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
32
+ * @license http://framework.zend.com/license/new-bsd New BSD License
33
+ */
34
+ class Zend_EventManager_Event implements Zend_EventManager_EventDescription
35
+ {
36
+ /**
37
+ * @var string Event name
38
+ */
39
+ protected $name;
40
+
41
+ /**
42
+ * @var string|object The event target
43
+ */
44
+ protected $target;
45
+
46
+ /**
47
+ * @var array|ArrayAccess|object The event parameters
48
+ */
49
+ protected $params = array();
50
+
51
+ /**
52
+ * @var bool Whether or not to stop propagation
53
+ */
54
+ protected $stopPropagation = false;
55
+
56
+ /**
57
+ * Constructor
58
+ *
59
+ * Accept a target and its parameters.
60
+ *
61
+ * @param string $name Event name
62
+ * @param string|object $target
63
+ * @param array|ArrayAccess $params
64
+ * @return void
65
+ */
66
+ public function __construct($name = null, $target = null, $params = null)
67
+ {
68
+ if (null !== $name) {
69
+ $this->setName($name);
70
+ }
71
+
72
+ if (null !== $target) {
73
+ $this->setTarget($target);
74
+ }
75
+
76
+ if (null !== $params) {
77
+ $this->setParams($params);
78
+ }
79
+ }
80
+
81
+ /**
82
+ * Get event name
83
+ *
84
+ * @return string
85
+ */
86
+ public function getName()
87
+ {
88
+ return $this->name;
89
+ }
90
+
91
+ /**
92
+ * Get the event target
93
+ *
94
+ * This may be either an object, or the name of a static method.
95
+ *
96
+ * @return string|object
97
+ */
98
+ public function getTarget()
99
+ {
100
+ return $this->target;
101
+ }
102
+
103
+ /**
104
+ * Set parameters
105
+ *
106
+ * Overwrites parameters
107
+ *
108
+ * @param array|ArrayAccess|object $params
109
+ * @return Event
110
+ */
111
+ public function setParams($params)
112
+ {
113
+ if (!is_array($params) && !is_object($params)) {
114
+ #require_once 'Zend/EventManager/Exception/InvalidArgumentException.php';
115
+ throw new Zend_EventManager_Exception_InvalidArgumentException(sprintf(
116
+ 'Event parameters must be an array or object; received "%s"',
117
+ (is_object($params) ? get_class($params) : gettype($params))
118
+ ));
119
+ }
120
+
121
+ $this->params = $params;
122
+ return $this;
123
+ }
124
+
125
+ /**
126
+ * Get all parameters
127
+ *
128
+ * @return array|object|ArrayAccess
129
+ */
130
+ public function getParams()
131
+ {
132
+ return $this->params;
133
+ }
134
+
135
+ /**
136
+ * Get an individual parameter
137
+ *
138
+ * If the parameter does not exist, the $default value will be returned.
139
+ *
140
+ * @param string|int $name
141
+ * @param mixed $default
142
+ * @return mixed
143
+ */
144
+ public function getParam($name, $default = null)
145
+ {
146
+ // Check in params that are arrays or implement array access
147
+ if (is_array($this->params) || $this->params instanceof ArrayAccess) {
148
+ if (!isset($this->params[$name])) {
149
+ return $default;
150
+ }
151
+
152
+ return $this->params[$name];
153
+ }
154
+
155
+ // Check in normal objects
156
+ if (!isset($this->params->{$name})) {
157
+ return $default;
158
+ }
159
+ return $this->params->{$name};
160
+ }
161
+
162
+ /**
163
+ * Set the event name
164
+ *
165
+ * @param string $name
166
+ * @return Zend_EventManager_Event
167
+ */
168
+ public function setName($name)
169
+ {
170
+ $this->name = (string) $name;
171
+ return $this;
172
+ }
173
+
174
+ /**
175
+ * Set the event target/context
176
+ *
177
+ * @param null|string|object $target
178
+ * @return Zend_EventManager_Event
179
+ */
180
+ public function setTarget($target)
181
+ {
182
+ $this->target = $target;
183
+ return $this;
184
+ }
185
+
186
+ /**
187
+ * Set an individual parameter to a value
188
+ *
189
+ * @param string|int $name
190
+ * @param mixed $value
191
+ * @return Zend_EventManager_Event
192
+ */
193
+ public function setParam($name, $value)
194
+ {
195
+ if (is_array($this->params) || $this->params instanceof ArrayAccess) {
196
+ // Arrays or objects implementing array access
197
+ $this->params[$name] = $value;
198
+ } else {
199
+ // Objects
200
+ $this->params->{$name} = $value;
201
+ }
202
+ return $this;
203
+ }
204
+
205
+ /**
206
+ * Stop further event propagation
207
+ *
208
+ * @param bool $flag
209
+ * @return void
210
+ */
211
+ public function stopPropagation($flag = true)
212
+ {
213
+ $this->stopPropagation = (bool) $flag;
214
+ }
215
+
216
+ /**
217
+ * Is propagation stopped?
218
+ *
219
+ * @return bool
220
+ */
221
+ public function propagationIsStopped()
222
+ {
223
+ return $this->stopPropagation;
224
+ }
225
+ }
lib/Zend/EventManager/EventCollection.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zend Framework
4
+ *
5
+ * LICENSE
6
+ *
7
+ * This source file is subject to the new BSD license that is bundled
8
+ * with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://framework.zend.com/license/new-bsd
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@zend.com so we can send you a copy immediately.
14
+ *
15
+ * @category Zend
16
+ * @package Zend_EventManager
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
+ * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ */
20
+
21
+ #require_once 'Zend/Stdlib/CallbackHandler.php';
22
+
23
+ /**
24
+ * Interface for messengers
25
+ *
26
+ * @category Zend
27
+ * @package Zend_EventManager
28
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
29
+ * @license http://framework.zend.com/license/new-bsd New BSD License
30
+ */
31
+ interface Zend_EventManager_EventCollection
32
+ {
33
+ /**
34
+ * Trigger an event
35
+ *
36
+ * Should allow handling the following scenarios:
37
+ * - Passing Event object only
38
+ * - Passing event name and Event object only
39
+ * - Passing event name, target, and Event object
40
+ * - Passing event name, target, and array|ArrayAccess of arguments
41
+ *
42
+ * Can emulate triggerUntil() if the last argument provided is a callback.
43
+ *
44
+ * @param string $event
45
+ * @param object|string $target
46
+ * @param array|object $argv
47
+ * @param null|callback $callback
48
+ * @return Zend_EventManager_ResponseCollection
49
+ */
50
+ public function trigger($event, $target = null, $argv = array(), $callback = null);
51
+
52
+ /**
53
+ * Trigger an event until the given callback returns a boolean false
54
+ *
55
+ * Should allow handling the following scenarios:
56
+ * - Passing Event object and callback only
57
+ * - Passing event name, Event object, and callback only
58
+ * - Passing event name, target, Event object, and callback
59
+ * - Passing event name, target, array|ArrayAccess of arguments, and callback
60
+ *
61
+ * @param string $event
62
+ * @param object|string $target
63
+ * @param array|object $argv
64
+ * @param callback $callback
65
+ * @return Zend_EventManager_ResponseCollection
66
+ */
67
+ public function triggerUntil($event, $target, $argv = null, $callback = null);
68
+
69
+ /**
70
+ * Attach a listener to an event
71
+ *
72
+ * @param string $event
73
+ * @param callback $callback
74
+ * @param int $priority Priority at which to register listener
75
+ * @return Zend_Stdlib_CallbackHandler
76
+ */
77
+ public function attach($event, $callback = null, $priority = 1);
78
+
79
+ /**
80
+ * Detach an event listener
81
+ *
82
+ * @param Zend_Stdlib_CallbackHandler|Zend_EventManager_ListenerAggregate $listener
83
+ * @return void
84
+ */
85
+ public function detach($listener);
86
+
87
+ /**
88
+ * Get a list of events for which this collection has listeners
89
+ *
90
+ * @return array
91
+ */
92
+ public function getEvents();
93
+
94
+ /**
95
+ * Retrieve a list of listeners registered to a given event
96
+ *
97
+ * @param string $event
98
+ * @return array|object
99
+ */
100
+ public function getListeners($event);
101
+
102
+ /**
103
+ * Clear all listeners for a given event
104
+ *
105
+ * @param string $event
106
+ * @return void
107
+ */
108
+ public function clearListeners($event);
109
+ }
lib/Zend/EventManager/EventDescription.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zend Framework
4
+ *
5
+ * LICENSE
6
+ *
7
+ * This source file is subject to the new BSD license that is bundled
8
+ * with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://framework.zend.com/license/new-bsd
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@zend.com so we can send you a copy immediately.
14
+ *
15
+ * @category Zend
16
+ * @package Zend_EventManager
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
+ * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ */
20
+
21
+ /**
22
+ * Representation of an event
23
+ *
24
+ * @category Zend
25
+ * @package Zend_EventManager
26
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27
+ * @license http://framework.zend.com/license/new-bsd New BSD License
28
+ */
29
+ interface Zend_EventManager_EventDescription
30
+ {
31
+ /**
32
+ * Get event name
33
+ *
34
+ * @return string
35
+ */
36
+ public function getName();
37
+
38
+ /**
39
+ * Get target/context from which event was triggered
40
+ *
41
+ * @return null|string|object
42
+ */
43
+ public function getTarget();
44
+
45
+ /**
46
+ * Get parameters passed to the event
47
+ *
48
+ * @return array|ArrayAccess
49
+ */
50
+ public function getParams();
51
+
52
+ /**
53
+ * Get a single parameter by name
54
+ *
55
+ * @param string $name
56
+ * @param mixed $default Default value to return if parameter does not exist
57
+ * @return mixed
58
+ */
59
+ public function getParam($name, $default = null);
60
+
61
+ /**
62
+ * Set the event name
63
+ *
64
+ * @param string $name
65
+ * @return void
66
+ */
67
+ public function setName($name);
68
+
69
+ /**
70
+ * Set the event target/context
71
+ *
72
+ * @param null|string|object $target
73
+ * @return void
74
+ */
75
+ public function setTarget($target);
76
+
77
+ /**
78
+ * Set event parameters
79
+ *
80
+ * @param string $params
81
+ * @return void
82
+ */
83
+ public function setParams($params);
84
+
85
+ /**
86
+ * Set a single parameter by key
87
+ *
88
+ * @param string $name
89
+ * @param mixed $value
90
+ * @return void
91
+ */
92
+ public function setParam($name, $value);
93
+
94
+ /**
95
+ * Indicate whether or not the parent EventCollection should stop propagating events
96
+ *
97
+ * @param bool $flag
98
+ * @return void
99
+ */
100
+ public function stopPropagation($flag = true);
101
+
102
+ /**
103
+ * Has this event indicated event propagation should stop?
104
+ *
105
+ * @return bool
106
+ */
107
+ public function propagationIsStopped();
108
+ }
lib/Zend/EventManager/EventManager.php ADDED
@@ -0,0 +1,551 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zend Framework
4
+ *
5
+ * LICENSE
6
+ *
7
+ * This source file is subject to the new BSD license that is bundled
8
+ * with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://framework.zend.com/license/new-bsd
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@zend.com so we can send you a copy immediately.
14
+ *
15
+ * @category Zend
16
+ * @package Zend_EventManager
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
+ * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ */
20
+
21
+ #require_once 'Zend/EventManager/Event.php';
22
+ #require_once 'Zend/EventManager/EventCollection.php';
23
+ #require_once 'Zend/EventManager/ResponseCollection.php';
24
+ #require_once 'Zend/EventManager/SharedEventCollectionAware.php';
25
+ #require_once 'Zend/EventManager/StaticEventManager.php';
26
+ #require_once 'Zend/Stdlib/CallbackHandler.php';
27
+ #require_once 'Zend/Stdlib/PriorityQueue.php';
28
+
29
+ /**
30
+ * Event manager: notification system
31
+ *
32
+ * Use the EventManager when you want to create a per-instance notification
33
+ * system for your objects.
34
+ *
35
+ * @category Zend
36
+ * @package Zend_EventManager
37
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
38
+ * @license http://framework.zend.com/license/new-bsd New BSD License
39
+ */
40
+ class Zend_EventManager_EventManager implements Zend_EventManager_EventCollection, Zend_EventManager_SharedEventCollectionAware
41
+ {
42
+ /**
43
+ * Subscribed events and their listeners
44
+ * @var array Array of Zend_Stdlib_PriorityQueue objects
45
+ */
46
+ protected $events = array();
47
+
48
+ /**
49
+ * @var string Class representing the event being emitted
50
+ */
51
+ protected $eventClass = 'Zend_EventManager_Event';
52
+
53
+ /**
54
+ * Identifiers, used to pull static signals from StaticEventManager
55
+ * @var array
56
+ */
57
+ protected $identifiers = array();
58
+
59
+ /**
60
+ * Static collections
61
+ * @var false|null|Zend_EventManager_StaticEventCollection
62
+ */
63
+ protected $sharedCollections = null;
64
+
65
+ /**
66
+ * Constructor
67
+ *
68
+ * Allows optionally specifying identifier(s) to use to pull signals from a
69
+ * StaticEventManager.
70
+ *
71
+ * @param null|string|int|array|Traversable $identifiers
72
+ * @return void
73
+ */
74
+ public function __construct($identifiers = null)
75
+ {
76
+ $this->setIdentifiers($identifiers);
77
+ }
78
+
79
+ /**
80
+ * Set the event class to utilize
81
+ *
82
+ * @param string $class
83
+ * @return Zend_EventManager_EventManager
84
+ */
85
+ public function setEventClass($class)
86
+ {
87
+ $this->eventClass = $class;
88
+ return $this;
89
+ }
90
+
91
+ /**
92
+ * Set static collections container
93
+ *
94
+ * @param Zend_EventManager_StaticEventCollection $collections
95
+ * @return void
96
+ */
97
+ public function setSharedCollections(Zend_EventManager_SharedEventCollection $collections)
98
+ {
99
+ $this->sharedCollections = $collections;
100
+ return $this;
101
+ }
102
+
103
+ /**
104
+ * Remove any shared collections
105
+ *
106
+ * Sets {@link $sharedCollections} to boolean false to disable ability
107
+ * to lazy-load static event manager instance.
108
+ *
109
+ * @return void
110
+ */
111
+ public function unsetSharedCollections()
112
+ {
113
+ $this->sharedCollections = false;
114
+ }
115
+
116
+ /**
117
+ * Get static collections container
118
+ *
119
+ * @return false|Zend_EventManager_SharedEventCollection
120
+ */
121
+ public function getSharedCollections()
122
+ {
123
+ if (null === $this->sharedCollections) {
124
+ $this->setSharedCollections(Zend_EventManager_StaticEventManager::getInstance());
125
+ }
126
+ return $this->sharedCollections;
127
+ }
128
+
129
+ /**
130
+ * Get the identifier(s) for this Zend_EventManager_EventManager
131
+ *
132
+ * @return array
133
+ */
134
+ public function getIdentifiers()
135
+ {
136
+ return $this->identifiers;
137
+ }
138
+
139
+ /**
140
+ * Set the identifiers (overrides any currently set identifiers)
141
+ *
142
+ * @param string|int|array|Traversable $identifiers
143
+ * @return Zend_EventManager_EventManager
144
+ */
145
+ public function setIdentifiers($identifiers)
146
+ {
147
+ if (is_array($identifiers) || $identifiers instanceof Traversable) {
148
+ $this->identifiers = array_unique((array) $identifiers);
149
+ } elseif ($identifiers !== null) {
150
+ $this->identifiers = array($identifiers);
151
+ }
152
+ return $this;
153
+ }
154
+
155
+ /**
156
+ * Add some identifier(s) (appends to any currently set identifiers)
157
+ *
158
+ * @param string|int|array|Traversable $identifiers
159
+ * @return Zend_EventManager_EventManager
160
+ */
161
+ public function addIdentifiers($identifiers)
162
+ {
163
+ if (is_array($identifiers) || $identifiers instanceof Traversable) {
164
+ $this->identifiers = array_unique($this->identifiers + (array) $identifiers);
165
+ } elseif ($identifiers !== null) {
166
+ $this->identifiers = array_unique(array_merge($this->identifiers, array($identifiers)));
167
+ }
168
+ return $this;
169
+ }
170
+
171
+ /**
172
+ * Trigger all listeners for a given event
173
+ *
174
+ * Can emulate triggerUntil() if the last argument provided is a callback.
175
+ *
176
+ * @param string $event
177
+ * @param string|object $target Object calling emit, or symbol describing target (such as static method name)
178
+ * @param array|ArrayAccess $argv Array of arguments; typically, should be associative
179
+ * @param null|callback $callback
180
+ * @return Zend_EventManager_ResponseCollection All listener return values
181
+ */
182
+ public function trigger($event, $target = null, $argv = array(), $callback = null)
183
+ {
184
+ if ($event instanceof Zend_EventManager_EventDescription) {
185
+ $e = $event;
186
+ $event = $e->getName();
187
+ $callback = $target;
188
+ } elseif ($target instanceof Zend_EventManager_EventDescription) {
189
+ $e = $target;
190
+ $e->setName($event);
191
+ $callback = $argv;
192
+ } elseif ($argv instanceof Zend_EventManager_EventDescription) {
193
+ $e = $argv;
194
+ $e->setName($event);
195
+ $e->setTarget($target);
196
+ } else {
197
+ $e = new $this->eventClass();
198
+ $e->setName($event);
199
+ $e->setTarget($target);
200
+ $e->setParams($argv);
201
+ }
202
+
203
+ if ($callback && !is_callable($callback)) {
204
+ #require_once 'Zend/Stdlib/Exception/InvalidCallbackException.php';
205
+ throw new Zend_Stdlib_Exception_InvalidCallbackException('Invalid callback provided');
206
+ }
207
+
208
+ return $this->triggerListeners($event, $e, $callback);
209
+ }
210
+
211
+ /**
212
+ * Trigger listeners until return value of one causes a callback to
213
+ * evaluate to true
214
+ *
215
+ * Triggers listeners until the provided callback evaluates the return
216
+ * value of one as true, or until all listeners have been executed.
217
+ *
218
+ * @param string $event
219
+ * @param string|object $target Object calling emit, or symbol describing target (such as static method name)
220
+ * @param array|ArrayAccess $argv Array of arguments; typically, should be associative
221
+ * @param Callable $callback
222
+ * @throws Zend_Stdlib_Exception_InvalidCallbackException if invalid callback provided
223
+ */
224
+ public function triggerUntil($event, $target, $argv = null, $callback = null)
225
+ {
226
+ if ($event instanceof Zend_EventManager_EventDescription) {
227
+ $e = $event;
228
+ $event = $e->getName();
229
+ $callback = $target;
230
+ } elseif ($target instanceof Zend_EventManager_EventDescription) {
231
+ $e = $target;
232
+ $e->setName($event);
233
+ $callback = $argv;
234
+ } elseif ($argv instanceof Zend_EventManager_EventDescription) {
235
+ $e = $argv;
236
+ $e->setName($event);
237
+ $e->setTarget($target);
238
+ } else {
239
+ $e = new $this->eventClass();
240
+ $e->setName($event);
241
+ $e->setTarget($target);
242
+ $e->setParams($argv);
243
+ }
244
+
245
+ if (!is_callable($callback)) {
246
+ #require_once 'Zend/Stdlib/Exception/InvalidCallbackException.php';
247
+ throw new Zend_Stdlib_Exception_InvalidCallbackException('Invalid callback provided');
248
+ }
249
+
250
+ return $this->triggerListeners($event, $e, $callback);
251
+ }
252
+
253
+ /**
254
+ * Attach a listener to an event
255
+ *
256
+ * The first argument is the event, and the next argument describes a
257
+ * callback that will respond to that event. A CallbackHandler instance
258
+ * describing the event listener combination will be returned.
259
+ *
260
+ * The last argument indicates a priority at which the event should be
261
+ * executed. By default, this value is 1; however, you may set it for any
262
+ * integer value. Higher values have higher priority (i.e., execute first).
263
+ *
264
+ * You can specify "*" for the event name. In such cases, the listener will
265
+ * be triggered for every event.
266
+ *
267
+ * @param string|array|Zend_EventManager_ListenerAggregate $event An event or array of event names. If a ListenerAggregate, proxies to {@link attachAggregate()}.
268
+ * @param callback|int $callback If string $event provided, expects PHP callback; for a ListenerAggregate $event, this will be the priority
269
+ * @param int $priority If provided, the priority at which to register the callback
270
+ * @return Zend_Stdlib_CallbackHandler|mixed CallbackHandler if attaching callback (to allow later unsubscribe); mixed if attaching aggregate
271
+ */
272
+ public function attach($event, $callback = null, $priority = 1)
273
+ {
274
+ // Proxy ListenerAggregate arguments to attachAggregate()
275
+ if ($event instanceof Zend_EventManager_ListenerAggregate) {
276
+ return $this->attachAggregate($event, $callback);
277
+ }
278
+
279
+ // Null callback is invalid
280
+ if (null === $callback) {
281
+ #require_once 'Zend/EventManager/Exception/InvalidArgumentException.php';
282
+ throw new Zend_EventManager_Exception_InvalidArgumentException(sprintf(
283
+ '%s: expects a callback; none provided',
284
+ __METHOD__
285
+ ));
286
+ }
287
+
288
+ // Array of events should be registered individually, and return an array of all listeners
289
+ if (is_array($event)) {
290
+ $listeners = array();
291
+ foreach ($event as $name) {
292
+ $listeners[] = $this->attach($name, $callback, $priority);
293
+ }
294
+ return $listeners;
295
+ }
296
+
297
+ // If we don't have a priority queue for the event yet, create one
298
+ if (empty($this->events[$event])) {
299
+ $this->events[$event] = new Zend_Stdlib_PriorityQueue();
300
+ }
301
+
302
+ // Create a callback handler, setting the event and priority in its metadata
303
+ $listener = new Zend_Stdlib_CallbackHandler($callback, array('event' => $event, 'priority' => $priority));
304
+
305
+ // Inject the callback handler into the queue
306
+ $this->events[$event]->insert($listener, $priority);
307
+ return $listener;
308
+ }
309
+
310
+ /**
311
+ * Attach a listener aggregate
312
+ *
313
+ * Listener aggregates accept an EventCollection instance, and call attach()
314
+ * one or more times, typically to attach to multiple events using local
315
+ * methods.
316
+ *
317
+ * @param Zend_EventManager_ListenerAggregate $aggregate
318
+ * @param int $priority If provided, a suggested priority for the aggregate to use
319
+ * @return mixed return value of {@link Zend_EventManager_ListenerAggregate::attach()}
320
+ */
321
+ public function attachAggregate(Zend_EventManager_ListenerAggregate $aggregate, $priority = 1)
322
+ {
323
+ return $aggregate->attach($this, $priority);
324
+ }
325
+
326
+ /**
327
+ * Unsubscribe a listener from an event
328
+ *
329
+ * @param Zend_Stdlib_CallbackHandler|Zend_EventManager_ListenerAggregate $listener
330
+ * @return bool Returns true if event and listener found, and unsubscribed; returns false if either event or listener not found
331
+ * @throws Zend_EventManager_Exception_InvalidArgumentException if invalid listener provided
332
+ */
333
+ public function detach($listener)
334
+ {
335
+ if ($listener instanceof Zend_EventManager_ListenerAggregate) {
336
+ return $this->detachAggregate($listener);
337
+ }
338
+
339
+ if (!$listener instanceof Zend_Stdlib_CallbackHandler) {
340
+ #require_once 'Zend/EventManager/Exception/InvalidArgumentException.php';
341
+ throw new Zend_EventManager_Exception_InvalidArgumentException(sprintf(
342
+ '%s: expected a Zend_EventManager_ListenerAggregate or Zend_Stdlib_CallbackHandler; received "%s"',
343
+ __METHOD__,
344
+ (is_object($listener) ? get_class($listener) : gettype($listener))
345
+ ));
346
+ }
347
+
348
+ $event = $listener->getMetadatum('event');
349
+ if (!$event || empty($this->events[$event])) {
350
+ return false;
351
+ }
352
+ $return = $this->events[$event]->remove($listener);
353
+ if (!$return) {
354
+ return false;
355
+ }
356
+ if (!count($this->events[$event])) {
357
+ unset($this->events[$event]);
358
+ }
359
+ return true;
360
+ }
361
+
362
+ /**
363
+ * Detach a listener aggregate
364
+ *
365
+ * Listener aggregates accept an EventCollection instance, and call detach()
366
+ * of all previously attached listeners.
367
+ *
368
+ * @param Zend_EventManager_ListenerAggregate $aggregate
369
+ * @return mixed return value of {@link Zend_EventManager_ListenerAggregate::detach()}
370
+ */
371
+ public function detachAggregate(Zend_EventManager_ListenerAggregate $aggregate)
372
+ {
373
+ return $aggregate->detach($this);
374
+ }
375
+
376
+ /**
377
+ * Retrieve all registered events
378
+ *
379
+ * @return array
380
+ */
381
+ public function getEvents()
382
+ {
383
+ return array_keys($this->events);
384
+ }
385
+
386
+ /**
387
+ * Retrieve all listeners for a given event
388
+ *
389
+ * @param string $event
390
+ * @return Zend_Stdlib_PriorityQueue
391
+ */
392
+ public function getListeners($event)
393
+ {
394
+ if (!array_key_exists($event, $this->events)) {
395
+ return new Zend_Stdlib_PriorityQueue();
396
+ }
397
+ return $this->events[$event];
398
+ }
399
+
400
+ /**
401
+ * Clear all listeners for a given event
402
+ *
403
+ * @param string $event
404
+ * @return void
405
+ */
406
+ public function clearListeners($event)
407
+ {
408
+ if (!empty($this->events[$event])) {
409
+ unset($this->events[$event]);
410
+ }
411
+ }
412
+
413
+ /**
414
+ * Prepare arguments
415
+ *
416
+ * Use this method if you want to be able to modify arguments from within a
417
+ * listener. It returns an ArrayObject of the arguments, which may then be
418
+ * passed to trigger() or triggerUntil().
419
+ *
420
+ * @param array $args
421
+ * @return ArrayObject
422
+ */
423
+ public function prepareArgs(array $args)
424
+ {
425
+ return new ArrayObject($args);
426
+ }
427
+
428
+ /**
429
+ * Trigger listeners
430
+ *
431
+ * Actual functionality for triggering listeners, to which both trigger() and triggerUntil()
432
+ * delegate.
433
+ *
434
+ * @param string $event Event name
435
+ * @param EventDescription $e
436
+ * @param null|callback $callback
437
+ * @return ResponseCollection
438
+ */
439
+ protected function triggerListeners($event, Zend_EventManager_EventDescription $e, $callback = null)
440
+ {
441
+ $responses = new Zend_EventManager_ResponseCollection;
442
+ $listeners = $this->getListeners($event);
443
+
444
+ // Add shared/wildcard listeners to the list of listeners,
445
+ // but don't modify the listeners object
446
+ $sharedListeners = $this->getSharedListeners($event);
447
+ $sharedWildcardListeners = $this->getSharedListeners('*');
448
+ $wildcardListeners = $this->getListeners('*');
449
+ if (count($sharedListeners) || count($sharedWildcardListeners) || count($wildcardListeners)) {
450
+ $listeners = clone $listeners;
451
+ }
452
+
453
+ // Shared listeners on this specific event
454
+ $this->insertListeners($listeners, $sharedListeners);
455
+
456
+ // Shared wildcard listeners
457
+ $this->insertListeners($listeners, $sharedWildcardListeners);
458
+
459
+ // Add wildcard listeners
460
+ $this->insertListeners($listeners, $wildcardListeners);
461
+
462
+ if ($listeners->isEmpty()) {
463
+ return $responses;
464
+ }
465
+
466
+ foreach ($listeners as $listener) {
467
+ // Trigger the listener's callback, and push its result onto the
468
+ // response collection
469
+ $responses->push(call_user_func($listener->getCallback(), $e));
470
+
471
+ // If the event was asked to stop propagating, do so
472
+ if ($e->propagationIsStopped()) {
473
+ $responses->setStopped(true);
474
+ break;
475
+ }
476
+
477
+ // If the result causes our validation callback to return true,
478
+ // stop propagation
479
+ if ($callback && call_user_func($callback, $responses->last())) {
480
+ $responses->setStopped(true);
481
+ break;
482
+ }
483
+ }
484
+
485
+ return $responses;
486
+ }
487
+
488
+ /**
489
+ * Get list of all listeners attached to the shared collection for
490
+ * identifiers registered by this instance
491
+ *
492
+ * @param string $event
493
+ * @return array
494
+ */
495
+ protected function getSharedListeners($event)
496
+ {
497
+ if (!$sharedCollections = $this->getSharedCollections()) {
498
+ return array();
499
+ }
500
+
501
+ $identifiers = $this->getIdentifiers();
502
+ $sharedListeners = array();
503
+
504
+ foreach ($identifiers as $id) {
505
+ if (!$listeners = $sharedCollections->getListeners($id, $event)) {
506
+ continue;
507
+ }
508
+
509
+ if (!is_array($listeners) && !($listeners instanceof Traversable)) {
510
+ continue;
511
+ }
512
+
513
+ foreach ($listeners as $listener) {
514
+ if (!$listener instanceof Zend_Stdlib_CallbackHandler) {
515
+ continue;
516
+ }
517
+ $sharedListeners[] = $listener;
518
+ }
519
+ }
520
+
521
+ return $sharedListeners;
522
+ }
523
+
524
+ /**
525
+ * Add listeners to the master queue of listeners
526
+ *
527
+ * Used to inject shared listeners and wildcard listeners.
528
+ *
529
+ * @param Zend_Stdlib_PriorityQueue $masterListeners
530
+ * @param Zend_Stdlib_PriorityQueue $listeners
531
+ * @return void
532
+ */
533
+ protected function insertListeners($masterListeners, $listeners)
534
+ {
535
+ if (!count($listeners)) {
536
+ return;
537
+ }
538
+
539
+ foreach ($listeners as $listener) {
540
+ $priority = $listener->getMetadatum('priority');
541
+ if (null === $priority) {
542
+ $priority = 1;
543
+ } elseif (is_array($priority)) {
544
+ // If we have an array, likely using PriorityQueue. Grab first
545
+ // element of the array, as that's the actual priority.
546
+ $priority = array_shift($priority);
547
+ }
548
+ $masterListeners->insert($listener, $priority);
549
+ }
550
+ }
551
+ }
lib/Zend/EventManager/EventManagerAware.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zend Framework
4
+ *
5
+ * LICENSE
6
+ *
7
+ * This source file is subject to the new BSD license that is bundled
8
+ * with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://framework.zend.com/license/new-bsd
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@zend.com so we can send you a copy immediately.
14
+ *
15
+ * @category Zend
16
+ * @package Zend_EventManager
17
+ * @subpackage UnitTest
18
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19
+ * @license http://framework.zend.com/license/new-bsd New BSD License
20
+ */
21
+
22
+ /**
23
+ * Interface to automate setter injection for an EventManager instance
24
+ *
25
+ * @category Zend
26
+ * @package Zend_EventManager
27
+ * @subpackage UnitTest
28
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
29
+ * @license http://framework.zend.com/license/new-bsd New BSD License
30
+ */
31
+ interface Zend_EventManager_EventManagerAware
32
+ {
33
+ /**
34
+ * Inject an EventManager instance
35
+ *
36
+ * @param Zend_EventManager_EventCollection $eventManager
37
+ * @return void
38
+ */
39
+ public function setEventManager(Zend_EventManager_EventCollection $eventManager);
40
+ }
lib/Zend/EventManager/Exception.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zend Framework
4
+ *
5
+ * LICENSE
6
+ *
7
+ * This source file is subject to the new BSD license that is bundled
8
+ * with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://framework.zend.com/license/new-bsd
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@zend.com so we can send you a copy immediately.
14
+ *
15
+ * @category Zend
16
+ * @package Zend_EventManager
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
+ * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ */
20
+
21
+ /**
22
+ * Base exception interface
23
+ *
24
+ * @category Zend
25
+ * @package Zend_EventManager
26
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
27
+ * @license http://framework.zend.com/license/new-bsd New BSD License
28
+ */
29
+ interface Zend_EventManager_Exception
30
+ {
31
+ }
lib/Zend/EventManager/Exception/InvalidArgumentException.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zend Framework
4
+ *
5
+ * LICENSE
6
+ *
7
+ * This source file is subject to the new BSD license that is bundled
8
+ * with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://framework.zend.com/license/new-bsd
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@zend.com so we can send you a copy immediately.
14
+ *
15
+ * @category Zend
16
+ * @package Zend_EventManager
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
+ * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ */
20
+
21
+ /**
22
+ * @see Zend_Exception
23
+ */
24
+ #require_once 'Zend/Exception.php';
25
+
26
+ /**
27
+ * @see Zend_EventManager_Exception
28
+ */
29
+ #require_once 'Zend/EventManager/Exception.php';
30
+
31
+ /**
32
+ * Invalid argument exception
33
+ *
34
+ * @category Zend
35
+ * @package Zend_EventManager
36
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37
+ * @license http://framework.zend.com/license/new-bsd New BSD License
38
+ */
39
+ class Zend_EventManager_Exception_InvalidArgumentException
40
+ extends Zend_Exception implements Zend_EventManager_Exception
41
+ {
42
+ }
lib/Zend/EventManager/Filter.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zend Framework
4
+ *
5
+ * LICENSE
6
+ *
7
+ * This source file is subject to the new BSD license that is bundled
8
+ * with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://framework.zend.com/license/new-bsd
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@zend.com so we can send you a copy immediately.
14
+ *
15
+ * @category Zend
16
+ * @package Zend_EventManager
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
+ * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ */
20
+
21
+ #require_once 'Zend/Stdlib/CallbackHandler.php';
22
+
23
+ /**
24
+ * Interface for intercepting filter chains
25
+ *
26
+ * @category Zend
27
+ * @package Zend_EventManager
28
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
29
+ * @license http://framework.zend.com/license/new-bsd New BSD License
30
+ */
31
+ interface Zend_EventManager_Filter
32
+ {
33
+ /**
34
+ * Execute the filter chain
35
+ *
36
+ * @param string|object $context
37
+ * @param array $params
38
+ * @return mixed
39
+ */
40
+ public function run($context, array $params = array());
41
+
42
+ /**
43
+ * Attach an intercepting filter
44
+ *
45
+ * @param callback $callback
46
+ * @return Zend_Stdlib_CallbackHandler
47
+ */
48
+ public function attach($callback);
49
+
50
+ /**
51
+ * Detach an intercepting filter
52
+ *
53
+ * @param Zend_Stdlib_CallbackHandler $filter
54
+ * @return bool
55
+ */
56
+ public function detach(Zend_Stdlib_CallbackHandler $filter);
57
+
58
+ /**
59
+ * Get all intercepting filters
60
+ *
61
+ * @return array
62
+ */
63
+ public function getFilters();
64
+
65
+ /**
66
+ * Clear all filters
67
+ *
68
+ * @return void
69
+ */
70
+ public function clearFilters();
71
+
72
+ /**
73
+ * Get all filter responses
74
+ *
75
+ * @return Zend_EventManager_ResponseCollection
76
+ */
77
+ public function getResponses();
78
+ }
lib/Zend/EventManager/Filter/FilterIterator.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zend Framework
4
+ *
5
+ * LICENSE
6
+ *
7
+ * This source file is subject to the new BSD license that is bundled
8
+ * with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://framework.zend.com/license/new-bsd
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@zend.com so we can send you a copy immediately.
14
+ *
15
+ * @category Zend
16
+ * @package Zend_EventManager
17
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18
+ * @license http://framework.zend.com/license/new-bsd New BSD License
19
+ */
20
+
21
+ #require_once 'Zend/Stdlib/CallbackHandler.php';
22
+ #require_once 'Zend/Stdlib/SplPriorityQueue.php';
23
+
24
+ /**
25
+ * Specialized priority queue implementation for use with an intercepting
26
+ * filter chain.
27
+ *
28
+ * Allows removal
29
+ *
30
+ * @category Zend
31
+ * @package Zend_EventManager
32
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33
+ * @license http://framework.zend.com/license/new-bsd New BSD License
34
+ */
35
+ class Zend_EventManager_Filter_FilterIterator extends Zend_Stdlib_SplPriorityQueue
36
+ {
37
+ /**
38
+ * Does the queue contain a given value?
39
+ *
40
+ * @param mixed $datum
41
+ * @return bool
42
+ */
43
+ public function contains($datum)
44
+ {
45
+ $chain = clone $this;
46
+ foreach ($chain as $item) {
47
+ if ($item === $datum) {
48
+ return true;
49
+ }
50
+ }
51
+ return false;
52
+ }
53
+
54
+ /**
55
+ * Remove a value from the queue
56
+ *
57
+ * This is an expensive operation. It must first iterate through all values,
58
+ * and then re-populate itself. Use only if absolutely necessary.
59
+ *
60
+ * @param mixed $datum
61
+ * @return bool
62
+ */
63
+ public function remove($datum)
64
+ {
65
+ $this->setExtractFlags(self::EXTR_BOTH);
66
+
67
+ // Iterate and remove any matches
68
+ $removed = false;
69
+ $items = array();
70
+ $this->rewind();
71
+ while (!$this->isEmpty()) {
72
+ $item = $this->extract();
73
+ if ($item['data'] === $datum) {
74
+ $removed = true;
75
+ continue;
76
+ }
77
+ $items[] = $item;
78
+ }
79
+
80
+ // Repopulate
81
+ foreach ($items as $item) {
82
+ $this->insert($item['data'], $item['priority']);
83
+ }
84
+
85
+ $this->setExtractFlags(self::EXTR_DATA);
86
+ return $removed;
87
+ }
88
+
89
+ /**
90
+ * Iterate the next filter in the chain
91
+ *
92
+ * Itera