WP Offload S3 Lite - Version 1.3

Version Description

= 1.1 = This is a major change, which ensures S3 URLs are no longer saved in post content. Instead, local URLs are filtered on page generation and replaced with the S3 version. If you depend on the S3 URLs being stored in post content you will need to make modifications to support this version.

= 0.6 = This version requires PHP 5.3.3+ and the Amazon Web Services plugin

Download this release

Release Info

Developer deliciousbrains
Plugin Icon 128x128 WP Offload S3 Lite
Version 1.3
Comparing to
See all releases

Code changes from version 1.2.1 to 1.3

Files changed (267) hide show
  1. README.md +18 -1
  2. assets/css/notice.css +1 -1
  3. assets/css/styles.css +1 -1
  4. assets/img/as3cf-banner-bw.jpg +0 -0
  5. assets/img/as3cf-banner-bw@2x.jpg +0 -0
  6. assets/img/as3cf-banner.jpg +0 -0
  7. assets/img/as3cf-banner@2x.jpg +0 -0
  8. assets/img/aws-logo.svg +17 -0
  9. assets/img/icon-assets-pull.svg +10 -0
  10. assets/img/icon16.png +0 -0
  11. assets/img/snail-banner.jpg +0 -0
  12. assets/img/snail-banner@2x.jpg +0 -0
  13. assets/js/script.js +145 -14
  14. assets/js/script.min.js +1 -1
  15. assets/sass/notice.scss +5 -1
  16. assets/sass/styles.scss +205 -30
  17. classes/amazon-s3-and-cloudfront.php +366 -136
  18. classes/amazon-web-services.php +167 -0
  19. classes/{wp-aws-compatibility-check.php → as3cf-compatibility-check.php} +175 -19
  20. classes/as3cf-filter.php +14 -0
  21. classes/as3cf-plugin-base.php +605 -0
  22. classes/as3cf-plugin-compatibility.php +86 -1
  23. classes/as3cf-stream-wrapper.php +6 -3
  24. classes/as3cf-utils.php +17 -71
  25. classes/filters/as3cf-local-to-s3.php +51 -14
  26. classes/upgrades/upgrade.php +1 -1
  27. composer.json +2 -2
  28. languages/amazon-s3-and-cloudfront-en.pot +375 -150
  29. readme.txt +18 -1
  30. vendor/Aws2/aws/aws-sdk-php/LICENSE.md +141 -0
  31. vendor/Aws2/aws/aws-sdk-php/NOTICE.md +112 -0
  32. vendor/Aws2/aws/aws-sdk-php/composer.json +51 -0
  33. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Aws.php +97 -0
  34. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/AbstractClient.php +215 -0
  35. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/AwsClientInterface.php +107 -0
  36. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/ClientBuilder.php +429 -0
  37. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/DefaultClient.php +63 -0
  38. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/ExpiredCredentialsChecker.php +68 -0
  39. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/ThrottlingErrorChecker.php +60 -0
  40. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/UploadBodyListener.php +87 -0
  41. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/UserAgentListener.php +58 -0
  42. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Command/AwsQueryVisitor.php +108 -0
  43. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Command/JsonCommand.php +43 -0
  44. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Command/QueryCommand.php +49 -0
  45. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Command/XmlResponseLocationVisitor.php +63 -0
  46. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/AbstractCredentialsDecorator.php +120 -0
  47. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/AbstractRefreshableCredentials.php +80 -0
  48. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/CacheableCredentials.php +69 -0
  49. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/Credentials.php +270 -0
  50. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/CredentialsInterface.php +88 -0
  51. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/NullCredentials.php +59 -0
  52. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/RefreshableInstanceProfileCredentials.php +75 -0
  53. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum.php +51 -0
  54. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/ClientOptions.php +142 -0
  55. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/DateFormat.php +30 -0
  56. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/Region.php +52 -0
  57. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/Size.php +46 -0
  58. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/Time.php +39 -0
  59. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/UaString.php +49 -0
  60. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/AwsExceptionInterface.php +30 -0
  61. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/BadMethodCallException.php +24 -0
  62. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/DomainException.php +24 -0
  63. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/ExceptionFactoryInterface.php +35 -0
  64. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/ExceptionListener.php +55 -0
  65. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/InstanceProfileCredentialsException.php +47 -0
  66. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/InvalidArgumentException.php +24 -0
  67. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/LogicException.php +24 -0
  68. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/MultipartUploadException.php +47 -0
  69. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/NamespaceExceptionFactory.php +89 -0
  70. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/OutOfBoundsException.php +24 -0
  71. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/OverflowException.php +24 -0
  72. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/Parser/AbstractJsonExceptionParser.php +54 -0
  73. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/Parser/DefaultXmlExceptionParser.php +93 -0
  74. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/Parser/ExceptionParserInterface.php +41 -0
  75. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/Parser/JsonQueryExceptionParser.php +39 -0
  76. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/Parser/JsonRestExceptionParser.php +44 -0
  77. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/RequiredExtensionNotLoadedException.php +24 -0
  78. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/RuntimeException.php +24 -0
  79. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/ServiceResponseException.php +194 -0
  80. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/TransferException.php +25 -0
  81. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/UnexpectedValueException.php +24 -0
  82. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Facade/Facade.php +65 -0
  83. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Facade/FacadeInterface.php +34 -0
  84. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Facade/facade-classes.php +249 -0
  85. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Hash/ChunkHash.php +77 -0
  86. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Hash/ChunkHashInterface.php +49 -0
  87. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Hash/HashUtils.php +70 -0
  88. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Hash/TreeHash.php +169 -0
  89. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/HostNameUtils.php +75 -0
  90. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/InstanceMetadata/InstanceMetadataClient.php +81 -0
  91. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/InstanceMetadata/Waiter/ServiceAvailable.php +46 -0
  92. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Iterator/AwsResourceIterator.php +152 -0
  93. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Iterator/AwsResourceIteratorFactory.php +84 -0
  94. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/AbstractTransfer.php +219 -0
  95. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/AbstractTransferState.php +145 -0
  96. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/AbstractUploadBuilder.php +131 -0
  97. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/AbstractUploadId.php +81 -0
  98. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/AbstractUploadPart.php +91 -0
  99. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/TransferInterface.php +61 -0
  100. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/TransferStateInterface.php +84 -0
  101. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/UploadIdInterface.php +38 -0
  102. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/UploadPartInterface.php +44 -0
  103. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Resources/aws-config.php +17 -0
  104. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Resources/public-endpoints.php +3 -0
  105. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Resources/sdk1-config.php +17 -0
  106. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/RulesEndpointProvider.php +55 -0
  107. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Signature/AbstractSignature.php +39 -0
  108. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Signature/EndpointSignatureInterface.php +41 -0
  109. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Signature/SignatureInterface.php +46 -0
  110. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Signature/SignatureListener.php +76 -0
  111. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Signature/SignatureV2.php +86 -0
  112. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Signature/SignatureV3Https.php +47 -0
  113. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Signature/SignatureV4.php +360 -0
  114. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/AbstractResourceWaiter.php +48 -0
  115. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/AbstractWaiter.php +120 -0
  116. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/CallableWaiter.php +73 -0
  117. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/CompositeWaiterFactory.php +81 -0
  118. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/ConfigResourceWaiter.php +185 -0
  119. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/ResourceWaiterInterface.php +33 -0
  120. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/WaiterClassFactory.php +95 -0
  121. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/WaiterConfig.php +64 -0
  122. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/WaiterConfigFactory.php +86 -0
  123. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/WaiterFactoryInterface.php +40 -0
  124. vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/WaiterInterface.php +56 -0
  125. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/AcpListener.php +68 -0
  126. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/BucketStyleListener.php +73 -0
  127. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Command/S3Command.php +57 -0
  128. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/CannedAcl.php +31 -0
  129. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/EncodingType.php +26 -0
  130. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/Event.php +26 -0
  131. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/GranteeType.php +28 -0
  132. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/Group.php +28 -0
  133. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/MFADelete.php +27 -0
  134. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/MetadataDirective.php +27 -0
  135. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/Payer.php +27 -0
  136. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/Permission.php +30 -0
  137. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/Protocol.php +27 -0
  138. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/ServerSideEncryption.php +26 -0
  139. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/Status.php +27 -0
  140. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/Storage.php +28 -0
  141. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/StorageClass.php +27 -0
  142. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/AccessDeniedException.php +24 -0
  143. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/AccountProblemException.php +24 -0
  144. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/AmbiguousGrantByEmailAddressException.php +24 -0
  145. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/BadDigestException.php +24 -0
  146. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/BucketAlreadyExistsException.php +24 -0
  147. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/BucketAlreadyOwnedByYouException.php +24 -0
  148. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/BucketNotEmptyException.php +24 -0
  149. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/CredentialsNotSupportedException.php +24 -0
  150. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/CrossLocationLoggingProhibitedException.php +24 -0
  151. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/DeleteMultipleObjectsException.php +46 -0
  152. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/EntityTooLargeException.php +24 -0
  153. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/EntityTooSmallException.php +24 -0
  154. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/ExpiredTokenException.php +24 -0
  155. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/IllegalVersioningConfigurationException.php +24 -0
  156. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/IncompleteBodyException.php +24 -0
  157. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/IncorrectNumberOfFilesInPostRequestException.php +24 -0
  158. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InlineDataTooLargeException.php +24 -0
  159. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InternalErrorException.php +24 -0
  160. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidAccessKeyIdException.php +24 -0
  161. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidAddressingHeaderException.php +24 -0
  162. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidArgumentException.php +24 -0
  163. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidBucketNameException.php +24 -0
  164. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidBucketStateException.php +24 -0
  165. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidDigestException.php +24 -0
  166. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidLocationConstraintException.php +24 -0
  167. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidPartException.php +24 -0
  168. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidPartOrderException.php +24 -0
  169. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidPayerException.php +24 -0
  170. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidPolicyDocumentException.php +24 -0
  171. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidRangeException.php +24 -0
  172. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidRequestException.php +24 -0
  173. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidSOAPRequestException.php +24 -0
  174. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidSecurityException.php +24 -0
  175. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidStorageClassException.php +24 -0
  176. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidTagErrorException.php +25 -0
  177. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidTargetBucketForLoggingException.php +24 -0
  178. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidTokenException.php +24 -0
  179. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidURIException.php +24 -0
  180. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/KeyTooLongException.php +24 -0
  181. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MalformedACLErrorException.php +24 -0
  182. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MalformedPOSTRequestException.php +24 -0
  183. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MalformedXMLException.php +24 -0
  184. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MaxMessageLengthExceededException.php +24 -0
  185. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MaxPostPreDataLengthExceededErrorException.php +24 -0
  186. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MetadataTooLargeException.php +24 -0
  187. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MethodNotAllowedException.php +24 -0
  188. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MissingAttachmentException.php +24 -0
  189. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MissingContentLengthException.php +24 -0
  190. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MissingRequestBodyErrorException.php +24 -0
  191. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MissingSecurityElementException.php +24 -0
  192. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MissingSecurityHeaderException.php +24 -0
  193. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoLoggingStatusForKeyException.php +24 -0
  194. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchBucketException.php +24 -0
  195. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchBucketPolicyException.php +24 -0
  196. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchCORSConfigurationException.php +24 -0
  197. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchKeyException.php +24 -0
  198. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchLifecycleConfigurationException.php +24 -0
  199. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchTagSetException.php +24 -0
  200. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchUploadException.php +24 -0
  201. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchVersionException.php +24 -0
  202. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchWebsiteConfigurationException.php +24 -0
  203. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NotImplementedException.php +24 -0
  204. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NotSignedUpException.php +24 -0
  205. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NotSuchBucketPolicyException.php +24 -0
  206. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/ObjectAlreadyInActiveTierErrorException.php +24 -0
  207. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/ObjectNotInActiveTierErrorException.php +24 -0
  208. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/OperationAbortedException.php +24 -0
  209. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/Parser/S3ExceptionParser.php +65 -0
  210. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/PermanentRedirectException.php +24 -0
  211. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/PreconditionFailedException.php +24 -0
  212. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/RedirectException.php +24 -0
  213. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/RequestIsNotMultiPartContentException.php +24 -0
  214. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/RequestTimeTooSkewedException.php +24 -0
  215. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/RequestTimeoutException.php +24 -0
  216. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/RequestTorrentOfBucketErrorException.php +24 -0
  217. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/S3Exception.php +25 -0
  218. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/ServiceUnavailableException.php +24 -0
  219. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/SignatureDoesNotMatchException.php +24 -0
  220. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/SlowDownException.php +24 -0
  221. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/TemporaryRedirectException.php +24 -0
  222. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/TokenRefreshRequiredException.php +24 -0
  223. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/TooManyBucketsException.php +24 -0
  224. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/UnexpectedContentException.php +24 -0
  225. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/UnresolvableGrantByEmailAddressException.php +24 -0
  226. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/UserKeyMustBeSpecifiedException.php +24 -0
  227. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/IncompleteMultipartUploadChecker.php +44 -0
  228. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Iterator/ListBucketsIterator.php +45 -0
  229. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Iterator/ListMultipartUploadsIterator.php +43 -0
  230. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Iterator/ListObjectVersionsIterator.php +45 -0
  231. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Iterator/ListObjectsIterator.php +62 -0
  232. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Iterator/OpendirIterator.php +75 -0
  233. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/Acp.php +208 -0
  234. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/AcpBuilder.php +120 -0
  235. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/ClearBucket.php +161 -0
  236. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/DeleteObjectsBatch.php +72 -0
  237. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/DeleteObjectsTransfer.php +112 -0
  238. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/Grant.php +114 -0
  239. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/Grantee.php +211 -0
  240. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/MultipartUpload/AbstractTransfer.php +83 -0
  241. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/MultipartUpload/ParallelTransfer.php +100 -0
  242. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/MultipartUpload/SerialTransfer.php +65 -0
  243. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/MultipartUpload/TransferState.php +38 -0
  244. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/MultipartUpload/UploadBuilder.php +243 -0
  245. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/MultipartUpload/UploadId.php +30 -0
  246. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/MultipartUpload/UploadPart.php +62 -0
  247. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/PostObject.php +229 -0
  248. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Resources/s3-2006-03-01.php +17 -0
  249. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/ResumableDownload.php +150 -0
  250. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/S3Client.php +524 -0
  251. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/S3Md5Listener.php +65 -0
  252. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/S3Signature.php +191 -0
  253. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/S3SignatureInterface.php +25 -0
  254. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/S3SignatureV4.php +53 -0
  255. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/SocketTimeoutChecker.php +60 -0
  256. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/SseCpkListener.php +54 -0
  257. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/StreamWrapper.php +757 -0
  258. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/AbstractSync.php +114 -0
  259. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/AbstractSyncBuilder.php +359 -0
  260. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/ChangedFilesIterator.php +105 -0
  261. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/DownloadSync.php +83 -0
  262. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/DownloadSyncBuilder.php +97 -0
  263. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/FilenameConverterInterface.php +32 -0
  264. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/KeyConverter.php +55 -0
  265. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/UploadSync.php +61 -0
  266. vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/UploadSyncBuilder.php +147 -0
  267. vendor/Aws2/guzzle/guzzle/CHANGELOG.md +729 -0
README.md CHANGED
@@ -3,7 +3,7 @@
3
  **Tags:** uploads, amazon, s3, amazon s3, mirror, admin, media, cdn, cloudfront
4
  **Requires at least:** 4.6
5
  **Tested up to:** 4.9
6
- **Stable tag:** 1.2.1
7
  **License:** GPLv3
8
 
9
  Copies files to Amazon S3 as they are uploaded to the Media Library. Optionally configure Amazon CloudFront for faster delivery.
@@ -69,6 +69,23 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin
69
 
70
  ## Changelog ##
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  ### WP Offload S3 Lite 1.2.1 - 2017-11-20 ###
73
  * New: Compatibility with HTML Widget
74
  * New: Dismissible admin notice that WP Offload S3 Lite will soon require PHP 5.5+
3
  **Tags:** uploads, amazon, s3, amazon s3, mirror, admin, media, cdn, cloudfront
4
  **Requires at least:** 4.6
5
  **Tested up to:** 4.9
6
+ **Stable tag:** 1.3
7
  **License:** GPLv3
8
 
9
  Copies files to Amazon S3 as they are uploaded to the Media Library. Optionally configure Amazon CloudFront for faster delivery.
69
 
70
  ## Changelog ##
71
 
72
+ ### WP Offload S3 Lite 1.3 - 2018-02-20 ###
73
+ * [Release Summary Blog Post](https://deliciousbrains.com/wp-offload-s3-1-6-released/?utm_campaign=changelogs&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting)
74
+ * New: [Amazon Web Services plugin](https://wordpress.org/plugins/amazon-web-services/) is no longer required to run WP Offload S3 Lite
75
+ * New: Added [`as3cf_local_domains`](https://deliciousbrains.com/wp-offload-s3/doc/filtering-urls-for-multiple-domains/?utm_campaign=changelogs&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting) filter for when site content is updated through multiple domains
76
+ * Improvement: AWS keys can be set in new "Settings" tab if not defined in wp-config.php
77
+ * Improvement: Minor tweaks to settings page UI including right aligning tabs and consistent title across Lite and Pro plugins
78
+ * Improvement: cURL version, theme version and parent theme information added to diagnostics
79
+ * Bug fix: Incompatible with plugins that include AWS PHP SDK v3
80
+ * Bug fix: Regenerate Thumbnails v3.0+ does not work with Remove Files From Server option
81
+ * Bug fix: "Warning: count(): Parameter must be an array or an object that implements Countable" error with PHP 7.2
82
+ * Bug fix: Force HTTPS not being applied to non-srcset S3 URLs in pages served over HTTP
83
+ * Bug fix: Content URLs not filtered to S3 URLs if AWS keys not set
84
+ * Bug fix: URL preview can be coerced to display invalid URL
85
+ * Bug fix: Changes to upload made via `as3cf_object_meta` filter are not reflected in amazonS3_info records
86
+ * Bug fix: Settings link not showing in network admin plugins page
87
+ * Bug fix: License in composer.json fails Packagist validation
88
+
89
  ### WP Offload S3 Lite 1.2.1 - 2017-11-20 ###
90
  * New: Compatibility with HTML Widget
91
  * New: Dismissible admin notice that WP Offload S3 Lite will soon require PHP 5.5+
assets/css/notice.css CHANGED
@@ -1 +1 @@
1
- .as3cf-notice p,.aws-compatibility-notice p{max-width:800px}.as3cf-license-notice p:not(.as3cf-before):before{display:none}
1
+ .as3cf-notice p,.as3cf-compatibility-notice p{max-width:800px}.as3cf-license-notice p:not(.as3cf-before):before{display:none}.as3cf-notice-warning{border-left-color:#ffba00}
assets/css/styles.css CHANGED
@@ -1 +1 @@
1
- .aws-main.wrap{position:relative}.aws-main.wrap>h1{float:left}.aws-main.wrap .as3cf-notice,.aws-main.wrap .as3cf-updated,.aws-main.wrap .as3cf-error{-webkit-box-sizing:border-box;box-sizing:border-box}.aws-main.wrap .as3cf-error.fatal{clear:both}.aws-main.wrap h2.nav-tab-wrapper{float:none;margin-bottom:15px;width:650px;margin-top:10px;padding:9px 0 0 5px}.aws-main.wrap h2.nav-tab-wrapper a.nav-tab-active{color:#464646;cursor:default}.aws-main.wrap h2.nav-tab-wrapper a:focus{-webkit-box-shadow:none;box-shadow:none}.aws-main.wrap .more-info{white-space:nowrap}.aws-main.wrap .error pre{background:#eaeaea;background:rgba(0,0,0,0.07);display:block;padding:10px 15px}.aws-main.wrap .error pre code{padding:0;background:none}.aws-main.wrap[data-tab="support"] .as3cf-notice,.aws-main.wrap[data-tab="support"] .error,.aws-main.wrap[data-tab="support"] .updated,.aws-main.wrap[data-tab="support"] .updated.show{display:none}.aws-main.wrap[data-tab="support"] .fatal .error,.aws-main.wrap[data-tab="support"] .as3cf-notice.important,.aws-main.wrap[data-tab="support"] .dbrains-api-down{display:block}.aws-main.wrap .as3cf-notice,.aws-main.wrap .error,.aws-main.wrap .updated{max-width:650px;margin-top:15px;-webkit-box-sizing:border-box;box-sizing:border-box}.aws-main.wrap .as3cf-updated{display:none}.aws-main.wrap .as3cf-updated.as3cf-notice,.aws-main.wrap .as3cf-updated.show{display:block}.as3cf-tab .as3cf-main-settings{display:none}.as3cf-tab .as3cf-bucket-container{display:block}.as3cf-tab.as3cf-has-bucket .as3cf-main-settings{display:block}.as3cf-tab.as3cf-has-bucket .as3cf-bucket-container{display:none}.as3cf-tab{display:none;position:relative;width:650px}.as3cf-tab .as3cf-main-settings p{font-size:13px}.as3cf-tab .as3cf-main-settings p a{color:#444}.as3cf-tab .object-prefix-desc em{white-space:nowrap}.as3cf-tab .as3cf-url-preview-wrap{background:#fff;text-align:center;padding:20px 0 0;max-width:650px;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.as3cf-tab .as3cf-url-preview-wrap .as3cf-url-preview{margin-top:10px;padding:0 20px 10px;overflow-x:scroll}.as3cf-tab .as3cf-url-preview-wrap span{color:#aaa;text-transform:uppercase;font-weight:bold}.as3cf-tab .as3cf-radio-group label{display:block;margin-bottom:10px}.as3cf-tab .as3cf-radio-group label.disabled,.as3cf-tab .as3cf-radio-group label.disabled p{color:#bbb;cursor:default}.as3cf-tab .as3cf-radio-group p{padding-left:25px;color:#6b6b6b;margin:0;font-size:12px}.as3cf-tab .as3cf-radio-group p.as3cf-setting{margin-top:5px}.as3cf-tab .as3cf-switch{position:relative;display:inline-block;padding:2px;overflow:hidden;border-radius:2px;-webkit-border-radius:2px;background-color:#d4d3d3;cursor:pointer}.as3cf-tab .as3cf-switch.on{background-color:#ade7b5}.as3cf-tab .as3cf-switch span{visibility:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;float:left;display:inline-block;height:100%;font-size:12px;line-height:20px;border-radius:2px;-webkit-border-radius:2px;font-weight:bold;padding:4px 8px;background:#fff;color:#8d8d8d;z-index:1}.as3cf-tab .as3cf-switch span.on{color:#82d78b}.as3cf-tab .as3cf-switch span.checked{visibility:visible}.as3cf-tab .as3cf-switch.disabled{cursor:default;background:#e6e6e6}.as3cf-tab .as3cf-switch.disabled span{background:#f1f1f1;color:#d6d6d6}.as3cf-tab .as3cf-switch input[type="checkbox"]{position:absolute !important;top:0;left:0;opacity:0;filter:alpha(opacity=0);z-index:-1}.as3cf-tab .as3cf-setting.hide{display:none}.as3cf-tab div.as3cf-setting{margin-top:4px}.as3cf-tab h3{font-weight:normal;text-transform:uppercase;margin:15px 0}.as3cf-tab .form-table{margin:0}.as3cf-tab .form-table tr.as3cf-border-bottom td{border-bottom:1px solid #ddd;padding:20px 0px}.as3cf-tab .form-table tr.as3cf-setting-title td{padding-bottom:0}.as3cf-tab .form-table tr.as3cf-setting-title:first-child td{padding-top:20px}.as3cf-tab .form-table tr td{padding:15px 0}.as3cf-tab .form-table tr td:first-child{vertical-align:top;min-width:120px}.as3cf-tab .form-table tr td .as3cf-notice:last-child{margin-bottom:0}.as3cf-tab .form-table tr td>p:first-child{margin-top:0}.as3cf-tab .form-table tr:first-of-type td{padding-top:5px}.as3cf-tab .form-table tr.as3cf-bucket-setting .as3cf-defined-in-config{float:none}.as3cf-tab .form-table h3{padding:0;margin:0}.as3cf-tab .form-table h4{margin:0}.as3cf-tab .as3cf-active-bucket{font-weight:bold;margin-right:10px}.as3cf-tab .as3cf-view-bucket{color:#444;text-decoration:none;margin-right:10px}.as3cf-tab .as3cf-view-bucket:hover,.as3cf-tab .as3cf-view-bucket:active{color:#00a0d2}.as3cf-tab .as3cf-view-bucket:focus{-webkit-box-shadow:none;box-shadow:none}.as3cf-tab .as3cf-view-bucket .dashicons-external{margin-top:-2px}.as3cf-tab .tooltip{position:relative;z-index:2;cursor:pointer}.as3cf-tab .tooltip:before,.as3cf-tab .tooltip:after{visibility:hidden;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=0);opacity:0;pointer-events:none}.as3cf-tab .tooltip:before{position:absolute;bottom:150%;left:50%;margin-bottom:5px;margin-left:-250px;padding:10px;width:500px;border-radius:3px;background-color:#000;background-color:rgba(51,51,51,0.9);color:#fff;content:attr(data-tooltip);text-align:center;font-size:14px;line-height:1.3}.as3cf-tab .tooltip:after{position:absolute;bottom:150%;left:50%;margin-left:-5px;width:0;border-top:5px solid #000;border-top:5px solid rgba(51,51,51,0.9);border-right:5px solid transparent;border-left:5px solid transparent;content:" ";font-size:0;line-height:0}.as3cf-tab .tooltip:hover:before,.as3cf-tab .tooltip:hover:after{visibility:visible;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);opacity:1}.as3cf-tab .as3cf-defined-in-config{background:#ccc;color:#fff;padding:2px 5px;margin:0 0 5px 5px;float:right}.as3cf-tab .as3cf-defined-setting{color:#bbb}.as3cf-tab .as3cf-defined-setting label{cursor:default}.as3cf-tab .as3cf-defined-setting p .more-info a{color:#bbb}.as3cf-tab .as3cf-defined-setting .as3cf-radio-group p{color:#bbb}.as3cf-tab .as3cf-defined-setting .as3cf-notice{display:none !important}#tab-media{display:block}#tab-media .as3cf-main-settings{display:none}#tab-media .as3cf-bucket-container{display:block}#tab-media.as3cf-has-bucket .as3cf-main-settings{display:block}#tab-media.as3cf-has-bucket .as3cf-bucket-container{display:none}.as3cf-bucket-container h3{line-height:1.3;text-transform:none}.as3cf-bucket-container a:focus{-webkit-box-shadow:none;box-shadow:none;outline:none}.as3cf-bucket-container input[type=text]{-webkit-box-sizing:border-box;box-sizing:border-box;width:100%}.as3cf-bucket-container select{-webkit-box-sizing:border-box;box-sizing:border-box;width:50%}.as3cf-bucket-container .form-table td{padding:5px 0}.as3cf-bucket-container .form-table td:first-child{width:100px;line-height:30px;vertical-align:top}.as3cf-bucket-container .bucket-actions{margin:15px 0;border-top:1px solid #ccc;padding-top:15px;overflow:hidden}.as3cf-bucket-container .bucket-actions button,.as3cf-bucket-container .bucket-actions .right{float:right;margin-right:0}.as3cf-bucket-container .bucket-actions span{display:inline-block;margin-right:20px;line-height:28px}.as3cf-bucket-container .bucket-actions .bucket-action-cancel{color:#a00;text-decoration:none}.as3cf-bucket-container .bucket-actions .bucket-action-cancel:hover{color:red}.as3cf-bucket-container .as3cf-bucket-list{padding:15px;max-height:200px;overflow-x:hidden;overflow-y:auto;background-color:#fff;font-size:14px}.as3cf-bucket-container .as3cf-bucket-list li:last-of-type{margin-bottom:0}.as3cf-bucket-container .as3cf-bucket-list a{color:#444;text-decoration:none}.as3cf-bucket-container .as3cf-bucket-list a:hover{color:#0074a2}.as3cf-bucket-container .as3cf-bucket-list a.selected{font-weight:bold;color:#0074a2}.as3cf-bucket-container .as3cf-bucket-list a .dashicons{margin-right:5px}.as3cf-bucket-container .as3cf-bucket-select,.as3cf-bucket-container .as3cf-bucket-create{display:none}.as3cf-bucket-container .bucket-actions.select{display:none}.as3cf-tab{display:none}#tab-media{display:block}#tab-support{min-height:900px}#tab-support .as3cf-sidebar{top:11px}#tab-support .support-section{border-bottom:1px solid #ccc;padding-bottom:20px;margin-bottom:20px}#tab-support .debug textarea{width:100%;min-height:200px;font-family:Consolas, Monaco, monospace;margin-bottom:5px}.as3cf-sidebar{position:absolute;top:9px;left:670px;width:292px}.as3cf-sidebar .block{padding:20px;border:1px solid #ccc}.as3cf-sidebar .subscribe{border-top:none}.as3cf-sidebar .subscribe h2{padding:0;margin:0;margin-bottom:0.5em;color:#666;font-size:20px;line-height:1.2em;float:none}.as3cf-sidebar .subscribe h3{font-size:16px;margin:0}.as3cf-sidebar .subscribe p{margin:0}.as3cf-sidebar .subscribe .intro{margin-bottom:1em;line-height:1.4}.as3cf-sidebar .subscribe li{line-height:1.4}.as3cf-sidebar .subscribe .links{margin-bottom:2em}.as3cf-sidebar .subscribe .links a{text-decoration:none}.as3cf-sidebar .subscribe .promise{color:#999;font-size:12px;line-height:1.4em}.as3cf-sidebar .subscribe .field{margin-bottom:0.5em}.as3cf-sidebar .subscribe .field p{margin-bottom:0.3em}.as3cf-sidebar .subscribe .field input[type=text],.as3cf-sidebar .subscribe .field input[type=email]{width:100%}.as3cf-sidebar .subscribe .field.submit-button{margin-bottom:1em}.as3cf-sidebar .credits{border-top:0}.as3cf-sidebar .credits h4{font-size:16px;margin-top:0;margin-bottom:10px}.as3cf-sidebar .credits ul{margin:0}.as3cf-sidebar .credits li{overflow:hidden}.as3cf-sidebar .credits li:last-child{margin-bottom:0}.as3cf-sidebar .credits img{float:left;margin-right:10px}.as3cf-sidebar .credits span{float:left;display:block;line-height:32px}.as3cf-sidebar .credits a{display:block;text-decoration:none;color:#444;font-size:16px;text-align:center}.as3cf-sidebar .credits a:hover{color:#888}@media screen and (max-width: 1052px){.as3cf-sidebar{position:relative;top:auto;right:auto}}.as3cf-banner{margin-top:35px;width:292px;height:200px;display:block;background:#f8cfae url(../img/os3-banner.svg) left bottom/220px 220px no-repeat}.as3cf-banner:focus{-webkit-box-shadow:none;box-shadow:none}.wrap .as3cf-upgrade-details{background-color:#4e0d33;padding:10px 20px 20px 20px;color:#eee;font-size:13px;margin:0;display:block;text-decoration:none}.wrap .as3cf-upgrade-details h1{font-size:28px;color:#eee;margin:0 0 15px 0;padding:0;text-decoration:none;font-weight:200;line-height:1}.wrap .as3cf-upgrade-details p{margin:0}.wrap .as3cf-upgrade-details a{color:#eee;font-weight:bold;text-decoration:none;font-size:16px;-webkit-box-shadow:none;box-shadow:none}.wrap .as3cf-upgrade-details a:hover{color:#fff}.wrap .as3cf-upgrade-details ul{margin-top:0;margin-left:16px;list-style-type:disc}.aws-compatibility-notice.error{clear:both;margin:5px 20px 5px 0}.as3cf-bucket-error span.title{font-weight:bold}.as3cf-invalid-bucket-name,.as3cf-validation-error{display:block;margin-top:2px;font-size:12px;color:#a00}.as3cf-notice-toggle-content{max-height:100px;overflow-y:scroll}.as3cf-notice-toggle-content .as3cf-notice-toggle-list{margin-top:0;margin-left:0;padding-left:40px;color:#dc3232}
1
+ .as3cf-content,.as3cf-updated,.as3cf-compatibility-notice{-webkit-box-sizing:border-box;box-sizing:border-box;max-width:650px}.settings_page_amazon-s3-and-cloudfront .error,.settings_page_amazon-s3-and-cloudfront .notice,.settings_page_amazon-s3-and-cloudfront .updated{-webkit-box-sizing:border-box;box-sizing:border-box;max-width:650px}.as3cf-main.wrap{position:relative}.as3cf-main.wrap>h1{float:left}.as3cf-main.wrap .as3cf-notice,.as3cf-main.wrap .as3cf-updated,.as3cf-main.wrap .as3cf-error{-webkit-box-sizing:border-box;box-sizing:border-box}.as3cf-main.wrap .as3cf-error.fatal{clear:both}.as3cf-main.wrap h2.nav-tab-wrapper{float:none;margin-bottom:15px;width:650px;margin-top:10px;padding:9px 0 0 5px}.as3cf-main.wrap h2.nav-tab-wrapper .nav-tab-container{float:right}.as3cf-main.wrap h2.nav-tab-wrapper .nav-tab-container :last-child{margin-right:5px}.as3cf-main.wrap h2.nav-tab-wrapper a.nav-tab-active{color:#464646;cursor:default}.as3cf-main.wrap h2.nav-tab-wrapper a:focus{-webkit-box-shadow:none;box-shadow:none}.as3cf-main.wrap .more-info{white-space:nowrap}.as3cf-main.wrap .error pre{background:#eaeaea;background:rgba(0,0,0,0.07);display:block;padding:10px 15px}.as3cf-main.wrap .error pre code{padding:0;background:none}.as3cf-main.wrap[data-tab="support"] .as3cf-notice,.as3cf-main.wrap[data-tab="support"] .error,.as3cf-main.wrap[data-tab="support"] .updated,.as3cf-main.wrap[data-tab="support"] .updated.show{display:none}.as3cf-main.wrap[data-tab="support"] .fatal .error,.as3cf-main.wrap[data-tab="support"] .as3cf-notice.important,.as3cf-main.wrap[data-tab="support"] .dbrains-api-down{display:block}.as3cf-main.wrap .as3cf-notice,.as3cf-main.wrap .error,.as3cf-main.wrap .updated{max-width:650px;margin-top:15px;-webkit-box-sizing:border-box;box-sizing:border-box}.as3cf-main.wrap .as3cf-updated{display:none}.as3cf-main.wrap .as3cf-updated.as3cf-notice,.as3cf-main.wrap .as3cf-updated.show{display:block}.as3cf-main.wrap .alignleft{margin-right:20px;margin-bottom:20px}.as3cf-main.wrap .spinner{min-width:20px}.as3cf-tab .as3cf-main-settings{display:none}.as3cf-tab .as3cf-bucket-container{display:block}.as3cf-tab.as3cf-has-bucket .as3cf-main-settings{display:block}.as3cf-tab.as3cf-has-bucket .as3cf-bucket-container{display:none}.as3cf-content>section{margin-bottom:20px}.as3cf-content>section+section.as3cf-access-keys{padding-top:20px;border-top:1px solid #d3d3d3}.as3cf-content>section+section.as3cf-access-keys .as3cf-section-heading{margin-top:0}.as3cf-tab{display:none;position:relative;width:650px}.as3cf-tab .as3cf-main-settings p{font-size:13px}.as3cf-tab .as3cf-main-settings p a{color:#444}.as3cf-tab .object-prefix-desc em{white-space:nowrap}.as3cf-tab .as3cf-url-preview-wrap{background:#fff;text-align:center;padding:20px 0 0;max-width:650px;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.as3cf-tab .as3cf-url-preview-wrap .as3cf-url-preview{margin-top:10px;padding:0 20px 10px;overflow-x:scroll}.as3cf-tab .as3cf-url-preview-wrap span{color:#aaa;text-transform:uppercase;font-weight:bold}.as3cf-tab .as3cf-radio-group label{display:block;margin-bottom:10px}.as3cf-tab .as3cf-radio-group label.disabled,.as3cf-tab .as3cf-radio-group label.disabled p{color:#bbb;cursor:default}.as3cf-tab .as3cf-radio-group p{padding-left:25px;color:#6b6b6b;margin:0;font-size:12px}.as3cf-tab .as3cf-radio-group p.as3cf-setting{margin-top:5px}.as3cf-tab .as3cf-switch{position:relative;display:inline-block;padding:2px;overflow:hidden;border-radius:2px;background-color:#d4d3d3;cursor:pointer}.as3cf-tab .as3cf-switch.on{background-color:#ade7b5}.as3cf-tab .as3cf-switch span{visibility:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;float:left;display:inline-block;height:100%;font-size:12px;line-height:20px;border-radius:2px;font-weight:bold;padding:4px 8px;background:#fff;color:#8d8d8d;z-index:1}.as3cf-tab .as3cf-switch span.on{color:#82d78b}.as3cf-tab .as3cf-switch span.checked{visibility:visible}.as3cf-tab .as3cf-switch.disabled{cursor:default;background:#e6e6e6}.as3cf-tab .as3cf-switch.disabled span{background:#f1f1f1;color:#d6d6d6}.as3cf-tab .as3cf-switch input[type="checkbox"]{position:absolute !important;top:0;left:0;opacity:0;filter:alpha(opacity=0);z-index:-1}.as3cf-tab .as3cf-setting.hide{display:none}.as3cf-tab div.as3cf-setting{margin-top:4px}.as3cf-tab h3{font-weight:normal;text-transform:uppercase}.as3cf-tab .form-table{margin:0}.as3cf-tab .form-table tr.as3cf-border-bottom td{border-bottom:1px solid #ddd;padding:20px 0px}.as3cf-tab .form-table tr.as3cf-setting-title td{padding-bottom:0}.as3cf-tab .form-table tr.as3cf-setting-title:first-child td{padding-top:20px}.as3cf-tab .form-table tr td{padding:15px 0}.as3cf-tab .form-table tr td:first-child{vertical-align:top;min-width:120px}.as3cf-tab .form-table tr td .as3cf-notice:last-child{margin-bottom:0}.as3cf-tab .form-table tr td>p:first-child{margin-top:0}.as3cf-tab .form-table tr.as3cf-bucket-setting .as3cf-defined-in-config{float:none}.as3cf-tab .form-table h3{padding:0;margin:0}.as3cf-tab .form-table h4{margin:0}.as3cf-tab .as3cf-active-bucket{font-weight:bold;margin-right:10px}.as3cf-tab .as3cf-view-bucket{color:#444;text-decoration:none;margin-right:10px}.as3cf-tab .as3cf-view-bucket:hover,.as3cf-tab .as3cf-view-bucket:active{color:#00a0d2}.as3cf-tab .as3cf-view-bucket:focus{-webkit-box-shadow:none;box-shadow:none}.as3cf-tab .as3cf-view-bucket .dashicons-external{margin-top:-2px}.as3cf-tab .tooltip{position:relative;z-index:2;cursor:pointer}.as3cf-tab .tooltip:before,.as3cf-tab .tooltip:after{visibility:hidden;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=0);opacity:0;pointer-events:none}.as3cf-tab .tooltip:before{position:absolute;bottom:150%;left:50%;margin-bottom:5px;margin-left:-250px;padding:10px;width:500px;border-radius:3px;background-color:#000;background-color:rgba(51,51,51,0.9);color:#fff;content:attr(data-tooltip);text-align:center;font-size:14px;line-height:1.3}.as3cf-tab .tooltip:after{position:absolute;bottom:150%;left:50%;margin-left:-5px;width:0;border-top:5px solid #000;border-top:5px solid rgba(51,51,51,0.9);border-right:5px solid transparent;border-left:5px solid transparent;content:" ";font-size:0;line-height:0}.as3cf-tab .tooltip:hover:before,.as3cf-tab .tooltip:hover:after{visibility:visible;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);opacity:1}.as3cf-tab .as3cf-defined-in-config{background:#ccc;color:#fff;padding:2px 5px;margin:0 0 5px 5px;float:right;white-space:nowrap}.as3cf-tab .as3cf-defined-setting{color:#bbb}.as3cf-tab .as3cf-defined-setting label{cursor:default}.as3cf-tab .as3cf-defined-setting p .more-info a{color:#bbb}.as3cf-tab .as3cf-defined-setting .as3cf-radio-group p{color:#bbb}.as3cf-tab .as3cf-defined-setting .as3cf-notice{display:none !important}#tab-media{display:block}#tab-media .as3cf-main-settings{display:none}#tab-media .as3cf-bucket-setting td{padding-top:5px}#tab-media .as3cf-bucket-container{display:block}#tab-media.as3cf-has-bucket .as3cf-main-settings{display:block}#tab-media.as3cf-has-bucket .as3cf-bucket-container{display:none}.as3cf-bucket-container h3{line-height:1.3;text-transform:none}.as3cf-bucket-container a:focus{-webkit-box-shadow:none;box-shadow:none;outline:none}.as3cf-bucket-container input[type=text]{-webkit-box-sizing:border-box;box-sizing:border-box;width:100%}.as3cf-bucket-container select{-webkit-box-sizing:border-box;box-sizing:border-box;width:50%}.as3cf-bucket-container .form-table td{padding:5px 0}.as3cf-bucket-container .form-table td:first-child{width:100px;line-height:30px;vertical-align:top}.as3cf-bucket-container .bucket-actions{margin:15px 0;border-top:1px solid #ccc;padding-top:15px;overflow:hidden}.as3cf-bucket-container .bucket-actions button,.as3cf-bucket-container .bucket-actions .right{float:right;margin-right:0}.as3cf-bucket-container .bucket-actions span{display:inline-block;margin-right:20px;line-height:28px}.as3cf-bucket-container .bucket-actions .bucket-action-cancel{color:#a00;text-decoration:none}.as3cf-bucket-container .bucket-actions .bucket-action-cancel:hover{color:red}.as3cf-bucket-container .as3cf-bucket-list{padding:15px;max-height:200px;overflow-x:hidden;overflow-y:auto;background-color:#fff;font-size:14px}.as3cf-bucket-container .as3cf-bucket-list li:last-of-type{margin-bottom:0}.as3cf-bucket-container .as3cf-bucket-list a{color:#444;text-decoration:none}.as3cf-bucket-container .as3cf-bucket-list a:hover{color:#0074a2}.as3cf-bucket-container .as3cf-bucket-list a.selected{font-weight:bold;color:#0074a2}.as3cf-bucket-container .as3cf-bucket-list a .dashicons{margin-right:5px}.as3cf-bucket-container .as3cf-bucket-select,.as3cf-bucket-container .as3cf-bucket-create{display:none}.as3cf-bucket-container .bucket-actions.select{display:none}#tab-media{display:block}#tab-settings .as3cf-field-wrap{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}#tab-settings .as3cf-field-wrap input{width:100%}#tab-settings .as3cf-field-wrap button,#tab-settings .as3cf-field-wrap .as3cf-defined-in-config{margin-left:20px}#tab-settings .as3cf-field-wrap .as3cf-defined-in-config{display:none;margin-bottom:0}#tab-settings .as3cf-field-wrap.as3cf-defined button{display:none}#tab-settings .as3cf-field-wrap.as3cf-defined .as3cf-defined-in-config{display:inline-block}#tab-settings .as3cf-field-wrap.as3cf-saved-field .as3cf-activate-licence{display:none}#tab-settings .as3cf-field-wrap.as3cf-licence-not-entered .as3cf-remove-licence{display:none}#tab-support{min-height:900px}#tab-support .as3cf-sidebar{top:11px}#tab-support .support-section{border-bottom:1px solid #ccc;padding-bottom:20px;margin-bottom:20px}#tab-support .support-section h3{font-size:20px}#tab-support .debug textarea{width:100%;min-height:200px;font-family:Consolas, Monaco, monospace;margin-bottom:5px}.as3cf-sidebar{position:absolute;top:9px;left:670px;width:292px}.as3cf-sidebar .block{padding:20px;border:1px solid #ccc}.as3cf-sidebar .subscribe{border-top:none}.as3cf-sidebar .subscribe h2{padding:0;margin:0;margin-bottom:0.5em;color:#666;font-size:20px;line-height:1.2em;float:none}.as3cf-sidebar .subscribe h3{font-size:16px;margin:0}.as3cf-sidebar .subscribe p{margin:0}.as3cf-sidebar .subscribe .intro{margin-bottom:1em;line-height:1.4}.as3cf-sidebar .subscribe li{line-height:1.4}.as3cf-sidebar .subscribe .links{margin-bottom:2em}.as3cf-sidebar .subscribe .links a{text-decoration:none}.as3cf-sidebar .subscribe .promise{color:#999;font-size:12px;line-height:1.4em}.as3cf-sidebar .subscribe .field{margin-bottom:0.5em}.as3cf-sidebar .subscribe .field p{margin-bottom:0.3em}.as3cf-sidebar .subscribe .field input[type=text],.as3cf-sidebar .subscribe .field input[type=email]{width:100%}.as3cf-sidebar .subscribe .field.submit-button{margin-bottom:1em}.as3cf-sidebar .credits{border-top:0}.as3cf-sidebar .credits h4{font-size:16px;margin-top:0;margin-bottom:10px}.as3cf-sidebar .credits ul{margin:0}.as3cf-sidebar .credits li{overflow:hidden}.as3cf-sidebar .credits li:last-child{margin-bottom:0}.as3cf-sidebar .credits img{float:left;margin-right:10px}.as3cf-sidebar .credits span{float:left;display:block;line-height:32px}.as3cf-sidebar .credits a{display:block;text-decoration:none;color:#444;font-size:16px;text-align:center}.as3cf-sidebar .credits a:hover{color:#888}@media screen and (max-width: 1052px){.as3cf-sidebar{position:relative;top:auto;right:auto}}.as3cf-banner{margin-top:35px;width:292px;height:200px;display:block;background:#f8cfae url(../img/os3-banner.svg) left bottom/220px 220px no-repeat}.as3cf-banner:focus{-webkit-box-shadow:none;box-shadow:none}.wrap .as3cf-upgrade-details{background-color:#4e0d33;padding:10px 20px 20px 20px;color:#eee;font-size:13px;margin:0;display:block;text-decoration:none}.wrap .as3cf-upgrade-details h1{font-size:28px;color:#eee;margin:0 0 15px 0;padding:0;text-decoration:none;font-weight:200;line-height:1}.wrap .as3cf-upgrade-details p{margin:0}.wrap .as3cf-upgrade-details a{color:#eee;font-weight:bold;text-decoration:none;font-size:16px;-webkit-box-shadow:none;box-shadow:none}.wrap .as3cf-upgrade-details a:hover{color:#fff}.wrap .as3cf-upgrade-details ul{margin-top:0;margin-left:16px;list-style-type:disc}.as3cf-compatibility-notice.error{clear:both;margin:5px 20px 5px 0}.as3cf-bucket-error span.title{font-weight:bold}.as3cf-invalid-bucket-name,.as3cf-validation-error{display:block;margin-top:2px;font-size:12px;color:#a00}.as3cf-notice-toggle-content{max-height:100px;overflow-y:scroll}.as3cf-notice-toggle-content .as3cf-notice-toggle-list{margin-top:0;margin-left:0;padding-left:40px;color:#dc3232}.as3cf-need-help{background-color:white;font-size:16px;font-weight:bold;padding:1em}.as3cf-need-help a{text-decoration:none}.as3cf-aws-logo{color:white;background-color:#f7a80d;padding:1em}.as3cf-settings h3{font-size:20px}.as3cf-settings p{font-size:14px}.as3cf-addons,.as3cf-tab .as3cf-compatibility-notice{max-width:cover}textarea.as3cf-access-key-constants-snippet.code{width:100%;white-space:pre;overflow:hidden;font-size:12px;padding:10px;height:53px}.as3cf-addons .as3cf-addons-list{margin:20px 0 200px;padding-top:5px}.as3cf-addons .as3cf-addon{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;padding:20px;font-size:14px}.as3cf-addons .as3cf-addon-info{min-height:100px}.as3cf-addons .as3cf-addon-links{float:right}.as3cf-addons .as3cf-addon-links span{padding:4px 6px}.as3cf-addons .as3cf-addon-icon{float:left;margin-right:20px}.as3cf-addons .as3cf-addon-details{white-space:nowrap}.as3cf-addons .as3cf-addon-title,.as3cf-addons .as3cf-addon-description{font-weight:100}.as3cf-addons .as3cf-addon+.as3cf-addon{margin-top:20px}.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull{background-color:#0769ad;color:white}.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull .as3cf-addon-title,.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull .as3cf-addon-description,.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull a{color:white}.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull .extra{background:white}.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull .extra a{color:#0769ad;text-decoration:none}
assets/img/as3cf-banner-bw.jpg ADDED
Binary file
assets/img/as3cf-banner-bw@2x.jpg ADDED
Binary file
assets/img/as3cf-banner.jpg ADDED
Binary file
assets/img/as3cf-banner@2x.jpg ADDED
Binary file
assets/img/aws-logo.svg ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1"
4
+ id="svg2" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#"
5
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
6
+ viewBox="-243.4 335.3 101.3 79.8" enable-background="new -243.4 335.3 101.3 79.8" xml:space="preserve">
7
+ <path id="polygon287" fill="#FFFFFF" d="M-213.9,386.2l-9.3,4l8.6,3.7l10-3.7L-213.9,386.2z M-227.8,391.1l-0.3,17.9l13.6,6v-18.6
8
+ L-227.8,391.1z M-199.9,391.1l-12.3,4.7v17.6l12.3-5V391.1z"/>
9
+ <path id="polygon311" fill="#FFFFFF" d="M-185.3,335.3l-9.3,4l8.7,3.7l10-3.7L-185.3,335.3z M-198.2,340.6v17.9l11.6,3.4l0.4-16.3
10
+ L-198.2,340.6z M-172.3,341.6l-11,4.7v17.6l11-5V341.6z"/>
11
+ <path id="use3387" fill="#FFFFFF" d="M-229.2,360.6l-9.3,4l8.6,3.7l10-3.7L-229.2,360.6z M-243.1,365.6l-0.3,17.9l13.6,6v-18.6
12
+ L-243.1,365.6z M-215.2,365.6l-12.3,4.7v17.6l12.3-5V365.6z"/>
13
+ <path id="use3389" fill="#FFFFFF" d="M-199.2,359.9l-9.3,4l8.6,3.7l10-3.7L-199.2,359.9z M-213.2,364.9l-0.3,17.9l13.6,6v-18.6
14
+ L-213.2,364.9z M-185.3,364.9l-12.3,4.7v17.6l12.3-5V364.9z"/>
15
+ <path id="use3391" fill="#FFFFFF" d="M-156,335.3l-9.3,4l8.6,3.7l10-3.7L-156,335.3z M-170,340.3l-0.3,17.9l13.6,6v-18.6L-170,340.3
16
+ z M-142.1,340.3l-12.3,4.7v17.6l12.3-5V340.3z"/>
17
+ </svg>
assets/img/icon-assets-pull.svg ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <svg width="354px" height="318px" viewBox="0 0 354 318" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
3
+ <!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
4
+ <title>Untitled</title>
5
+ <desc>Created with Sketch.</desc>
6
+ <defs></defs>
7
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
8
+ <path d="M51.269,159 C68.955,166.75 81.519,183.5 81.519,213 L81.519,247.457 C81.519,272.412 103.898,280.369 123.066,280.951 L123.066,317.812 C70.802,317.812 39.955,299.912 39.955,251.578 L39.955,213.195 C39.955,188.648 20.455,177.658 0.601,177.658 L0.601,140.342 C20.455,140.342 39.955,129.353 39.955,104.806 L39.955,66.422 C39.955,18.089 70.803,0.188 123.066,0.188 L123.066,37.049 C103.898,37.631 81.519,45.588 81.519,70.544 L81.519,105 C81.519,134.5 68.954,151.25 51.269,159 L51.269,159 Z M272.481,105 L272.481,70.544 C272.481,45.588 250.102,37.631 230.934,37.049 L230.934,0.188 C283.198,0.188 314.045,18.089 314.045,66.422 L314.045,104.806 C314.045,129.353 333.545,140.342 353.399,140.342 L353.399,177.658 C333.545,177.658 314.045,188.648 314.045,213.195 L314.045,251.578 C314.045,299.912 283.197,317.812 230.934,317.812 L230.934,280.951 C250.102,280.369 272.481,272.412 272.481,247.457 L272.481,213 C272.481,183.5 285.045,166.75 302.731,159 C285.046,151.25 272.481,134.5 272.481,105 L272.481,105 Z M204.546,175.288 L204.546,206.442 C204.546,234.293 186.946,256.827 161.302,261.899 L156.442,251.395 C168.318,246.92 175.85,232.55 175.85,221.755 L155.804,221.755 L155.804,175.287 L204.546,175.287 L204.546,175.288 Z M204.546,75.051 L155.804,75.051 L155.804,123.872 L204.546,123.872 L204.546,75.051 L204.546,75.051 Z" id="javascript-code-icon" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>
9
+ </g>
10
+ </svg>
assets/img/icon16.png ADDED
Binary file
assets/img/snail-banner.jpg DELETED
Binary file
assets/img/snail-banner@2x.jpg DELETED
Binary file
assets/js/script.js CHANGED
@@ -4,7 +4,9 @@
4
  var bucketNamePattern = /[^a-z0-9.-]/;
5
  var refreshBucketListOnLoad = false;
6
 
 
7
  var $tabs = $( '.as3cf-tab' );
 
8
  var $activeTab;
9
 
10
  /**
@@ -68,7 +70,7 @@
68
  $activeTab.show();
69
  $( '.nav-tab' ).removeClass( 'nav-tab-active' );
70
  $( 'a.nav-tab[data-tab="' + hash + '"]' ).addClass( 'nav-tab-active' );
71
- $( '.aws-main' ).data( 'tab', hash );
72
  if ( $activeTab.data( 'prefix' ) ) {
73
  as3cfModal.prefix = $activeTab.data( 'prefix' );
74
  }
@@ -294,6 +296,8 @@
294
 
295
  // Make sure the bucket list will refresh the next time the modal loads
296
  refreshBucketListOnLoad = true;
 
 
297
  } else {
298
  that.showError( as3cf.strings.save_bucket_error, data[ 'error' ], 'as3cf-bucket-manual' );
299
  }
@@ -358,6 +362,8 @@
358
  if ( 'undefined' !== typeof data[ 'success' ] ) {
359
  that.set( bucketName, data[ 'region' ], data[ 'can_write' ] );
360
  $( '#' + as3cfModal.prefix + '-bucket-select' ).val( '' );
 
 
361
  } else {
362
  that.showError( as3cf.strings.save_bucket_error, data[ 'error' ], 'as3cf-bucket-select' );
363
  $( '.as3cf-bucket-list a' ).removeClass( 'selected' );
@@ -518,6 +524,8 @@
518
 
519
  // Make sure the bucket list will refresh the next time the modal loads
520
  refreshBucketListOnLoad = true;
 
 
521
  } else {
522
  that.showError( as3cf.strings.create_bucket_error, data[ 'error' ], 'as3cf-bucket-create' );
523
  }
@@ -571,6 +579,35 @@
571
 
572
  };
573
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
574
  /**
575
  * Get the link to the bucket on the AWS Console and update the DOM
576
  *
@@ -667,6 +704,85 @@
667
  $( document ).trigger( 'as3cf.tabRendered', [ location.hash.replace( '#', '' ) ] );
668
  }
669
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
670
  $( document ).ready( function() {
671
 
672
  // Tabs
@@ -687,8 +803,8 @@
687
  };
688
 
689
  // Move any compatibility errors below the nav tabs
690
- var $navTabs = $( '.wrap.aws-main .nav-tab-wrapper' );
691
- $( '.aws-compatibility-notice, div.updated, div.error, div.notice' ).not( '.below-h2, .inline' ).insertAfter( $navTabs );
692
 
693
  // Settings
694
  // --------------------
@@ -791,17 +907,17 @@
791
  $( '#tab-media > .as3cf-bucket-error' ).detach().insertAfter( '.as3cf-bucket-container h3' );
792
 
793
  // Action click handlers
794
- $( 'body' ).on( 'click', '.bucket-action-manual', function( e ) {
795
  e.preventDefault();
796
  $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-manual' ).show().siblings().hide();
797
  } );
798
- $( 'body' ).on( 'click', '.bucket-action-browse', function( e ) {
799
  e.preventDefault();
800
  $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-select' ).show().siblings().hide();
801
  as3cf.buckets.loadList( refreshBucketListOnLoad );
802
  refreshBucketListOnLoad = false;
803
  } );
804
- $( 'body' ).on( 'click', '.bucket-action-create', function( e ) {
805
  e.preventDefault();
806
 
807
  // Reset create bucket modal
@@ -810,27 +926,27 @@
810
 
811
  $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-create' ).show().siblings().hide();
812
  } );
813
- $( 'body' ).on( 'click', '.bucket-action-cancel', function( e ) {
814
  e.preventDefault();
815
  as3cf.buckets.resetModal();
816
  } );
817
- $( 'body' ).on( 'click', '.bucket-action-save', function( e ) {
818
  e.preventDefault();
819
  as3cf.buckets.saveManual();
820
  } );
821
- $( 'body' ).on( 'click', '.as3cf-create-bucket-form button[type="submit"]', function( e ) {
822
  e.preventDefault();
823
  as3cf.buckets.create();
824
  } );
825
 
826
  // Bucket list refresh handler
827
- $( 'body' ).on( 'click', '.bucket-action-refresh', function( e ) {
828
  e.preventDefault();
829
  as3cf.buckets.loadList( true );
830
  } );
831
 
832
  // Bucket list click handler
833
- $( 'body' ).on( 'click', '.as3cf-bucket-list a', function( e ) {
834
  e.preventDefault();
835
  as3cf.buckets.saveSelected( $( this ) );
836
  } );
@@ -844,7 +960,7 @@
844
  } );
845
 
846
  // Modal open
847
- $( 'body' ).on( 'as3cf-modal-open', function( e, target ) {
848
  if ( '.as3cf-bucket-container.' + as3cfModal.prefix === target ) {
849
 
850
  // Reset modal
@@ -862,7 +978,7 @@
862
  as3cf.buckets.disabledButtons();
863
 
864
  // Validate bucket name on create
865
- $( 'body' ).on( 'input keyup', '.as3cf-create-bucket-form .as3cf-bucket-name', function( e ) {
866
  var bucketName = $( this ).val();
867
  var $createBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-create-bucket-form' );
868
 
@@ -875,7 +991,7 @@
875
  } );
876
 
877
  // Check bucket name length on manual
878
- $( 'body' ).on( 'input keyup', '.as3cf-manual-save-bucket-form .as3cf-bucket-name', function( e ) {
879
  var $manualBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-manual-save-bucket-form' );
880
 
881
  if ( $manualBucketForm.find( '.as3cf-bucket-name' ).val().length < as3cf.buckets.validLength ) {
@@ -885,6 +1001,21 @@
885
  }
886
  } );
887
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
888
  } );
889
 
890
  })( jQuery, as3cfModal );
4
  var bucketNamePattern = /[^a-z0-9.-]/;
5
  var refreshBucketListOnLoad = false;
6
 
7
+ var $body = $( 'body' );
8
  var $tabs = $( '.as3cf-tab' );
9
+ var $settings = $( '.as3cf-settings' );
10
  var $activeTab;
11
 
12
  /**
70
  $activeTab.show();
71
  $( '.nav-tab' ).removeClass( 'nav-tab-active' );
72
  $( 'a.nav-tab[data-tab="' + hash + '"]' ).addClass( 'nav-tab-active' );
73
+ $( '.as3cf-main' ).data( 'tab', hash );
74
  if ( $activeTab.data( 'prefix' ) ) {
75
  as3cfModal.prefix = $activeTab.data( 'prefix' );
76
  }
296
 
297
  // Make sure the bucket list will refresh the next time the modal loads
298
  refreshBucketListOnLoad = true;
299
+
300
+ as3cf.showSettingsSavedNotice();
301
  } else {
302
  that.showError( as3cf.strings.save_bucket_error, data[ 'error' ], 'as3cf-bucket-manual' );
303
  }
362
  if ( 'undefined' !== typeof data[ 'success' ] ) {
363
  that.set( bucketName, data[ 'region' ], data[ 'can_write' ] );
364
  $( '#' + as3cfModal.prefix + '-bucket-select' ).val( '' );
365
+
366
+ as3cf.showSettingsSavedNotice();
367
  } else {
368
  that.showError( as3cf.strings.save_bucket_error, data[ 'error' ], 'as3cf-bucket-select' );
369
  $( '.as3cf-bucket-list a' ).removeClass( 'selected' );
524
 
525
  // Make sure the bucket list will refresh the next time the modal loads
526
  refreshBucketListOnLoad = true;
527
+
528
+ as3cf.showSettingsSavedNotice();
529
  } else {
530
  that.showError( as3cf.strings.create_bucket_error, data[ 'error' ], 'as3cf-bucket-create' );
531
  }
579
 
580
  };
581
 
582
+ /**
583
+ * Reload the page, and show the persistent updated notice.
584
+ *
585
+ * Intended for use on plugin settings page.
586
+ */
587
+ as3cf.reloadUpdated = function() {
588
+ var url = location.pathname + location.search;
589
+
590
+ if ( ! location.search.match( /[?&]updated=/ ) ) {
591
+ url += '&updated=1';
592
+ }
593
+
594
+ url += location.hash;
595
+
596
+ location.assign( url );
597
+ };
598
+
599
+ /**
600
+ * Show the standard "Settings saved." notice if not already visible.
601
+ */
602
+ as3cf.showSettingsSavedNotice = function() {
603
+ if ( 0 < $( '#setting-error-settings_updated:visible' ).length || 0 < $( '#as3cf-settings_updated:visible' ).length ) {
604
+ return;
605
+ }
606
+ var settingsUpdatedNotice = '<div id="as3cf-settings_updated" class="updated settings-error notice is-dismissible"><p><strong>' + as3cf.strings.settings_saved + '</strong></p></div>';
607
+ $( 'h2.nav-tab-wrapper' ).after( settingsUpdatedNotice );
608
+ $( document ).trigger( 'wp-updates-notice-added' ); // Hack to run WP Core's makeNoticesDismissible() function.
609
+ };
610
+
611
  /**
612
  * Get the link to the bucket on the AWS Console and update the DOM
613
  *
704
  $( document ).trigger( 'as3cf.tabRendered', [ location.hash.replace( '#', '' ) ] );
705
  }
706
 
707
+ /**
708
+ * Access Keys API object
709
+ * @constructor
710
+ */
711
+ var AccessKeys = function() {
712
+ this.$key = $settings.find( 'input[name="aws-access-key-id"]' );
713
+ this.$secret = $settings.find( 'input[name="aws-secret-access-key"]' );
714
+ this.$spinner = $settings.find( '[data-as3cf-aws-keys-spinner]' );
715
+ this.$feedback = $settings.find( '[data-as3cf-aws-keys-feedback]' );
716
+ };
717
+
718
+ /**
719
+ * Set the access keys using the values in the settings fields.
720
+ */
721
+ AccessKeys.prototype.set = function() {
722
+ this.sendRequest( 'set', {
723
+ 'aws-access-key-id': this.$key.val(),
724
+ 'aws-secret-access-key': this.$secret.val()
725
+ } ).done( function( response ) {
726
+ if ( response.success ) {
727
+ this.$secret.val( as3cf.strings.not_shown_placeholder );
728
+ }
729
+ }.bind( this ) );
730
+ };
731
+
732
+ /**
733
+ * Remove the access keys from the database and clear the fields.
734
+ */
735
+ AccessKeys.prototype.remove = function() {
736
+ this.sendRequest( 'remove' )
737
+ .done( function( response ) {
738
+ if ( response.success ) {
739
+ this.$key.val( '' );
740
+ this.$secret.val( '' );
741
+ }
742
+ }.bind( this ) )
743
+ ;
744
+ };
745
+
746
+ /**
747
+ * Send the request to the server to update the access keys.
748
+ *
749
+ * @param {string} action The action to perform with the keys
750
+ * @param {undefined|Object} params Extra parameters to send with the request
751
+ *
752
+ * @returns {jqXHR}
753
+ */
754
+ AccessKeys.prototype.sendRequest = function( action, params ) {
755
+ var data = {
756
+ action: 'as3cf-aws-keys-' + action,
757
+ _ajax_nonce: as3cf.nonces[ 'aws_keys_' + action ]
758
+ };
759
+
760
+ if ( _.isObject( params ) ) {
761
+ data = _.extend( data, params );
762
+ }
763
+
764
+ this.$spinner.addClass( 'is-active' );
765
+
766
+ return $.post( ajaxurl, data )
767
+ .done( function( response ) {
768
+ this.$feedback
769
+ .toggleClass( 'notice-success', response.success )
770
+ .toggleClass( 'notice-error', ! response.success );
771
+
772
+ if ( response.data && response.data.message ) {
773
+ this.$feedback.html( '<p>' + response.data.message + '</p>' ).show();
774
+ }
775
+
776
+ if ( response.success ) {
777
+ as3cf.reloadUpdated();
778
+ }
779
+ }.bind( this ) )
780
+ .always( function() {
781
+ this.$spinner.removeClass( 'is-active' );
782
+ }.bind( this ) )
783
+ ;
784
+ };
785
+
786
  $( document ).ready( function() {
787
 
788
  // Tabs
803
  };
804
 
805
  // Move any compatibility errors below the nav tabs
806
+ var $navTabs = $( '.as3cf-main .nav-tab-wrapper' );
807
+ $( '.as3cf-compatibility-notice, div.updated, div.error, div.notice' ).not( '.below-h2, .inline' ).insertAfter( $navTabs );
808
 
809
  // Settings
810
  // --------------------
907
  $( '#tab-media > .as3cf-bucket-error' ).detach().insertAfter( '.as3cf-bucket-container h3' );
908
 
909
  // Action click handlers
910
+ $body.on( 'click', '.bucket-action-manual', function( e ) {
911
  e.preventDefault();
912
  $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-manual' ).show().siblings().hide();
913
  } );
914
+ $body.on( 'click', '.bucket-action-browse', function( e ) {
915
  e.preventDefault();
916
  $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-select' ).show().siblings().hide();
917
  as3cf.buckets.loadList( refreshBucketListOnLoad );
918
  refreshBucketListOnLoad = false;
919
  } );
920
+ $body.on( 'click', '.bucket-action-create', function( e ) {
921
  e.preventDefault();
922
 
923
  // Reset create bucket modal
926
 
927
  $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-create' ).show().siblings().hide();
928
  } );
929
+ $body.on( 'click', '.bucket-action-cancel', function( e ) {
930
  e.preventDefault();
931
  as3cf.buckets.resetModal();
932
  } );
933
+ $body.on( 'click', '.bucket-action-save', function( e ) {
934
  e.preventDefault();
935
  as3cf.buckets.saveManual();
936
  } );
937
+ $body.on( 'click', '.as3cf-create-bucket-form button[type="submit"]', function( e ) {
938
  e.preventDefault();
939
  as3cf.buckets.create();
940
  } );
941
 
942
  // Bucket list refresh handler
943
+ $body.on( 'click', '.bucket-action-refresh', function( e ) {
944
  e.preventDefault();
945
  as3cf.buckets.loadList( true );
946
  } );
947
 
948
  // Bucket list click handler
949
+ $body.on( 'click', '.as3cf-bucket-list a', function( e ) {
950
  e.preventDefault();
951
  as3cf.buckets.saveSelected( $( this ) );
952
  } );
960
  } );
961
 
962
  // Modal open
963
+ $body.on( 'as3cf-modal-open', function( e, target ) {
964
  if ( '.as3cf-bucket-container.' + as3cfModal.prefix === target ) {
965
 
966
  // Reset modal
978
  as3cf.buckets.disabledButtons();
979
 
980
  // Validate bucket name on create
981
+ $body.on( 'input keyup', '.as3cf-create-bucket-form .as3cf-bucket-name', function( e ) {
982
  var bucketName = $( this ).val();
983
  var $createBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-create-bucket-form' );
984
 
991
  } );
992
 
993
  // Check bucket name length on manual
994
+ $body.on( 'input keyup', '.as3cf-manual-save-bucket-form .as3cf-bucket-name', function( e ) {
995
  var $manualBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-manual-save-bucket-form' );
996
 
997
  if ( $manualBucketForm.find( '.as3cf-bucket-name' ).val().length < as3cf.buckets.validLength ) {
1001
  }
1002
  } );
1003
 
1004
+ $settings
1005
+ .on( 'click', '[data-as3cf-toggle-access-keys-form]', function( event ) {
1006
+ event.preventDefault();
1007
+ $( '#as3cf_access_keys' ).toggle();
1008
+ } )
1009
+ .on( 'click', '[data-as3cf-aws-keys-action]', function( event ) {
1010
+ event.preventDefault();
1011
+ var action = $( this ).data( 'as3cfAwsKeysAction' );
1012
+ var api = new AccessKeys();
1013
+
1014
+ if ( 'function' === typeof api[action] ) {
1015
+ api[action]();
1016
+ }
1017
+ } )
1018
+ ;
1019
  } );
1020
 
1021
  })( jQuery, as3cfModal );
assets/js/script.min.js CHANGED
@@ -1 +1 @@
1
- !function(a,b){function c(b){return a("#"+b+" .as3cf-main-settings form").find("input:not(.no-compare)").serialize()}function d(a){var b=k.find("#"+a),c=b.find("input[type=checkbox]");b.toggleClass("on").find("span").toggleClass("checked");var d=b.find("span.on").hasClass("checked");c.prop("checked",d).trigger("change")}function e(b){var c=b.next(".as3cf-validation-error"),d=a("#"+k.attr("id")+' form button[type="submit"]'),e=/[^a-zA-Z0-9\.\-]/;e.test(b.val())?(c.show(),d.prop("disabled",!0)):(c.hide(),d.prop("disabled",!1))}function f(){var c=a("#"+b.prefix+"-bucket").val(),d=k.find('input[name="object-prefix"]'),e=d.val();""!==e&&(e="&prefix="+encodeURIComponent(e));var f=as3cf.aws_bucket_link+c+e;a("#"+b.prefix+"-view-bucket").attr("href",f)}function g(){a(".as3cf-url-preview").html("Generating...");var b={_nonce:as3cf.nonces.get_url_preview};a.each(a("#tab-"+as3cf.tabs.defaultTab+" .as3cf-main-settings form").serializeArray(),function(c,d){var e=d.name,f=d.value;e=e.replace("[]",""),b[e]=void 0===b[e]?f:a.isArray(b[e])?b[e].concat(f):[b[e],f]}),b.action="as3cf-get-url-preview",a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:b,error:function(a,b,c){alert(as3cf.strings.get_url_preview_error+c)},success:function(b,c,d){"undefined"!=typeof b.success?a(".as3cf-url-preview").html(b.url):alert(as3cf.strings.get_url_preview_error+b.error)}})}function h(){a("#as3cf-remove-local-file").is(":checked")&&a("#as3cf-serve-from-s3").is(":not(:checked)")?a("#as3cf-lost-files-notice").show():a("#as3cf-lost-files-notice").hide()}function i(){a("#as3cf-remove-local-file").is(":checked")?a("#as3cf-remove-local-notice").show():a("#as3cf-remove-local-notice").hide()}function j(){return"#"+as3cf.tabs.defaultTab===location.hash?void(location.hash=""):(as3cf.tabs.toggle(location.hash.replace("#",""),!0),void a(document).trigger("as3cf.tabRendered",[location.hash.replace("#","")]))}var k,l={},m=/[^a-z0-9.-]/,n=!1,o=a(".as3cf-tab");as3cf.tabs={defaultTab:"media",toggle:function(c,d){c=as3cf.tabs.sanitizeHash(c),o.hide(),k=a("#tab-"+c),k.show(),a(".nav-tab").removeClass("nav-tab-active"),a('a.nav-tab[data-tab="'+c+'"]').addClass("nav-tab-active"),a(".aws-main").data("tab",c),k.data("prefix")&&(b.prefix=k.data("prefix")),d||a(".as3cf-updated").removeClass("show"),"support"===c&&as3cf.tabs.getDiagnosticInfo()},getDiagnosticInfo:function(){var b=a(".debug-log-textarea");b.html(as3cf.strings.get_diagnostic_info);var c={action:"as3cf-get-diagnostic-info",_nonce:as3cf.nonces.get_diagnostic_info};a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:c,error:function(a,c,d){b.html(d)},success:function(a,c,d){"undefined"!=typeof a.success?b.html(a.diagnostic_info):(b.html(as3cf.strings.get_diagnostic_info_error),b.append(a.error))}})},sanitizeHash:function(b){var c=a("#tab-"+b);return 0===c.length&&(b=as3cf.tabs.defaultTab),b}},as3cf.buckets={validLength:3,bucketSelectLock:!1,loadList:function(c){"undefined"==typeof c&&(c=!1);var d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-list"),e=a("#"+b.prefix+"-bucket").val();if(!1===c&&d.find("li").length>1)return a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+e+'"]').addClass("selected"),void this.scrollToSelected();d.html('<li class="loading">'+d.data("working")+"</li>");var f={action:b.prefix+"-get-buckets",_nonce:window[b.prefix.replace(/-/g,"_")].nonces.get_buckets},g=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:f,error:function(a,b,c){d.html(""),g.showError(as3cf.strings.get_buckets_error,c,"as3cf-bucket-select")},success:function(b,c,f){d.html(""),"undefined"!=typeof b.success?(a(".as3cf-bucket-error").hide(),a(b.buckets).each(function(a,b){var c=b.Name===e?"selected":"";d.append('<li><a class="'+c+'" href="#" data-bucket="'+b.Name+'"><span class="bucket"><span class="dashicons dashicons-portfolio"></span> '+b.Name+'</span><span class="spinner"></span></span></a></li>')}),g.scrollToSelected()):g.showError(as3cf.strings.get_buckets_error,b.error,"as3cf-bucket-select")}})},scrollToSelected:function(){if(a(".as3cf-bucket-list a.selected").length){var b=a("ul.as3cf-bucket-list li").first().position().top+150;a(".as3cf-bucket-list").animate({scrollTop:a("ul.as3cf-bucket-list li a.selected").position().top-b})}},resetModal:function(){var c=a(".as3cf-bucket-container."+b.prefix);!1===k.hasClass("as3cf-has-bucket")||"manual"===a("#"+b.prefix+"-bucket-select").val()?(c.find(".as3cf-bucket-manual").show().siblings().hide(),c.find(".bucket-actions.manual").show().siblings(".bucket-actions").hide()):(c.find(".as3cf-bucket-select").show().siblings().hide(),c.find(".bucket-actions.select").show().siblings(".bucket-actions").hide(),this.loadList(n),n=!1),c.find(".as3cf-bucket-error").hide();var d=a("#"+b.prefix+"-bucket").val();c.find(".as3cf-bucket-manual .as3cf-bucket-name").val(d),this.bucketSelectLock=!1},saveManual:function(){var c=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form"),d=c.find(".as3cf-bucket-name"),e=c.find("button[type=submit]"),f=d.val(),g=e.first().text();if(f===a("#"+b.prefix+"-active-bucket").text())return a(".as3cf-bucket-error").hide(),k.addClass("as3cf-has-bucket"),void b.close();a(".as3cf-bucket-error").hide(),e.text(e.data("working")),e.prop("disabled",!0);var h={action:b.prefix+"-manual-save-bucket",bucket_name:f,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.manual_bucket},i=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:h,error:function(a,b,c){e.text(g),i.showError(as3cf.strings.save_bucket_error,c,"as3cf-bucket-manual")},success:function(c,d,h){e.text(g),e.prop("disabled",!1),"undefined"!=typeof c.success?(i.set(f,c.region,c.can_write),a("#"+b.prefix+"-bucket-select").val("manual"),a(".as3cf-bucket-list a").removeClass("selected").filter('[data-bucket="'+f+'"]').addClass("selected"),n=!0):i.showError(as3cf.strings.save_bucket_error,c.error,"as3cf-bucket-manual")}})},saveSelected:function(c){var d=a(".as3cf-bucket-list");if(!this.bucketSelectLock){if(this.bucketSelectLock=!0,c.hasClass("selected"))return k.addClass("as3cf-has-bucket"),void b.close();var e=a(".as3cf-bucket-list a.selected").data("bucket");a(".as3cf-bucket-list a").removeClass("selected"),c.addClass("selected"),d.addClass("saving"),c.find(".spinner").show().css("visibility","visible");var f=c.data("bucket"),g={action:b.prefix+"-save-bucket",bucket_name:f,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.save_bucket},h=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:g,error:function(b,c,f){d.removeClass("saving"),h.showError(as3cf.strings.save_bucket_error,f,"as3cf-bucket-select"),a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+e+'"]').addClass("selected")},success:function(g,i,j){c.find(".spinner").hide().css("visibility","hidden"),d.removeClass("saving"),"undefined"!=typeof g.success?(h.set(f,g.region,g.can_write),a("#"+b.prefix+"-bucket-select").val("")):(h.showError(as3cf.strings.save_bucket_error,g.error,"as3cf-bucket-select"),a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+e+'"]').addClass("selected"))}})}},disabledButtons:function(){if(0!==a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form").length){var c=a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form"),d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form");c.find(".as3cf-bucket-name").val().length<3?c.find("button[type=submit]").prop("disabled",!0):c.find("button[type=submit]").prop("disabled",!1),d.find(".as3cf-bucket-name").val().length<3?d.find("button[type=submit]").prop("disabled",!0):d.find("button[type=submit]").prop("disabled",!1)}},showError:function(b,c,d){var e=a(".as3cf-bucket-container").children(":visible"),f=e.find(".as3cf-bucket-error");d="undefined"==typeof d?null:d,d&&!e.hasClass(d)||(f.find("span.title").html(b+" &mdash;"),f.find("span.message").html(c),f.show(),this.bucketSelectLock=!1)},set:function(e,h,i){var j=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form"),m=a("#"+b.prefix+"-active-bucket");if("as3cf"===b.prefix&&0===m.text().trim().length){d("as3cf-copy-to-s3-wrap"),d("as3cf-serve-from-s3-wrap");var n=k.attr("id");l[n]=c(n)}a(".as3cf-error.fatal").hide(),m.text(e),j.find(".as3cf-bucket-name").val(e),a("#"+b.prefix+"-bucket").val(e),a("#"+b.prefix+"-region").val(h),a(".updated").not(".as3cf-notice").show(),k.addClass("as3cf-has-bucket"),k.find(".as3cf-can-write-error").toggle(!i),k.find(".as3cf-bucket-error").hide(),"as3cf"===b.prefix&&g(),f(),b.close(function(){k.trigger("bucket-change",[i]),as3cf.buckets.bucketSelectLock=!1})},create:function(){var c=a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form"),d=c.find(".as3cf-bucket-name"),e=c.find(".bucket-create-region"),f=c.find("button[type=submit]"),g=d.val(),h=f.text();a(".as3cf-bucket-error").hide(),f.text(f.data("working")),f.prop("disabled",!0);var i={action:b.prefix+"-create-bucket",bucket_name:g,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.create_bucket};e.val()&&(i.region=e.val());var j=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:i,error:function(a,b,c){f.text(h),j.showError(as3cf.strings.create_bucket_error,c,"as3cf-bucket-create")},success:function(b,c,e){f.text(h),f.prop("disabled",!1),"undefined"!=typeof b.success?(j.set(g,b.region,b.can_write),a(".as3cf-bucket-select-region").hide(),a(".as3cf-bucket-select-region").prop("selected",!1),d.val(""),f.prop("disabled",!0),n=!0):j.showError(as3cf.strings.create_bucket_error,b.error,"as3cf-bucket-create")}})},isValidName:function(a){return!(a.length<3||a.length>63)&&!0!==m.test(a)},updateNameNotice:function(b){var c=null;!0===m.test(b)?c=as3cf.strings.create_bucket_invalid_chars:b.length<3?c=as3cf.strings.create_bucket_name_short:b.length>63&&(c=as3cf.strings.create_bucket_name_long),c&&b.length>0?a(".as3cf-invalid-bucket-name").html(c):a(".as3cf-invalid-bucket-name").html("")}},a(document).ready(function(){j(),window.onhashchange=function(a){"function"==typeof history.replaceState&&"#"===location.href.slice(-1)&&history.replaceState({},"",location.href.slice(0,-1)),j()};var m=a(".wrap.aws-main .nav-tab-wrapper");a(".aws-compatibility-notice, div.updated, div.error, div.notice").not(".below-h2, .inline").insertAfter(m),o.length&&o.each(function(a,b){l[b.id]=c(b.id)}),a(window).on("beforeunload.as3cf-settings",function(){if(!a.isEmptyObject(l)){var b=k.attr("id");return c(b)!==l[b]?as3cf.strings.save_alert:void 0}}),a(document).on("submit",".as3cf-main-settings form",function(b){a(window).off("beforeunload.as3cf-settings")}),a(".as3cf-switch").on("click",function(b){a(this).hasClass("disabled")||d(a(this).attr("id"))}),o.on("change",".sub-toggle",function(b){var c=a(this).attr("id");a(".as3cf-setting."+c).toggleClass("hide")}),a(".as3cf-domain").on("change",'input[type="radio"]',function(b){var c=a(this).closest('input:radio[name="domain"]:checked'),d=c.val(),e=a(this).parents(".as3cf-domain").find(".as3cf-setting.cloudfront"),f="cloudfront"===d;e.toggleClass("hide",!f)}),a(".url-preview").on("change","input",function(a){g()}),h(),a("#as3cf-serve-from-s3,#as3cf-remove-local-file").on("change",function(a){h()}),i(),a("#as3cf-remove-local-file").on("change",function(a){i()}),a('.as3cf-setting input[type="text"]').keypress(function(a){if(13===a.which)return a.preventDefault(),!1}),a('input[name="cloudfront"]').on("keyup",function(b){e(a(this))}),a('input[name="domain"]').on("change",function(b){var c=a(this),d=a("#"+k.attr("id")+' form button[type="submit"]');"cloudfront"!==c.val()?d.prop("disabled",!1):e(c.next(".as3cf-setting").find('input[name="cloudfront"]'))}),a('input[name="object-prefix"]').on("change",function(a){f()}),a("#tab-media > .as3cf-bucket-error").detach().insertAfter(".as3cf-bucket-container h3"),a("body").on("click",".bucket-action-manual",function(c){c.preventDefault(),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-manual").show().siblings().hide()}),a("body").on("click",".bucket-action-browse",function(c){c.preventDefault(),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-select").show().siblings().hide(),as3cf.buckets.loadList(n),n=!1}),a("body").on("click",".bucket-action-create",function(c){c.preventDefault(),a(".as3cf-bucket-name").val(""),a(".as3cf-invalid-bucket-name").html(""),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-create").show().siblings().hide()}),a("body").on("click",".bucket-action-cancel",function(a){a.preventDefault(),as3cf.buckets.resetModal()}),a("body").on("click",".bucket-action-save",function(a){a.preventDefault(),as3cf.buckets.saveManual()}),a("body").on("click",'.as3cf-create-bucket-form button[type="submit"]',function(a){a.preventDefault(),as3cf.buckets.create()}),a("body").on("click",".bucket-action-refresh",function(a){a.preventDefault(),as3cf.buckets.loadList(!0)}),a("body").on("click",".as3cf-bucket-list a",function(b){b.preventDefault(),as3cf.buckets.saveSelected(a(this))}),a(".as3cf-bucket-container").on("click","a.js-link",function(b){return b.preventDefault(),window.open(a(this).attr("href")),!1}),a("body").on("as3cf-modal-open",function(c,d){if(".as3cf-bucket-container."+b.prefix===d){as3cf.buckets.resetModal();var e=a(".as3cf-bucket-manual h3").data("modal-title");a(".as3cf-bucket-manual h3").text(e),as3cf.buckets.disabledButtons()}}),as3cf.buckets.disabledButtons(),a("body").on("input keyup",".as3cf-create-bucket-form .as3cf-bucket-name",function(c){var d=a(this).val(),e=a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form");as3cf.buckets.isValidName(d)?e.find("button[type=submit]").prop("disabled",!1):e.find("button[type=submit]").prop("disabled",!0),as3cf.buckets.updateNameNotice(d)}),a("body").on("input keyup",".as3cf-manual-save-bucket-form .as3cf-bucket-name",function(c){var d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form");d.find(".as3cf-bucket-name").val().length<as3cf.buckets.validLength?d.find("button[type=submit]").prop("disabled",!0):d.find("button[type=submit]").prop("disabled",!1)})})}(jQuery,as3cfModal);
1
+ !function(a,b){function c(b){return a("#"+b+" .as3cf-main-settings form").find("input:not(.no-compare)").serialize()}function d(a){var b=k.find("#"+a),c=b.find("input[type=checkbox]");b.toggleClass("on").find("span").toggleClass("checked");var d=b.find("span.on").hasClass("checked");c.prop("checked",d).trigger("change")}function e(b){var c=b.next(".as3cf-validation-error"),d=a("#"+k.attr("id")+' form button[type="submit"]'),e=/[^a-zA-Z0-9\.\-]/;e.test(b.val())?(c.show(),d.prop("disabled",!0)):(c.hide(),d.prop("disabled",!1))}function f(){var c=a("#"+b.prefix+"-bucket").val(),d=k.find('input[name="object-prefix"]'),e=d.val();""!==e&&(e="&prefix="+encodeURIComponent(e));var f=as3cf.aws_bucket_link+c+e;a("#"+b.prefix+"-view-bucket").attr("href",f)}function g(){a(".as3cf-url-preview").html("Generating...");var b={_nonce:as3cf.nonces.get_url_preview};a.each(a("#tab-"+as3cf.tabs.defaultTab+" .as3cf-main-settings form").serializeArray(),function(c,d){var e=d.name,f=d.value;e=e.replace("[]",""),b[e]=void 0===b[e]?f:a.isArray(b[e])?b[e].concat(f):[b[e],f]}),b.action="as3cf-get-url-preview",a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:b,error:function(a,b,c){alert(as3cf.strings.get_url_preview_error+c)},success:function(b,c,d){"undefined"!=typeof b.success?a(".as3cf-url-preview").html(b.url):alert(as3cf.strings.get_url_preview_error+b.error)}})}function h(){a("#as3cf-remove-local-file").is(":checked")&&a("#as3cf-serve-from-s3").is(":not(:checked)")?a("#as3cf-lost-files-notice").show():a("#as3cf-lost-files-notice").hide()}function i(){a("#as3cf-remove-local-file").is(":checked")?a("#as3cf-remove-local-notice").show():a("#as3cf-remove-local-notice").hide()}function j(){return"#"+as3cf.tabs.defaultTab===location.hash?void(location.hash=""):(as3cf.tabs.toggle(location.hash.replace("#",""),!0),void a(document).trigger("as3cf.tabRendered",[location.hash.replace("#","")]))}var k,l={},m=/[^a-z0-9.-]/,n=!1,o=a("body"),p=a(".as3cf-tab"),q=a(".as3cf-settings");as3cf.tabs={defaultTab:"media",toggle:function(c,d){c=as3cf.tabs.sanitizeHash(c),p.hide(),k=a("#tab-"+c),k.show(),a(".nav-tab").removeClass("nav-tab-active"),a('a.nav-tab[data-tab="'+c+'"]').addClass("nav-tab-active"),a(".as3cf-main").data("tab",c),k.data("prefix")&&(b.prefix=k.data("prefix")),d||a(".as3cf-updated").removeClass("show"),"support"===c&&as3cf.tabs.getDiagnosticInfo()},getDiagnosticInfo:function(){var b=a(".debug-log-textarea");b.html(as3cf.strings.get_diagnostic_info);var c={action:"as3cf-get-diagnostic-info",_nonce:as3cf.nonces.get_diagnostic_info};a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:c,error:function(a,c,d){b.html(d)},success:function(a,c,d){"undefined"!=typeof a.success?b.html(a.diagnostic_info):(b.html(as3cf.strings.get_diagnostic_info_error),b.append(a.error))}})},sanitizeHash:function(b){var c=a("#tab-"+b);return 0===c.length&&(b=as3cf.tabs.defaultTab),b}},as3cf.buckets={validLength:3,bucketSelectLock:!1,loadList:function(c){"undefined"==typeof c&&(c=!1);var d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-list"),e=a("#"+b.prefix+"-bucket").val();if(!1===c&&d.find("li").length>1)return a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+e+'"]').addClass("selected"),void this.scrollToSelected();d.html('<li class="loading">'+d.data("working")+"</li>");var f={action:b.prefix+"-get-buckets",_nonce:window[b.prefix.replace(/-/g,"_")].nonces.get_buckets},g=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:f,error:function(a,b,c){d.html(""),g.showError(as3cf.strings.get_buckets_error,c,"as3cf-bucket-select")},success:function(b,c,f){d.html(""),"undefined"!=typeof b.success?(a(".as3cf-bucket-error").hide(),a(b.buckets).each(function(a,b){var c=b.Name===e?"selected":"";d.append('<li><a class="'+c+'" href="#" data-bucket="'+b.Name+'"><span class="bucket"><span class="dashicons dashicons-portfolio"></span> '+b.Name+'</span><span class="spinner"></span></span></a></li>')}),g.scrollToSelected()):g.showError(as3cf.strings.get_buckets_error,b.error,"as3cf-bucket-select")}})},scrollToSelected:function(){if(a(".as3cf-bucket-list a.selected").length){var b=a("ul.as3cf-bucket-list li").first().position().top+150;a(".as3cf-bucket-list").animate({scrollTop:a("ul.as3cf-bucket-list li a.selected").position().top-b})}},resetModal:function(){var c=a(".as3cf-bucket-container."+b.prefix);!1===k.hasClass("as3cf-has-bucket")||"manual"===a("#"+b.prefix+"-bucket-select").val()?(c.find(".as3cf-bucket-manual").show().siblings().hide(),c.find(".bucket-actions.manual").show().siblings(".bucket-actions").hide()):(c.find(".as3cf-bucket-select").show().siblings().hide(),c.find(".bucket-actions.select").show().siblings(".bucket-actions").hide(),this.loadList(n),n=!1),c.find(".as3cf-bucket-error").hide();var d=a("#"+b.prefix+"-bucket").val();c.find(".as3cf-bucket-manual .as3cf-bucket-name").val(d),this.bucketSelectLock=!1},saveManual:function(){var c=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form"),d=c.find(".as3cf-bucket-name"),e=c.find("button[type=submit]"),f=d.val(),g=e.first().text();if(f===a("#"+b.prefix+"-active-bucket").text())return a(".as3cf-bucket-error").hide(),k.addClass("as3cf-has-bucket"),void b.close();a(".as3cf-bucket-error").hide(),e.text(e.data("working")),e.prop("disabled",!0);var h={action:b.prefix+"-manual-save-bucket",bucket_name:f,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.manual_bucket},i=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:h,error:function(a,b,c){e.text(g),i.showError(as3cf.strings.save_bucket_error,c,"as3cf-bucket-manual")},success:function(c,d,h){e.text(g),e.prop("disabled",!1),"undefined"!=typeof c.success?(i.set(f,c.region,c.can_write),a("#"+b.prefix+"-bucket-select").val("manual"),a(".as3cf-bucket-list a").removeClass("selected").filter('[data-bucket="'+f+'"]').addClass("selected"),n=!0,as3cf.showSettingsSavedNotice()):i.showError(as3cf.strings.save_bucket_error,c.error,"as3cf-bucket-manual")}})},saveSelected:function(c){var d=a(".as3cf-bucket-list");if(!this.bucketSelectLock){if(this.bucketSelectLock=!0,c.hasClass("selected"))return k.addClass("as3cf-has-bucket"),void b.close();var e=a(".as3cf-bucket-list a.selected").data("bucket");a(".as3cf-bucket-list a").removeClass("selected"),c.addClass("selected"),d.addClass("saving"),c.find(".spinner").show().css("visibility","visible");var f=c.data("bucket"),g={action:b.prefix+"-save-bucket",bucket_name:f,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.save_bucket},h=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:g,error:function(b,c,f){d.removeClass("saving"),h.showError(as3cf.strings.save_bucket_error,f,"as3cf-bucket-select"),a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+e+'"]').addClass("selected")},success:function(g,i,j){c.find(".spinner").hide().css("visibility","hidden"),d.removeClass("saving"),"undefined"!=typeof g.success?(h.set(f,g.region,g.can_write),a("#"+b.prefix+"-bucket-select").val(""),as3cf.showSettingsSavedNotice()):(h.showError(as3cf.strings.save_bucket_error,g.error,"as3cf-bucket-select"),a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+e+'"]').addClass("selected"))}})}},disabledButtons:function(){if(0!==a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form").length){var c=a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form"),d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form");c.find(".as3cf-bucket-name").val().length<3?c.find("button[type=submit]").prop("disabled",!0):c.find("button[type=submit]").prop("disabled",!1),d.find(".as3cf-bucket-name").val().length<3?d.find("button[type=submit]").prop("disabled",!0):d.find("button[type=submit]").prop("disabled",!1)}},showError:function(b,c,d){var e=a(".as3cf-bucket-container").children(":visible"),f=e.find(".as3cf-bucket-error");d="undefined"==typeof d?null:d,d&&!e.hasClass(d)||(f.find("span.title").html(b+" &mdash;"),f.find("span.message").html(c),f.show(),this.bucketSelectLock=!1)},set:function(e,h,i){var j=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form"),m=a("#"+b.prefix+"-active-bucket");if("as3cf"===b.prefix&&0===m.text().trim().length){d("as3cf-copy-to-s3-wrap"),d("as3cf-serve-from-s3-wrap");var n=k.attr("id");l[n]=c(n)}a(".as3cf-error.fatal").hide(),m.text(e),j.find(".as3cf-bucket-name").val(e),a("#"+b.prefix+"-bucket").val(e),a("#"+b.prefix+"-region").val(h),a(".updated").not(".as3cf-notice").show(),k.addClass("as3cf-has-bucket"),k.find(".as3cf-can-write-error").toggle(!i),k.find(".as3cf-bucket-error").hide(),"as3cf"===b.prefix&&g(),f(),b.close(function(){k.trigger("bucket-change",[i]),as3cf.buckets.bucketSelectLock=!1})},create:function(){var c=a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form"),d=c.find(".as3cf-bucket-name"),e=c.find(".bucket-create-region"),f=c.find("button[type=submit]"),g=d.val(),h=f.text();a(".as3cf-bucket-error").hide(),f.text(f.data("working")),f.prop("disabled",!0);var i={action:b.prefix+"-create-bucket",bucket_name:g,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.create_bucket};e.val()&&(i.region=e.val());var j=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:i,error:function(a,b,c){f.text(h),j.showError(as3cf.strings.create_bucket_error,c,"as3cf-bucket-create")},success:function(b,c,e){f.text(h),f.prop("disabled",!1),"undefined"!=typeof b.success?(j.set(g,b.region,b.can_write),a(".as3cf-bucket-select-region").hide(),a(".as3cf-bucket-select-region").prop("selected",!1),d.val(""),f.prop("disabled",!0),n=!0,as3cf.showSettingsSavedNotice()):j.showError(as3cf.strings.create_bucket_error,b.error,"as3cf-bucket-create")}})},isValidName:function(a){return!(a.length<3||a.length>63)&&!0!==m.test(a)},updateNameNotice:function(b){var c=null;!0===m.test(b)?c=as3cf.strings.create_bucket_invalid_chars:b.length<3?c=as3cf.strings.create_bucket_name_short:b.length>63&&(c=as3cf.strings.create_bucket_name_long),c&&b.length>0?a(".as3cf-invalid-bucket-name").html(c):a(".as3cf-invalid-bucket-name").html("")}},as3cf.reloadUpdated=function(){var a=location.pathname+location.search;location.search.match(/[?&]updated=/)||(a+="&updated=1"),a+=location.hash,location.assign(a)},as3cf.showSettingsSavedNotice=function(){if(!(0<a("#setting-error-settings_updated:visible").length||0<a("#as3cf-settings_updated:visible").length)){var b='<div id="as3cf-settings_updated" class="updated settings-error notice is-dismissible"><p><strong>'+as3cf.strings.settings_saved+"</strong></p></div>";a("h2.nav-tab-wrapper").after(b),a(document).trigger("wp-updates-notice-added")}};var r=function(){this.$key=q.find('input[name="aws-access-key-id"]'),this.$secret=q.find('input[name="aws-secret-access-key"]'),this.$spinner=q.find("[data-as3cf-aws-keys-spinner]"),this.$feedback=q.find("[data-as3cf-aws-keys-feedback]")};r.prototype.set=function(){this.sendRequest("set",{"aws-access-key-id":this.$key.val(),"aws-secret-access-key":this.$secret.val()}).done(function(a){a.success&&this.$secret.val(as3cf.strings.not_shown_placeholder)}.bind(this))},r.prototype.remove=function(){this.sendRequest("remove").done(function(a){a.success&&(this.$key.val(""),this.$secret.val(""))}.bind(this))},r.prototype.sendRequest=function(b,c){var d={action:"as3cf-aws-keys-"+b,_ajax_nonce:as3cf.nonces["aws_keys_"+b]};return _.isObject(c)&&(d=_.extend(d,c)),this.$spinner.addClass("is-active"),a.post(ajaxurl,d).done(function(a){this.$feedback.toggleClass("notice-success",a.success).toggleClass("notice-error",!a.success),a.data&&a.data.message&&this.$feedback.html("<p>"+a.data.message+"</p>").show(),a.success&&as3cf.reloadUpdated()}.bind(this)).always(function(){this.$spinner.removeClass("is-active")}.bind(this))},a(document).ready(function(){j(),window.onhashchange=function(a){"function"==typeof history.replaceState&&"#"===location.href.slice(-1)&&history.replaceState({},"",location.href.slice(0,-1)),j()};var m=a(".as3cf-main .nav-tab-wrapper");a(".as3cf-compatibility-notice, div.updated, div.error, div.notice").not(".below-h2, .inline").insertAfter(m),p.length&&p.each(function(a,b){l[b.id]=c(b.id)}),a(window).on("beforeunload.as3cf-settings",function(){if(!a.isEmptyObject(l)){var b=k.attr("id");return c(b)!==l[b]?as3cf.strings.save_alert:void 0}}),a(document).on("submit",".as3cf-main-settings form",function(b){a(window).off("beforeunload.as3cf-settings")}),a(".as3cf-switch").on("click",function(b){a(this).hasClass("disabled")||d(a(this).attr("id"))}),p.on("change",".sub-toggle",function(b){var c=a(this).attr("id");a(".as3cf-setting."+c).toggleClass("hide")}),a(".as3cf-domain").on("change",'input[type="radio"]',function(b){var c=a(this).closest('input:radio[name="domain"]:checked'),d=c.val(),e=a(this).parents(".as3cf-domain").find(".as3cf-setting.cloudfront"),f="cloudfront"===d;e.toggleClass("hide",!f)}),a(".url-preview").on("change","input",function(a){g()}),h(),a("#as3cf-serve-from-s3,#as3cf-remove-local-file").on("change",function(a){h()}),i(),a("#as3cf-remove-local-file").on("change",function(a){i()}),a('.as3cf-setting input[type="text"]').keypress(function(a){if(13===a.which)return a.preventDefault(),!1}),a('input[name="cloudfront"]').on("keyup",function(b){e(a(this))}),a('input[name="domain"]').on("change",function(b){var c=a(this),d=a("#"+k.attr("id")+' form button[type="submit"]');"cloudfront"!==c.val()?d.prop("disabled",!1):e(c.next(".as3cf-setting").find('input[name="cloudfront"]'))}),a('input[name="object-prefix"]').on("change",function(a){f()}),a("#tab-media > .as3cf-bucket-error").detach().insertAfter(".as3cf-bucket-container h3"),o.on("click",".bucket-action-manual",function(c){c.preventDefault(),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-manual").show().siblings().hide()}),o.on("click",".bucket-action-browse",function(c){c.preventDefault(),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-select").show().siblings().hide(),as3cf.buckets.loadList(n),n=!1}),o.on("click",".bucket-action-create",function(c){c.preventDefault(),a(".as3cf-bucket-name").val(""),a(".as3cf-invalid-bucket-name").html(""),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-create").show().siblings().hide()}),o.on("click",".bucket-action-cancel",function(a){a.preventDefault(),as3cf.buckets.resetModal()}),o.on("click",".bucket-action-save",function(a){a.preventDefault(),as3cf.buckets.saveManual()}),o.on("click",'.as3cf-create-bucket-form button[type="submit"]',function(a){a.preventDefault(),as3cf.buckets.create()}),o.on("click",".bucket-action-refresh",function(a){a.preventDefault(),as3cf.buckets.loadList(!0)}),o.on("click",".as3cf-bucket-list a",function(b){b.preventDefault(),as3cf.buckets.saveSelected(a(this))}),a(".as3cf-bucket-container").on("click","a.js-link",function(b){return b.preventDefault(),window.open(a(this).attr("href")),!1}),o.on("as3cf-modal-open",function(c,d){if(".as3cf-bucket-container."+b.prefix===d){as3cf.buckets.resetModal();var e=a(".as3cf-bucket-manual h3").data("modal-title");a(".as3cf-bucket-manual h3").text(e),as3cf.buckets.disabledButtons()}}),as3cf.buckets.disabledButtons(),o.on("input keyup",".as3cf-create-bucket-form .as3cf-bucket-name",function(c){var d=a(this).val(),e=a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form");as3cf.buckets.isValidName(d)?e.find("button[type=submit]").prop("disabled",!1):e.find("button[type=submit]").prop("disabled",!0),as3cf.buckets.updateNameNotice(d)}),o.on("input keyup",".as3cf-manual-save-bucket-form .as3cf-bucket-name",function(c){var d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form");d.find(".as3cf-bucket-name").val().length<as3cf.buckets.validLength?d.find("button[type=submit]").prop("disabled",!0):d.find("button[type=submit]").prop("disabled",!1)}),q.on("click","[data-as3cf-toggle-access-keys-form]",function(b){b.preventDefault(),a("#as3cf_access_keys").toggle()}).on("click","[data-as3cf-aws-keys-action]",function(b){b.preventDefault();var c=a(this).data("as3cfAwsKeysAction"),d=new r;"function"==typeof d[c]&&d[c]()})})}(jQuery,as3cfModal);
assets/sass/notice.scss CHANGED
@@ -2,7 +2,7 @@
2
  * Common as3cf-notice styles.
3
  */
4
  .as3cf-notice,
5
- .aws-compatibility-notice {
6
  p {
7
  max-width: 800px;
8
  }
@@ -14,3 +14,7 @@
14
  .as3cf-license-notice p:not(.as3cf-before):before {
15
  display: none;
16
  }
 
 
 
 
2
  * Common as3cf-notice styles.
3
  */
4
  .as3cf-notice,
5
+ .as3cf-compatibility-notice {
6
  p {
7
  max-width: 800px;
8
  }
14
  .as3cf-license-notice p:not(.as3cf-before):before {
15
  display: none;
16
  }
17
+
18
+ .as3cf-notice-warning {
19
+ border-left-color: #ffba00;
20
+ }
assets/sass/styles.scss CHANGED
@@ -1,7 +1,23 @@
1
- /**
2
- * AWS wrap
3
- */
4
- .aws-main.wrap {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  position: relative;
6
 
7
  & > h1 {
@@ -9,8 +25,6 @@
9
  }
10
 
11
  .as3cf-notice, .as3cf-updated, .as3cf-error {
12
- -webkit-box-sizing: border-box;
13
- -moz-box-sizing: border-box;
14
  box-sizing: border-box;
15
  }
16
 
@@ -25,13 +39,20 @@
25
  margin-top: 10px;
26
  padding: 9px 0 0 5px;
27
 
 
 
 
 
 
 
 
 
28
  a.nav-tab-active {
29
  color: #464646;
30
  cursor: default;
31
  }
32
 
33
  a:focus {
34
- -webkit-box-shadow: none;
35
  box-shadow: none;
36
  }
37
  }
@@ -65,8 +86,6 @@
65
  .as3cf-notice, .error, .updated {
66
  max-width: 650px;
67
  margin-top: 15px;
68
- -webkit-box-sizing: border-box;
69
- -moz-box-sizing: border-box;
70
  box-sizing: border-box;
71
  }
72
 
@@ -76,6 +95,15 @@
76
  display: block;
77
  }
78
  }
 
 
 
 
 
 
 
 
 
79
  }
80
 
81
  /**
@@ -101,6 +129,21 @@
101
  }
102
  }
103
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  /**
105
  * Settings
106
  */
@@ -130,8 +173,6 @@
130
  padding: 20px 0 0;
131
  max-width: 650px;
132
  width: 100%;
133
- -webkit-box-sizing: border-box;
134
- -moz-box-sizing: border-box;
135
  box-sizing: border-box;
136
 
137
  .as3cf-url-preview {
@@ -173,7 +214,6 @@
173
  padding: 2px;
174
  overflow: hidden;
175
  border-radius: 2px;
176
- -webkit-border-radius: 2px;
177
  background-color: #d4d3d3;
178
  cursor: pointer;
179
 
@@ -183,8 +223,6 @@
183
 
184
  span {
185
  visibility: hidden;
186
- -webkit-box-sizing: border-box;
187
- -moz-box-sizing: border-box;
188
  box-sizing: border-box;
189
  float: left;
190
  display: inline-block;
@@ -192,7 +230,6 @@
192
  font-size: 12px;
193
  line-height: 20px;
194
  border-radius: 2px;
195
- -webkit-border-radius: 2px;
196
  font-weight: bold;
197
  padding: 4px 8px;
198
  background: #fff;
@@ -241,7 +278,6 @@
241
  h3 {
242
  font-weight: normal;
243
  text-transform: uppercase;
244
- margin: 15px 0;
245
  }
246
 
247
  .form-table {
@@ -273,12 +309,6 @@
273
  margin-top: 0;
274
  }
275
  }
276
-
277
- &:first-of-type {
278
- td {
279
- padding-top: 5px;
280
- }
281
- }
282
  }
283
 
284
  tr.as3cf-bucket-setting .as3cf-defined-in-config {
@@ -338,8 +368,6 @@
338
  margin-left: -250px;
339
  padding: 10px;
340
  width: 500px;
341
- -webkit-border-radius: 3px;
342
- -moz-border-radius: 3px;
343
  border-radius: 3px;
344
  background-color: #000;
345
  background-color: hsla(0, 0%, 20%, 0.9);
@@ -381,6 +409,7 @@
381
  padding: 2px 5px;
382
  margin: 0 0 5px 5px;
383
  float: right;
 
384
  }
385
 
386
  .as3cf-defined-setting {
@@ -414,6 +443,10 @@
414
  display: none;
415
  }
416
 
 
 
 
 
417
  .as3cf-bucket-container {
418
  display: block;
419
  }
@@ -439,7 +472,6 @@
439
  }
440
 
441
  a:focus {
442
- -webkit-box-shadow: none;
443
  box-shadow: none;
444
  outline: none;
445
  }
@@ -535,14 +567,47 @@
535
  }
536
  }
537
 
538
- .as3cf-tab {
539
- display: none;
540
- }
541
-
542
  #tab-media {
543
  display: block;
544
  }
545
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
546
  #tab-support {
547
  min-height: 900px;
548
  .as3cf-sidebar {
@@ -553,6 +618,10 @@
553
  border-bottom: 1px solid #ccc;
554
  padding-bottom: 20px;
555
  margin-bottom: 20px;
 
 
 
 
556
  }
557
 
558
  .debug {
@@ -750,7 +819,7 @@
750
  }
751
  }
752
 
753
- .aws-compatibility-notice.error {
754
  clear: both;
755
  margin: 5px 20px 5px 0;
756
  }
@@ -780,3 +849,109 @@
780
  color: #dc3232;
781
  }
782
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ $aws_orange: #f7a80d;
2
+ $as3cf_assets: #0769ad;
3
+
4
+ .as3cf-content,
5
+ .as3cf-updated,
6
+ .as3cf-compatibility-notice {
7
+ box-sizing: border-box;
8
+ max-width: 650px;
9
+ }
10
+
11
+ .settings_page_amazon-s3-and-cloudfront {
12
+ .error,
13
+ .notice,
14
+ .updated {
15
+ box-sizing: border-box;
16
+ max-width: 650px;
17
+ }
18
+ }
19
+
20
+ .as3cf-main.wrap {
21
  position: relative;
22
 
23
  & > h1 {
25
  }
26
 
27
  .as3cf-notice, .as3cf-updated, .as3cf-error {
 
 
28
  box-sizing: border-box;
29
  }
30
 
39
  margin-top: 10px;
40
  padding: 9px 0 0 5px;
41
 
42
+ .nav-tab-container {
43
+ float: right;
44
+
45
+ :last-child {
46
+ margin-right: 5px;
47
+ }
48
+ }
49
+
50
  a.nav-tab-active {
51
  color: #464646;
52
  cursor: default;
53
  }
54
 
55
  a:focus {
 
56
  box-shadow: none;
57
  }
58
  }
86
  .as3cf-notice, .error, .updated {
87
  max-width: 650px;
88
  margin-top: 15px;
 
 
89
  box-sizing: border-box;
90
  }
91
 
95
  display: block;
96
  }
97
  }
98
+
99
+ .alignleft {
100
+ margin-right: 20px;
101
+ margin-bottom: 20px;
102
+ }
103
+
104
+ .spinner {
105
+ min-width: 20px;
106
+ }
107
  }
108
 
109
  /**
129
  }
130
  }
131
 
132
+ .as3cf-content {
133
+ > section {
134
+ margin-bottom: 20px;
135
+ }
136
+
137
+ > section + section.as3cf-access-keys {
138
+ padding-top: 20px;
139
+ border-top: 1px solid #d3d3d3;
140
+
141
+ .as3cf-section-heading {
142
+ margin-top: 0;
143
+ }
144
+ }
145
+ }
146
+
147
  /**
148
  * Settings
149
  */
173
  padding: 20px 0 0;
174
  max-width: 650px;
175
  width: 100%;
 
 
176
  box-sizing: border-box;
177
 
178
  .as3cf-url-preview {
214
  padding: 2px;
215
  overflow: hidden;
216
  border-radius: 2px;
 
217
  background-color: #d4d3d3;
218
  cursor: pointer;
219
 
223
 
224
  span {
225
  visibility: hidden;
 
 
226
  box-sizing: border-box;
227
  float: left;
228
  display: inline-block;
230
  font-size: 12px;
231
  line-height: 20px;
232
  border-radius: 2px;
 
233
  font-weight: bold;
234
  padding: 4px 8px;
235
  background: #fff;
278
  h3 {
279
  font-weight: normal;
280
  text-transform: uppercase;
 
281
  }
282
 
283
  .form-table {
309
  margin-top: 0;
310
  }
311
  }
 
 
 
 
 
 
312
  }
313
 
314
  tr.as3cf-bucket-setting .as3cf-defined-in-config {
368
  margin-left: -250px;
369
  padding: 10px;
370
  width: 500px;
 
 
371
  border-radius: 3px;
372
  background-color: #000;
373
  background-color: hsla(0, 0%, 20%, 0.9);
409
  padding: 2px 5px;
410
  margin: 0 0 5px 5px;
411
  float: right;
412
+ white-space: nowrap;
413
  }
414
 
415
  .as3cf-defined-setting {
443
  display: none;
444
  }
445
 
446
+ .as3cf-bucket-setting td {
447
+ padding-top: 5px;
448
+ }
449
+
450
  .as3cf-bucket-container {
451
  display: block;
452
  }
472
  }
473
 
474
  a:focus {
 
475
  box-shadow: none;
476
  outline: none;
477
  }
567
  }
568
  }
569
 
 
 
 
 
570
  #tab-media {
571
  display: block;
572
  }
573
 
574
+ #tab-settings {
575
+ .as3cf-field-wrap {
576
+ display: flex;
577
+ align-items: center;
578
+
579
+ input {
580
+ width: 100%;
581
+ }
582
+
583
+ button, .as3cf-defined-in-config {
584
+ margin-left: 20px;
585
+ }
586
+
587
+ .as3cf-defined-in-config {
588
+ display: none;
589
+ margin-bottom: 0;
590
+ }
591
+
592
+ &.as3cf-defined {
593
+ button {
594
+ display: none;
595
+ }
596
+ .as3cf-defined-in-config {
597
+ display: inline-block;
598
+ }
599
+ }
600
+
601
+ &.as3cf-saved-field .as3cf-activate-licence {
602
+ display: none;
603
+ }
604
+
605
+ &.as3cf-licence-not-entered .as3cf-remove-licence {
606
+ display: none;
607
+ }
608
+ }
609
+ }
610
+
611
  #tab-support {
612
  min-height: 900px;
613
  .as3cf-sidebar {
618
  border-bottom: 1px solid #ccc;
619
  padding-bottom: 20px;
620
  margin-bottom: 20px;
621
+
622
+ h3 {
623
+ font-size: 20px;
624
+ }
625
  }
626
 
627
  .debug {
819
  }
820
  }
821
 
822
+ .as3cf-compatibility-notice.error {
823
  clear: both;
824
  margin: 5px 20px 5px 0;
825
  }
849
  color: #dc3232;
850
  }
851
  }
852
+
853
+ .as3cf-need-help {
854
+ background-color: white;
855
+ font-size: 16px;
856
+ font-weight: bold;
857
+ padding: 1em;
858
+
859
+ a {
860
+ text-decoration: none;
861
+ }
862
+ }
863
+
864
+ .as3cf-aws-logo {
865
+ color: white;
866
+ background-color: $aws_orange;
867
+ padding: 1em;
868
+ }
869
+
870
+ .as3cf-settings {
871
+ h3 {
872
+ font-size: 20px;
873
+ }
874
+
875
+ p {
876
+ font-size: 14px;
877
+ }
878
+ }
879
+
880
+ .as3cf-addons,
881
+ .as3cf-tab .as3cf-compatibility-notice {
882
+ max-width: cover;
883
+ }
884
+
885
+ textarea.as3cf-access-key-constants-snippet.code {
886
+ width: 100%;
887
+ white-space: pre;
888
+ overflow: hidden;
889
+ font-size: 12px;
890
+ padding: 10px;
891
+ height: 53px;
892
+ }
893
+
894
+ /**
895
+ * Addons Tab
896
+ */
897
+ .as3cf-addons {
898
+ .as3cf-addons-list {
899
+ margin: 20px 0 200px;
900
+ padding-top: 5px;
901
+ }
902
+
903
+ .as3cf-addon {
904
+ display: flex;
905
+ padding: 20px;
906
+ font-size: 14px;
907
+
908
+ &-info {
909
+ min-height: 100px;
910
+ }
911
+
912
+ &-links {
913
+ float: right;
914
+
915
+ span {
916
+ padding: 4px 6px;
917
+ }
918
+ }
919
+
920
+ &-icon {
921
+ float: left;
922
+ margin-right: 20px;
923
+ }
924
+
925
+ &-details {
926
+ white-space: nowrap;
927
+ }
928
+
929
+ &-title,
930
+ &-description {
931
+ font-weight: 100;
932
+ }
933
+
934
+ + .as3cf-addon {
935
+ margin-top: 20px;
936
+ }
937
+
938
+ &.amazon-s3-and-cloudfront-assets-pull {
939
+ background-color: $as3cf_assets;
940
+ color: white;
941
+
942
+ .as3cf-addon-title,
943
+ .as3cf-addon-description,
944
+ a {
945
+ color: white;
946
+ }
947
+
948
+ .extra {
949
+ background: white;
950
+ a {
951
+ color: $as3cf_assets;
952
+ text-decoration: none;
953
+ }
954
+ }
955
+ }
956
+ }
957
+ }
classes/amazon-s3-and-cloudfront.php CHANGED
@@ -1,6 +1,8 @@
1
  <?php
2
 
 
3
  use DeliciousBrains\WP_Offload_S3\Null_S3_Client;
 
4
  use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_Content_Replace_URLs;
5
  use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_EDD_Replace_URLs;
6
  use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_File_Sizes;
@@ -8,7 +10,7 @@ use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_Filter_Post_Excerpt;
8
  use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_Meta_WP_Error;
9
  use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_Region_Meta;
10
 
11
- class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
12
 
13
  /**
14
  * @var Amazon_Web_Services
@@ -16,10 +18,15 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
16
  private $aws;
17
 
18
  /**
19
- * @var Aws\S3\S3Client
20
  */
21
  private $s3client;
22
 
 
 
 
 
 
23
  /**
24
  * @var array
25
  */
@@ -40,21 +47,11 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
40
  */
41
  protected static $admin_notices = array();
42
 
43
- /**
44
- * @var
45
- */
46
- protected static $plugin_page;
47
-
48
  /**
49
  * @var string
50
  */
51
  protected $plugin_prefix = 'as3cf';
52
 
53
- /**
54
- * @var string
55
- */
56
- protected $default_tab = '';
57
-
58
  /**
59
  * @var AS3CF_Local_To_S3
60
  */
@@ -98,16 +95,20 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
98
  const LATEST_UPGRADE_ROUTINE = 6;
99
 
100
  /**
101
- * @param string $plugin_file_path
102
- * @param Amazon_Web_Services $aws
103
- * @param string|null $slug
104
  */
105
- function __construct( $plugin_file_path, $aws, $slug = null ) {
106
  $this->plugin_slug = ( is_null( $slug ) ) ? 'amazon-s3-and-cloudfront' : $slug;
107
 
108
  parent::__construct( $plugin_file_path );
109
 
110
- $this->aws = $aws;
 
 
 
 
111
  $this->notices = AS3CF_Notices::get_instance( $this );
112
 
113
  $this->init( $plugin_file_path );
@@ -119,9 +120,11 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
119
  * @param string $plugin_file_path
120
  */
121
  function init( $plugin_file_path ) {
122
- self::$plugin_page = $this->plugin_slug;
123
- $this->plugin_title = __( 'Offload S3 Lite', 'amazon-s3-and-cloudfront' );
124
- $this->plugin_menu_title = __( 'S3 and CloudFront', 'amazon-s3-and-cloudfront' );
 
 
125
 
126
  new Upgrade_Region_Meta( $this );
127
  new Upgrade_File_Sizes( $this );
@@ -131,11 +134,15 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
131
  new Upgrade_Filter_Post_Excerpt( $this );
132
 
133
  // Plugin setup
134
- add_action( 'aws_admin_menu', array( $this, 'admin_menu' ) );
 
 
135
  add_filter( 'plugin_action_links', array( $this, 'plugin_actions_settings_link' ), 10, 2 );
136
- add_filter( 'pre_get_space_used', array( $this, 'multisite_get_spaced_used' ) );
 
137
  // display a notice when either lite or pro is automatically deactivated
138
  add_action( 'pre_current_active_plugins', array( $this, 'plugin_deactivated_notice' ) );
 
139
 
140
  // Attachment screens/modals
141
  add_action( 'load-upload.php', array( $this, 'load_media_assets' ), 11 );
@@ -150,6 +157,8 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
150
  add_action( 'wp_ajax_as3cf-get-url-preview', array( $this, 'ajax_get_url_preview' ) );
151
  add_action( 'wp_ajax_as3cf_get_attachment_s3_details', array( $this, 'ajax_get_attachment_s3_details' ) );
152
  add_action( 'wp_ajax_as3cf-get-diagnostic-info', array( $this, 'ajax_get_diagnostic_info' ) );
 
 
153
 
154
  // Rewriting URLs, doesn't depend on plugin being setup
155
  add_filter( 'wp_get_attachment_url', array( $this, 'wp_get_attachment_url' ), 99, 2 );
@@ -184,6 +193,13 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
184
  $this->register_modal_assets();
185
  }
186
 
 
 
 
 
 
 
 
187
  /**
188
  * Get the plugin title to be used in page headings
189
  *
@@ -252,6 +268,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
252
  function get_setting( $key, $default = '' ) {
253
  // use settings from $_POST when generating URL preview via AJAX
254
  if ( isset( $_POST['action'] ) && 'as3cf-get-url-preview' == sanitize_key( $_POST['action'] ) ) { // input var okay
 
255
  $value = 0;
256
  if ( isset( $_POST[ $key ] ) ) { // input var okay
257
  $value = $_POST[ $key ]; // input var okay
@@ -752,6 +769,80 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
752
  $this->end_ajax( $out );
753
  }
754
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
755
  /**
756
  * Delete bulk objects from an S3 bucket
757
  *
@@ -828,7 +919,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
828
  * to cope with possible different regions
829
  */
830
  function delete_attachment( $post_id, $force_new_s3_client = false ) {
831
- if ( ! $this->is_plugin_setup() ) {
832
  return;
833
  }
834
 
@@ -851,7 +942,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
851
  * @return array
852
  */
853
  function wp_update_attachment_metadata( $data, $post_id ) {
854
- if ( ! $this->is_plugin_setup() ) {
855
  return $data;
856
  }
857
 
@@ -947,9 +1038,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
947
  // use existing bucket
948
  $bucket = $old_s3object['bucket'];
949
  // get existing region
950
- if ( isset( $old_s3object['region'] ) ) {
951
- $region = $old_s3object['region'];
952
- };
953
  } else {
954
  // derive prefix from various settings
955
  if ( isset( $data['file'] ) ) {
@@ -972,19 +1061,6 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
972
  $acl = apply_filters( 'wps3_upload_acl', $acl, $type, $data, $post_id, $this ); // Old naming convention, will be deprecated soon
973
  $acl = apply_filters( 'as3cf_upload_acl', $acl, $data, $post_id );
974
 
975
- $s3object = array(
976
- 'bucket' => $bucket,
977
- 'key' => $prefix . $file_name,
978
- 'region' => $region,
979
- );
980
-
981
- // store acl if not default
982
- if ( $acl != self::DEFAULT_ACL ) {
983
- $s3object['acl'] = $acl;
984
- }
985
-
986
- $s3client = $this->get_s3client( $region, $force_new_s3_client );
987
-
988
  $args = array(
989
  'Bucket' => $bucket,
990
  'Key' => $prefix . $file_name,
@@ -1005,11 +1081,24 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
1005
 
1006
  $image_size = wp_attachment_is_image( $post_id ) ? 'full' : '';
1007
  $args = apply_filters( 'as3cf_object_meta', $args, $post_id, $image_size, false );
 
 
 
 
 
 
 
 
 
 
 
1008
 
1009
  do_action( 'as3cf_upload_attachment_pre_remove', $post_id, $s3object, $prefix, $args );
1010
 
1011
  $files_to_remove = array();
1012
 
 
 
1013
  try {
1014
  $s3client->putObject( $args );
1015
  $files_to_remove[] = $file_path;
@@ -1341,7 +1430,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
1341
  * @return string
1342
  */
1343
  public function filter_unique_filename( $filename, $post_id = null ) {
1344
- if ( ! $this->get_setting( 'copy-to-s3' ) || ! $this->is_plugin_setup() ) {
1345
  return $filename;
1346
  }
1347
 
@@ -1514,10 +1603,12 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
1514
  /**
1515
  * Check the plugin is correctly setup
1516
  *
 
 
1517
  * @return bool
1518
  */
1519
- function is_plugin_setup() {
1520
- if ( $this->aws->needs_access_keys() ) {
1521
  // AWS not configured
1522
  return false;
1523
  }
@@ -1842,7 +1933,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
1842
  }
1843
  }
1844
 
1845
- if ( ! is_null( $expires ) && $this->is_plugin_setup() ) {
1846
  try {
1847
  $expires = time() + apply_filters( 'as3cf_expires', $expires );
1848
  $secure_url = $this->get_s3client( $region )
@@ -2183,7 +2274,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
2183
  * @return string
2184
  */
2185
  function update_attached_file( $file, $attachment_id ) {
2186
- if ( ! $this->is_plugin_setup() ) {
2187
  return $file;
2188
  }
2189
 
@@ -2438,12 +2529,11 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
2438
  }
2439
 
2440
  /**
2441
- * Add the settings menu item
2442
- *
2443
- * @param Amazon_Web_Services $aws
2444
  */
2445
- function admin_menu( $aws ) {
2446
- $hook_suffix = $aws->add_page(
 
2447
  $this->get_plugin_page_title(),
2448
  $this->plugin_menu_title,
2449
  'manage_options',
@@ -2451,10 +2541,24 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
2451
  array( $this, 'render_page' )
2452
  );
2453
 
2454
- if ( false !== $hook_suffix ) {
2455
- $this->hook_suffix = $hook_suffix;
2456
- add_action( 'load-' . $this->hook_suffix, array( $this, 'plugin_load' ) );
2457
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2458
  }
2459
 
2460
  /**
@@ -2463,10 +2567,13 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
2463
  * @param bool|string $region specify region to client for signature
2464
  * @param bool $force force return of new S3 client when swapping regions
2465
  *
2466
- * @return Aws\S3\S3Client
2467
  */
2468
  public function get_s3client( $region = false, $force = false ) {
2469
- if ( is_null( $this->s3client ) || $force ) {
 
 
 
2470
 
2471
  $args = array(
2472
  'version' => self::S3_API_VERSION,
@@ -2477,9 +2584,11 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
2477
  $args['signature'] = self::AWS_SIGNATURE;
2478
  }
2479
 
 
 
2480
  try {
2481
  $aws_client = $this->aws->get_client();
2482
- $this->set_client( $aws_client->get( 's3', $args ) );
2483
  } catch ( \Exception $e ) {
2484
  AS3CF_Error::log( $e->getMessage() );
2485
  $this->set_client( new Null_S3_Client );
@@ -2493,9 +2602,14 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
2493
  * Setter for S3 client
2494
  *
2495
  * @param Aws\S3\S3Client|Null_S3_Client $client
 
2496
  */
2497
- public function set_client( $client ) {
2498
  $this->s3client = $client;
 
 
 
 
2499
  }
2500
 
2501
  /**
@@ -2633,6 +2747,11 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
2633
  * @return bool|WP_Error
2634
  */
2635
  function check_write_permission( $bucket = null, $region = null ) {
 
 
 
 
 
2636
  if ( is_null( $bucket ) ) {
2637
  if ( ! ( $bucket = $this->get_setting( 'bucket' ) ) ) {
2638
  // if no bucket set then no need check
@@ -2720,8 +2839,20 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
2720
  * On plugin load.
2721
  */
2722
  public function plugin_load() {
 
 
 
 
 
 
 
 
 
 
 
 
2723
  $this->enqueue_style( 'as3cf-styles', 'assets/css/styles', array( 'as3cf-modal' ) );
2724
- $this->enqueue_script( 'as3cf-script', 'assets/js/script', array( 'jquery', 'as3cf-modal' ) );
2725
 
2726
  wp_localize_script( 'as3cf-script',
2727
  'as3cf',
@@ -2737,6 +2868,9 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
2737
  'save_alert' => __( 'The changes you made will be lost if you navigate away from this page', 'amazon-s3-and-cloudfront' ),
2738
  'get_diagnostic_info' => __( 'Getting diagnostic info...', 'amazon-s3-and-cloudfront' ),
2739
  'get_diagnostic_info_error' => __( 'Error getting diagnostic info: ', 'amazon-s3-and-cloudfront' ),
 
 
 
2740
  ),
2741
  'nonces' => array(
2742
  'create_bucket' => wp_create_nonce( 'as3cf-create-bucket' ),
@@ -2745,6 +2879,8 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
2745
  'save_bucket' => wp_create_nonce( 'as3cf-save-bucket' ),
2746
  'get_url_preview' => wp_create_nonce( 'as3cf-get-url-preview' ),
2747
  'get_diagnostic_info' => wp_create_nonce( 'as3cf-get-diagnostic-info' ),
 
 
2748
  ),
2749
  'is_pro' => $this->is_pro(),
2750
  'aws_bucket_link' => $this->get_aws_bucket_link(),
@@ -2810,7 +2946,6 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
2810
  do_action( 'as3cf_pre_save_settings' );
2811
 
2812
  $post_vars = $this->get_settings_whitelist();
2813
- $skip_sanitize = $this->get_skip_sanitize_settings();
2814
 
2815
  foreach ( $post_vars as $var ) {
2816
  $this->remove_setting( $var );
@@ -2819,11 +2954,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
2819
  continue;
2820
  }
2821
 
2822
- if ( in_array( $var, $skip_sanitize ) ) {
2823
- $value = wp_strip_all_tags( $_POST[ $var ] ); // input var okay
2824
- } else {
2825
- $value = sanitize_text_field( $_POST[ $var ] ); // input var okay
2826
- }
2827
 
2828
  $this->set_setting( $var, $value );
2829
  }
@@ -2835,72 +2966,20 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
2835
  exit;
2836
  }
2837
 
2838
- /**
2839
- * Helper method to return the settings page URL for the plugin
2840
- *
2841
- * @param array $args
2842
- * @param string $url_method To prepend to admin_url()
2843
- * @param bool $escape Should we escape the URL
2844
- *
2845
- * @return string
2846
- */
2847
- function get_plugin_page_url( $args = array(), $url_method = 'network', $escape = true ) {
2848
- $default_args = array(
2849
- 'page' => self::$plugin_page,
2850
- );
2851
-
2852
- $args = array_merge( $default_args, $args );
2853
-
2854
- switch ( $url_method ) {
2855
- case 'self':
2856
- $base_url = self_admin_url( 'admin.php' );
2857
- break;
2858
- case '':
2859
- $base_url = admin_url( 'admin.php' );
2860
- break;
2861
- default:
2862
- $base_url = network_admin_url( 'admin.php' );
2863
- }
2864
-
2865
- // Add a hash to the URL
2866
- $hash = false;
2867
- if ( isset( $args['hash'] ) ) {
2868
- $hash = $args['hash'];
2869
- unset( $args['hash'] );
2870
- } else if ( $this->default_tab ) {
2871
- $hash = $this->default_tab;
2872
- }
2873
-
2874
- $url = add_query_arg( $args, $base_url );
2875
-
2876
- if ( $hash ) {
2877
- $url .= '#' . $hash;
2878
- }
2879
-
2880
- if ( $escape ) {
2881
- $url = esc_url_raw( $url );
2882
- }
2883
-
2884
- return $url;
2885
- }
2886
-
2887
  /**
2888
  * Display the main settings page for the plugin
2889
  */
2890
  function render_page() {
2891
- $this->aws->render_view( 'header', array( 'page_title' => $this->get_plugin_page_title(), 'page' => 'as3cf' ) );
 
2892
 
2893
- try {
2894
- $this->aws->get_client();
2895
- $this->render_view( 'settings-tabs' );
2896
- do_action( 'as3cf_pre_settings_render' );
2897
- $this->render_view( 'settings' );
2898
- do_action( 'as3cf_post_settings_render' );
2899
- } catch ( \Exception $e ) {
2900
- $this->render_view( 'error-fatal', array( 'message' => $e->getMessage() ) );
2901
- }
2902
 
2903
- $this->aws->render_view( 'footer' );
2904
  }
2905
 
2906
  /**
@@ -2910,13 +2989,33 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
2910
  */
2911
  function get_settings_tabs() {
2912
  $tabs = array(
2913
- 'media' => _x( 'Media Library', 'Show the media library tab', 'amazon-s3-and-cloudfront' ),
2914
- 'support' => _x( 'Support', 'Show the support tab', 'amazon-s3-and-cloudfront' ),
 
 
2915
  );
2916
 
2917
  return apply_filters( 'as3cf_settings_tabs', $tabs );
2918
  }
2919
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2920
  /**
2921
  * Get the prefix path for the files. Ignores WP media library
2922
  * year month subdirectory setting and just uses S3 setting
@@ -3137,7 +3236,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
3137
  * Check if PHP GD and Imagick is installed
3138
  */
3139
  function check_for_gd_imagick() {
3140
- if ( ! $this->is_plugin_setup() ) {
3141
  // No notice until plugin is setup
3142
  return;
3143
  }
@@ -3339,7 +3438,8 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
3339
 
3340
  $output .= 'cURL: ';
3341
  if ( function_exists( 'curl_init' ) ) {
3342
- $output .= 'Enabled';
 
3343
  } else {
3344
  $output .= 'Disabled';
3345
  }
@@ -3492,10 +3592,21 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
3492
  }
3493
 
3494
  $theme_info = wp_get_theme();
3495
- $output .= "Active Theme Name: " . esc_html( $theme_info->get( 'Name' ) ) . "\r\n";
3496
- $output .= "Active Theme Folder: " . esc_html( basename( $theme_info->get_stylesheet_directory() ) ) . "\r\n";
3497
- if ( $theme_info->get( 'Template' ) ) {
3498
- $output .= "Parent Theme Folder: " . esc_html( $theme_info->get( 'Template' ) ) . "\r\n";
 
 
 
 
 
 
 
 
 
 
 
3499
  }
3500
  if ( ! file_exists( $theme_info->get_stylesheet_directory() ) ) {
3501
  $output .= "WARNING: Active Theme Folder Not Found\r\n";
@@ -3748,6 +3859,10 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
3748
  * @return string
3749
  */
3750
  function get_access_denied_notice_message( $single = true ) {
 
 
 
 
3751
  $url = $this->dbrains_url( '/wp-offload-s3/doc/quick-start-guide/', array(
3752
  'utm_campaign' => 'error+messages',
3753
  ), 'bucket-restrictions' );
@@ -3770,7 +3885,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
3770
  *
3771
  * @return float|int
3772
  */
3773
- function multisite_get_spaced_used( $space_used ) {
3774
  global $wpdb;
3775
 
3776
  // Sum the total file size (including image sizes) for all S3 attachments
@@ -3962,10 +4077,10 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
3962
  }
3963
 
3964
  $url = $this->dbrains_url( $path, $args, $hash );
3965
- $text = __( 'More&nbsp;info', 'amazon-s3-and-cloudfront' );
3966
  $link = AS3CF_Utils::dbrains_link( $url, $text );
3967
 
3968
- return sprintf( '<span class="more-info">%s&nbsp;&raquo;</span>', $link );
3969
  }
3970
 
3971
  /**
@@ -4404,4 +4519,119 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
4404
 
4405
  return $errors;
4406
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4407
  }
1
  <?php
2
 
3
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\S3Client;
4
  use DeliciousBrains\WP_Offload_S3\Null_S3_Client;
5
+ use DeliciousBrains\WP_Offload_S3\Amazon_Web_Services;
6
  use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_Content_Replace_URLs;
7
  use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_EDD_Replace_URLs;
8
  use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_File_Sizes;
10
  use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_Meta_WP_Error;
11
  use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_Region_Meta;
12
 
13
+ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
14
 
15
  /**
16
  * @var Amazon_Web_Services
18
  private $aws;
19
 
20
  /**
21
+ * @var S3Client
22
  */
23
  private $s3client;
24
 
25
+ /**
26
+ * @var string
27
+ */
28
+ private $s3client_region;
29
+
30
  /**
31
  * @var array
32
  */
47
  */
48
  protected static $admin_notices = array();
49
 
 
 
 
 
 
50
  /**
51
  * @var string
52
  */
53
  protected $plugin_prefix = 'as3cf';
54
 
 
 
 
 
 
55
  /**
56
  * @var AS3CF_Local_To_S3
57
  */
95
  const LATEST_UPGRADE_ROUTINE = 6;
96
 
97
  /**
98
+ * @param string $plugin_file_path
99
+ * @param Amazon_Web_Services|null $aws
100
+ * @param string|null $slug
101
  */
102
+ function __construct( $plugin_file_path, $aws = null, $slug = null ) {
103
  $this->plugin_slug = ( is_null( $slug ) ) ? 'amazon-s3-and-cloudfront' : $slug;
104
 
105
  parent::__construct( $plugin_file_path );
106
 
107
+ if ( is_null( $aws ) ) {
108
+ $this->aws = new \DeliciousBrains\WP_Offload_S3\Amazon_Web_Services( $plugin_file_path );
109
+ } else {
110
+ $this->aws = $aws;
111
+ }
112
  $this->notices = AS3CF_Notices::get_instance( $this );
113
 
114
  $this->init( $plugin_file_path );
120
  * @param string $plugin_file_path
121
  */
122
  function init( $plugin_file_path ) {
123
+ $this->plugin_title = __( 'Offload S3', 'amazon-s3-and-cloudfront' );
124
+ $this->plugin_menu_title = __( 'Offload S3', 'amazon-s3-and-cloudfront' );
125
+
126
+ // Bundled SDK may require AWS setup before data migrations.
127
+ $this->handle_aws_access_key_migration();
128
 
129
  new Upgrade_Region_Meta( $this );
130
  new Upgrade_File_Sizes( $this );
134
  new Upgrade_Filter_Post_Excerpt( $this );
135
 
136
  // Plugin setup
137
+ add_action( 'admin_menu', array( $this, 'admin_menu' ) );
138
+ add_action( 'network_admin_menu', array( $this, 'admin_menu' ) );
139
+ add_action( 'aws_admin_menu', array( $this, 'aws_admin_menu' ) );
140
  add_filter( 'plugin_action_links', array( $this, 'plugin_actions_settings_link' ), 10, 2 );
141
+ add_filter( 'network_admin_plugin_action_links', array( $this, 'plugin_actions_settings_link' ), 10, 2 );
142
+ add_filter( 'pre_get_space_used', array( $this, 'multisite_get_space_used' ) );
143
  // display a notice when either lite or pro is automatically deactivated
144
  add_action( 'pre_current_active_plugins', array( $this, 'plugin_deactivated_notice' ) );
145
+ add_action( 'as3cf_plugin_load', array( $this, 'remove_aws_keys_if_constants_set' ) );
146
 
147
  // Attachment screens/modals
148
  add_action( 'load-upload.php', array( $this, 'load_media_assets' ), 11 );
157
  add_action( 'wp_ajax_as3cf-get-url-preview', array( $this, 'ajax_get_url_preview' ) );
158
  add_action( 'wp_ajax_as3cf_get_attachment_s3_details', array( $this, 'ajax_get_attachment_s3_details' ) );
159
  add_action( 'wp_ajax_as3cf-get-diagnostic-info', array( $this, 'ajax_get_diagnostic_info' ) );
160
+ add_action( 'wp_ajax_as3cf-aws-keys-set', array( $this, 'ajax_set_aws_keys' ) );
161
+ add_action( 'wp_ajax_as3cf-aws-keys-remove', array( $this, 'ajax_remove_aws_keys' ) );
162
 
163
  // Rewriting URLs, doesn't depend on plugin being setup
164
  add_filter( 'wp_get_attachment_url', array( $this, 'wp_get_attachment_url' ), 99, 2 );
193
  $this->register_modal_assets();
194
  }
195
 
196
+ /**
197
+ * @return Amazon_Web_Services
198
+ */
199
+ public function get_aws() {
200
+ return $this->aws;
201
+ }
202
+
203
  /**
204
  * Get the plugin title to be used in page headings
205
  *
268
  function get_setting( $key, $default = '' ) {
269
  // use settings from $_POST when generating URL preview via AJAX
270
  if ( isset( $_POST['action'] ) && 'as3cf-get-url-preview' == sanitize_key( $_POST['action'] ) ) { // input var okay
271
+ $this->verify_ajax_request();
272
  $value = 0;
273
  if ( isset( $_POST[ $key ] ) ) { // input var okay
274
  $value = $_POST[ $key ]; // input var okay
769
  $this->end_ajax( $out );
770
  }
771
 
772
+ /**
773
+ * Set AWS keys via ajax.
774
+ */
775
+ public function ajax_set_aws_keys() {
776
+ check_ajax_referer( 'as3cf-aws-keys-set' );
777
+
778
+ $key_id = filter_input( INPUT_POST, 'aws-access-key-id' );
779
+ $secret_key = filter_input( INPUT_POST, 'aws-secret-access-key' );
780
+ $response = array(
781
+ 'message' => __( 'Access keys updated successfully.', 'amazon-s3-and-cloudfront' ),
782
+ );
783
+
784
+ if ( Amazon_Web_Services::is_any_access_key_constant_defined() ) {
785
+ wp_send_json_error( array(
786
+ 'message' => __( 'All access key constants must be removed before keys can be set in the database.', 'amazon-s3-and-cloudfront' ),
787
+ ) );
788
+ }
789
+
790
+ if ( $key_id ) {
791
+ $this->set_setting( 'aws-access-key-id', $key_id );
792
+ } else {
793
+ wp_send_json_error( array(
794
+ 'message' => __( 'The Access Key ID must be set.', 'amazon-s3-and-cloudfront' ),
795
+ ) );
796
+ }
797
+
798
+ // Only update the secret key if entered and not set to "-- not shown --".
799
+ if ( _x( '-- not shown --', 'placeholder for hidden access key, 39 char max', 'amazon-s3-and-cloudfront' ) !== $secret_key || ! $this->get_setting( 'aws-secret-access-key' ) ) {
800
+ // AWS Secret Access keys are 40 char long.
801
+ if ( ! $secret_key || strlen( $secret_key ) < 40 ) {
802
+ wp_send_json_error( array(
803
+ 'message' => __( 'The Secret Access Key must be at least 40 characters long.', 'amazon-s3-and-cloudfront' ),
804
+ ) );
805
+ }
806
+
807
+ $this->set_setting( 'aws-secret-access-key', $secret_key );
808
+ }
809
+
810
+ $this->save_settings();
811
+
812
+ wp_send_json_success( $response );
813
+ }
814
+
815
+ /**
816
+ * Remove AWS access keys via ajax.
817
+ */
818
+ public function ajax_remove_aws_keys() {
819
+ check_ajax_referer( 'as3cf-aws-keys-remove' );
820
+
821
+ $this->remove_aws_keys();
822
+
823
+ wp_send_json_success( array(
824
+ 'message' => __( 'Access keys removed from the database successfully.', 'amazon-s3-and-cloudfront' ),
825
+ ) );
826
+ }
827
+
828
+ /**
829
+ * Remove AWS access keys from saved settings if a key constant is defined.
830
+ */
831
+ public function remove_aws_keys_if_constants_set() {
832
+ if ( Amazon_Web_Services::is_any_access_key_constant_defined() ) {
833
+ $this->remove_aws_keys();
834
+ }
835
+ }
836
+
837
+ /**
838
+ * Remove AWS keys from settings.
839
+ */
840
+ protected function remove_aws_keys() {
841
+ $this->remove_setting( 'aws-access-key-id' );
842
+ $this->remove_setting( 'aws-secret-access-key' );
843
+ $this->save_settings();
844
+ }
845
+
846
  /**
847
  * Delete bulk objects from an S3 bucket
848
  *
919
  * to cope with possible different regions
920
  */
921
  function delete_attachment( $post_id, $force_new_s3_client = false ) {
922
+ if ( ! $this->is_plugin_setup( true ) ) {
923
  return;
924
  }
925
 
942
  * @return array
943
  */
944
  function wp_update_attachment_metadata( $data, $post_id ) {
945
+ if ( ! $this->is_plugin_setup( true ) ) {
946
  return $data;
947
  }
948
 
1038
  // use existing bucket
1039
  $bucket = $old_s3object['bucket'];
1040
  // get existing region
1041
+ $region = isset( $old_s3object['region'] ) ? $old_s3object['region'] : '';
 
 
1042
  } else {
1043
  // derive prefix from various settings
1044
  if ( isset( $data['file'] ) ) {
1061
  $acl = apply_filters( 'wps3_upload_acl', $acl, $type, $data, $post_id, $this ); // Old naming convention, will be deprecated soon
1062
  $acl = apply_filters( 'as3cf_upload_acl', $acl, $data, $post_id );
1063
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1064
  $args = array(
1065
  'Bucket' => $bucket,
1066
  'Key' => $prefix . $file_name,
1081
 
1082
  $image_size = wp_attachment_is_image( $post_id ) ? 'full' : '';
1083
  $args = apply_filters( 'as3cf_object_meta', $args, $post_id, $image_size, false );
1084
+ $s3object = array(
1085
+ 'region' => $bucket !== $args['Bucket'] ? $this->get_bucket_region( $args['Bucket'], true ) : $region,
1086
+ 'bucket' => $args['Bucket'],
1087
+ 'key' => $args['Key'],
1088
+ 'acl' => $args['ACL'],
1089
+ );
1090
+
1091
+ // Do not store object ACL if set to the default value.
1092
+ if ( $s3object['acl'] === self::DEFAULT_ACL ) {
1093
+ unset( $s3object['acl'] );
1094
+ }
1095
 
1096
  do_action( 'as3cf_upload_attachment_pre_remove', $post_id, $s3object, $prefix, $args );
1097
 
1098
  $files_to_remove = array();
1099
 
1100
+ $s3client = $this->get_s3client( $s3object['region'], $force_new_s3_client );
1101
+
1102
  try {
1103
  $s3client->putObject( $args );
1104
  $files_to_remove[] = $file_path;
1430
  * @return string
1431
  */
1432
  public function filter_unique_filename( $filename, $post_id = null ) {
1433
+ if ( ! $this->get_setting( 'copy-to-s3' ) || ! $this->is_plugin_setup( true ) ) {
1434
  return $filename;
1435
  }
1436
 
1603
  /**
1604
  * Check the plugin is correctly setup
1605
  *
1606
+ * @param bool $with_credentials Do S3 credentials need to be set up too? Defaults to false.
1607
+ *
1608
  * @return bool
1609
  */
1610
+ function is_plugin_setup( $with_credentials = false ) {
1611
+ if ( $with_credentials && $this->aws->needs_access_keys() ) {
1612
  // AWS not configured
1613
  return false;
1614
  }
1933
  }
1934
  }
1935
 
1936
+ if ( ! is_null( $expires ) && $this->is_plugin_setup( true ) ) {
1937
  try {
1938
  $expires = time() + apply_filters( 'as3cf_expires', $expires );
1939
  $secure_url = $this->get_s3client( $region )
2274
  * @return string
2275
  */
2276
  function update_attached_file( $file, $attachment_id ) {
2277
+ if ( ! $this->is_plugin_setup( true ) ) {
2278
  return $file;
2279
  }
2280
 
2529
  }
2530
 
2531
  /**
2532
+ * Add the settings page to the top-level Settings menu item.
 
 
2533
  */
2534
+ public function admin_menu() {
2535
+ $this->hook_suffix = add_submenu_page(
2536
+ $this->get_plugin_pagenow(),
2537
  $this->get_plugin_page_title(),
2538
  $this->plugin_menu_title,
2539
  'manage_options',
2541
  array( $this, 'render_page' )
2542
  );
2543
 
2544
+ do_action( 'as3cf_hook_suffix', $this->hook_suffix );
2545
+
2546
+ add_action( 'load-' . $this->hook_suffix, array( $this, 'plugin_load' ) );
2547
+ }
2548
+
2549
+ /**
2550
+ * Add the settings page to the top-level AWS menu item for backwards compatibility.
2551
+ *
2552
+ * @param \Amazon_Web_Services $aws Plugin class instance from the amazon-web-services plugin.
2553
+ */
2554
+ public function aws_admin_menu( $aws ) {
2555
+ $aws->add_page(
2556
+ $this->get_plugin_page_title(),
2557
+ $this->plugin_menu_title,
2558
+ 'manage_options',
2559
+ $this->plugin_slug,
2560
+ array( $this, 'render_page' )
2561
+ );
2562
  }
2563
 
2564
  /**
2567
  * @param bool|string $region specify region to client for signature
2568
  * @param bool $force force return of new S3 client when swapping regions
2569
  *
2570
+ * @return S3Client
2571
  */
2572
  public function get_s3client( $region = false, $force = false ) {
2573
+ if ( is_null( $this->s3client ) ||
2574
+ is_null( $this->s3client_region ) ||
2575
+ $force ||
2576
+ ( false !== $region && $this->s3client_region !== $region ) ) {
2577
 
2578
  $args = array(
2579
  'version' => self::S3_API_VERSION,
2584
  $args['signature'] = self::AWS_SIGNATURE;
2585
  }
2586
 
2587
+ $s3client_region = isset( $args['region'] ) ? $args['region'] : $region;
2588
+
2589
  try {
2590
  $aws_client = $this->aws->get_client();
2591
+ $this->set_client( $aws_client->get( 's3', $args ), $s3client_region );
2592
  } catch ( \Exception $e ) {
2593
  AS3CF_Error::log( $e->getMessage() );
2594
  $this->set_client( new Null_S3_Client );
2602
  * Setter for S3 client
2603
  *
2604
  * @param Aws\S3\S3Client|Null_S3_Client $client
2605
+ * @param bool|string $region
2606
  */
2607
+ public function set_client( $client, $region = false ) {
2608
  $this->s3client = $client;
2609
+
2610
+ if ( false !== $region ) {
2611
+ $this->s3client_region = $region;
2612
+ }
2613
  }
2614
 
2615
  /**
2747
  * @return bool|WP_Error
2748
  */
2749
  function check_write_permission( $bucket = null, $region = null ) {
2750
+ if ( $this->aws->needs_access_keys() ) {
2751
+ // If no access keys set then no need check.
2752
+ return false;
2753
+ }
2754
+
2755
  if ( is_null( $bucket ) ) {
2756
  if ( ! ( $bucket = $this->get_setting( 'bucket' ) ) ) {
2757
  // if no bucket set then no need check
2839
  * On plugin load.
2840
  */
2841
  public function plugin_load() {
2842
+ /*
2843
+ * If the request is using the old parent page for the settings page, (i.e. in AWS menu)
2844
+ * redirect to the new one. Unfortunately, there is no way to preserve the hash, if present.
2845
+ * This works because the hook suffix is the same for both, regardless of parent page.
2846
+ */
2847
+ if ( $this->get_plugin_pagenow() !== $GLOBALS['pagenow'] ) {
2848
+ wp_redirect( $this->get_plugin_page_url() );
2849
+ exit;
2850
+ }
2851
+
2852
+ add_action( 'network_admin_notices', array( $this, 'settings_saved_notice' ) );
2853
+
2854
  $this->enqueue_style( 'as3cf-styles', 'assets/css/styles', array( 'as3cf-modal' ) );
2855
+ $this->enqueue_script( 'as3cf-script', 'assets/js/script', array( 'jquery', 'underscore', 'as3cf-modal' ) );
2856
 
2857
  wp_localize_script( 'as3cf-script',
2858
  'as3cf',
2868
  'save_alert' => __( 'The changes you made will be lost if you navigate away from this page', 'amazon-s3-and-cloudfront' ),
2869
  'get_diagnostic_info' => __( 'Getting diagnostic info...', 'amazon-s3-and-cloudfront' ),
2870
  'get_diagnostic_info_error' => __( 'Error getting diagnostic info: ', 'amazon-s3-and-cloudfront' ),
2871
+ 'not_shown_placeholder' => _x( '-- not shown --', 'placeholder for hidden access key, 39 char max', 'amazon-s3-and-cloudfront' ),
2872
+ // Mimic WP Core's notice text, therefore no translation needed here.
2873
+ 'settings_saved' => __( 'Settings saved.' ),
2874
  ),
2875
  'nonces' => array(
2876
  'create_bucket' => wp_create_nonce( 'as3cf-create-bucket' ),
2879
  'save_bucket' => wp_create_nonce( 'as3cf-save-bucket' ),
2880
  'get_url_preview' => wp_create_nonce( 'as3cf-get-url-preview' ),
2881
  'get_diagnostic_info' => wp_create_nonce( 'as3cf-get-diagnostic-info' ),
2882
+ 'aws_keys_set' => wp_create_nonce( 'as3cf-aws-keys-set' ),
2883
+ 'aws_keys_remove' => wp_create_nonce( 'as3cf-aws-keys-remove' ),
2884
  ),
2885
  'is_pro' => $this->is_pro(),
2886
  'aws_bucket_link' => $this->get_aws_bucket_link(),
2946
  do_action( 'as3cf_pre_save_settings' );
2947
 
2948
  $post_vars = $this->get_settings_whitelist();
 
2949
 
2950
  foreach ( $post_vars as $var ) {
2951
  $this->remove_setting( $var );
2954
  continue;
2955
  }
2956
 
2957
+ $value = $this->sanitize_setting( $var, $_POST[ $var ] );
 
 
 
 
2958
 
2959
  $this->set_setting( $var, $value );
2960
  }
2966
  exit;
2967
  }
2968
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2969
  /**
2970
  * Display the main settings page for the plugin
2971
  */
2972
  function render_page() {
2973
+ $this->render_view( 'header', array( 'page_title' => $this->get_plugin_page_title(), 'page' => 'as3cf' ) );
2974
+ $this->render_view( 'settings-tabs' );
2975
 
2976
+ do_action( 'as3cf_pre_settings_render' );
2977
+
2978
+ $this->render_view( 'settings' );
2979
+
2980
+ do_action( 'as3cf_post_settings_render' );
 
 
 
 
2981
 
2982
+ $this->render_view( 'footer' );
2983
  }
2984
 
2985
  /**
2989
  */
2990
  function get_settings_tabs() {
2991
  $tabs = array(
2992
+ 'media' => _x( 'Media Library', 'Show the media library tab', 'amazon-s3-and-cloudfront' ),
2993
+ 'addons' => _x( 'Addons', 'Show the addons tab', 'amazon-s3-and-cloudfront' ),
2994
+ 'settings' => _x( 'Settings', 'Show the settings tab', 'amazon-s3-and-cloudfront' ),
2995
+ 'support' => _x( 'Support', 'Show the support tab', 'amazon-s3-and-cloudfront' ),
2996
  );
2997
 
2998
  return apply_filters( 'as3cf_settings_tabs', $tabs );
2999
  }
3000
 
3001
+ /**
3002
+ * Recursively build addons list
3003
+ *
3004
+ * @param array|null $addons
3005
+ */
3006
+ function render_addons( $addons = null ) {
3007
+ if ( is_null( $addons ) ) {
3008
+ $addons = $this->get_addons();
3009
+ }
3010
+
3011
+ foreach ( $addons as $slug => $addon ) {
3012
+ $this->render_view( 'addon', array(
3013
+ 'slug' => $slug,
3014
+ 'addon' => $addon
3015
+ ) );
3016
+ }
3017
+ }
3018
+
3019
  /**
3020
  * Get the prefix path for the files. Ignores WP media library
3021
  * year month subdirectory setting and just uses S3 setting
3236
  * Check if PHP GD and Imagick is installed
3237
  */
3238
  function check_for_gd_imagick() {
3239
+ if ( ! $this->is_plugin_setup( true ) ) {
3240
  // No notice until plugin is setup
3241
  return;
3242
  }
3438
 
3439
  $output .= 'cURL: ';
3440
  if ( function_exists( 'curl_init' ) ) {
3441
+ $curl = curl_version();
3442
+ $output .= esc_html( $curl['version'] );
3443
  } else {
3444
  $output .= 'Disabled';
3445
  }
3592
  }
3593
 
3594
  $theme_info = wp_get_theme();
3595
+ $output .= "Active Theme Name: " . esc_html( $theme_info->get( 'Name' ) );
3596
+ $output .= "\r\n";
3597
+ $output .= "Active Theme Version: " . esc_html( $theme_info->get( 'Version' ) );
3598
+ $output .= "\r\n";
3599
+ $output .= "Active Theme Folder: " . esc_html( $theme_info->get_stylesheet() );
3600
+ $output .= "\r\n";
3601
+
3602
+ if ( is_child_theme() ) {
3603
+ $parent_info = $theme_info->parent();
3604
+ $output .= "Parent Theme Name: " . esc_html( $parent_info->get( 'Name' ) );
3605
+ $output .= "\r\n";
3606
+ $output .= "Parent Theme Version: " . esc_html( $parent_info->get( 'Version' ) );
3607
+ $output .= "\r\n";
3608
+ $output .= "Parent Theme Folder: " . esc_html( $parent_info->get_stylesheet() );
3609
+ $output .= "\r\n";
3610
  }
3611
  if ( ! file_exists( $theme_info->get_stylesheet_directory() ) ) {
3612
  $output .= "WARNING: Active Theme Folder Not Found\r\n";
3859
  * @return string
3860
  */
3861
  function get_access_denied_notice_message( $single = true ) {
3862
+ if ( $this->aws->needs_access_keys() ) {
3863
+ return sprintf( __( '<a href="%s">Define your AWS keys</a> to enable write access to the bucket', 'amazon-s3-and-cloudfront' ), '#settings' );
3864
+ }
3865
+
3866
  $url = $this->dbrains_url( '/wp-offload-s3/doc/quick-start-guide/', array(
3867
  'utm_campaign' => 'error+messages',
3868
  ), 'bucket-restrictions' );
3885
  *
3886
  * @return float|int
3887
  */
3888
+ function multisite_get_space_used( $space_used ) {
3889
  global $wpdb;
3890
 
3891
  // Sum the total file size (including image sizes) for all S3 attachments
4077
  }
4078
 
4079
  $url = $this->dbrains_url( $path, $args, $hash );
4080
+ $text = __( 'More&nbsp;info&nbsp;&raquo;', 'amazon-s3-and-cloudfront' );
4081
  $link = AS3CF_Utils::dbrains_link( $url, $text );
4082
 
4083
+ return sprintf( '<span class="more-info">%s</span>', $link );
4084
  }
4085
 
4086
  /**
4519
 
4520
  return $errors;
4521
  }
4522
+
4523
+ /**
4524
+ * Get all defined addons that use this plugin
4525
+ *
4526
+ * @param bool $unfiltered
4527
+ *
4528
+ * @return array
4529
+ */
4530
+ public function get_addons( $unfiltered = false ) {
4531
+ $addons = $this->get_available_addons();
4532
+
4533
+ if ( $unfiltered ) {
4534
+ return $addons;
4535
+ }
4536
+
4537
+ return apply_filters( 'as3cf_addons', $addons );
4538
+ }
4539
+
4540
+ /**
4541
+ * @return array
4542
+ */
4543
+ protected function get_available_addons() {
4544
+ return array(
4545
+ 'amazon-s3-and-cloudfront-assets-pull' => array(
4546
+ 'title' => __( 'Assets Pull', 'amazon-s3-and-cloudfront' ),
4547
+ 'sub' => __( 'An addon for WP Offload S3 to serve your site\'s JS, CSS, and other enqueued assets from Amazon CloudFront or another CDN.', 'amazon-s3-and-cloudfront'),
4548
+ 'url' => $this->dbrains_url( '/wp-offload-s3/doc/assets-pull-addon/', array(
4549
+ 'utm_campaign' => 'addons+install',
4550
+ ) ),
4551
+ 'label' => __( 'Feature', 'amazon-s3-and-cloudfront' ),
4552
+ 'icon' => true,
4553
+ 'active' => class_exists( 'Amazon_S3_And_CloudFront_Assets_Pull' ),
4554
+ ),
4555
+ );
4556
+ }
4557
+
4558
+ /**
4559
+ * Get the URL of the addon's icon
4560
+ *
4561
+ * @param string $slug
4562
+ *
4563
+ * @return string
4564
+ */
4565
+ function get_addon_icon_url( $slug ) {
4566
+ $filename = str_replace( 'amazon-s3-and-cloudfront-', '', $slug );
4567
+ $filename = 'icon-' . $filename . '.svg';
4568
+
4569
+ return plugins_url( 'assets/img/' . $filename, $this->plugin_file_path );
4570
+ }
4571
+
4572
+ /**
4573
+ * Polyfill for displaying "Settings saved." consistently between single-site and multisite environments.
4574
+ *
4575
+ * TL;DR: options-head.php is loaded for options-general.php (single sites only) which does this, but not on multisite.
4576
+ *
4577
+ * @see https://github.com/WordPress/WordPress/blob/c2d709e9d6cbe7f9b3c37da0a7c9aae788158124/wp-admin/admin-header.php#L265-L266
4578
+ * @see https://github.com/WordPress/WordPress/blob/9b68e5953406024c75b92f7ebe2aef0385c8956e/wp-admin/options-head.php#L13-L16
4579
+ */
4580
+ public function settings_saved_notice() {
4581
+ if ( isset( $_GET['updated'] ) && isset( $_GET['page'] ) ) {
4582
+ // For back-compat with plugins that don't use the Settings API and just set updated=1 in the redirect.
4583
+ add_settings_error( 'general', 'settings_updated', __( 'Settings saved.' ), 'updated' );
4584
+ }
4585
+
4586
+ settings_errors();
4587
+ }
4588
+
4589
+ /**
4590
+ * Migrate access keys from AWS database setting to this plugin's settings record and raise any notices.
4591
+ */
4592
+ private function handle_aws_access_key_migration() {
4593
+ add_action( 'aws_access_key_form_header', array( $this, 'handle_aws_access_key_form_header' ) );
4594
+
4595
+ if ( class_exists( '\Amazon_Web_Services' ) ) {
4596
+ $message = sprintf(
4597
+ __( '<strong>Amazon Web Services Plugin No Longer Required</strong> &mdash; As of version 1.6 of WP Offload S3, the <a href="%1$s">Amazon Web Services</a> plugin is no longer required. We have removed the dependency by bundling a small portion of the AWS SDK into WP Offload S3. As long as none of your other active plugins or themes depend on the Amazon Web Services plugin, it should be safe to deactivate and delete it. %2$s', 'amazon-s3-and-cloudfront' ),
4598
+ 'https://wordpress.org/plugins/amazon-web-services/',
4599
+ $this->more_info_link( '/wp-offload-s3-1-6-released/', 'os3+settings+aws+active' )
4600
+ );
4601
+ $args = array(
4602
+ 'only_show_to_user' => false,
4603
+ 'only_show_in_settings' => true,
4604
+ 'custom_id' => 'aws-plugin-no-longer-required',
4605
+ );
4606
+ $this->notices->add_notice( $message, $args );
4607
+
4608
+ if ( is_a( $this->aws, '\DeliciousBrains\WP_Offload_S3\Amazon_Web_Services' ) && $this->aws->needs_access_keys() ) {
4609
+ // Have access keys been defined in still active AWS plugin's database settings?
4610
+ $aws_settings = get_site_option( \Amazon_Web_Services::SETTINGS_KEY );
4611
+
4612
+ // If both AWS keys set and we already have a bucket set, safe to use the AWS keys.
4613
+ if ( ! empty( $aws_settings['access_key_id'] ) && ! empty( $aws_settings['secret_access_key'] ) && false !== $this->get_setting( 'bucket' ) ) {
4614
+ $this->set_setting( 'aws-access-key-id', $aws_settings['access_key_id'] );
4615
+ $this->set_setting( 'aws-secret-access-key', $aws_settings['secret_access_key'] );
4616
+ $this->save_settings();
4617
+ }
4618
+ }
4619
+ } else {
4620
+ $this->notices->remove_notice_by_id( 'aws-plugin-no-longer-required' );
4621
+ }
4622
+ }
4623
+
4624
+ /**
4625
+ * Create message in AWS access key form that this plugin no longer uses those settings.
4626
+ */
4627
+ public function handle_aws_access_key_form_header() {
4628
+ $notice['message'] = sprintf(
4629
+ __( '<strong>WP Offload S3 Settings Moved</strong> &mdash; You now define your AWS keys for WP Offload S3 in the new <a href="%1$s">Settings tab</a>. Saving settings in the form below will have no effect on WP Offload S3. %2$s', 'amazon-s3-and-cloudfront' ),
4630
+ $this->get_plugin_page_url( array( 'hash' => 'settings' ) ),
4631
+ $this->more_info_link( '/wp-offload-s3-1-6-released/', 'aws+os3+access+keys+setting+moved' )
4632
+ );
4633
+ $notice['inline'] = true;
4634
+
4635
+ $this->render_view( 'notice', $notice );
4636
+ }
4637
  }
classes/amazon-web-services.php ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DeliciousBrains\WP_Offload_S3;
4
+
5
+ use AS3CF_Utils;
6
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Aws;
7
+ use Exception;
8
+
9
+ class Amazon_Web_Services extends \AS3CF_Plugin_Base {
10
+
11
+ /**
12
+ * @var
13
+ */
14
+ private $client;
15
+
16
+ protected $plugin_slug = 'amazon-s3-and-cloudfront';
17
+
18
+ const SETTINGS_KEY = \Amazon_S3_And_CloudFront::SETTINGS_KEY;
19
+
20
+ /**
21
+ * Whether or not IAM access keys are needed.
22
+ *
23
+ * Keys are needed if we are not using EC2 roles or not defined/set yet.
24
+ *
25
+ * @return bool
26
+ */
27
+ public function needs_access_keys() {
28
+ if ( $this->use_ec2_iam_roles() ) {
29
+ return false;
30
+ }
31
+
32
+ return ! $this->are_access_keys_set();
33
+ }
34
+
35
+ /**
36
+ * Check if both access key id & secret are present.
37
+ *
38
+ * @return bool
39
+ */
40
+ function are_access_keys_set() {
41
+ return $this->get_access_key_id() && $this->get_secret_access_key();
42
+ }
43
+
44
+ /**
45
+ * Get the AWS key from a constant or the settings.
46
+ *
47
+ * Falls back to settings only if neither constant is defined.
48
+ *
49
+ * @return string
50
+ */
51
+ public function get_access_key_id() {
52
+ if ( $this->is_any_access_key_constant_defined() ) {
53
+ $constant = $this->access_key_id_constant();
54
+
55
+ return $constant ? constant( $constant ) : '';
56
+ }
57
+
58
+ return $this->get_setting( 'aws-access-key-id' );
59
+ }
60
+
61
+ /**
62
+ * Get the AWS secret from a constant or the settings
63
+ *
64
+ * Falls back to settings only if neither constant is defined.
65
+ *
66
+ * @return string
67
+ */
68
+ public function get_secret_access_key() {
69
+ if ( $this->is_any_access_key_constant_defined() ) {
70
+ $constant = $this->secret_access_key_constant();
71
+
72
+ return $constant ? constant( $constant ) : '';
73
+ }
74
+
75
+ return $this->get_setting( 'aws-secret-access-key' );
76
+ }
77
+
78
+ /**
79
+ * Check if any access key (id or secret, prefixed or not) is defined.
80
+ *
81
+ * @return bool
82
+ */
83
+ public static function is_any_access_key_constant_defined() {
84
+ return static::access_key_id_constant() || static::secret_access_key_constant();
85
+ }
86
+
87
+ /**
88
+ * Allows the AWS client factory to use the IAM role for EC2 instances
89
+ * instead of key/secret for credentials
90
+ * http://docs.aws.amazon.com/aws-sdk-php/guide/latest/credentials.html#instance-profile-credentials
91
+ *
92
+ * @return bool
93
+ */
94
+ public function use_ec2_iam_roles() {
95
+ $constant = $this->use_ec2_iam_role_constant();
96
+
97
+ return $constant && constant( $constant );
98
+ }
99
+
100
+ /**
101
+ * Get the constant used to define the aws access key id.
102
+ *
103
+ * @return string|false Constant name if defined, otherwise false
104
+ */
105
+ public static function access_key_id_constant() {
106
+ return AS3CF_Utils::get_first_defined_constant( array(
107
+ 'AS3CF_AWS_ACCESS_KEY_ID',
108
+ 'DBI_AWS_ACCESS_KEY_ID',
109
+ 'AWS_ACCESS_KEY_ID',
110
+ ) );
111
+ }
112
+
113
+ /**
114
+ * Get the constant used to define the aws secret access key.
115
+ *
116
+ * @return string|false Constant name if defined, otherwise false
117
+ */
118
+ public static function secret_access_key_constant() {
119
+ return AS3CF_Utils::get_first_defined_constant( array(
120
+ 'AS3CF_AWS_SECRET_ACCESS_KEY',
121
+ 'DBI_AWS_SECRET_ACCESS_KEY',
122
+ 'AWS_SECRET_ACCESS_KEY',
123
+ ) );
124
+ }
125
+
126
+ /**
127
+ * Get the constant used to enable the use of EC2 IAM roles.
128
+ *
129
+ * @return string|false Constant name if defined, otherwise false
130
+ */
131
+ public static function use_ec2_iam_role_constant() {
132
+ return AS3CF_Utils::get_first_defined_constant( array(
133
+ 'AS3CF_AWS_USE_EC2_IAM_ROLE',
134
+ 'DBI_AWS_USE_EC2_IAM_ROLE',
135
+ 'AWS_USE_EC2_IAM_ROLE',
136
+ ) );
137
+ }
138
+
139
+ /**
140
+ * Instantiate a new AWS service client for the AWS SDK
141
+ * using the defined AWS key and secret
142
+ *
143
+ * @return Aws
144
+ * @throws Exception
145
+ */
146
+ function get_client() {
147
+ if ( $this->needs_access_keys() ) {
148
+ throw new Exception( sprintf( __( 'You must first <a href="%s">set your AWS access keys</a> to use this addon.', 'amazon-s3-and-cloudfront' ), $this->get_plugin_page_url() . '#settings' ) );
149
+ }
150
+
151
+ if ( is_null( $this->client ) ) {
152
+ $args = array();
153
+
154
+ if ( ! $this->use_ec2_iam_roles() ) {
155
+ $args = array(
156
+ 'key' => $this->get_access_key_id(),
157
+ 'secret' => $this->get_secret_access_key(),
158
+ );
159
+ }
160
+
161
+ $args = apply_filters( 'aws_get_client_args', $args );
162
+ $this->client = Aws::factory( $args );
163
+ }
164
+
165
+ return $this->client;
166
+ }
167
+ }
classes/{wp-aws-compatibility-check.php → as3cf-compatibility-check.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * WP AWS Compatibility Check
4
  *
5
  * @package wp-aws
6
  * @copyright Copyright (c) 2015, Delicious Brains
@@ -14,16 +14,17 @@ if ( ! defined( 'ABSPATH' ) ) {
14
  }
15
 
16
  // Check if already defined
17
- if ( ! class_exists( 'WP_AWS_Compatibility_Check' ) ) {
18
 
19
  /**
20
- * WP_AWS_Compatibility_Check Class
21
  *
22
  * This class handles compatibility between an AWS plugin and a required parent plugin
23
  *
24
  * @since 0.1
25
  */
26
- class WP_AWS_Compatibility_Check {
 
27
  /**
28
  * @var string The derived key of the plugin from the name, e.g. amazon-s3-and-cloudfront
29
  */
@@ -241,7 +242,7 @@ if ( ! class_exists( 'WP_AWS_Compatibility_Check' ) ) {
241
  $page = 'plugins';
242
 
243
  if ( in_array( $action, array( 'upgrade', 'install' ) ) ) {
244
- $page = 'update';
245
  $action .= '-plugin';
246
  }
247
 
@@ -306,23 +307,31 @@ if ( ! class_exists( 'WP_AWS_Compatibility_Check' ) ) {
306
  *
307
  * @return string|bool
308
  */
309
- function get_error_msg() {
310
- if ( is_null( $this->parent_plugin_slug ) ) {
311
- return false;
312
- }
313
-
314
  if ( ! is_null( $this->error_message ) ) {
315
  return $this->error_message;
316
  }
317
 
318
- $plugin_basename = $this->get_plugin_basename();
319
- $parent_basename = $this->get_parent_plugin_basename();
320
- $parent_plugin_link_html = sprintf( '<a style="text-decoration:none;" href="%s">%s</a>', $this->get_parent_plugin_url(), $this->get_parent_plugin_name() );
321
-
322
  $deactivate_url = $this->get_plugin_action_url( 'deactivate', $plugin_basename );
323
  $deactivate_link = sprintf( '<a style="text-decoration:none;" href="%s">%s</a>', $deactivate_url, __( 'deactivate', 'amazon-s3-and-cloudfront' ) );
324
  $hide_notice_msg = '<br><em>' . sprintf( __( 'You can %s the %s plugin to get rid of this notice.', 'amazon-s3-and-cloudfront' ), $deactivate_link, $this->plugin_name ) . '</em>';
325
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326
  if ( ! $this->is_parent_plugin_enabled() ) {
327
  $msg = sprintf( __( '%s has been disabled as it requires the %s plugin.', 'amazon-s3-and-cloudfront' ), $this->plugin_name, $parent_plugin_link_html );
328
 
@@ -330,9 +339,9 @@ if ( ! class_exists( 'WP_AWS_Compatibility_Check' ) ) {
330
  if ( isset( $GLOBALS['aws_meta'][ $this->parent_plugin_slug ]['compatible'] ) && ! $GLOBALS['aws_meta'][ $this->parent_plugin_slug ]['compatible'] ) {
331
  $msg = rtrim( $msg, '.' ) . ', ' . __( 'which is currently disabled.', 'amazon-s3-and-cloudfront' );
332
  } else {
333
- $msg .= ' ' . __( 'It appears to be installed already.', 'amazon-s3-and-cloudfront' );
334
  $activate_url = $this->get_plugin_action_url( 'activate', $parent_basename );
335
- $msg .= ' <a id="'. $this->plugin_slug . '-activate-parent" style="font-weight:bold;text-decoration:none;" href="' . $activate_url . '">' . _x( 'Activate it now.', 'Activate plugin', 'amazon-s3-and-cloudfront' ) . '</a>';
336
  }
337
  } else {
338
  $install_url = 'https://deliciousbrains.com/my-account/';
@@ -368,8 +377,8 @@ if ( ! class_exists( 'WP_AWS_Compatibility_Check' ) ) {
368
  }
369
 
370
  $update_url = $this->get_plugin_action_url( 'upgrade', $parent_basename );
371
- $msg .= ' <a style="font-weight:bold;text-decoration:none;white-space:nowrap;" href="' . $update_url . '">' . __( 'Update to the latest version', 'amazon-s3-and-cloudfront' ) . '</a>';
372
 
 
373
  $msg .= $hide_notice_msg;
374
 
375
  return $this->set_error_msg( $msg );
@@ -438,7 +447,7 @@ if ( ! class_exists( 'WP_AWS_Compatibility_Check' ) ) {
438
  * Display compatibility notices to users who can manage plugins
439
  */
440
  function hook_admin_notices() {
441
- if ( ! $this->check_capabilities() ){
442
  return;
443
  }
444
 
@@ -479,7 +488,7 @@ if ( ! class_exists( 'WP_AWS_Compatibility_Check' ) ) {
479
  * @param string $message
480
  */
481
  function render_notice( $message ) {
482
- printf( '<div id="aws-compat-notice' . $this->plugin_slug . '" class="' . $this->notice_class . ' aws-compatibility-notice"><p>%s</p></div>', $message );
483
  }
484
 
485
  /**
@@ -520,5 +529,152 @@ if ( ! class_exists( 'WP_AWS_Compatibility_Check' ) ) {
520
 
521
  return self::$is_installing_or_updating_plugins;
522
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
523
  }
524
  }
1
  <?php
2
  /**
3
+ * AS3CF Compatibility Check
4
  *
5
  * @package wp-aws
6
  * @copyright Copyright (c) 2015, Delicious Brains
14
  }
15
 
16
  // Check if already defined
17
+ if ( ! class_exists( 'AS3CF_Compatibility_Check' ) ) {
18
 
19
  /**
20
+ * AS3CF_Compatibility_Check Class
21
  *
22
  * This class handles compatibility between an AWS plugin and a required parent plugin
23
  *
24
  * @since 0.1
25
  */
26
+ class AS3CF_Compatibility_Check {
27
+
28
  /**
29
  * @var string The derived key of the plugin from the name, e.g. amazon-s3-and-cloudfront
30
  */
242
  $page = 'plugins';
243
 
244
  if ( in_array( $action, array( 'upgrade', 'install' ) ) ) {
245
+ $page = 'update';
246
  $action .= '-plugin';
247
  }
248
 
307
  *
308
  * @return string|bool
309
  */
310
+ public function get_error_msg() {
 
 
 
 
311
  if ( ! is_null( $this->error_message ) ) {
312
  return $this->error_message;
313
  }
314
 
315
+ $plugin_basename = $this->get_plugin_basename();
 
 
 
316
  $deactivate_url = $this->get_plugin_action_url( 'deactivate', $plugin_basename );
317
  $deactivate_link = sprintf( '<a style="text-decoration:none;" href="%s">%s</a>', $deactivate_url, __( 'deactivate', 'amazon-s3-and-cloudfront' ) );
318
  $hide_notice_msg = '<br><em>' . sprintf( __( 'You can %s the %s plugin to get rid of this notice.', 'amazon-s3-and-cloudfront' ), $deactivate_link, $this->plugin_name ) . '</em>';
319
 
320
+ // Check basic requirements for AWS SDK.
321
+ $sdk_errors = $this->get_sdk_requirements_errors();
322
+ if ( ! empty( $sdk_errors ) ) {
323
+ $sdk_errors = $this->get_sdk_error_msg() . $hide_notice_msg;
324
+ return $this->set_error_msg( $sdk_errors );
325
+ }
326
+
327
+ // Remainder of tests are for addons.
328
+ if ( is_null( $this->parent_plugin_slug ) ) {
329
+ return false;
330
+ }
331
+
332
+ $parent_basename = $this->get_parent_plugin_basename();
333
+ $parent_plugin_link_html = sprintf( '<a style="text-decoration:none;" href="%s">%s</a>', $this->get_parent_plugin_url(), $this->get_parent_plugin_name() );
334
+
335
  if ( ! $this->is_parent_plugin_enabled() ) {
336
  $msg = sprintf( __( '%s has been disabled as it requires the %s plugin.', 'amazon-s3-and-cloudfront' ), $this->plugin_name, $parent_plugin_link_html );
337
 
339
  if ( isset( $GLOBALS['aws_meta'][ $this->parent_plugin_slug ]['compatible'] ) && ! $GLOBALS['aws_meta'][ $this->parent_plugin_slug ]['compatible'] ) {
340
  $msg = rtrim( $msg, '.' ) . ', ' . __( 'which is currently disabled.', 'amazon-s3-and-cloudfront' );
341
  } else {
342
+ $msg .= ' ' . __( 'It appears to be installed already.', 'amazon-s3-and-cloudfront' );
343
  $activate_url = $this->get_plugin_action_url( 'activate', $parent_basename );
344
+ $msg .= ' <a id="' . $this->plugin_slug . '-activate-parent" style="font-weight:bold;text-decoration:none;" href="' . $activate_url . '">' . _x( 'Activate it now.', 'Activate plugin', 'amazon-s3-and-cloudfront' ) . '</a>';
345
  }
346
  } else {
347
  $install_url = 'https://deliciousbrains.com/my-account/';
377
  }
378
 
379
  $update_url = $this->get_plugin_action_url( 'upgrade', $parent_basename );
 
380
 
381
+ $msg .= ' <a style="font-weight:bold;text-decoration:none;white-space:nowrap;" href="' . $update_url . '">' . __( 'Update to the latest version', 'amazon-s3-and-cloudfront' ) . '</a>';
382
  $msg .= $hide_notice_msg;
383
 
384
  return $this->set_error_msg( $msg );
447
  * Display compatibility notices to users who can manage plugins
448
  */
449
  function hook_admin_notices() {
450
+ if ( ! $this->check_capabilities() ) {
451
  return;
452
  }
453
 
488
  * @param string $message
489
  */
490
  function render_notice( $message ) {
491
+ printf( '<div id="as3cf-compat-notice' . $this->plugin_slug . '" class="' . $this->notice_class . ' as3cf-compatibility-notice"><p>%s</p></div>', $message );
492
  }
493
 
494
  /**
529
 
530
  return self::$is_installing_or_updating_plugins;
531
  }
532
+
533
+ /**
534
+ * Checks if another version of WP Offload S3 (Lite) is active and deactivates it.
535
+ * To be hooked on `activated_plugin` so other plugin is deactivated when current plugin is activated.
536
+ *
537
+ * @param string $plugin
538
+ *
539
+ * @return bool
540
+ */
541
+ public static function deactivate_other_instances( $plugin ) {
542
+ if ( ! in_array( basename( $plugin ), array( 'amazon-s3-and-cloudfront-pro.php', 'wordpress-s3.php' ) ) ) {
543
+ return false;
544
+ }
545
+
546
+ $plugin_to_deactivate = 'wordpress-s3.php';
547
+ $deactivated_notice_id = '1';
548
+ $activated_plugin_min_version = '1.1';
549
+ $plugin_to_deactivate_min_version = '1.0';
550
+ if ( basename( $plugin ) === $plugin_to_deactivate ) {
551
+ $plugin_to_deactivate = 'amazon-s3-and-cloudfront-pro.php';
552
+ $deactivated_notice_id = '2';
553
+ $activated_plugin_min_version = '1.0';
554
+ $plugin_to_deactivate_min_version = '1.1';
555
+ }
556
+
557
+ $version = self::get_plugin_version_from_basename( $plugin );
558
+
559
+ if ( version_compare( $version, $activated_plugin_min_version, '<' ) ) {
560
+ return false;
561
+ }
562
+
563
+ if ( is_multisite() ) {
564
+ $active_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
565
+ $active_plugins = array_keys( $active_plugins );
566
+ } else {
567
+ $active_plugins = (array) get_option( 'active_plugins', array() );
568
+ }
569
+
570
+ foreach ( $active_plugins as $basename ) {
571
+ if ( false !== strpos( $basename, $plugin_to_deactivate ) ) {
572
+ $version = self::get_plugin_version_from_basename( $basename );
573
+
574
+ if ( version_compare( $version, $plugin_to_deactivate_min_version, '<' ) ) {
575
+ return false;
576
+ }
577
+
578
+ set_transient( 'as3cf_deactivated_notice_id', $deactivated_notice_id, HOUR_IN_SECONDS );
579
+ deactivate_plugins( $basename );
580
+
581
+ return true;
582
+ }
583
+ }
584
+
585
+ return false;
586
+ }
587
+
588
+ /**
589
+ * Get plugin data from basename
590
+ *
591
+ * @param string $basename
592
+ *
593
+ * @return string
594
+ */
595
+ public static function get_plugin_version_from_basename( $basename ) {
596
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
597
+
598
+ $plugin_path = WP_PLUGIN_DIR . '/' . $basename;
599
+ $plugin_data = get_plugin_data( $plugin_path );
600
+
601
+ return $plugin_data['Version'];
602
+ }
603
+
604
+ /**
605
+ * Return an array of issues with the server's compatibility with the AWS SDK
606
+ *
607
+ * @return array
608
+ */
609
+ public function get_sdk_requirements_errors() {
610
+ static $errors;
611
+
612
+ if ( ! is_null( $errors ) ) {
613
+ return $errors;
614
+ }
615
+
616
+ $errors = array();
617
+
618
+ if ( version_compare( PHP_VERSION, '5.3.3', '<' ) ) {
619
+ $errors[] = __( 'a PHP version less than 5.3.3', 'amazon-s3-and-cloudfront' );
620
+ }
621
+
622
+ if ( ! function_exists( 'curl_version' ) ) {
623
+ $errors[] = __( 'no PHP cURL library activated', 'amazon-s3-and-cloudfront' );
624
+
625
+ return $errors;
626
+ }
627
+
628
+ if ( ! ( $curl = curl_version() ) || empty( $curl['version'] ) || empty( $curl['features'] ) || version_compare( $curl['version'], '7.16.2', '<' ) ) {
629
+ $errors[] = __( 'a cURL version less than 7.16.2', 'amazon-s3-and-cloudfront' );
630
+ }
631
+
632
+ if ( ! empty( $curl['features'] ) ) {
633
+ $curl_errors = array();
634
+
635
+ if ( ! CURL_VERSION_SSL ) {
636
+ $curl_errors[] = 'OpenSSL';
637
+ }
638
+
639
+ if ( ! CURL_VERSION_LIBZ ) {
640
+ $curl_errors[] = 'zlib';
641
+ }
642
+
643
+ if ( $curl_errors ) {
644
+ $errors[] = __( 'cURL compiled without', 'amazon-s3-and-cloudfront' ) . ' ' . implode( ' or ', $curl_errors ); // xss ok
645
+ }
646
+ }
647
+
648
+ if ( ! function_exists( 'curl_multi_exec' ) ) {
649
+ $errors[] = __( 'the function curl_multi_exec disabled', 'amazon-s3-and-cloudfront' );
650
+ }
651
+
652
+ return $errors;
653
+ }
654
+
655
+ /**
656
+ * Prepare an error message with compatibility issues
657
+ *
658
+ * @return string
659
+ */
660
+ public function get_sdk_error_msg() {
661
+ $errors = $this->get_sdk_requirements_errors();
662
+
663
+ if ( ! $errors ) {
664
+ return '';
665
+ }
666
+
667
+ $msg = __( 'The official Amazon&nbsp;Web&nbsp;Services SDK requires PHP 5.3.3+ and cURL 7.16.2+ compiled with OpenSSL and zlib. Your server currently has', 'amazon-s3-and-cloudfront' );
668
+
669
+ if ( count( $errors ) > 1 ) {
670
+ $last_one = ' and ' . array_pop( $errors );
671
+ } else {
672
+ $last_one = '';
673
+ }
674
+
675
+ $msg .= ' ' . implode( ', ', $errors ) . $last_one . '.';
676
+
677
+ return $msg;
678
+ }
679
  }
680
  }
classes/as3cf-filter.php CHANGED
@@ -621,11 +621,25 @@ abstract class AS3CF_Filter {
621
  foreach ( $url_pairs as $find => $replace ) {
622
  $replace = $this->normalize_replace_value( $replace );
623
  $content = str_replace( $find, $replace, $content );
 
624
  }
625
 
626
  return $content;
627
  }
628
 
 
 
 
 
 
 
 
 
 
 
 
 
 
629
  /**
630
  * Get post cache
631
  *
621
  foreach ( $url_pairs as $find => $replace ) {
622
  $replace = $this->normalize_replace_value( $replace );
623
  $content = str_replace( $find, $replace, $content );
624
+ $content = $this->url_replaced( $find, $replace, $content );
625
  }
626
 
627
  return $content;
628
  }
629
 
630
+ /**
631
+ * Each time a URL is replaced this function is called to allow for logging or further updates etc.
632
+ *
633
+ * @param string $find URL with no scheme.
634
+ * @param string $replace URL with no scheme.
635
+ * @param string $content
636
+ *
637
+ * @return string
638
+ */
639
+ protected function url_replaced( $find, $replace, $content ) {
640
+ return $content;
641
+ }
642
+
643
  /**
644
  * Get post cache
645
  *
classes/as3cf-plugin-base.php ADDED
@@ -0,0 +1,605 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ abstract class AS3CF_Plugin_Base {
4
+
5
+ const DBRAINS_URL = 'https://deliciousbrains.com';
6
+
7
+ const SETTINGS_KEY = '';
8
+ const SETTINGS_CONSTANT = '';
9
+
10
+ protected static $plugin_page = 'amazon-s3-and-cloudfront';
11
+ protected $default_tab = '';
12
+
13
+ protected $plugin_file_path;
14
+ protected $plugin_dir_path;
15
+ protected $plugin_slug;
16
+ protected $plugin_basename;
17
+ protected $plugin_version;
18
+ protected $plugin_pagenow;
19
+
20
+ /**
21
+ * @var array
22
+ */
23
+ private $settings;
24
+
25
+ /**
26
+ * @var array
27
+ */
28
+ private $defined_settings;
29
+
30
+ function __construct( $plugin_file_path ) {
31
+ $this->plugin_file_path = $plugin_file_path;
32
+ $this->plugin_dir_path = rtrim( plugin_dir_path( $plugin_file_path ), '/' );
33
+ $this->plugin_basename = plugin_basename( $plugin_file_path );
34
+ $this->plugin_pagenow = is_multisite() ? 'settings.php' : 'options-general.php';
35
+
36
+ if ( $this->plugin_slug && isset( $GLOBALS['aws_meta'][ $this->plugin_slug ]['version'] ) ) {
37
+ $this->plugin_version = $GLOBALS['aws_meta'][ $this->plugin_slug ]['version'];
38
+ }
39
+ }
40
+
41
+ /**
42
+ * Accessor for plugin version
43
+ *
44
+ * @return mixed
45
+ */
46
+ public function get_plugin_version() {
47
+ return $this->plugin_version;
48
+ }
49
+
50
+ /**
51
+ * Accessor for plugin slug
52
+ *
53
+ * @return string
54
+ */
55
+ public function get_plugin_slug() {
56
+ return $this->plugin_slug;
57
+ }
58
+
59
+ /**
60
+ * Accessor for plugin basename
61
+ *
62
+ * @return string
63
+ */
64
+ public function get_plugin_basename() {
65
+ return $this->plugin_basename;
66
+ }
67
+
68
+ /**
69
+ * Accessor for plugin file path
70
+ *
71
+ * @return string
72
+ */
73
+ public function get_plugin_file_path() {
74
+ return $this->plugin_file_path;
75
+ }
76
+
77
+ /**
78
+ * Accessor for plugin dir path
79
+ *
80
+ * @return string
81
+ */
82
+ public function get_plugin_dir_path() {
83
+ return $this->plugin_dir_path;
84
+ }
85
+
86
+ /**
87
+ * Accessor for plugin_pagenow
88
+ *
89
+ * @return string
90
+ */
91
+ public function get_plugin_pagenow() {
92
+ return $this->plugin_pagenow;
93
+ }
94
+
95
+ /**
96
+ * Get the plugin's settings array
97
+ *
98
+ * @param bool $force
99
+ *
100
+ * @return array
101
+ */
102
+ function get_settings( $force = false ) {
103
+ if ( is_null( $this->settings ) || $force ) {
104
+ $this->settings = $this->filter_settings( get_site_option( static::SETTINGS_KEY ) );
105
+ }
106
+
107
+ return $this->settings;
108
+ }
109
+
110
+ /**
111
+ * Get all settings that have been defined via constant for the plugin
112
+ *
113
+ * @param bool $force
114
+ *
115
+ * @return array
116
+ */
117
+ function get_defined_settings( $force = false ) {
118
+ if ( ! defined( static::SETTINGS_CONSTANT ) ) {
119
+ $this->defined_settings = array();
120
+
121
+ return $this->defined_settings;
122
+ }
123
+
124
+ if ( is_null( $this->defined_settings ) || $force ) {
125
+ $this->defined_settings = array();
126
+ $unserialized = maybe_unserialize( constant( static::SETTINGS_CONSTANT ) );
127
+ $unserialized = is_array( $unserialized ) ? $unserialized : array();
128
+
129
+ foreach ( $unserialized as $key => $value ) {
130
+ if ( ! in_array( $key, $this->get_settings_whitelist() ) ) {
131
+ continue;
132
+ }
133
+
134
+ if ( is_bool( $value ) || is_null( $value ) ) {
135
+ $value = (int) $value;
136
+ }
137
+
138
+ if ( is_numeric( $value ) ) {
139
+ $value = strval( $value );
140
+ } else {
141
+ $value = $this->sanitize_setting( $key, $value );
142
+ }
143
+
144
+ $this->defined_settings[ $key ] = $value;
145
+ }
146
+
147
+ $this->listen_for_settings_constant_changes();
148
+
149
+ // Normalize the defined settings before saving, so we can detect when a real change happens.
150
+ ksort( $this->defined_settings );
151
+ update_site_option( 'as3cf_constant_' . static::SETTINGS_CONSTANT, $this->defined_settings );
152
+ }
153
+
154
+ return $this->defined_settings;
155
+ }
156
+
157
+ /**
158
+ * Subscribe to changes of the site option used to store the constant-defined settings.
159
+ */
160
+ protected function listen_for_settings_constant_changes() {
161
+ if ( ! has_action( 'update_site_option_' . 'as3cf_constant_' . static::SETTINGS_CONSTANT, array(
162
+ $this,
163
+ 'settings_constant_changed',
164
+ ) ) ) {
165
+ add_action( 'add_site_option_' . 'as3cf_constant_' . static::SETTINGS_CONSTANT, array(
166
+ $this,
167
+ 'settings_constant_added',
168
+ ), 10, 3 );
169
+ add_action( 'update_site_option_' . 'as3cf_constant_' . static::SETTINGS_CONSTANT, array(
170
+ $this,
171
+ 'settings_constant_changed',
172
+ ), 10, 4 );
173
+ }
174
+ }
175
+
176
+ /**
177
+ * Translate a settings constant option addition into a change.
178
+ *
179
+ * @param string $option Name of the option.
180
+ * @param mixed $value Value the option is being initialized with.
181
+ * @param int $network_id ID of the network.
182
+ */
183
+ public function settings_constant_added( $option, $value, $network_id ) {
184
+ $db_settings = get_site_option( static::SETTINGS_KEY, array() );
185
+ $this->settings_constant_changed( $option, $value, $db_settings, $network_id );
186
+ }
187
+
188
+ /**
189
+ * Callback for announcing when settings-defined values change.
190
+ *
191
+ * @param string $option Name of the option.
192
+ * @param mixed $new_settings Current value of the option.
193
+ * @param mixed $old_settings Old value of the option.
194
+ * @param int $network_id ID of the network.
195
+ */
196
+ public function settings_constant_changed( $option, $new_settings, $old_settings, $network_id ) {
197
+ $old_settings = $old_settings ?: array();
198
+
199
+ foreach ( $this->get_settings_whitelist() as $setting ) {
200
+ $old_value = isset( $old_settings[ $setting ] ) ? $old_settings[ $setting ] : null;
201
+ $new_value = isset( $new_settings[ $setting ] ) ? $new_settings[ $setting ] : null;
202
+
203
+ if ( $old_value !== $new_value ) {
204
+ /**
205
+ * Setting-specific hook for setting change.
206
+ *
207
+ * @param mixed $new_value
208
+ * @param mixed $old_value
209
+ * @param string $setting
210
+ */
211
+ do_action( 'as3cf_constant_' . static::SETTINGS_CONSTANT . '_changed_' . $setting, $new_value, $old_value, $setting );
212
+
213
+ /**
214
+ * Generic hook for setting change.
215
+ *
216
+ * @param mixed $new_value
217
+ * @param mixed $old_value
218
+ * @param string $setting
219
+ */
220
+ do_action( 'as3cf_constant_' . static::SETTINGS_CONSTANT . '_changed', $new_value, $old_value, $setting );
221
+ }
222
+ }
223
+ }
224
+
225
+ /**
226
+ * Filter the plugin settings array
227
+ *
228
+ * @param array $settings
229
+ *
230
+ * @return array $settings
231
+ */
232
+ function filter_settings( $settings ) {
233
+ $defined_settings = $this->get_defined_settings();
234
+
235
+ // Bail early if there are no defined settings
236
+ if ( empty( $defined_settings ) ) {
237
+ return $settings;
238
+ }
239
+
240
+ foreach ( $defined_settings as $key => $value ) {
241
+ $settings[ $key ] = $value;
242
+ }
243
+
244
+ return $settings;
245
+ }
246
+
247
+ /**
248
+ * Get the whitelisted settings for the plugin.
249
+ * Meant to be overridden in child classes.
250
+ *
251
+ * @return array
252
+ */
253
+ function get_settings_whitelist() {
254
+ return array();
255
+ }
256
+
257
+ /**
258
+ * List of settings that should skip full sanitize.
259
+ *
260
+ * @return array
261
+ */
262
+ function get_skip_sanitize_settings() {
263
+ return array();
264
+ }
265
+
266
+ /**
267
+ * Sanitize a setting value, maybe.
268
+ *
269
+ * @param $key
270
+ * @param $value
271
+ *
272
+ * @return string
273
+ */
274
+ function sanitize_setting( $key, $value ) {
275
+ $skip_sanitize = $this->get_skip_sanitize_settings();
276
+
277
+ if ( in_array( $key, $skip_sanitize ) ) {
278
+ $value = wp_strip_all_tags( $value );
279
+ } else {
280
+ $value = sanitize_text_field( $value );
281
+ }
282
+
283
+ return $value;
284
+ }
285
+
286
+ /**
287
+ * Get a specific setting
288
+ *
289
+ * @param $key
290
+ * @param string $default
291
+ *
292
+ * @return string
293
+ */
294
+ function get_setting( $key, $default = '' ) {
295
+ $this->get_settings();
296
+
297
+ if ( isset( $this->settings[ $key ] ) ) {
298
+ $setting = $this->settings[ $key ];
299
+ } else {
300
+ $setting = $default;
301
+ }
302
+
303
+ return apply_filters( 'as3cf_get_setting', $setting, $key );
304
+ }
305
+
306
+ /**
307
+ * Gets a single setting that has been defined in the plugin settings constant
308
+ *
309
+ * @param string $key
310
+ * @param mixed $default
311
+ *
312
+ * @return mixed
313
+ */
314
+ function get_defined_setting( $key, $default = '' ) {
315
+ $defined_settings = $this->get_defined_settings();
316
+ $setting = isset( $defined_settings[ $key ] ) ? $defined_settings[ $key ] : $default;
317
+
318
+ return $setting;
319
+ }
320
+
321
+ /**
322
+ * Delete a setting
323
+ *
324
+ * @param $key
325
+ */
326
+ function remove_setting( $key ) {
327
+ $this->get_settings();
328
+
329
+ if ( isset( $this->settings[ $key ] ) ) {
330
+ unset( $this->settings[ $key ] );
331
+ }
332
+ }
333
+
334
+ /**
335
+ * Removes a defined setting from the defined_settings array.
336
+ *
337
+ * Does not unset the actual constant.
338
+ *
339
+ * @param $key
340
+ */
341
+ function remove_defined_setting( $key ) {
342
+ $this->get_defined_settings();
343
+
344
+ if ( isset( $this->defined_settings[ $key ] ) ) {
345
+ unset( $this->defined_settings[ $key ] );
346
+ }
347
+ }
348
+
349
+ /**
350
+ * Render a view template file
351
+ *
352
+ * @param string $view View filename without the extension
353
+ * @param array $args Arguments to pass to the view
354
+ */
355
+ function render_view( $view, $args = array() ) {
356
+ extract( $args );
357
+ include $this->plugin_dir_path . '/view/' . $view . '.php';
358
+ }
359
+
360
+ /**
361
+ * Set a setting
362
+ *
363
+ * @param $key
364
+ * @param $value
365
+ */
366
+ function set_setting( $key, $value ) {
367
+ $this->get_settings();
368
+
369
+ $this->settings[ $key ] = $value;
370
+ }
371
+
372
+ /**
373
+ * Bulk set the settings array
374
+ *
375
+ * @param array $settings
376
+ */
377
+ function set_settings( $settings ) {
378
+ $this->settings = $settings;
379
+ }
380
+
381
+ /**
382
+ * Save the settings to the database
383
+ */
384
+ public function save_settings() {
385
+ if ( is_array( $this->settings ) ) {
386
+ ksort( $this->settings );
387
+ }
388
+
389
+ $this->update_site_option( static::SETTINGS_KEY, $this->settings );
390
+ }
391
+
392
+ /**
393
+ * Update site option.
394
+ *
395
+ * @param string $option
396
+ * @param mixed $value
397
+ * @param bool $autoload
398
+ *
399
+ * @return bool
400
+ */
401
+ public function update_site_option( $option, $value, $autoload = true ) {
402
+ if ( is_multisite() ) {
403
+ return update_site_option( $option, $value );
404
+ }
405
+
406
+ return update_option( $option, $value, $autoload );
407
+ }
408
+
409
+ /**
410
+ * Helper method to return the settings page URL for the plugin
411
+ *
412
+ * @param array $args
413
+ * @param string $url_method To prepend to admin_url()
414
+ * @param bool $escape Should we escape the URL
415
+ *
416
+ * @return string
417
+ */
418
+ public function get_plugin_page_url( $args = array(), $url_method = 'network', $escape = true ) {
419
+ $default_args = array(
420
+ 'page' => static::$plugin_page,
421
+ );
422
+
423
+ $args = array_merge( $default_args, $args );
424
+
425
+ switch ( $url_method ) {
426
+ case 'self':
427
+ $base_url = self_admin_url( $this->get_plugin_pagenow() );
428
+ break;
429
+ default:
430
+ $base_url = network_admin_url( $this->get_plugin_pagenow() );
431
+ }
432
+
433
+ // Add a hash to the URL
434
+ $hash = false;
435
+ if ( isset( $args['hash'] ) ) {
436
+ $hash = $args['hash'];
437
+ unset( $args['hash'] );
438
+ } else if ( $this->default_tab ) {
439
+ $hash = $this->default_tab;
440
+ }
441
+
442
+ $url = add_query_arg( $args, $base_url );
443
+
444
+ if ( $hash ) {
445
+ $url .= '#' . $hash;
446
+ }
447
+
448
+ if ( $escape ) {
449
+ $url = esc_url_raw( $url );
450
+ }
451
+
452
+ return $url;
453
+ }
454
+
455
+ /**
456
+ * The text for the plugin action link for the plugin on the plugins page.
457
+ *
458
+ * @return string
459
+ */
460
+ function get_plugin_action_settings_text() {
461
+ return __( 'Settings', 'amazon-s3-and-cloudfront' );
462
+ }
463
+
464
+ /**
465
+ * Add a link to the plugin row for the plugin on the plugins page.
466
+ * Needs to be implemented for an extending class using -
467
+ * add_filter( 'plugin_action_links', array( $this, 'plugin_actions_settings_link' ), 10, 2 );
468
+ *
469
+ * @param array $links
470
+ * @param string $file
471
+ *
472
+ * @return array
473
+ */
474
+ function plugin_actions_settings_link( $links, $file ) {
475
+ $url = $this->get_plugin_page_url();
476
+ $text = $this->get_plugin_action_settings_text();
477
+
478
+ $settings_link = '<a href="' . $url . '">' . esc_html( $text ) . '</a>';
479
+
480
+ if ( $file == $this->plugin_basename ) {
481
+ array_unshift( $links, $settings_link );
482
+ }
483
+
484
+ return $links;
485
+ }
486
+
487
+ /**
488
+ * Enqueue script.
489
+ *
490
+ * @param string $handle
491
+ * @param string $path
492
+ * @param array $deps
493
+ * @param bool $footer
494
+ */
495
+ public function enqueue_script( $handle, $path, $deps = array(), $footer = true ) {
496
+ $version = $this->get_asset_version();
497
+ $suffix = $this->get_asset_suffix();
498
+
499
+ $src = plugins_url( $path . $suffix . '.js', $this->plugin_file_path );
500
+ wp_enqueue_script( $handle, $src, $deps, $version, $footer );
501
+ }
502
+
503
+ /**
504
+ * Enqueue style.
505
+ *
506
+ * @param string $handle
507
+ * @param string $path
508
+ * @param array $deps
509
+ */
510
+ public function enqueue_style( $handle, $path, $deps = array() ) {
511
+ $version = $this->get_asset_version();
512
+
513
+ $src = plugins_url( $path . '.css', $this->plugin_file_path );
514
+ wp_enqueue_style( $handle, $src, $deps, $version );
515
+ }
516
+
517
+ /**
518
+ * Get the version used for script enqueuing
519
+ *
520
+ * @return mixed
521
+ */
522
+ public function get_asset_version() {
523
+ return defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? time() : $this->plugin_version;
524
+ }
525
+
526
+ /**
527
+ * Get the filename suffix used for script enqueuing
528
+ *
529
+ * @return mixed
530
+ */
531
+ public function get_asset_suffix() {
532
+ return defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
533
+ }
534
+
535
+ /**
536
+ * Get all AWS regions
537
+ *
538
+ * @return array
539
+ */
540
+ public function get_aws_regions() {
541
+ $regions = array(
542
+ 'us-east-1' => 'US Standard',
543
+ 'us-west-1' => 'Northern California',
544
+ 'us-west-2' => 'Oregon',
545
+ 'ca-central-1' => 'Montreal',
546
+ 'eu-west-1' => 'Ireland',
547
+ 'eu-west-2' => 'London',
548
+ 'eu-central-1' => 'Frankfurt',
549
+ 'ap-southeast-1' => 'Singapore',
550
+ 'ap-southeast-2' => 'Sydney',
551
+ 'ap-northeast-1' => 'Tokyo',
552
+ 'ap-northeast-2' => 'Seoul',
553
+ 'ap-south-1' => 'Mumbai',
554
+ 'sa-east-1' => 'Sao Paulo',
555
+ );
556
+
557
+ return apply_filters( 'aws_get_regions', $regions );
558
+ }
559
+
560
+ /**
561
+ * Generate site URL with correct UTM tags.
562
+ *
563
+ * @param string $path
564
+ * @param array $args
565
+ * @param string $hash
566
+ *
567
+ * @return string
568
+ */
569
+ public function dbrains_url( $path, $args = array(), $hash = '' ) {
570
+ $args = wp_parse_args( $args, array(
571
+ 'utm_medium' => 'insideplugin',
572
+ 'utm_source' => $this->get_utm_source(),
573
+ ) );
574
+ $args = array_map( 'urlencode', $args );
575
+ $url = trailingslashit( self::DBRAINS_URL ) . ltrim( $path, '/' );
576
+ $url = add_query_arg( $args, $url );
577
+
578
+ if ( $hash ) {
579
+ $url .= '#' . $hash;
580
+ }
581
+
582
+ return $url;
583
+ }
584
+
585
+ /**
586
+ * Get UTM source for plugin.
587
+ *
588
+ * @return string
589
+ */
590
+ protected function get_utm_source() {
591
+ return 'AWS';
592
+ }
593
+
594
+ /**
595
+ * Get the My Account URL
596
+ *
597
+ * @param array $args
598
+ * @param string $hash
599
+ *
600
+ * @return string
601
+ */
602
+ public function get_my_account_url( $args = array(), $hash = '' ) {
603
+ return $this->dbrains_url( '/my-account/', $args, $hash );
604
+ }
605
+ }
classes/as3cf-plugin-compatibility.php CHANGED
@@ -38,6 +38,11 @@ class AS3CF_Plugin_Compatibility {
38
  */
39
  protected $compatibility_addons;
40
 
 
 
 
 
 
41
  /**
42
  * @param Amazon_S3_And_CloudFront $as3cf
43
  */
@@ -96,11 +101,16 @@ class AS3CF_Plugin_Compatibility {
96
  add_filter( 'wp_unique_filename', array( $this, 'customizer_crop_unique_filename' ), 10, 3 );
97
 
98
  /*
99
- * Regenerate Thumbnails
100
  * https://wordpress.org/plugins/regenerate-thumbnails/
101
  */
102
  add_filter( 'as3cf_get_attached_file', array( $this, 'regenerate_thumbnails_download_file' ), 10, 4 );
103
 
 
 
 
 
 
104
  /*
105
  * WP-CLI Compatibility
106
  */
@@ -141,6 +151,51 @@ class AS3CF_Plugin_Compatibility {
141
  */
142
  public function enable_get_attached_file_copy_back_to_local() {
143
  add_filter( 'as3cf_get_attached_file_copy_back_to_local', '__return_true' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  }
145
 
146
  /**
@@ -863,4 +918,34 @@ class AS3CF_Plugin_Compatibility {
863
  $this->as3cf->notices->remove_notice_by_id( $key_base . '-settings' );
864
  }
865
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
866
  }
38
  */
39
  protected $compatibility_addons;
40
 
41
+ /**
42
+ * @var array
43
+ */
44
+ private $removed_files = array();
45
+
46
  /**
47
  * @param Amazon_S3_And_CloudFront $as3cf
48
  */
101
  add_filter( 'wp_unique_filename', array( $this, 'customizer_crop_unique_filename' ), 10, 3 );
102
 
103
  /*
104
+ * Regenerate Thumbnails (before v3)
105
  * https://wordpress.org/plugins/regenerate-thumbnails/
106
  */
107
  add_filter( 'as3cf_get_attached_file', array( $this, 'regenerate_thumbnails_download_file' ), 10, 4 );
108
 
109
+ /**
110
+ * Regenerate Thumbnails v3+ and other REST-API using plugins that need a local file.
111
+ */
112
+ add_filter( 'rest_dispatch_request', array( $this, 'rest_dispatch_request_copy_back_to_local' ), 10, 4 );
113
+
114
  /*
115
  * WP-CLI Compatibility
116
  */
151
  */
152
  public function enable_get_attached_file_copy_back_to_local() {
153
  add_filter( 'as3cf_get_attached_file_copy_back_to_local', '__return_true' );
154
+
155
+ // Monitor any files that are subsequently removed.
156
+ add_filter( 'as3cf_upload_attachment_local_files_to_remove', array(
157
+ $this,
158
+ 'monitor_local_files_to_remove',
159
+ ), 10, 3 );
160
+
161
+ // Prevent subsequent attempts to copy back after upload and remove.
162
+ add_filter( 'as3cf_get_attached_file_copy_back_to_local', array(
163
+ $this,
164
+ 'prevent_copy_back_to_local_after_remove',
165
+ ), 10, 4 );
166
+ }
167
+
168
+ /**
169
+ * Keeps track of local files that are removed after upload.
170
+ *
171
+ * @param array $files_to_remove
172
+ * @param integer $post_id
173
+ * @param string $file_path
174
+ *
175
+ * @return array
176
+ */
177
+ public function monitor_local_files_to_remove( $files_to_remove, $post_id, $file_path ) {
178
+ $this->removed_files = array_merge( $this->removed_files, $files_to_remove );
179
+
180
+ return $files_to_remove;
181
+ }
182
+
183
+ /**
184
+ * Prevent subsequent attempts to copy back after upload and remove.
185
+ *
186
+ * @param bool $copy_back_to_local
187
+ * @param string $file
188
+ * @param integer $attachment_id
189
+ * @param array $s3_object
190
+ *
191
+ * @return bool
192
+ */
193
+ public function prevent_copy_back_to_local_after_remove( $copy_back_to_local, $file, $attachment_id, $s3_object ) {
194
+ if ( $copy_back_to_local && in_array( $file, $this->removed_files ) ) {
195
+ $copy_back_to_local = false;
196
+ }
197
+
198
+ return $copy_back_to_local;
199
  }
200
 
201
  /**
918
  $this->as3cf->notices->remove_notice_by_id( $key_base . '-settings' );
919
  }
920
  }
921
+
922
+ /**
923
+ * Filters the REST dispatch request to determine whether route needs compatibility actions.
924
+ *
925
+ * @param bool $dispatch_result Dispatch result, will be used if not empty.
926
+ * @param WP_REST_Request $request Request used to generate the response.
927
+ * @param string $route Route matched for the request.
928
+ * @param array $handler Route handler used for the request.
929
+ *
930
+ * @return bool
931
+ */
932
+ public function rest_dispatch_request_copy_back_to_local( $dispatch_result, $request, $route, $handler ) {
933
+ $routes = array(
934
+ '/regenerate-thumbnails/v\d+/regenerate/',
935
+ );
936
+
937
+ $routes = apply_filters( 'as3cf_rest_api_enable_get_attached_file_copy_back_to_local', $routes );
938
+ $routes = is_array( $routes ) ? $routes : (array) $routes;
939
+
940
+ if ( ! empty( $routes ) ) {
941
+ foreach ( $routes as $match_route ) {
942
+ if ( preg_match( '@' . $match_route . '@i', $route ) ) {
943
+ $this->enable_get_attached_file_copy_back_to_local();
944
+ break;
945
+ }
946
+ }
947
+ }
948
+
949
+ return $dispatch_result;
950
+ }
951
  }
classes/as3cf-stream-wrapper.php CHANGED
@@ -1,14 +1,17 @@
1
  <?php
2
 
3
- class AS3CF_Stream_Wrapper extends Aws\S3\StreamWrapper {
 
 
 
4
 
5
  /**
6
  * Register the 's3://' stream wrapper
7
  *
8
- * @param Aws\S3\S3Client $client
9
  * @param string $protocol
10
  */
11
- public static function register( Aws\S3\S3Client $client, $protocol = 's3' ) {
12
  if ( in_array( $protocol, stream_get_wrappers() ) ) {
13
  stream_wrapper_unregister( $protocol );
14
  }
1
  <?php
2
 
3
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\S3Client;
4
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\StreamWrapper;
5
+
6
+ class AS3CF_Stream_Wrapper extends StreamWrapper {
7
 
8
  /**
9
  * Register the 's3://' stream wrapper
10
  *
11
+ * @param S3Client $client
12
  * @param string $protocol
13
  */
14
+ public static function register( S3Client $client, $protocol = 's3' ) {
15
  if ( in_array( $protocol, stream_get_wrappers() ) ) {
16
  stream_wrapper_unregister( $protocol );
17
  }
classes/as3cf-utils.php CHANGED
@@ -34,77 +34,6 @@ if ( ! class_exists( 'AS3CF_Utils' ) ) {
34
  return (int) get_post_field( 'ID', $post );
35
  }
36
 
37
- /**
38
- * Checks if another version of WP Offload S3 (Lite) is active and deactivates it.
39
- * To be hooked on `activated_plugin` so other plugin is deactivated when current plugin is activated.
40
- *
41
- * @param string $plugin
42
- *
43
- * @return bool
44
- */
45
- public static function deactivate_other_instances( $plugin ) {
46
- if ( ! in_array( basename( $plugin ), array( 'amazon-s3-and-cloudfront-pro.php', 'wordpress-s3.php' ) ) ) {
47
- return false;
48
- }
49
-
50
- $plugin_to_deactivate = 'wordpress-s3.php';
51
- $deactivated_notice_id = '1';
52
- $activated_plugin_min_version = '1.1';
53
- $plugin_to_deactivate_min_version = '1.0';
54
- if ( basename( $plugin ) === $plugin_to_deactivate ) {
55
- $plugin_to_deactivate = 'amazon-s3-and-cloudfront-pro.php';
56
- $deactivated_notice_id = '2';
57
- $activated_plugin_min_version = '1.0';
58
- $plugin_to_deactivate_min_version = '1.1';
59
- }
60
-
61
- $version = self::get_plugin_version_from_basename( $plugin );
62
-
63
- if ( version_compare( $version, $activated_plugin_min_version, '<' ) ) {
64
- return false;
65
- }
66
-
67
- if ( is_multisite() ) {
68
- $active_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
69
- $active_plugins = array_keys( $active_plugins );
70
- } else {
71
- $active_plugins = (array) get_option( 'active_plugins', array() );
72
- }
73
-
74
- foreach ( $active_plugins as $basename ) {
75
- if ( false !== strpos( $basename, $plugin_to_deactivate ) ) {
76
- $version = self::get_plugin_version_from_basename( $basename );
77
-
78
- if ( version_compare( $version, $plugin_to_deactivate_min_version, '<' ) ) {
79
- return false;
80
- }
81
-
82
- set_transient( 'as3cf_deactivated_notice_id', $deactivated_notice_id, HOUR_IN_SECONDS );
83
- deactivate_plugins( $basename );
84
-
85
- return true;
86
- }
87
- }
88
-
89
- return false;
90
- }
91
-
92
- /**
93
- * Get plugin data from basename
94
- *
95
- * @param string $basename
96
- *
97
- * @return string
98
- */
99
- public static function get_plugin_version_from_basename( $basename ) {
100
- require_once ABSPATH . 'wp-admin/includes/plugin.php';
101
-
102
- $plugin_path = WP_PLUGIN_DIR . '/' . $basename;
103
- $plugin_data = get_plugin_data( $plugin_path );
104
-
105
- return $plugin_data['Version'];
106
- }
107
-
108
  /**
109
  * Trailing slash prefix string ensuring no leading slashes.
110
  *
@@ -432,5 +361,22 @@ if ( ! class_exists( 'AS3CF_Utils' ) ) {
432
 
433
  call_user_func_array( 'deactivate_plugins', func_get_args() );
434
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
435
  }
436
  }
34
  return (int) get_post_field( 'ID', $post );
35
  }
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  /**
38
  * Trailing slash prefix string ensuring no leading slashes.
39
  *
361
 
362
  call_user_func_array( 'deactivate_plugins', func_get_args() );
363
  }
364
+
365
+ /**
366
+ * Get the first defined constant from the given list of constant names.
367
+ *
368
+ * @param array $constants
369
+ *
370
+ * @return string|false string constant name if defined, otherwise false if none are defined
371
+ */
372
+ public static function get_first_defined_constant( $constants ) {
373
+ foreach ( (array) $constants as $constant ) {
374
+ if ( defined( $constant ) ) {
375
+ return $constant;
376
+ }
377
+ }
378
+
379
+ return false;
380
+ }
381
  }
382
  }
classes/filters/as3cf-local-to-s3.php CHANGED
@@ -61,7 +61,7 @@ class AS3CF_Local_To_S3 extends AS3CF_Filter {
61
  $cache = $this->get_post_cache( $post->ID );
62
  $to_cache = array();
63
 
64
- if ( 1 === count( $pages ) && ! empty( $pages[0] ) ) {
65
  // Post already filtered and available on global $page array, continue
66
  $post->post_content = $pages[0];
67
  } else {
@@ -113,17 +113,42 @@ class AS3CF_Local_To_S3 extends AS3CF_Filter {
113
  * @return bool
114
  */
115
  protected function url_needs_replacing( $url ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  $uploads = wp_upload_dir();
117
  $base_url = $this->as3cf->maybe_fix_local_subsite_url( $uploads['baseurl'] );
118
  $base_url = AS3CF_Utils::remove_scheme( $base_url );
119
-
120
- if ( false !== strpos( $url, $base_url ) ) {
121
- // Local URL, perform replacement
122
- return true;
 
 
 
 
 
 
 
 
 
123
  }
124
 
125
- // Remote URL, no replacement needed
126
- return false;
127
  }
128
 
129
  /**
@@ -166,9 +191,7 @@ class AS3CF_Local_To_S3 extends AS3CF_Filter {
166
  return $this->query_cache[ $full_url ];
167
  }
168
 
169
- $upload_dir = wp_upload_dir();
170
- $base_url = AS3CF_Utils::remove_scheme( $upload_dir['baseurl'] );
171
- $path = $this->as3cf->decode_filename_in_path( ltrim( str_replace( $base_url, '', $full_url ), '/' ) );
172
 
173
  $sql = $wpdb->prepare( "
174
  SELECT post_id FROM {$wpdb->postmeta}
@@ -210,9 +233,6 @@ class AS3CF_Local_To_S3 extends AS3CF_Filter {
210
  $urls = array( $urls );
211
  }
212
 
213
- $upload_dir = wp_upload_dir();
214
- $base_url = AS3CF_Utils::remove_scheme( $upload_dir['baseurl'] );
215
-
216
  $paths = array();
217
  $full_urls = array();
218
 
@@ -226,7 +246,7 @@ class AS3CF_Local_To_S3 extends AS3CF_Filter {
226
  continue;
227
  }
228
 
229
- $path = $this->as3cf->decode_filename_in_path( ltrim( str_replace( $base_url, '', $full_url ), '/' ) );
230
 
231
  $paths[ $path ] = $full_url;
232
  $full_urls[ $full_url ] = $url;
@@ -312,4 +332,21 @@ class AS3CF_Local_To_S3 extends AS3CF_Filter {
312
 
313
  return $this->remove_aws_query_strings( $content, $base_url );
314
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
315
  }
61
  $cache = $this->get_post_cache( $post->ID );
62
  $to_cache = array();
63
 
64
+ if ( is_array( $pages ) && 1 === count( $pages ) && ! empty( $pages[0] ) ) {
65
  // Post already filtered and available on global $page array, continue
66
  $post->post_content = $pages[0];
67
  } else {
113
  * @return bool
114
  */
115
  protected function url_needs_replacing( $url ) {
116
+ if ( str_replace( $this->get_bare_upload_base_urls(), '', $url ) === $url ) {
117
+ // Remote URL, no replacement needed
118
+ return false;
119
+ }
120
+
121
+ // Local URL, perform replacement
122
+ return true;
123
+ }
124
+
125
+ /**
126
+ * Get an array of bare base_urls that can be used for uploaded items.
127
+ *
128
+ * @return array
129
+ */
130
+ private function get_bare_upload_base_urls() {
131
+ $base_urls = array();
132
+
133
  $uploads = wp_upload_dir();
134
  $base_url = $this->as3cf->maybe_fix_local_subsite_url( $uploads['baseurl'] );
135
  $base_url = AS3CF_Utils::remove_scheme( $base_url );
136
+ $domain = AS3CF_Utils::parse_url( $uploads['baseurl'], PHP_URL_HOST );
137
+
138
+ /**
139
+ * Allow alteration of the local domains that can be matched on.
140
+ *
141
+ * @param array $domains
142
+ */
143
+ $domains = apply_filters( 'as3cf_local_domains', (array) $domain );
144
+
145
+ if ( ! empty( $domains ) ) {
146
+ foreach ( array_unique( $domains ) as $match_domain ) {
147
+ $base_urls[] = substr_replace( $base_url, $match_domain, 2, strlen( $domain ) );
148
+ }
149
  }
150
 
151
+ return $base_urls;
 
152
  }
153
 
154
  /**
191
  return $this->query_cache[ $full_url ];
192
  }
193
 
194
+ $path = $this->as3cf->decode_filename_in_path( ltrim( str_replace( $this->get_bare_upload_base_urls(), '', $full_url ), '/' ) );
 
 
195
 
196
  $sql = $wpdb->prepare( "
197
  SELECT post_id FROM {$wpdb->postmeta}
233
  $urls = array( $urls );
234
  }
235
 
 
 
 
236
  $paths = array();
237
  $full_urls = array();
238
 
246
  continue;
247
  }
248
 
249
+ $path = $this->as3cf->decode_filename_in_path( ltrim( str_replace( $this->get_bare_upload_base_urls(), '', $full_url ), '/' ) );
250
 
251
  $paths[ $path ] = $full_url;
252
  $full_urls[ $full_url ] = $url;
332
 
333
  return $this->remove_aws_query_strings( $content, $base_url );
334
  }
335
+
336
+ /**
337
+ * Each time a URL is replaced this function is called to allow for logging or further updates etc.
338
+ *
339
+ * @param string $find URL with no scheme.
340
+ * @param string $replace URL with no scheme.
341
+ * @param string $content
342
+ *
343
+ * @return string
344
+ */
345
+ protected function url_replaced( $find, $replace, $content ) {
346
+ if ( (bool) $this->as3cf->get_setting( 'force-https' ) ) {
347
+ $content = str_replace( 'http:' . $replace, 'https:' . $replace, $content );
348
+ }
349
+
350
+ return $content;
351
+ }
352
  }
classes/upgrades/upgrade.php CHANGED
@@ -187,7 +187,7 @@ abstract class Upgrade {
187
  return false;
188
  }
189
 
190
- if ( ! $this->as3cf->is_plugin_setup() ) {
191
  return false;
192
  }
193
 
187
  return false;
188
  }
189
 
190
+ if ( ! $this->as3cf->is_plugin_setup( true ) ) {
191
  return false;
192
  }
193
 
composer.json CHANGED
@@ -2,10 +2,10 @@
2
  "name": "deliciousbrains/wp-amazon-s3-and-cloudfront",
3
  "type": "wordpress-plugin",
4
  "homepage": "https://github.com/deliciousbrains/wp-amazon-s3-and-cloudfront",
5
- "license": "GPLv3",
6
  "description": "Automatically copies media uploads to Amazon S3 for delivery. Optionally configure Amazon CloudFront for even faster delivery.",
7
  "keywords": ["plugin","amazon-web-services","s3","cloudfront","cdn"],
8
  "require": {
9
- "composer/installers": "~1.0.6"
10
  }
11
  }
2
  "name": "deliciousbrains/wp-amazon-s3-and-cloudfront",
3
  "type": "wordpress-plugin",
4
  "homepage": "https://github.com/deliciousbrains/wp-amazon-s3-and-cloudfront",
5
+ "license": "GPL-3.0-only",
6
  "description": "Automatically copies media uploads to Amazon S3 for delivery. Optionally configure Amazon CloudFront for even faster delivery.",
7
  "keywords": ["plugin","amazon-web-services","s3","cloudfront","cdn"],
8
  "require": {
9
+ "composer/installers": "^1.0"
10
  }
11
  }
languages/amazon-s3-and-cloudfront-en.pot CHANGED
@@ -8,7 +8,7 @@ msgid ""
8
  msgstr ""
9
  "Project-Id-Version: amazon-s3-and-cloudfront\n"
10
  "Report-Msgid-Bugs-To: nom@deliciousbrains.com\n"
11
- "POT-Creation-Date: 2018-01-26 12:18+0000\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -18,132 +18,175 @@ msgstr ""
18
  "Content-Transfer-Encoding: 8bit\n"
19
 
20
  #: classes/amazon-s3-and-cloudfront.php:123
21
- msgid "Offload S3 Lite"
22
- msgstr ""
23
-
24
  #: classes/amazon-s3-and-cloudfront.php:124
25
- msgid "S3 and CloudFront"
26
  msgstr ""
27
 
28
- #: classes/amazon-s3-and-cloudfront.php:238
29
- #: view/bucket-setting.php:18
 
 
30
  msgid "defined in wp-config.php"
31
  msgstr ""
32
 
33
- #: classes/amazon-s3-and-cloudfront.php:921
34
- #: classes/amazon-s3-and-cloudfront.php:1081
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  #, php-format
36
  msgid "File %s does not exist"
37
  msgstr ""
38
 
39
- #: classes/amazon-s3-and-cloudfront.php:932
40
  #, php-format
41
  msgid "Mime type %s is not allowed"
42
  msgstr ""
43
 
44
- #: classes/amazon-s3-and-cloudfront.php:1017
45
- #: classes/amazon-s3-and-cloudfront.php:1089
46
  #, php-format
47
  msgid "Error uploading %s to S3: %s"
48
  msgstr ""
49
 
50
- #: classes/amazon-s3-and-cloudfront.php:2233
51
  msgid "Cheatin&#8217; eh?"
52
  msgstr ""
53
 
54
- #: classes/amazon-s3-and-cloudfront.php:2237
55
  msgid "You do not have sufficient permissions to access this page."
56
  msgstr ""
57
 
58
- #: classes/amazon-s3-and-cloudfront.php:2243
59
  msgid "No bucket name provided."
60
  msgstr ""
61
 
62
- #: classes/amazon-s3-and-cloudfront.php:2523
63
  msgid "Error Getting Bucket Region"
64
  msgstr ""
65
 
66
- #: classes/amazon-s3-and-cloudfront.php:2524
67
  #, php-format
68
  msgid "There was an error attempting to get the region of the bucket %s: %s"
69
  msgstr ""
70
 
71
- #: classes/amazon-s3-and-cloudfront.php:2657
72
  msgid ""
73
  "This is a test file to check if the user has write permission to S3. Delete "
74
  "me if found."
75
  msgstr ""
76
 
77
- #: classes/amazon-s3-and-cloudfront.php:2676
78
  #, php-format
79
  msgid ""
80
  "There was an error attempting to check the permissions of the bucket %s: %s"
81
  msgstr ""
82
 
83
- #: classes/amazon-s3-and-cloudfront.php:2730
84
  msgid "Error creating bucket"
85
  msgstr ""
86
 
87
- #: classes/amazon-s3-and-cloudfront.php:2731
88
  msgid "Bucket name too short."
89
  msgstr ""
90
 
91
- #: classes/amazon-s3-and-cloudfront.php:2732
92
  msgid "Bucket name too long."
93
  msgstr ""
94
 
95
- #: classes/amazon-s3-and-cloudfront.php:2733
96
  msgid ""
97
  "Invalid character. Bucket names can contain lowercase letters, numbers, "
98
  "periods and hyphens."
99
  msgstr ""
100
 
101
- #: classes/amazon-s3-and-cloudfront.php:2734
102
  msgid "Error saving bucket"
103
  msgstr ""
104
 
105
- #: classes/amazon-s3-and-cloudfront.php:2735
106
  msgid "Error fetching buckets"
107
  msgstr ""
108
 
109
- #: classes/amazon-s3-and-cloudfront.php:2736
110
  msgid "Error getting URL preview: "
111
  msgstr ""
112
 
113
- #: classes/amazon-s3-and-cloudfront.php:2737
114
  msgid "The changes you made will be lost if you navigate away from this page"
115
  msgstr ""
116
 
117
- #: classes/amazon-s3-and-cloudfront.php:2738
118
  msgid "Getting diagnostic info..."
119
  msgstr ""
120
 
121
- #: classes/amazon-s3-and-cloudfront.php:2739
122
  msgid "Error getting diagnostic info: "
123
  msgstr ""
124
 
125
- #: classes/amazon-s3-and-cloudfront.php:2807
 
 
 
 
 
126
  msgid "Cheatin' eh?"
127
  msgstr ""
128
 
129
- #: classes/amazon-s3-and-cloudfront.php:2913
130
  msgctxt "Show the media library tab"
131
  msgid "Media Library"
132
  msgstr ""
133
 
134
- #: classes/amazon-s3-and-cloudfront.php:2914
 
 
 
 
 
 
 
 
 
 
135
  msgctxt "Show the support tab"
136
  msgid "Support"
137
  msgstr ""
138
 
139
- #: classes/amazon-s3-and-cloudfront.php:3131
140
  #, php-format
141
  msgid ""
142
  "<strong>WP Offload S3</strong> &mdash; The file %s has been given %s "
143
  "permissions on Amazon S3."
144
  msgstr ""
145
 
146
- #: classes/amazon-s3-and-cloudfront.php:3150
147
  msgid ""
148
  "<strong>WP Offload S3 Requirement Missing</strong> &mdash; Looks like you "
149
  "don't have an image manipulation library installed on this server and "
@@ -151,11 +194,17 @@ msgid ""
151
  "Please setup GD or ImageMagick."
152
  msgstr ""
153
 
154
- #: classes/amazon-s3-and-cloudfront.php:3755
 
 
 
 
 
 
155
  msgid "Quick Start Guide"
156
  msgstr ""
157
 
158
- #: classes/amazon-s3-and-cloudfront.php:3757
159
  #, php-format
160
  msgid ""
161
  "Looks like we don't have write access to this bucket. It's likely that the "
@@ -164,7 +213,7 @@ msgid ""
164
  "correctly."
165
  msgstr ""
166
 
167
- #: classes/amazon-s3-and-cloudfront.php:3759
168
  #, php-format
169
  msgid ""
170
  "Looks like we don't have access to the buckets. It's likely that the user "
@@ -172,39 +221,39 @@ msgid ""
172
  "Please see our %s for instructions on setting up permissions correctly."
173
  msgstr ""
174
 
175
- #: classes/amazon-s3-and-cloudfront.php:3909
176
  msgid "WP Offload S3 Activation"
177
  msgstr ""
178
 
179
- #: classes/amazon-s3-and-cloudfront.php:3910
180
  msgid ""
181
  "WP Offload S3 Lite and WP Offload S3 cannot both be active. We've "
182
  "automatically deactivated WP Offload S3 Lite."
183
  msgstr ""
184
 
185
- #: classes/amazon-s3-and-cloudfront.php:3912
186
  msgid "WP Offload S3 Lite Activation"
187
  msgstr ""
188
 
189
- #: classes/amazon-s3-and-cloudfront.php:3913
190
  msgid ""
191
  "WP Offload S3 Lite and WP Offload S3 cannot both be active. We've "
192
  "automatically deactivated WP Offload S3."
193
  msgstr ""
194
 
195
- #: classes/amazon-s3-and-cloudfront.php:3965
196
- msgid "More&nbsp;info"
197
  msgstr ""
198
 
199
- #: classes/amazon-s3-and-cloudfront.php:4060
200
  msgid "this doc"
201
  msgstr ""
202
 
203
- #: classes/amazon-s3-and-cloudfront.php:4062
204
  msgid "WP Offload S3 Feature Removed"
205
  msgstr ""
206
 
207
- #: classes/amazon-s3-and-cloudfront.php:4063
208
  #, php-format
209
  msgid ""
210
  "You had the \"Always non-SSL\" option selected in your settings, but we've "
@@ -215,35 +264,177 @@ msgid ""
215
  "to the old behavior."
216
  msgstr ""
217
 
218
- #: classes/amazon-s3-and-cloudfront.php:4093
219
- #: classes/amazon-s3-and-cloudfront.php:4202
220
  msgid "Amazon S3"
221
  msgstr ""
222
 
223
- #: classes/amazon-s3-and-cloudfront.php:4203
224
  msgctxt "Amazon S3 bucket"
225
  msgid "Bucket"
226
  msgstr ""
227
 
228
- #: classes/amazon-s3-and-cloudfront.php:4204
229
  msgctxt "Path to file on Amazon S3"
230
  msgid "Path"
231
  msgstr ""
232
 
233
- #: classes/amazon-s3-and-cloudfront.php:4205
234
  msgctxt "Location of Amazon S3 bucket"
235
  msgid "Region"
236
  msgstr ""
237
 
238
- #: classes/amazon-s3-and-cloudfront.php:4206
239
  msgctxt "Access control list of the file on Amazon S3"
240
  msgid "Access"
241
  msgstr ""
242
 
243
- #: classes/amazon-s3-and-cloudfront.php:4207
244
  msgid "URL"
245
  msgstr ""
246
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  #: classes/as3cf-notices.php:431
248
  msgid "Error dismissing notice."
249
  msgstr ""
@@ -252,19 +443,23 @@ msgstr ""
252
  msgid "Invalid notice ID."
253
  msgstr ""
254
 
255
- #: classes/as3cf-plugin-compatibility.php:515
 
 
 
 
256
  #, php-format
257
  msgid "The local directory %s does not exist and could not be created."
258
  msgstr ""
259
 
260
- #: classes/as3cf-plugin-compatibility.php:516
261
- #: classes/as3cf-plugin-compatibility.php:528
262
  #: classes/upgrades/upgrade-meta-wp-error.php:81
263
  #, php-format
264
  msgid "There was an error attempting to download the file %s from S3: %s"
265
  msgstr ""
266
 
267
- #: classes/as3cf-plugin-compatibility.php:836
268
  #, php-format
269
  msgid ""
270
  "<strong>Warning:</strong> This site is using PHP %1$s, in a future update WP "
@@ -381,81 +576,28 @@ msgstr ""
381
  msgid "Every %d Minutes"
382
  msgstr ""
383
 
384
- #: classes/wp-aws-compatibility-check.php:323
385
- msgid "deactivate"
386
- msgstr ""
387
-
388
- #: classes/wp-aws-compatibility-check.php:324
389
- #, php-format
390
- msgid "You can %s the %s plugin to get rid of this notice."
391
- msgstr ""
392
-
393
- #: classes/wp-aws-compatibility-check.php:327
394
- #, php-format
395
- msgid "%s has been disabled as it requires the %s plugin."
396
- msgstr ""
397
-
398
- #: classes/wp-aws-compatibility-check.php:331
399
- msgid "which is currently disabled."
400
- msgstr ""
401
-
402
- #: classes/wp-aws-compatibility-check.php:333
403
- msgid "It appears to be installed already."
404
  msgstr ""
405
 
406
- #: classes/wp-aws-compatibility-check.php:335
407
- msgctxt "Activate plugin"
408
- msgid "Activate it now."
409
- msgstr ""
410
-
411
- #: classes/wp-aws-compatibility-check.php:342
412
- #, php-format
413
- msgid "<a href=\"%s\">Install</a> and activate it."
414
  msgstr ""
415
 
416
- #: classes/wp-aws-compatibility-check.php:353
417
- #, php-format
418
- msgid ""
419
- "%s has been disabled as it requires version %s or later of the %s plugin."
420
  msgstr ""
421
 
422
- #: classes/wp-aws-compatibility-check.php:356
423
- #, php-format
424
- msgid "You currently have version %s installed."
425
  msgstr ""
426
 
427
- #: classes/wp-aws-compatibility-check.php:363
428
- #: classes/wp-aws-compatibility-check.php:401
429
- #, php-format
430
- msgid "A valid license for %s is required to update."
431
- msgstr ""
432
-
433
- #: classes/wp-aws-compatibility-check.php:371
434
- msgid "Update to the latest version"
435
- msgstr ""
436
-
437
- #: classes/wp-aws-compatibility-check.php:383
438
- #, php-format
439
- msgid ""
440
- "%1$s has been disabled because it is not a supported addon of the %2$s "
441
- "plugin."
442
- msgstr ""
443
-
444
- #: classes/wp-aws-compatibility-check.php:392
445
- #, php-format
446
- msgid ""
447
- "%1$s has been disabled because it will not work with the version of the %2$s "
448
- "plugin installed. %1$s %3$s or later is required."
449
- msgstr ""
450
-
451
- #: classes/wp-aws-compatibility-check.php:395
452
- #, php-format
453
- msgid "Update %s to the latest version"
454
- msgstr ""
455
-
456
- #: classes/wp-aws-compatibility-check.php:464
457
- #, php-format
458
- msgid "The %s plugin has been deactivated."
459
  msgstr ""
460
 
461
  #: view/attachment-metabox.php:14
@@ -546,19 +688,26 @@ msgstr ""
546
  msgid "Create New Bucket"
547
  msgstr ""
548
 
549
- #: view/bucket-setting.php:7
550
  msgid "Bucket"
551
  msgstr ""
552
 
553
- #: view/bucket-setting.php:12
554
  msgid "View in S3 console"
555
  msgstr ""
556
 
557
- #: view/bucket-setting.php:16
558
  msgid "Change"
559
  msgstr ""
560
 
561
- #: view/bucket-setting.php:35
 
 
 
 
 
 
 
562
  msgid ""
563
  "<strong>Bucket Select Disabled</strong> &mdash; Bucket selection has been "
564
  "disabled while files are copied between buckets."
@@ -620,105 +769,181 @@ msgstr ""
620
  msgid "Show"
621
  msgstr ""
622
 
623
- #: view/settings.php:10
624
- msgid "Settings saved."
 
 
 
 
625
  msgstr ""
626
 
627
- #: view/settings.php:48
 
 
 
 
 
628
  msgid "Enable/Disable the Plugin"
629
  msgstr ""
630
 
631
- #: view/settings.php:56
632
  msgid "Copy Files to S3"
633
  msgstr ""
634
 
635
- #: view/settings.php:58
636
  msgid ""
637
  "When a file is uploaded to the Media Library, copy it to S3. Existing files "
638
  "are <em>not</em> copied to S3."
639
  msgstr ""
640
 
641
- #: view/settings.php:71
642
  msgid "Rewrite File URLs"
643
  msgstr ""
644
 
645
- #: view/settings.php:73
646
  msgid ""
647
  "For Media Library files that have been copied to S3, rewrite the URLs so "
648
  "that they are served from S3/CloudFront instead of your server."
649
  msgstr ""
650
 
651
- #: view/settings.php:80
652
  msgid "Configure File URLs"
653
  msgstr ""
654
 
655
- #: view/settings.php:101
656
  msgid "Path"
657
  msgstr ""
658
 
659
- #: view/settings.php:103
660
  msgid "By default the path is the same as your local WordPress files."
661
  msgstr ""
662
 
663
- #: view/settings.php:120
664
  msgid "Year/Month"
665
  msgstr ""
666
 
667
- #: view/settings.php:122
668
  msgid "Add the Year/Month in the URL."
669
  msgstr ""
670
 
671
- #: view/settings.php:135
672
  msgid "Force HTTPS"
673
  msgstr ""
674
 
675
- #: view/settings.php:137
676
  msgid ""
677
  "By default we use HTTPS when the request is HTTPS and regular HTTP when the "
678
  "request is HTTP, but you may want to force the use of HTTPS always, "
679
  "regardless of the request."
680
  msgstr ""
681
 
682
- #: view/settings.php:144
683
  msgid "Advanced Options"
684
  msgstr ""
685
 
686
- #: view/settings.php:153
687
  msgid "Remove Files From Server"
688
  msgstr ""
689
 
690
- #: view/settings.php:154
691
  msgid "Once a file has been copied to S3, remove it from the local server."
692
  msgstr ""
693
 
694
- #: view/settings.php:158
695
  msgid ""
696
  "<strong>Broken URLs</strong> &mdash; There will be broken URLs for files "
697
  "that don't exist locally. You can fix this by enabling <strong>Rewrite File "
698
  "URLs</strong> to use the S3 URLs."
699
  msgstr ""
700
 
701
- #: view/settings.php:169
702
  #, php-format
703
  msgid ""
704
  "<strong>Warning</strong> &mdash; Some plugins depend on the file being "
705
  "present on the local server and may not work when the file is removed. %s"
706
  msgstr ""
707
 
708
- #: view/settings.php:187
709
  msgid "Object Versioning"
710
  msgstr ""
711
 
712
- #: view/settings.php:189
713
  msgid ""
714
  "Append a timestamp to the S3 file path. Recommended when using CloudFront so "
715
  "you don't have to worry about cache invalidation."
716
  msgstr ""
717
 
718
- #: view/settings.php:196
 
719
  msgid "Save Changes"
720
  msgstr ""
721
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
722
  #: view/sidebar.php:13
723
  msgid "Upload existing Media Library to S3"
724
  msgstr ""
8
  msgstr ""
9
  "Project-Id-Version: amazon-s3-and-cloudfront\n"
10
  "Report-Msgid-Bugs-To: nom@deliciousbrains.com\n"
11
+ "POT-Creation-Date: 2018-02-20 14:59+0000\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
18
  "Content-Transfer-Encoding: 8bit\n"
19
 
20
  #: classes/amazon-s3-and-cloudfront.php:123
 
 
 
21
  #: classes/amazon-s3-and-cloudfront.php:124
22
+ msgid "Offload S3"
23
  msgstr ""
24
 
25
+ #: classes/amazon-s3-and-cloudfront.php:254
26
+ #: view/bucket-setting.php:17
27
+ #: view/settings/settings.php:76
28
+ #: view/settings/settings.php:93
29
  msgid "defined in wp-config.php"
30
  msgstr ""
31
 
32
+ #: classes/amazon-s3-and-cloudfront.php:781
33
+ msgid "Access keys updated successfully."
34
+ msgstr ""
35
+
36
+ #: classes/amazon-s3-and-cloudfront.php:786
37
+ msgid ""
38
+ "All access key constants must be removed before keys can be set in the "
39
+ "database."
40
+ msgstr ""
41
+
42
+ #: classes/amazon-s3-and-cloudfront.php:794
43
+ msgid "The Access Key ID must be set."
44
+ msgstr ""
45
+
46
+ #: classes/amazon-s3-and-cloudfront.php:799
47
+ #: classes/amazon-s3-and-cloudfront.php:2871
48
+ #: view/settings/settings.php:88
49
+ msgctxt "placeholder for hidden access key, 39 char max"
50
+ msgid "-- not shown --"
51
+ msgstr ""
52
+
53
+ #: classes/amazon-s3-and-cloudfront.php:803
54
+ msgid "The Secret Access Key must be at least 40 characters long."
55
+ msgstr ""
56
+
57
+ #: classes/amazon-s3-and-cloudfront.php:824
58
+ msgid "Access keys removed from the database successfully."
59
+ msgstr ""
60
+
61
+ #: classes/amazon-s3-and-cloudfront.php:1012
62
+ #: classes/amazon-s3-and-cloudfront.php:1170
63
  #, php-format
64
  msgid "File %s does not exist"
65
  msgstr ""
66
 
67
+ #: classes/amazon-s3-and-cloudfront.php:1023
68
  #, php-format
69
  msgid "Mime type %s is not allowed"
70
  msgstr ""
71
 
72
+ #: classes/amazon-s3-and-cloudfront.php:1106
73
+ #: classes/amazon-s3-and-cloudfront.php:1178
74
  #, php-format
75
  msgid "Error uploading %s to S3: %s"
76
  msgstr ""
77
 
78
+ #: classes/amazon-s3-and-cloudfront.php:2324
79
  msgid "Cheatin&#8217; eh?"
80
  msgstr ""
81
 
82
+ #: classes/amazon-s3-and-cloudfront.php:2328
83
  msgid "You do not have sufficient permissions to access this page."
84
  msgstr ""
85
 
86
+ #: classes/amazon-s3-and-cloudfront.php:2334
87
  msgid "No bucket name provided."
88
  msgstr ""
89
 
90
+ #: classes/amazon-s3-and-cloudfront.php:2637
91
  msgid "Error Getting Bucket Region"
92
  msgstr ""
93
 
94
+ #: classes/amazon-s3-and-cloudfront.php:2638
95
  #, php-format
96
  msgid "There was an error attempting to get the region of the bucket %s: %s"
97
  msgstr ""
98
 
99
+ #: classes/amazon-s3-and-cloudfront.php:2776
100
  msgid ""
101
  "This is a test file to check if the user has write permission to S3. Delete "
102
  "me if found."
103
  msgstr ""
104
 
105
+ #: classes/amazon-s3-and-cloudfront.php:2795
106
  #, php-format
107
  msgid ""
108
  "There was an error attempting to check the permissions of the bucket %s: %s"
109
  msgstr ""
110
 
111
+ #: classes/amazon-s3-and-cloudfront.php:2861
112
  msgid "Error creating bucket"
113
  msgstr ""
114
 
115
+ #: classes/amazon-s3-and-cloudfront.php:2862
116
  msgid "Bucket name too short."
117
  msgstr ""
118
 
119
+ #: classes/amazon-s3-and-cloudfront.php:2863
120
  msgid "Bucket name too long."
121
  msgstr ""
122
 
123
+ #: classes/amazon-s3-and-cloudfront.php:2864
124
  msgid ""
125
  "Invalid character. Bucket names can contain lowercase letters, numbers, "
126
  "periods and hyphens."
127
  msgstr ""
128
 
129
+ #: classes/amazon-s3-and-cloudfront.php:2865
130
  msgid "Error saving bucket"
131
  msgstr ""
132
 
133
+ #: classes/amazon-s3-and-cloudfront.php:2866
134
  msgid "Error fetching buckets"
135
  msgstr ""
136
 
137
+ #: classes/amazon-s3-and-cloudfront.php:2867
138
  msgid "Error getting URL preview: "
139
  msgstr ""
140
 
141
+ #: classes/amazon-s3-and-cloudfront.php:2868
142
  msgid "The changes you made will be lost if you navigate away from this page"
143
  msgstr ""
144
 
145
+ #: classes/amazon-s3-and-cloudfront.php:2869
146
  msgid "Getting diagnostic info..."
147
  msgstr ""
148
 
149
+ #: classes/amazon-s3-and-cloudfront.php:2870
150
  msgid "Error getting diagnostic info: "
151
  msgstr ""
152
 
153
+ #: classes/amazon-s3-and-cloudfront.php:2873
154
+ #: classes/amazon-s3-and-cloudfront.php:4583
155
+ msgid "Settings saved."
156
+ msgstr ""
157
+
158
+ #: classes/amazon-s3-and-cloudfront.php:2943
159
  msgid "Cheatin' eh?"
160
  msgstr ""
161
 
162
+ #: classes/amazon-s3-and-cloudfront.php:2992
163
  msgctxt "Show the media library tab"
164
  msgid "Media Library"
165
  msgstr ""
166
 
167
+ #: classes/amazon-s3-and-cloudfront.php:2993
168
+ msgctxt "Show the addons tab"
169
+ msgid "Addons"
170
+ msgstr ""
171
+
172
+ #: classes/amazon-s3-and-cloudfront.php:2994
173
+ msgctxt "Show the settings tab"
174
+ msgid "Settings"
175
+ msgstr ""
176
+
177
+ #: classes/amazon-s3-and-cloudfront.php:2995
178
  msgctxt "Show the support tab"
179
  msgid "Support"
180
  msgstr ""
181
 
182
+ #: classes/amazon-s3-and-cloudfront.php:3230
183
  #, php-format
184
  msgid ""
185
  "<strong>WP Offload S3</strong> &mdash; The file %s has been given %s "
186
  "permissions on Amazon S3."
187
  msgstr ""
188
 
189
+ #: classes/amazon-s3-and-cloudfront.php:3249
190
  msgid ""
191
  "<strong>WP Offload S3 Requirement Missing</strong> &mdash; Looks like you "
192
  "don't have an image manipulation library installed on this server and "
194
  "Please setup GD or ImageMagick."
195
  msgstr ""
196
 
197
+ #: classes/amazon-s3-and-cloudfront.php:3863
198
+ #, php-format
199
+ msgid ""
200
+ "<a href=\"%s\">Define your AWS keys</a> to enable write access to the bucket"
201
+ msgstr ""
202
+
203
+ #: classes/amazon-s3-and-cloudfront.php:3870
204
  msgid "Quick Start Guide"
205
  msgstr ""
206
 
207
+ #: classes/amazon-s3-and-cloudfront.php:3872
208
  #, php-format
209
  msgid ""
210
  "Looks like we don't have write access to this bucket. It's likely that the "
213
  "correctly."
214
  msgstr ""
215
 
216
+ #: classes/amazon-s3-and-cloudfront.php:3874
217
  #, php-format
218
  msgid ""
219
  "Looks like we don't have access to the buckets. It's likely that the user "
221
  "Please see our %s for instructions on setting up permissions correctly."
222
  msgstr ""
223
 
224
+ #: classes/amazon-s3-and-cloudfront.php:4024
225
  msgid "WP Offload S3 Activation"
226
  msgstr ""
227
 
228
+ #: classes/amazon-s3-and-cloudfront.php:4025
229
  msgid ""
230
  "WP Offload S3 Lite and WP Offload S3 cannot both be active. We've "
231
  "automatically deactivated WP Offload S3 Lite."
232
  msgstr ""
233
 
234
+ #: classes/amazon-s3-and-cloudfront.php:4027
235
  msgid "WP Offload S3 Lite Activation"
236
  msgstr ""
237
 
238
+ #: classes/amazon-s3-and-cloudfront.php:4028
239
  msgid ""
240
  "WP Offload S3 Lite and WP Offload S3 cannot both be active. We've "
241
  "automatically deactivated WP Offload S3."
242
  msgstr ""
243
 
244
+ #: classes/amazon-s3-and-cloudfront.php:4080
245
+ msgid "More&nbsp;info&nbsp;&raquo;"
246
  msgstr ""
247
 
248
+ #: classes/amazon-s3-and-cloudfront.php:4175
249
  msgid "this doc"
250
  msgstr ""
251
 
252
+ #: classes/amazon-s3-and-cloudfront.php:4177
253
  msgid "WP Offload S3 Feature Removed"
254
  msgstr ""
255
 
256
+ #: classes/amazon-s3-and-cloudfront.php:4178
257
  #, php-format
258
  msgid ""
259
  "You had the \"Always non-SSL\" option selected in your settings, but we've "
264
  "to the old behavior."
265
  msgstr ""
266
 
267
+ #: classes/amazon-s3-and-cloudfront.php:4208
268
+ #: classes/amazon-s3-and-cloudfront.php:4317
269
  msgid "Amazon S3"
270
  msgstr ""
271
 
272
+ #: classes/amazon-s3-and-cloudfront.php:4318
273
  msgctxt "Amazon S3 bucket"
274
  msgid "Bucket"
275
  msgstr ""
276
 
277
+ #: classes/amazon-s3-and-cloudfront.php:4319
278
  msgctxt "Path to file on Amazon S3"
279
  msgid "Path"
280
  msgstr ""
281
 
282
+ #: classes/amazon-s3-and-cloudfront.php:4320
283
  msgctxt "Location of Amazon S3 bucket"
284
  msgid "Region"
285
  msgstr ""
286
 
287
+ #: classes/amazon-s3-and-cloudfront.php:4321
288
  msgctxt "Access control list of the file on Amazon S3"
289
  msgid "Access"
290
  msgstr ""
291
 
292
+ #: classes/amazon-s3-and-cloudfront.php:4322
293
  msgid "URL"
294
  msgstr ""
295
 
296
+ #: classes/amazon-s3-and-cloudfront.php:4546
297
+ msgid "Assets Pull"
298
+ msgstr ""
299
+
300
+ #: classes/amazon-s3-and-cloudfront.php:4547
301
+ msgid ""
302
+ "An addon for WP Offload S3 to serve your site's JS, CSS, and other enqueued "
303
+ "assets from Amazon CloudFront or another CDN."
304
+ msgstr ""
305
+
306
+ #: classes/amazon-s3-and-cloudfront.php:4551
307
+ msgid "Feature"
308
+ msgstr ""
309
+
310
+ #: classes/amazon-s3-and-cloudfront.php:4597
311
+ #, php-format
312
+ msgid ""
313
+ "<strong>Amazon Web Services Plugin No Longer Required</strong> &mdash; As of "
314
+ "version 1.6 of WP Offload S3, the <a href=\"%1$s\">Amazon Web Services</a> "
315
+ "plugin is no longer required. We have removed the dependency by bundling a "
316
+ "small portion of the AWS SDK into WP Offload S3. As long as none of your "
317
+ "other active plugins or themes depend on the Amazon Web Services plugin, it "
318
+ "should be safe to deactivate and delete it. %2$s"
319
+ msgstr ""
320
+
321
+ #: classes/amazon-s3-and-cloudfront.php:4629
322
+ #, php-format
323
+ msgid ""
324
+ "<strong>WP Offload S3 Settings Moved</strong> &mdash; You now define your "
325
+ "AWS keys for WP Offload S3 in the new <a href=\"%1$s\">Settings tab</a>. "
326
+ "Saving settings in the form below will have no effect on WP Offload S3. %2$s"
327
+ msgstr ""
328
+
329
+ #: classes/amazon-web-services.php:148
330
+ #, php-format
331
+ msgid ""
332
+ "You must first <a href=\"%s\">set your AWS access keys</a> to use this addon."
333
+ msgstr ""
334
+
335
+ #: classes/as3cf-compatibility-check.php:317
336
+ msgid "deactivate"
337
+ msgstr ""
338
+
339
+ #: classes/as3cf-compatibility-check.php:318
340
+ #, php-format
341
+ msgid "You can %s the %s plugin to get rid of this notice."
342
+ msgstr ""
343
+
344
+ #: classes/as3cf-compatibility-check.php:336
345
+ #, php-format
346
+ msgid "%s has been disabled as it requires the %s plugin."
347
+ msgstr ""
348
+
349
+ #: classes/as3cf-compatibility-check.php:340
350
+ msgid "which is currently disabled."
351
+ msgstr ""
352
+
353
+ #: classes/as3cf-compatibility-check.php:342
354
+ msgid "It appears to be installed already."
355
+ msgstr ""
356
+
357
+ #: classes/as3cf-compatibility-check.php:344
358
+ msgctxt "Activate plugin"
359
+ msgid "Activate it now."
360
+ msgstr ""
361
+
362
+ #: classes/as3cf-compatibility-check.php:351
363
+ #, php-format
364
+ msgid "<a href=\"%s\">Install</a> and activate it."
365
+ msgstr ""
366
+
367
+ #: classes/as3cf-compatibility-check.php:362
368
+ #, php-format
369
+ msgid ""
370
+ "%s has been disabled as it requires version %s or later of the %s plugin."
371
+ msgstr ""
372
+
373
+ #: classes/as3cf-compatibility-check.php:365
374
+ #, php-format
375
+ msgid "You currently have version %s installed."
376
+ msgstr ""
377
+
378
+ #: classes/as3cf-compatibility-check.php:372
379
+ #: classes/as3cf-compatibility-check.php:410
380
+ #, php-format
381
+ msgid "A valid license for %s is required to update."
382
+ msgstr ""
383
+
384
+ #: classes/as3cf-compatibility-check.php:381
385
+ msgid "Update to the latest version"
386
+ msgstr ""
387
+
388
+ #: classes/as3cf-compatibility-check.php:392
389
+ #, php-format
390
+ msgid ""
391
+ "%1$s has been disabled because it is not a supported addon of the %2$s "
392
+ "plugin."
393
+ msgstr ""
394
+
395
+ #: classes/as3cf-compatibility-check.php:401
396
+ #, php-format
397
+ msgid ""
398
+ "%1$s has been disabled because it will not work with the version of the %2$s "
399
+ "plugin installed. %1$s %3$s or later is required."
400
+ msgstr ""
401
+
402
+ #: classes/as3cf-compatibility-check.php:404
403
+ #, php-format
404
+ msgid "Update %s to the latest version"
405
+ msgstr ""
406
+
407
+ #: classes/as3cf-compatibility-check.php:473
408
+ #, php-format
409
+ msgid "The %s plugin has been deactivated."
410
+ msgstr ""
411
+
412
+ #: classes/as3cf-compatibility-check.php:619
413
+ msgid "a PHP version less than 5.3.3"
414
+ msgstr ""
415
+
416
+ #: classes/as3cf-compatibility-check.php:623
417
+ msgid "no PHP cURL library activated"
418
+ msgstr ""
419
+
420
+ #: classes/as3cf-compatibility-check.php:629
421
+ msgid "a cURL version less than 7.16.2"
422
+ msgstr ""
423
+
424
+ #: classes/as3cf-compatibility-check.php:644
425
+ msgid "cURL compiled without"
426
+ msgstr ""
427
+
428
+ #: classes/as3cf-compatibility-check.php:649
429
+ msgid "the function curl_multi_exec disabled"
430
+ msgstr ""
431
+
432
+ #: classes/as3cf-compatibility-check.php:667
433
+ msgid ""
434
+ "The official Amazon&nbsp;Web&nbsp;Services SDK requires PHP 5.3.3+ and cURL "
435
+ "7.16.2+ compiled with OpenSSL and zlib. Your server currently has"
436
+ msgstr ""
437
+
438
  #: classes/as3cf-notices.php:431
439
  msgid "Error dismissing notice."
440
  msgstr ""
443
  msgid "Invalid notice ID."
444
  msgstr ""
445
 
446
+ #: classes/as3cf-plugin-base.php:461
447
+ msgid "Settings"
448
+ msgstr ""
449
+
450
+ #: classes/as3cf-plugin-compatibility.php:570
451
  #, php-format
452
  msgid "The local directory %s does not exist and could not be created."
453
  msgstr ""
454
 
455
+ #: classes/as3cf-plugin-compatibility.php:571
456
+ #: classes/as3cf-plugin-compatibility.php:583
457
  #: classes/upgrades/upgrade-meta-wp-error.php:81
458
  #, php-format
459
  msgid "There was an error attempting to download the file %s from S3: %s"
460
  msgstr ""
461
 
462
+ #: classes/as3cf-plugin-compatibility.php:891
463
  #, php-format
464
  msgid ""
465
  "<strong>Warning:</strong> This site is using PHP %1$s, in a future update WP "
576
  msgid "Every %d Minutes"
577
  msgstr ""
578
 
579
+ #: view/addon.php:11
580
+ msgid "More Details &raquo;"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
581
  msgstr ""
582
 
583
+ #: view/addon.php:40
584
+ msgctxt "Plugin already installed and activated"
585
+ msgid "Installed & Activated"
 
 
 
 
 
586
  msgstr ""
587
 
588
+ #: view/addon.php:42
589
+ msgctxt "Plugin already installed"
590
+ msgid "Installed"
 
591
  msgstr ""
592
 
593
+ #: view/addon.php:43
594
+ msgctxt "Activate plugin now"
595
+ msgid "Activate Now"
596
  msgstr ""
597
 
598
+ #: view/addon.php:45
599
+ msgctxt "Install plugin now"
600
+ msgid "Install Now"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
601
  msgstr ""
602
 
603
  #: view/attachment-metabox.php:14
688
  msgid "Create New Bucket"
689
  msgstr ""
690
 
691
+ #: view/bucket-setting.php:8
692
  msgid "Bucket"
693
  msgstr ""
694
 
695
+ #: view/bucket-setting.php:13
696
  msgid "View in S3 console"
697
  msgstr ""
698
 
699
+ #: view/bucket-setting.php:19
700
  msgid "Change"
701
  msgstr ""
702
 
703
+ #: view/bucket-setting.php:37
704
+ #, php-format
705
+ msgid ""
706
+ "<strong>Bucket Select Disabled</strong> &mdash; <a href=\"%s\">Define your "
707
+ "AWS keys</a> to configure the bucket"
708
+ msgstr ""
709
+
710
+ #: view/bucket-setting.php:46
711
  msgid ""
712
  "<strong>Bucket Select Disabled</strong> &mdash; Bucket selection has been "
713
  "disabled while files are copied between buckets."
769
  msgid "Show"
770
  msgstr ""
771
 
772
+ #: view/settings/addons.php:10
773
+ #, php-format
774
+ msgid ""
775
+ "<strong>Get Addons</strong> — The following addons are available with a WP "
776
+ "Offload S3 Gold license or better.<br>Visit <a href=\"%s\">deliciousbrains."
777
+ "com</a> to purchase in just a few clicks."
778
  msgstr ""
779
 
780
+ #: view/settings/media.php:13
781
+ #, php-format
782
+ msgid "<a href=\"%s\">Define your AWS keys</a> to configure WP Offload S3"
783
+ msgstr ""
784
+
785
+ #: view/settings/media.php:47
786
  msgid "Enable/Disable the Plugin"
787
  msgstr ""
788
 
789
+ #: view/settings/media.php:56
790
  msgid "Copy Files to S3"
791
  msgstr ""
792
 
793
+ #: view/settings/media.php:58
794
  msgid ""
795
  "When a file is uploaded to the Media Library, copy it to S3. Existing files "
796
  "are <em>not</em> copied to S3."
797
  msgstr ""
798
 
799
+ #: view/settings/media.php:71
800
  msgid "Rewrite File URLs"
801
  msgstr ""
802
 
803
+ #: view/settings/media.php:73
804
  msgid ""
805
  "For Media Library files that have been copied to S3, rewrite the URLs so "
806
  "that they are served from S3/CloudFront instead of your server."
807
  msgstr ""
808
 
809
+ #: view/settings/media.php:80
810
  msgid "Configure File URLs"
811
  msgstr ""
812
 
813
+ #: view/settings/media.php:101
814
  msgid "Path"
815
  msgstr ""
816
 
817
+ #: view/settings/media.php:103
818
  msgid "By default the path is the same as your local WordPress files."
819
  msgstr ""
820
 
821
+ #: view/settings/media.php:120
822
  msgid "Year/Month"
823
  msgstr ""
824
 
825
+ #: view/settings/media.php:122
826
  msgid "Add the Year/Month in the URL."
827
  msgstr ""
828
 
829
+ #: view/settings/media.php:135
830
  msgid "Force HTTPS"
831
  msgstr ""
832
 
833
+ #: view/settings/media.php:137
834
  msgid ""
835
  "By default we use HTTPS when the request is HTTPS and regular HTTP when the "
836
  "request is HTTP, but you may want to force the use of HTTPS always, "
837
  "regardless of the request."
838
  msgstr ""
839
 
840
+ #: view/settings/media.php:144
841
  msgid "Advanced Options"
842
  msgstr ""
843
 
844
+ #: view/settings/media.php:153
845
  msgid "Remove Files From Server"
846
  msgstr ""
847
 
848
+ #: view/settings/media.php:154
849
  msgid "Once a file has been copied to S3, remove it from the local server."
850
  msgstr ""
851
 
852
+ #: view/settings/media.php:158
853
  msgid ""
854
  "<strong>Broken URLs</strong> &mdash; There will be broken URLs for files "
855
  "that don't exist locally. You can fix this by enabling <strong>Rewrite File "
856
  "URLs</strong> to use the S3 URLs."
857
  msgstr ""
858
 
859
+ #: view/settings/media.php:169
860
  #, php-format
861
  msgid ""
862
  "<strong>Warning</strong> &mdash; Some plugins depend on the file being "
863
  "present on the local server and may not work when the file is removed. %s"
864
  msgstr ""
865
 
866
+ #: view/settings/media.php:187
867
  msgid "Object Versioning"
868
  msgstr ""
869
 
870
+ #: view/settings/media.php:189
871
  msgid ""
872
  "Append a timestamp to the S3 file path. Recommended when using CloudFront so "
873
  "you don't have to worry about cache invalidation."
874
  msgstr ""
875
 
876
+ #: view/settings/media.php:196
877
+ #: view/settings/settings.php:112
878
  msgid "Save Changes"
879
  msgstr ""
880
 
881
+ #: view/settings/settings.php:19
882
+ msgid "AWS Access Keys"
883
+ msgstr ""
884
+
885
+ #: view/settings/settings.php:23
886
+ msgid "You have enabled the use of IAM roles for Amazon EC2 instances."
887
+ msgstr ""
888
+
889
+ #: view/settings/settings.php:30
890
+ msgid ""
891
+ "Please check your wp-config.php file as it looks like one of your defines is "
892
+ "missing or incorrect."
893
+ msgstr ""
894
+
895
+ #: view/settings/settings.php:36
896
+ #, php-format
897
+ msgid ""
898
+ "You&#8217;ve already defined your AWS access keys in your wp-config.php. If "
899
+ "you&#8217;d prefer to manage them here and store them in the database (<a "
900
+ "href=\"%s\">not recommended</a>), simply remove the lines from your wp-"
901
+ "config."
902
+ msgstr ""
903
+
904
+ #: view/settings/settings.php:42
905
+ msgid ""
906
+ "We recommend defining your Access Keys in wp-config.php so long as you "
907
+ "don&#8217;t commit it to source control (you shouldn&#8217;t be). Simply "
908
+ "copy the following snippet and replace the stars with the keys."
909
+ msgstr ""
910
+
911
+ #: view/settings/settings.php:52
912
+ #, php-format
913
+ msgid ""
914
+ "You&#8217;re storing your Access Keys in the database (<a href=\"%s\">not "
915
+ "recommended</a>).</a>"
916
+ msgstr ""
917
+
918
+ #: view/settings/settings.php:56
919
+ msgid ""
920
+ "If you&#8217;d rather store your Access Keys in the database, <a href=\"#\" "
921
+ "data-as3cf-toggle-access-keys-form>click here to reveal a form.</a>"
922
+ msgstr ""
923
+
924
+ #: view/settings/settings.php:66
925
+ msgid "Access Key ID"
926
+ msgstr ""
927
+
928
+ #: view/settings/settings.php:83
929
+ msgid "Secret Access Key"
930
+ msgstr ""
931
+
932
+ #: view/settings/settings.php:103
933
+ msgid "This will store your AWS access keys in the database (not recommended)."
934
+ msgstr ""
935
+
936
+ #: view/settings/settings.php:115
937
+ msgid "Remove Keys"
938
+ msgstr ""
939
+
940
+ #: view/settings/settings.php:127
941
+ #, php-format
942
+ msgid ""
943
+ "Need help getting your Access Keys? <a href=\"%s\">Check out the Quick Start "
944
+ "Guide &rarr;</a>"
945
+ msgstr ""
946
+
947
  #: view/sidebar.php:13
948
  msgid "Upload existing Media Library to S3"
949
  msgstr ""
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: bradt, deliciousbrains
3
  Tags: uploads, amazon, s3, amazon s3, mirror, admin, media, cdn, cloudfront
4
  Requires at least: 4.6
5
  Tested up to: 4.9
6
- Stable tag: 1.2.1
7
  License: GPLv3
8
 
9
  Copies files to Amazon S3 as they are uploaded to the Media Library. Optionally configure Amazon CloudFront for faster delivery.
@@ -65,6 +65,23 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin
65
 
66
  == Changelog ==
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  = WP Offload S3 Lite 1.2.1 - 2017-11-20 =
69
  * New: Compatibility with HTML Widget
70
  * New: Dismissible admin notice that WP Offload S3 Lite will soon require PHP 5.5+
3
  Tags: uploads, amazon, s3, amazon s3, mirror, admin, media, cdn, cloudfront
4
  Requires at least: 4.6
5
  Tested up to: 4.9
6
+ Stable tag: 1.3
7
  License: GPLv3
8
 
9
  Copies files to Amazon S3 as they are uploaded to the Media Library. Optionally configure Amazon CloudFront for faster delivery.
65
 
66
  == Changelog ==
67
 
68
+ = WP Offload S3 Lite 1.3 - 2018-02-20 =
69
+ * [Release Summary Blog Post](https://deliciousbrains.com/wp-offload-s3-1-6-released/?utm_campaign=changelogs&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting)
70
+ * New: [Amazon Web Services plugin](https://wordpress.org/plugins/amazon-web-services/) is no longer required to run WP Offload S3 Lite
71
+ * New: Added [`as3cf_local_domains`](https://deliciousbrains.com/wp-offload-s3/doc/filtering-urls-for-multiple-domains/?utm_campaign=changelogs&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting) filter for when site content is updated through multiple domains
72
+ * Improvement: AWS keys can be set in new "Settings" tab if not defined in wp-config.php
73
+ * Improvement: Minor tweaks to settings page UI including right aligning tabs and consistent title across Lite and Pro plugins
74
+ * Improvement: cURL version, theme version and parent theme information added to diagnostics
75
+ * Bug fix: Incompatible with plugins that include AWS PHP SDK v3
76
+ * Bug fix: Regenerate Thumbnails v3.0+ does not work with Remove Files From Server option
77
+ * Bug fix: "Warning: count(): Parameter must be an array or an object that implements Countable" error with PHP 7.2
78
+ * Bug fix: Force HTTPS not being applied to non-srcset S3 URLs in pages served over HTTP
79
+ * Bug fix: Content URLs not filtered to S3 URLs if AWS keys not set
80
+ * Bug fix: URL preview can be coerced to display invalid URL
81
+ * Bug fix: Changes to upload made via `as3cf_object_meta` filter are not reflected in amazonS3_info records
82
+ * Bug fix: Settings link not showing in network admin plugins page
83
+ * Bug fix: License in composer.json fails Packagist validation
84
+
85
  = WP Offload S3 Lite 1.2.1 - 2017-11-20 =
86
  * New: Compatibility with HTML Widget
87
  * New: Dismissible admin notice that WP Offload S3 Lite will soon require PHP 5.5+
vendor/Aws2/aws/aws-sdk-php/LICENSE.md ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Apache License
2
+ Version 2.0, January 2004
3
+
4
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
5
+
6
+ ## 1. Definitions.
7
+
8
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1
9
+ through 9 of this document.
10
+
11
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the
12
+ License.
13
+
14
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled
15
+ by, or are under common control with that entity. For the purposes of this definition, "control" means
16
+ (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract
17
+ or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial
18
+ ownership of such entity.
19
+
20
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
21
+
22
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software
23
+ source code, documentation source, and configuration files.
24
+
25
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form,
26
+ including but not limited to compiled object code, generated documentation, and conversions to other media
27
+ types.
28
+
29
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License,
30
+ as indicated by a copyright notice that is included in or attached to the work (an example is provided in the
31
+ Appendix below).
32
+
33
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from)
34
+ the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent,
35
+ as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not
36
+ include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work
37
+ and Derivative Works thereof.
38
+
39
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any
40
+ modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to
41
+ Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to
42
+ submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of
43
+ electronic, verbal, or written communication sent to the Licensor or its representatives, including but not
44
+ limited to communication on electronic mailing lists, source code control systems, and issue tracking systems
45
+ that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but
46
+ excluding communication that is conspicuously marked or otherwise designated in writing by the copyright
47
+ owner as "Not a Contribution."
48
+
49
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been
50
+ received by Licensor and subsequently incorporated within the Work.
51
+
52
+ ## 2. Grant of Copyright License.
53
+
54
+ Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual,
55
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare
56
+ Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such
57
+ Derivative Works in Source or Object form.
58
+
59
+ ## 3. Grant of Patent License.
60
+
61
+ Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual,
62
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent
63
+ license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such
64
+ license applies only to those patent claims licensable by such Contributor that are necessarily infringed by
65
+ their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such
66
+ Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim
67
+ or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work
68
+ constitutes direct or contributory patent infringement, then any patent licenses granted to You under this
69
+ License for that Work shall terminate as of the date such litigation is filed.
70
+
71
+ ## 4. Redistribution.
72
+
73
+ You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without
74
+ modifications, and in Source or Object form, provided that You meet the following conditions:
75
+
76
+ 1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
77
+
78
+ 2. You must cause any modified files to carry prominent notices stating that You changed the files; and
79
+
80
+ 3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent,
81
+ trademark, and attribution notices from the Source form of the Work, excluding those notices that do
82
+ not pertain to any part of the Derivative Works; and
83
+
84
+ 4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that
85
+ You distribute must include a readable copy of the attribution notices contained within such NOTICE
86
+ file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one
87
+ of the following places: within a NOTICE text file distributed as part of the Derivative Works; within
88
+ the Source form or documentation, if provided along with the Derivative Works; or, within a display
89
+ generated by the Derivative Works, if and wherever such third-party notices normally appear. The
90
+ contents of the NOTICE file are for informational purposes only and do not modify the License. You may
91
+ add Your own attribution notices within Derivative Works that You distribute, alongside or as an
92
+ addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be
93
+ construed as modifying the License.
94
+
95
+ You may add Your own copyright statement to Your modifications and may provide additional or different license
96
+ terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative
97
+ Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the
98
+ conditions stated in this License.
99
+
100
+ ## 5. Submission of Contributions.
101
+
102
+ Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by
103
+ You to the Licensor shall be under the terms and conditions of this License, without any additional terms or
104
+ conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate
105
+ license agreement you may have executed with Licensor regarding such Contributions.
106
+
107
+ ## 6. Trademarks.
108
+
109
+ This License does not grant permission to use the trade names, trademarks, service marks, or product names of
110
+ the Licensor, except as required for reasonable and customary use in describing the origin of the Work and
111
+ reproducing the content of the NOTICE file.
112
+
113
+ ## 7. Disclaimer of Warranty.
114
+
115
+ Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor
116
+ provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
117
+ or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT,
118
+ MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the
119
+ appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of
120
+ permissions under this License.
121
+
122
+ ## 8. Limitation of Liability.
123
+
124
+ In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless
125
+ required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any
126
+ Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential
127
+ damages of any character arising as a result of this License or out of the use or inability to use the Work
128
+ (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or
129
+ any and all other commercial damages or losses), even if such Contributor has been advised of the possibility
130
+ of such damages.
131
+
132
+ ## 9. Accepting Warranty or Additional Liability.
133
+
134
+ While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for,
135
+ acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this
136
+ License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole
137
+ responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold
138
+ each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason
139
+ of your accepting any such warranty or additional liability.
140
+
141
+ END OF TERMS AND CONDITIONS
vendor/Aws2/aws/aws-sdk-php/NOTICE.md ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AWS SDK for PHP
2
+
3
+ <http://aws.amazon.com/php>
4
+
5
+ Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License").
8
+ You may not use this file except in compliance with the License.
9
+ A copy of the License is located at
10
+
11
+ <http://aws.amazon.com/apache2.0>
12
+
13
+ or in the "license" file accompanying this file. This file is distributed
14
+ on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
15
+ express or implied. See the License for the specific language governing
16
+ permissions and limitations under the License.
17
+
18
+ # Guzzle
19
+
20
+ <https://github.com/guzzle/guzzle>
21
+
22
+ Copyright (c) 2011 Michael Dowling, https://github.com/mtdowling
23
+
24
+ Permission is hereby granted, free of charge, to any person obtaining a copy
25
+ of this software and associated documentation files (the "Software"), to deal
26
+ in the Software without restriction, including without limitation the rights
27
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
28
+ copies of the Software, and to permit persons to whom the Software is
29
+ furnished to do so, subject to the following conditions:
30
+
31
+ The above copyright notice and this permission notice shall be included in
32
+ all copies or substantial portions of the Software.
33
+
34
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
37
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
38
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
39
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
40
+ THE SOFTWARE.
41
+
42
+ # Symfony
43
+
44
+ <https://github.com/symfony/symfony>
45
+
46
+ Copyright (c) 2004-2012 Fabien Potencier
47
+
48
+ Permission is hereby granted, free of charge, to any person obtaining a copy
49
+ of this software and associated documentation files (the "Software"), to deal
50
+ in the Software without restriction, including without limitation the rights
51
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
52
+ copies of the Software, and to permit persons to whom the Software is furnished
53
+ to do so, subject to the following conditions:
54
+
55
+ The above copyright notice and this permission notice shall be included in all
56
+ copies or substantial portions of the Software.
57
+
58
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
59
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
60
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
61
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
62
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
63
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
64
+ THE SOFTWARE.
65
+
66
+ # Doctrine Common
67
+
68
+ <https://github.com/doctrine/common>
69
+
70
+ Copyright (c) 2006-2012 Doctrine Project
71
+
72
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
73
+ this software and associated documentation files (the "Software"), to deal in
74
+ the Software without restriction, including without limitation the rights to
75
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
76
+ of the Software, and to permit persons to whom the Software is furnished to do
77
+ so, subject to the following conditions:
78
+
79
+ The above copyright notice and this permission notice shall be included in all
80
+ copies or substantial portions of the Software.
81
+
82
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
83
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
84
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
85
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
86
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
87
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
88
+ SOFTWARE.
89
+
90
+ # Monolog
91
+
92
+ <https://github.com/Seldaek/monolog>
93
+
94
+ Copyright (c) Jordi Boggiano
95
+
96
+ Permission is hereby granted, free of charge, to any person obtaining a copy
97
+ of this software and associated documentation files (the "Software"), to deal
98
+ in the Software without restriction, including without limitation the rights
99
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
100
+ copies of the Software, and to permit persons to whom the Software is furnished
101
+ to do so, subject to the following conditions:
102
+
103
+ The above copyright notice and this permission notice shall be included in all
104
+ copies or substantial portions of the Software.
105
+
106
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
107
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
108
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
109
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
110
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
111
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
112
+ THE SOFTWARE.
vendor/Aws2/aws/aws-sdk-php/composer.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "aws\/aws-sdk-php",
3
+ "homepage": "http:\/\/aws.amazon.com\/sdkforphp",
4
+ "description": "AWS SDK for PHP - Use Amazon Web Services in your PHP project",
5
+ "keywords": [
6
+ "aws",
7
+ "amazon",
8
+ "sdk",
9
+ "s3",
10
+ "ec2",
11
+ "dynamodb",
12
+ "cloud",
13
+ "glacier"
14
+ ],
15
+ "type": "library",
16
+ "license": "Apache-2.0",
17
+ "authors": [
18
+ {
19
+ "name": "Amazon Web Services",
20
+ "homepage": "http:\/\/aws.amazon.com"
21
+ }
22
+ ],
23
+ "support": {
24
+ "forum": "https:\/\/forums.aws.amazon.com\/forum.jspa?forumID=80",
25
+ "issues": "https:\/\/github.com\/aws\/aws-sdk-php\/issues"
26
+ },
27
+ "require": {
28
+ "php": ">=5.3.3",
29
+ "guzzle\/guzzle": "~3.7"
30
+ },
31
+ "suggest": {
32
+ "doctrine\/cache": "Adds support for caching of credentials and responses",
33
+ "ext-apc": "Allows service description opcode caching, request and response caching, and credentials caching",
34
+ "ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages",
35
+ "monolog\/monolog": "Adds support for logging HTTP requests and responses",
36
+ "symfony\/yaml": "Eases the ability to write manifests for creating jobs in AWS Import\/Export"
37
+ },
38
+ "require-dev": {
39
+ "ext-openssl": "*",
40
+ "doctrine\/cache": "~1.0",
41
+ "monolog\/monolog": "~1.4",
42
+ "phpunit\/phpunit": "~4.0",
43
+ "phpunit\/phpunit-mock-objects": "2.3.1",
44
+ "symfony\/yaml": "~2.1"
45
+ },
46
+ "autoload": {
47
+ "psr-0": {
48
+ "Aws": "src\/"
49
+ }
50
+ }
51
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Aws.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Builder\ServiceBuilder;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Builder\ServiceBuilderLoader;
22
+ /**
23
+ * Base class for interacting with web service clients
24
+ */
25
+ class Aws extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Builder\ServiceBuilder
26
+ {
27
+ /**
28
+ * @var string Current version of the SDK
29
+ */
30
+ const VERSION = '2.8.31';
31
+ /**
32
+ * Create a new service locator for the AWS SDK
33
+ *
34
+ * You can configure the service locator is four different ways:
35
+ *
36
+ * 1. Use the default configuration file shipped with the SDK that wires class names with service short names and
37
+ * specify global parameters to add to every definition (e.g. key, secret, credentials, etc)
38
+ *
39
+ * 2. Use a custom configuration file that extends the default config and supplies credentials for each service.
40
+ *
41
+ * 3. Use a custom config file that wires services to custom short names for services.
42
+ *
43
+ * 4. If you are on Amazon EC2, you can use the default configuration file and not provide any credentials so that
44
+ * you are using InstanceProfile credentials.
45
+ *
46
+ * @param array|string $config The full path to a .php or .js|.json file, or an associative array of data
47
+ * to use as global parameters to pass to each service.
48
+ * @param array $globalParameters Global parameters to pass to every service as it is instantiated.
49
+ *
50
+ * @return Aws
51
+ */
52
+ public static function factory($config = null, array $globalParameters = array())
53
+ {
54
+ if (!$config) {
55
+ // If nothing is passed in, then use the default configuration file with credentials from the environment
56
+ $config = self::getDefaultServiceDefinition();
57
+ } elseif (is_array($config)) {
58
+ // If an array was passed, then use the default configuration file with parameter overrides
59
+ $globalParameters = $config;
60
+ $config = self::getDefaultServiceDefinition();
61
+ }
62
+ $loader = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Builder\ServiceBuilderLoader();
63
+ $loader->addAlias('_aws', self::getDefaultServiceDefinition())->addAlias('_sdk1', __DIR__ . '/Resources/sdk1-config.php');
64
+ return $loader->load($config, $globalParameters);
65
+ }
66
+ /**
67
+ * Get the full path to the default service builder definition file
68
+ *
69
+ * @return string
70
+ */
71
+ public static function getDefaultServiceDefinition()
72
+ {
73
+ return __DIR__ . '/Resources/aws-config.php';
74
+ }
75
+ /**
76
+ * Returns the configuration for the service builder
77
+ *
78
+ * @return array
79
+ */
80
+ public function getConfig()
81
+ {
82
+ return $this->builderConfig;
83
+ }
84
+ /**
85
+ * Enables the facades for the clients defined in the service builder
86
+ *
87
+ * @param string|null $namespace The namespace that the facades should be mounted to. Defaults to global namespace
88
+ *
89
+ * @return Aws
90
+ * @deprecated "Facades" are being removed in version 3.0 of the SDK.
91
+ */
92
+ public function enableFacades($namespace = null)
93
+ {
94
+ \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade::mountFacades($this, $namespace);
95
+ return $this;
96
+ }
97
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/AbstractClient.php ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Aws;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions as Options;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\TransferException;
24
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\RulesEndpointProvider;
25
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\EndpointSignatureInterface;
26
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureInterface;
27
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureListener;
28
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterClassFactory;
29
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\CompositeWaiterFactory;
30
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterFactoryInterface;
31
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfigFactory;
32
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection;
33
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Exception\CurlException;
34
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\QueryAggregator\DuplicateAggregator;
35
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Client;
36
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\ServiceDescriptionInterface;
37
+ /**
38
+ * Abstract AWS client
39
+ */
40
+ abstract class AbstractClient extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Client implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AwsClientInterface
41
+ {
42
+ /** @var CredentialsInterface AWS credentials */
43
+ protected $credentials;
44
+ /** @var SignatureInterface Signature implementation of the service */
45
+ protected $signature;
46
+ /** @var WaiterFactoryInterface Factory used to create waiter classes */
47
+ protected $waiterFactory;
48
+ /** @var DuplicateAggregator Cached query aggregator*/
49
+ protected $aggregator;
50
+ /**
51
+ * {@inheritdoc}
52
+ */
53
+ public static function getAllEvents()
54
+ {
55
+ return array_merge(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Client::getAllEvents(), array('client.region_changed', 'client.credentials_changed'));
56
+ }
57
+ /**
58
+ * @param CredentialsInterface $credentials AWS credentials
59
+ * @param SignatureInterface $signature Signature implementation
60
+ * @param Collection $config Configuration options
61
+ *
62
+ * @throws InvalidArgumentException if an endpoint provider isn't provided
63
+ */
64
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureInterface $signature, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection $config)
65
+ {
66
+ // Bootstrap with Guzzle
67
+ parent::__construct($config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BASE_URL), $config);
68
+ $this->credentials = $credentials;
69
+ $this->signature = $signature;
70
+ $this->aggregator = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\QueryAggregator\DuplicateAggregator();
71
+ // Make sure the user agent is prefixed by the SDK version
72
+ $this->setUserAgent('aws-sdk-php2/' . \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Aws::VERSION, true);
73
+ // Add the event listener so that requests are signed before they are sent
74
+ $dispatcher = $this->getEventDispatcher();
75
+ $dispatcher->addSubscriber(new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureListener($credentials, $signature));
76
+ if ($backoff = $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BACKOFF)) {
77
+ $dispatcher->addSubscriber($backoff, -255);
78
+ }
79
+ }
80
+ public function __call($method, $args)
81
+ {
82
+ if (substr($method, 0, 3) === 'get' && substr($method, -8) === 'Iterator') {
83
+ // Allow magic method calls for iterators (e.g. $client->get<CommandName>Iterator($params))
84
+ $commandOptions = isset($args[0]) ? $args[0] : null;
85
+ $iteratorOptions = isset($args[1]) ? $args[1] : array();
86
+ return $this->getIterator(substr($method, 3, -8), $commandOptions, $iteratorOptions);
87
+ } elseif (substr($method, 0, 9) == 'waitUntil') {
88
+ // Allow magic method calls for waiters (e.g. $client->waitUntil<WaiterName>($params))
89
+ return $this->waitUntil(substr($method, 9), isset($args[0]) ? $args[0] : array());
90
+ } else {
91
+ return parent::__call(ucfirst($method), $args);
92
+ }
93
+ }
94
+ /**
95
+ * Get an endpoint for a specific region from a service description
96
+ * @deprecated This function will no longer be updated to work with new regions.
97
+ */
98
+ public static function getEndpoint(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\ServiceDescriptionInterface $description, $region, $scheme)
99
+ {
100
+ try {
101
+ $service = $description->getData('endpointPrefix');
102
+ $provider = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\RulesEndpointProvider::fromDefaults();
103
+ $result = $provider(array('service' => $service, 'region' => $region, 'scheme' => $scheme));
104
+ return $result['endpoint'];
105
+ } catch (\InvalidArgumentException $e) {
106
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException($e->getMessage(), 0, $e);
107
+ }
108
+ }
109
+ public function getCredentials()
110
+ {
111
+ return $this->credentials;
112
+ }
113
+ public function setCredentials(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials)
114
+ {
115
+ $formerCredentials = $this->credentials;
116
+ $this->credentials = $credentials;
117
+ // Dispatch an event that the credentials have been changed
118
+ $this->dispatch('client.credentials_changed', array('credentials' => $credentials, 'former_credentials' => $formerCredentials));
119
+ return $this;
120
+ }
121
+ public function getSignature()
122
+ {
123
+ return $this->signature;
124
+ }
125
+ public function getRegions()
126
+ {
127
+ return $this->serviceDescription->getData('regions');
128
+ }
129
+ public function getRegion()
130
+ {
131
+ return $this->getConfig(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::REGION);
132
+ }
133
+ public function setRegion($region)
134
+ {
135
+ $config = $this->getConfig();
136
+ $formerRegion = $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::REGION);
137
+ $global = $this->serviceDescription->getData('globalEndpoint');
138
+ $provider = $config->get('endpoint_provider');
139
+ if (!$provider) {
140
+ throw new \RuntimeException('No endpoint provider configured');
141
+ }
142
+ // Only change the region if the service does not have a global endpoint
143
+ if (!$global || $this->serviceDescription->getData('namespace') === 'S3') {
144
+ $endpoint = call_user_func($provider, array('scheme' => $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SCHEME), 'region' => $region, 'service' => $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SERVICE)));
145
+ $this->setBaseUrl($endpoint['endpoint']);
146
+ $config->set(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BASE_URL, $endpoint['endpoint']);
147
+ $config->set(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::REGION, $region);
148
+ // Update the signature if necessary
149
+ $signature = $this->getSignature();
150
+ if ($signature instanceof EndpointSignatureInterface) {
151
+ /** @var EndpointSignatureInterface $signature */
152
+ $signature->setRegionName($region);
153
+ }
154
+ // Dispatch an event that the region has been changed
155
+ $this->dispatch('client.region_changed', array('region' => $region, 'former_region' => $formerRegion));
156
+ }
157
+ return $this;
158
+ }
159
+ public function waitUntil($waiter, array $input = array())
160
+ {
161
+ $this->getWaiter($waiter, $input)->wait();
162
+ return $this;
163
+ }
164
+ public function getWaiter($waiter, array $input = array())
165
+ {
166
+ return $this->getWaiterFactory()->build($waiter)->setClient($this)->setConfig($input);
167
+ }
168
+ public function setWaiterFactory(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterFactoryInterface $waiterFactory)
169
+ {
170
+ $this->waiterFactory = $waiterFactory;
171
+ return $this;
172
+ }
173
+ public function getWaiterFactory()
174
+ {
175
+ if (!$this->waiterFactory) {
176
+ $clientClass = get_class($this);
177
+ // Use a composite factory that checks for classes first, then config waiters
178
+ $this->waiterFactory = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\CompositeWaiterFactory(array(new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterClassFactory(substr($clientClass, 0, strrpos($clientClass, '\\')) . '\\Waiter')));
179
+ if ($this->getDescription()) {
180
+ $waiterConfig = $this->getDescription()->getData('waiters') ?: array();
181
+ $this->waiterFactory->addFactory(new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfigFactory($waiterConfig));
182
+ }
183
+ }
184
+ return $this->waiterFactory;
185
+ }
186
+ public function getApiVersion()
187
+ {
188
+ return $this->serviceDescription->getApiVersion();
189
+ }
190
+ /**
191
+ * {@inheritdoc}
192
+ * @throws \Aws\Common\Exception\TransferException
193
+ */
194
+ public function send($requests)
195
+ {
196
+ try {
197
+ return parent::send($requests);
198
+ } catch (CurlException $e) {
199
+ $wrapped = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\TransferException($e->getMessage(), null, $e);
200
+ $wrapped->setCurlHandle($e->getCurlHandle())->setCurlInfo($e->getCurlInfo())->setError($e->getError(), $e->getErrorNo())->setRequest($e->getRequest());
201
+ throw $wrapped;
202
+ }
203
+ }
204
+ /**
205
+ * Ensures that the duplicate query string aggregator is used so that
206
+ * query string values are sent over the wire as foo=bar&foo=baz.
207
+ * {@inheritdoc}
208
+ */
209
+ public function createRequest($method = 'GET', $uri = null, $headers = null, $body = null, array $options = array())
210
+ {
211
+ $request = parent::createRequest($method, $uri, $headers, $body, $options);
212
+ $request->getQuery()->setAggregator($this->aggregator);
213
+ return $request;
214
+ }
215
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/AwsClientInterface.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureInterface;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterFactoryInterface;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterInterface;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\ClientInterface;
24
+ /**
25
+ * Interface that all AWS clients implement
26
+ */
27
+ interface AwsClientInterface extends ClientInterface
28
+ {
29
+ /**
30
+ * Returns the AWS credentials associated with the client
31
+ *
32
+ * @return CredentialsInterface
33
+ */
34
+ public function getCredentials();
35
+ /**
36
+ * Sets the credentials object associated with the client
37
+ *
38
+ * @param CredentialsInterface $credentials Credentials object to use
39
+ *
40
+ * @return self
41
+ */
42
+ public function setCredentials(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials);
43
+ /**
44
+ * Returns the signature implementation used with the client
45
+ *
46
+ * @return SignatureInterface
47
+ */
48
+ public function getSignature();
49
+ /**
50
+ * Get a list of available regions and region data
51
+ *
52
+ * @return array
53
+ */
54
+ public function getRegions();
55
+ /**
56
+ * Get the name of the region to which the client is configured to send requests
57
+ *
58
+ * @return string
59
+ */
60
+ public function getRegion();
61
+ /**
62
+ * Change the region to which the client is configured to send requests
63
+ *
64
+ * @param string $region Name of the region
65
+ *
66
+ * @return self
67
+ */
68
+ public function setRegion($region);
69
+ /**
70
+ * Get the waiter factory being used by the client
71
+ *
72
+ * @return WaiterFactoryInterface
73
+ */
74
+ public function getWaiterFactory();
75
+ /**
76
+ * Set the waiter factory to use with the client
77
+ *
78
+ * @param WaiterFactoryInterface $waiterFactory Factory used to create waiters
79
+ *
80
+ * @return self
81
+ */
82
+ public function setWaiterFactory(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterFactoryInterface $waiterFactory);
83
+ /**
84
+ * Wait until a resource is available or an associated waiter returns true
85
+ *
86
+ * @param string $waiter Name of the waiter
87
+ * @param array $input Values used as input for the underlying operation and to control the waiter
88
+ *
89
+ * @return self
90
+ */
91
+ public function waitUntil($waiter, array $input = array());
92
+ /**
93
+ * Get a named waiter object
94
+ *
95
+ * @param string $waiter Name of the waiter
96
+ * @param array $input Values used as input for the underlying operation and to control the waiter
97
+ *
98
+ * @return WaiterInterface
99
+ */
100
+ public function getWaiter($waiter, array $input = array());
101
+ /**
102
+ * Get the API version of the client (e.g. 2006-03-01)
103
+ *
104
+ * @return string
105
+ */
106
+ public function getApiVersion();
107
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/ClientBuilder.php ADDED
@@ -0,0 +1,429 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\Credentials;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\NullCredentials;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions as Options;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\ExceptionListener;
24
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
25
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\NamespaceExceptionFactory;
26
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\DefaultXmlExceptionParser;
27
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\ExceptionParserInterface;
28
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Iterator\AwsResourceIteratorFactory;
29
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\RulesEndpointProvider;
30
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\EndpointSignatureInterface;
31
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureInterface;
32
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureV2;
33
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureV3Https;
34
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureV4;
35
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection;
36
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffPlugin;
37
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\CurlBackoffStrategy;
38
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\ExponentialBackoffStrategy;
39
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\HttpBackoffStrategy;
40
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\TruncatedBackoffStrategy;
41
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\ServiceDescription;
42
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\ResourceIteratorClassFactory;
43
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Log\LogAdapterInterface;
44
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Log\ClosureLogAdapter;
45
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffLogger;
46
+ /**
47
+ * Builder for creating AWS service clients
48
+ */
49
+ class ClientBuilder
50
+ {
51
+ /**
52
+ * @var array Default client config
53
+ */
54
+ protected static $commonConfigDefaults = array('scheme' => 'https');
55
+ /**
56
+ * @var array Default client requirements
57
+ */
58
+ protected static $commonConfigRequirements = array(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SERVICE_DESCRIPTION);
59
+ /**
60
+ * @var string The namespace of the client
61
+ */
62
+ protected $clientNamespace;
63
+ /**
64
+ * @var array The config options
65
+ */
66
+ protected $config = array();
67
+ /**
68
+ * @var array The config defaults
69
+ */
70
+ protected $configDefaults = array();
71
+ /**
72
+ * @var array The config requirements
73
+ */
74
+ protected $configRequirements = array();
75
+ /**
76
+ * @var ExceptionParserInterface The Parser interface for the client
77
+ */
78
+ protected $exceptionParser;
79
+ /**
80
+ * @var array Array of configuration data for iterators available for the client
81
+ */
82
+ protected $iteratorsConfig = array();
83
+ /** @var string */
84
+ private $clientClass;
85
+ /** @var string */
86
+ private $serviceName;
87
+ /**
88
+ * Factory method for creating the client builder
89
+ *
90
+ * @param string $namespace The namespace of the client
91
+ *
92
+ * @return ClientBuilder
93
+ */
94
+ public static function factory($namespace = null)
95
+ {
96
+ return new static($namespace);
97
+ }
98
+ /**
99
+ * Constructs a client builder
100
+ *
101
+ * @param string $namespace The namespace of the client
102
+ */
103
+ public function __construct($namespace = null)
104
+ {
105
+ $this->clientNamespace = $namespace;
106
+ // Determine service and class name
107
+ $this->clientClass = 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Common\\Client\\DefaultClient';
108
+ if ($this->clientNamespace) {
109
+ $this->serviceName = substr($this->clientNamespace, strrpos($this->clientNamespace, '\\') + 1);
110
+ $this->clientClass = $this->clientNamespace . '\\' . $this->serviceName . 'Client';
111
+ }
112
+ }
113
+ /**
114
+ * Sets the config options
115
+ *
116
+ * @param array|Collection $config The config options
117
+ *
118
+ * @return ClientBuilder
119
+ */
120
+ public function setConfig($config)
121
+ {
122
+ $this->config = $this->processArray($config);
123
+ return $this;
124
+ }
125
+ /**
126
+ * Sets the config options' defaults
127
+ *
128
+ * @param array|Collection $defaults The default values
129
+ *
130
+ * @return ClientBuilder
131
+ */
132
+ public function setConfigDefaults($defaults)
133
+ {
134
+ $this->configDefaults = $this->processArray($defaults);
135
+ return $this;
136
+ }
137
+ /**
138
+ * Sets the required config options
139
+ *
140
+ * @param array|Collection $required The required config options
141
+ *
142
+ * @return ClientBuilder
143
+ */
144
+ public function setConfigRequirements($required)
145
+ {
146
+ $this->configRequirements = $this->processArray($required);
147
+ return $this;
148
+ }
149
+ /**
150
+ * Sets the exception parser. If one is not provided the builder will use
151
+ * the default XML exception parser.
152
+ *
153
+ * @param ExceptionParserInterface $parser The exception parser
154
+ *
155
+ * @return ClientBuilder
156
+ */
157
+ public function setExceptionParser(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\ExceptionParserInterface $parser)
158
+ {
159
+ $this->exceptionParser = $parser;
160
+ return $this;
161
+ }
162
+ /**
163
+ * Set the configuration for the client's iterators
164
+ *
165
+ * @param array $config Configuration data for client's iterators
166
+ *
167
+ * @return ClientBuilder
168
+ */
169
+ public function setIteratorsConfig(array $config)
170
+ {
171
+ $this->iteratorsConfig = $config;
172
+ return $this;
173
+ }
174
+ /**
175
+ * Performs the building logic using all of the parameters that have been
176
+ * set and falling back to default values. Returns an instantiate service
177
+ * client with credentials prepared and plugins attached.
178
+ *
179
+ * @return AwsClientInterface
180
+ * @throws InvalidArgumentException
181
+ */
182
+ public function build()
183
+ {
184
+ // Resolve configuration
185
+ $config = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection::fromConfig($this->config, array_merge(self::$commonConfigDefaults, $this->configDefaults), self::$commonConfigRequirements + $this->configRequirements);
186
+ if ($config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::VERSION] === 'latest') {
187
+ $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::VERSION] = constant("{$this->clientClass}::LATEST_API_VERSION");
188
+ }
189
+ if (!isset($config['endpoint_provider'])) {
190
+ $config['endpoint_provider'] = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\RulesEndpointProvider::fromDefaults();
191
+ }
192
+ // Resolve the endpoint, signature, and credentials
193
+ $description = $this->updateConfigFromDescription($config);
194
+ $signature = $this->getSignature($description, $config);
195
+ $credentials = $this->getCredentials($config);
196
+ $this->extractHttpConfig($config);
197
+ // Resolve exception parser
198
+ if (!$this->exceptionParser) {
199
+ $this->exceptionParser = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\DefaultXmlExceptionParser();
200
+ }
201
+ // Resolve backoff strategy
202
+ $backoff = $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BACKOFF);
203
+ if ($backoff === null) {
204
+ $retries = isset($config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BACKOFF_RETRIES]) ? $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BACKOFF_RETRIES] : 3;
205
+ $backoff = $this->createDefaultBackoff($retries);
206
+ $config->set(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BACKOFF, $backoff);
207
+ }
208
+ if ($backoff) {
209
+ $this->addBackoffLogger($backoff, $config);
210
+ }
211
+ /** @var AwsClientInterface $client */
212
+ $client = new $this->clientClass($credentials, $signature, $config);
213
+ $client->setDescription($description);
214
+ // Add exception marshaling so that more descriptive exception are thrown
215
+ if ($this->clientNamespace) {
216
+ $exceptionFactory = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\NamespaceExceptionFactory($this->exceptionParser, "{$this->clientNamespace}\\Exception", "{$this->clientNamespace}\\Exception\\{$this->serviceName}Exception");
217
+ $client->addSubscriber(new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\ExceptionListener($exceptionFactory));
218
+ }
219
+ // Add the UserAgentPlugin to append to the User-Agent header of requests
220
+ $client->addSubscriber(new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\UserAgentListener());
221
+ // Filters used for the cache plugin
222
+ $client->getConfig()->set('params.cache.key_filter', 'header=date,x-amz-date,x-amz-security-token,x-amzn-authorization');
223
+ // Set the iterator resource factory based on the provided iterators config
224
+ $client->setResourceIteratorFactory(new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Iterator\AwsResourceIteratorFactory($this->iteratorsConfig, new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\ResourceIteratorClassFactory($this->clientNamespace . '\\Iterator')));
225
+ // Disable parameter validation if needed
226
+ if ($config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::VALIDATION) === false) {
227
+ $params = $config->get('command.params') ?: array();
228
+ $params['command.disable_validation'] = true;
229
+ $config->set('command.params', $params);
230
+ }
231
+ return $client;
232
+ }
233
+ /**
234
+ * Add backoff logging to the backoff plugin if needed
235
+ *
236
+ * @param BackoffPlugin $plugin Backoff plugin
237
+ * @param Collection $config Configuration settings
238
+ *
239
+ * @throws InvalidArgumentException
240
+ */
241
+ protected function addBackoffLogger(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffPlugin $plugin, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection $config)
242
+ {
243
+ // The log option can be set to `debug` or an instance of a LogAdapterInterface
244
+ if ($logger = $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BACKOFF_LOGGER)) {
245
+ $format = $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BACKOFF_LOGGER_TEMPLATE);
246
+ if ($logger === 'debug') {
247
+ $logger = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Log\ClosureLogAdapter(function ($message) {
248
+ trigger_error($message . "\n");
249
+ });
250
+ } elseif (!$logger instanceof LogAdapterInterface) {
251
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BACKOFF_LOGGER . ' must be set to `debug` or an instance of ' . 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Guzzle\\Common\\Log\\LogAdapterInterface');
252
+ }
253
+ // Create the plugin responsible for logging exponential backoff retries
254
+ $logPlugin = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffLogger($logger);
255
+ // You can specify a custom format or use the default
256
+ if ($format) {
257
+ $logPlugin->setTemplate($format);
258
+ }
259
+ $plugin->addSubscriber($logPlugin);
260
+ }
261
+ }
262
+ /**
263
+ * Ensures that an array (e.g. for config data) is actually in array form
264
+ *
265
+ * @param array|Collection $array The array data
266
+ *
267
+ * @return array
268
+ * @throws InvalidArgumentException if the arg is not an array or Collection
269
+ */
270
+ protected function processArray($array)
271
+ {
272
+ if ($array instanceof Collection) {
273
+ $array = $array->getAll();
274
+ }
275
+ if (!is_array($array)) {
276
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('The config must be provided as an array or Collection.');
277
+ }
278
+ return $array;
279
+ }
280
+ /**
281
+ * Update a configuration object from a service description
282
+ *
283
+ * @param Collection $config Config to update
284
+ *
285
+ * @return ServiceDescription
286
+ * @throws InvalidArgumentException
287
+ */
288
+ protected function updateConfigFromDescription(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection $config)
289
+ {
290
+ $description = $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SERVICE_DESCRIPTION);
291
+ if (!$description instanceof ServiceDescription) {
292
+ // Inject the version into the sprintf template if it is a string
293
+ if (is_string($description)) {
294
+ $description = sprintf($description, $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::VERSION));
295
+ }
296
+ $description = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\ServiceDescription::factory($description);
297
+ $config->set(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SERVICE_DESCRIPTION, $description);
298
+ }
299
+ if (!$config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SERVICE)) {
300
+ $config->set(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SERVICE, $description->getData('endpointPrefix'));
301
+ }
302
+ if ($iterators = $description->getData('iterators')) {
303
+ $this->setIteratorsConfig($iterators);
304
+ }
305
+ $this->handleRegion($config);
306
+ $this->handleEndpoint($config);
307
+ return $description;
308
+ }
309
+ /**
310
+ * Return an appropriate signature object for a a client based on the
311
+ * "signature" configuration setting, or the default signature specified in
312
+ * a service description. The signature can be set to a valid signature
313
+ * version identifier string or an instance of Aws\Common\Signature\SignatureInterface.
314
+ *
315
+ * @param ServiceDescription $description Description that holds a signature option
316
+ * @param Collection $config Configuration options
317
+ *
318
+ * @return SignatureInterface
319
+ * @throws InvalidArgumentException
320
+ */
321
+ protected function getSignature(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\ServiceDescription $description, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection $config)
322
+ {
323
+ // If a custom signature has not been provided, then use the default
324
+ // signature setting specified in the service description.
325
+ $signature = $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SIGNATURE) ?: $description->getData('signatureVersion');
326
+ if (is_string($signature)) {
327
+ if ($signature == 'v4') {
328
+ $signature = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureV4();
329
+ } elseif ($signature == 'v2') {
330
+ $signature = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureV2();
331
+ } elseif ($signature == 'v3https') {
332
+ $signature = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureV3Https();
333
+ } else {
334
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException("Invalid signature type: {$signature}");
335
+ }
336
+ } elseif (!$signature instanceof SignatureInterface) {
337
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('The provided signature is not ' . 'a signature version string or an instance of ' . 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Common\\Signature\\SignatureInterface');
338
+ }
339
+ // Allow a custom service name or region value to be provided
340
+ if ($signature instanceof EndpointSignatureInterface) {
341
+ // Determine the service name to use when signing
342
+ $signature->setServiceName($config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SIGNATURE_SERVICE) ?: $description->getData('signingName') ?: $description->getData('endpointPrefix'));
343
+ // Determine the region to use when signing requests
344
+ $signature->setRegionName($config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SIGNATURE_REGION) ?: $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::REGION));
345
+ }
346
+ return $signature;
347
+ }
348
+ protected function getCredentials(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection $config)
349
+ {
350
+ $credentials = $config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::CREDENTIALS);
351
+ if (is_array($credentials)) {
352
+ $credentials = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\Credentials::factory($credentials);
353
+ } elseif ($credentials === false) {
354
+ $credentials = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\NullCredentials();
355
+ } elseif (!$credentials instanceof CredentialsInterface) {
356
+ $credentials = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\Credentials::factory($config);
357
+ }
358
+ return $credentials;
359
+ }
360
+ private function handleRegion(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection $config)
361
+ {
362
+ // Make sure a valid region is set
363
+ $region = $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::REGION];
364
+ $description = $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SERVICE_DESCRIPTION];
365
+ $global = $description->getData('globalEndpoint');
366
+ if (!$global && !$region) {
367
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('A region is required when using ' . $description->getData('serviceFullName'));
368
+ } elseif ($global && !$region) {
369
+ $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::REGION] = 'us-east-1';
370
+ }
371
+ }
372
+ private function handleEndpoint(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection $config)
373
+ {
374
+ // Alias "endpoint" with "base_url" for forwards compatibility.
375
+ if ($config['endpoint']) {
376
+ $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BASE_URL] = $config['endpoint'];
377
+ return;
378
+ }
379
+ if ($config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BASE_URL]) {
380
+ return;
381
+ }
382
+ $endpoint = call_user_func($config['endpoint_provider'], array('scheme' => $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SCHEME], 'region' => $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::REGION], 'service' => $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SERVICE]));
383
+ $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BASE_URL] = $endpoint['endpoint'];
384
+ // Set a signature if one was not explicitly provided.
385
+ if (!$config->hasKey(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SIGNATURE) && isset($endpoint['signatureVersion'])) {
386
+ $config->set(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SIGNATURE, $endpoint['signatureVersion']);
387
+ }
388
+ // The the signing region if endpoint rule specifies one.
389
+ if (isset($endpoint['credentialScope'])) {
390
+ $scope = $endpoint['credentialScope'];
391
+ if (isset($scope['region'])) {
392
+ $config->set(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SIGNATURE_REGION, $scope['region']);
393
+ }
394
+ }
395
+ }
396
+ private function createDefaultBackoff($retries = 3)
397
+ {
398
+ return new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffPlugin(
399
+ // Retry failed requests up to 3 times if it is determined that the request can be retried
400
+ new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\TruncatedBackoffStrategy(
401
+ $retries,
402
+ // Retry failed requests with 400-level responses due to throttling
403
+ new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\ThrottlingErrorChecker(
404
+ $this->exceptionParser,
405
+ // Retry failed requests due to transient network or cURL problems
406
+ new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\CurlBackoffStrategy(
407
+ null,
408
+ // Retry failed requests with 500-level responses
409
+ new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\HttpBackoffStrategy(
410
+ array(500, 503, 509),
411
+ // Retry requests that failed due to expired credentials
412
+ new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\ExpiredCredentialsChecker($this->exceptionParser, new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\ExponentialBackoffStrategy())
413
+ )
414
+ )
415
+ )
416
+ )
417
+ );
418
+ }
419
+ private function extractHttpConfig(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection $config)
420
+ {
421
+ $http = $config['http'];
422
+ if (!is_array($http)) {
423
+ return;
424
+ }
425
+ if (isset($http['verify'])) {
426
+ $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SSL_CERT] = $http['verify'];
427
+ }
428
+ }
429
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/DefaultClient.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions as Options;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection;
21
+ /**
22
+ * Generic client for interacting with an AWS service
23
+ */
24
+ class DefaultClient extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AbstractClient
25
+ {
26
+ /**
27
+ * Factory method to create a default client using an array of configuration options.
28
+ *
29
+ * The following array keys and values are available options:
30
+ *
31
+ * Credential options ((`key`, `secret`, and optional `token`) OR `credentials` is required):
32
+ *
33
+ * - key: AWS Access Key ID
34
+ * - secret: AWS secret access key
35
+ * - credentials: You can optionally provide a custom `Aws\Common\Credentials\CredentialsInterface` object
36
+ * - token: Custom AWS security token to use with request authentication. Please note that not all services accept temporary credentials. See http://docs.aws.amazon.com/STS/latest/UsingSTS/UsingTokens.html
37
+ * - token.ttd: UNIX timestamp for when the custom credentials expire
38
+ * - credentials.cache.key: Optional custom cache key to use with the credentials
39
+ * - credentials.client: Pass this option to specify a custom `Guzzle\Http\ClientInterface` to use if your credentials require a HTTP request (e.g. RefreshableInstanceProfileCredentials)
40
+ *
41
+ * Region and endpoint options (Some services do not require a region while others do. Check the service specific user guide documentation for details):
42
+ *
43
+ * - region: Region name (e.g. 'us-east-1', 'us-west-1', 'us-west-2', 'eu-west-1', etc...)
44
+ * - scheme: URI Scheme of the base URL (e.g. 'https', 'http') used when endpoint is not supplied
45
+ * - endpoint: Allows you to specify a custom endpoint instead of building one from the region and scheme
46
+ *
47
+ * Generic client options:
48
+ *
49
+ * - signature: Overrides the signature used by the client. Clients will always choose an appropriate default signature. However, it can be useful to override this with a custom setting. This can be set to "v4", "v3https", "v2" or an instance of Aws\Common\Signature\SignatureInterface.
50
+ * - ssl.certificate_authority: Set to true to use the bundled CA cert or pass the full path to an SSL certificate bundle
51
+ * - curl.options: Associative of CURLOPT_* cURL options to add to each request
52
+ * - client.backoff.logger: `Guzzle\Log\LogAdapterInterface` object used to log backoff retries. Use 'debug' to emit PHP warnings when a retry is issued.
53
+ * - client.backoff.logger.template: Optional template to use for exponential backoff log messages. See `Guzzle\Plugin\Backoff\BackoffLogger` for formatting information.
54
+ *
55
+ * @param array|Collection $config Client configuration data
56
+ *
57
+ * @return self
58
+ */
59
+ public static function factory($config = array())
60
+ {
61
+ return \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\ClientBuilder::factory()->setConfig($config)->setConfigDefaults(array(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SCHEME => 'https'))->build();
62
+ }
63
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/ExpiredCredentialsChecker.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\AbstractRefreshableCredentials;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AwsClientInterface;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\ExceptionParserInterface;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Exception\HttpException;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
24
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response;
25
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffStrategyInterface;
26
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\AbstractBackoffStrategy;
27
+ /**
28
+ * Backoff logic that handles retrying requests when credentials expire
29
+ */
30
+ class ExpiredCredentialsChecker extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\AbstractBackoffStrategy
31
+ {
32
+ /**
33
+ * @var array Array of known retrying exception codes
34
+ */
35
+ protected $retryable = array('RequestExpired' => true, 'ExpiredTokenException' => true, 'ExpiredToken' => true);
36
+ /**
37
+ * @var ExceptionParserInterface Exception parser used to parse exception responses
38
+ */
39
+ protected $exceptionParser;
40
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\ExceptionParserInterface $exceptionParser, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffStrategyInterface $next = null)
41
+ {
42
+ $this->exceptionParser = $exceptionParser;
43
+ $this->next = $next;
44
+ }
45
+ public function makesDecision()
46
+ {
47
+ return true;
48
+ }
49
+ protected function getDelay($retries, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response $response = null, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Exception\HttpException $e = null)
50
+ {
51
+ if ($response && $response->isClientError()) {
52
+ $parts = $this->exceptionParser->parse($request, $response);
53
+ if (!isset($this->retryable[$parts['code']]) || !$request->getClient()) {
54
+ return null;
55
+ }
56
+ /** @var AwsClientInterface $client */
57
+ $client = $request->getClient();
58
+ // Only retry if the credentials can be refreshed
59
+ if (!$client->getCredentials() instanceof AbstractRefreshableCredentials) {
60
+ return null;
61
+ }
62
+ // Resign the request using new credentials
63
+ $client->getSignature()->signRequest($request, $client->getCredentials()->setExpiration(-1));
64
+ // Retry immediately with no delay
65
+ return 0;
66
+ }
67
+ }
68
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/ThrottlingErrorChecker.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\ExceptionParserInterface;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Exception\HttpException;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffStrategyInterface;
24
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\AbstractBackoffStrategy;
25
+ /**
26
+ * Backoff logic that handles throttling exceptions from services
27
+ */
28
+ class ThrottlingErrorChecker extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\AbstractBackoffStrategy
29
+ {
30
+ /** @var array Whitelist of exception codes (as indexes) that indicate throttling */
31
+ protected static $throttlingExceptions = array('RequestLimitExceeded' => true, 'Throttling' => true, 'ThrottlingException' => true, 'ProvisionedThroughputExceededException' => true, 'RequestThrottled' => true);
32
+ /**
33
+ * @var ExceptionParserInterface Exception parser used to parse exception responses
34
+ */
35
+ protected $exceptionParser;
36
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\ExceptionParserInterface $exceptionParser, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffStrategyInterface $next = null)
37
+ {
38
+ $this->exceptionParser = $exceptionParser;
39
+ if ($next) {
40
+ $this->setNext($next);
41
+ }
42
+ }
43
+ /**
44
+ * {@inheritdoc}
45
+ */
46
+ public function makesDecision()
47
+ {
48
+ return true;
49
+ }
50
+ /**
51
+ * {@inheritdoc}
52
+ */
53
+ protected function getDelay($retries, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response $response = null, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Exception\HttpException $e = null)
54
+ {
55
+ if ($response && $response->isClientError()) {
56
+ $parts = $this->exceptionParser->parse($request, $response);
57
+ return isset(self::$throttlingExceptions[$parts['code']]) ? true : null;
58
+ }
59
+ }
60
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/UploadBodyListener.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBody;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\AbstractCommand as Command;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Symfony\Component\EventDispatcher\EventSubscriberInterface;
24
+ /**
25
+ * Prepares the body parameter of a command such that the parameter is more flexible (e.g. accepts file handles) with
26
+ * the value it accepts but converts it to the correct format for the command. Also looks for a "Filename" parameter.
27
+ */
28
+ class UploadBodyListener implements \DeliciousBrains\WP_Offload_S3\Aws2\Symfony\Component\EventDispatcher\EventSubscriberInterface
29
+ {
30
+ /**
31
+ * @var array The names of the commands of which to modify the body parameter
32
+ */
33
+ protected $commands;
34
+ /**
35
+ * @var string The key for the upload body parameter
36
+ */
37
+ protected $bodyParameter;
38
+ /**
39
+ * @var string The key for the source file parameter
40
+ */
41
+ protected $sourceParameter;
42
+ /**
43
+ * @param array $commands The commands to modify
44
+ * @param string $bodyParameter The key for the body parameter
45
+ * @param string $sourceParameter The key for the source file parameter
46
+ */
47
+ public function __construct(array $commands, $bodyParameter = 'Body', $sourceParameter = 'SourceFile')
48
+ {
49
+ $this->commands = $commands;
50
+ $this->bodyParameter = (string) $bodyParameter;
51
+ $this->sourceParameter = (string) $sourceParameter;
52
+ }
53
+ /**
54
+ * {@inheritdoc}
55
+ */
56
+ public static function getSubscribedEvents()
57
+ {
58
+ return array('command.before_prepare' => array('onCommandBeforePrepare'));
59
+ }
60
+ /**
61
+ * Converts filenames and file handles into EntityBody objects before the command is validated
62
+ *
63
+ * @param Event $event Event emitted
64
+ * @throws InvalidArgumentException
65
+ */
66
+ public function onCommandBeforePrepare(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event $event)
67
+ {
68
+ /** @var Command $command */
69
+ $command = $event['command'];
70
+ if (in_array($command->getName(), $this->commands)) {
71
+ // Get the interesting parameters
72
+ $source = $command->get($this->sourceParameter);
73
+ $body = $command->get($this->bodyParameter);
74
+ // If a file path is passed in then get the file handle
75
+ if (is_string($source) && file_exists($source)) {
76
+ $body = fopen($source, 'r');
77
+ }
78
+ // Prepare the body parameter and remove the source file parameter
79
+ if (null !== $body) {
80
+ $command->remove($this->sourceParameter);
81
+ $command->set($this->bodyParameter, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBody::factory($body));
82
+ } else {
83
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException("You must specify a non-null value for the {$this->bodyParameter} or {$this->sourceParameter} parameters.");
84
+ }
85
+ }
86
+ }
87
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Client/UserAgentListener.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Symfony\Component\EventDispatcher\EventSubscriberInterface;
21
+ /**
22
+ * Listener used to append strings to the User-Agent header of a request based
23
+ * on the `ua.append` option. `ua.append` can contain a string or array of values.
24
+ */
25
+ class UserAgentListener implements \DeliciousBrains\WP_Offload_S3\Aws2\Symfony\Component\EventDispatcher\EventSubscriberInterface
26
+ {
27
+ /**
28
+ * @var string Option used to store User-Agent modifiers
29
+ */
30
+ const OPTION = 'ua.append';
31
+ /**
32
+ * {@inheritdoc}
33
+ */
34
+ public static function getSubscribedEvents()
35
+ {
36
+ return array('command.before_send' => 'onBeforeSend');
37
+ }
38
+ /**
39
+ * Adds strings to the User-Agent header using the `ua.append` parameter of a command
40
+ *
41
+ * @param Event $event Event emitted
42
+ */
43
+ public function onBeforeSend(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event $event)
44
+ {
45
+ $command = $event['command'];
46
+ if ($userAgentAppends = $command->get(self::OPTION)) {
47
+ $request = $command->getRequest();
48
+ $userAgent = (string) $request->getHeader('User-Agent');
49
+ foreach ((array) $userAgentAppends as $append) {
50
+ $append = ' ' . $append;
51
+ if (strpos($userAgent, $append) === false) {
52
+ $userAgent .= $append;
53
+ }
54
+ }
55
+ $request->setHeader('User-Agent', $userAgent);
56
+ }
57
+ }
58
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Command/AwsQueryVisitor.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Command;
4
+
5
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
6
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\Parameter;
7
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface;
8
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\LocationVisitor\Request\AbstractRequestVisitor;
9
+ /**
10
+ * Location visitor used to serialize AWS query parameters (e.g. EC2, SES, SNS, SQS, etc) as POST fields
11
+ */
12
+ class AwsQueryVisitor extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\LocationVisitor\Request\AbstractRequestVisitor
13
+ {
14
+ private $fqname;
15
+ public function visit(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface $command, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\Parameter $param, $value)
16
+ {
17
+ $this->fqname = $command->getName();
18
+ $query = array();
19
+ $this->customResolver($value, $param, $query, $param->getWireName());
20
+ $request->addPostFields($query);
21
+ }
22
+ /**
23
+ * Map nested parameters into the location_key based parameters
24
+ *
25
+ * @param array $value Value to map
26
+ * @param Parameter $param Parameter that holds information about the current key
27
+ * @param array $query Built up query string values
28
+ * @param string $prefix String to prepend to sub query values
29
+ */
30
+ protected function customResolver($value, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\Parameter $param, array &$query, $prefix = '')
31
+ {
32
+ switch ($param->getType()) {
33
+ case 'object':
34
+ $this->resolveObject($param, $value, $prefix, $query);
35
+ break;
36
+ case 'array':
37
+ $this->resolveArray($param, $value, $prefix, $query);
38
+ break;
39
+ default:
40
+ $query[$prefix] = $param->filter($value);
41
+ }
42
+ }
43
+ /**
44
+ * Custom handling for objects
45
+ *
46
+ * @param Parameter $param Parameter for the object
47
+ * @param array $value Value that is set for this parameter
48
+ * @param string $prefix Prefix for the resulting key
49
+ * @param array $query Query string array passed by reference
50
+ */
51
+ protected function resolveObject(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\Parameter $param, array $value, $prefix, array &$query)
52
+ {
53
+ // Maps are implemented using additional properties
54
+ $hasAdditionalProperties = $param->getAdditionalProperties() instanceof Parameter;
55
+ $additionalPropertyCount = 0;
56
+ foreach ($value as $name => $v) {
57
+ if ($subParam = $param->getProperty($name)) {
58
+ // if the parameter was found by name as a regular property
59
+ $key = $prefix . '.' . $subParam->getWireName();
60
+ $this->customResolver($v, $subParam, $query, $key);
61
+ } elseif ($hasAdditionalProperties) {
62
+ // Handle map cases like &Attribute.1.Name=<name>&Attribute.1.Value=<value>
63
+ $additionalPropertyCount++;
64
+ $data = $param->getData();
65
+ $keyName = isset($data['keyName']) ? $data['keyName'] : 'key';
66
+ $valueName = isset($data['valueName']) ? $data['valueName'] : 'value';
67
+ $query["{$prefix}.{$additionalPropertyCount}.{$keyName}"] = $name;
68
+ $newPrefix = "{$prefix}.{$additionalPropertyCount}.{$valueName}";
69
+ if (is_array($v)) {
70
+ $this->customResolver($v, $param->getAdditionalProperties(), $query, $newPrefix);
71
+ } else {
72
+ $query[$newPrefix] = $param->filter($v);
73
+ }
74
+ }
75
+ }
76
+ }
77
+ /**
78
+ * Custom handling for arrays
79
+ *
80
+ * @param Parameter $param Parameter for the object
81
+ * @param array $value Value that is set for this parameter
82
+ * @param string $prefix Prefix for the resulting key
83
+ * @param array $query Query string array passed by reference
84
+ */
85
+ protected function resolveArray(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\Parameter $param, array $value, $prefix, array &$query)
86
+ {
87
+ static $serializeEmpty = array('SetLoadBalancerPoliciesForBackendServer' => 1, 'SetLoadBalancerPoliciesOfListener' => 1, 'UpdateStack' => 1);
88
+ // For BC, serialize empty lists for specific operations
89
+ if (!$value) {
90
+ if (isset($serializeEmpty[$this->fqname])) {
91
+ if (substr($prefix, -7) === '.member') {
92
+ $prefix = substr($prefix, 0, -7);
93
+ }
94
+ $query[$prefix] = '';
95
+ }
96
+ return;
97
+ }
98
+ $offset = $param->getData('offset') ?: 1;
99
+ foreach ($value as $index => $v) {
100
+ $index += $offset;
101
+ if (is_array($v) && ($items = $param->getItems())) {
102
+ $this->customResolver($v, $items, $query, $prefix . '.' . $index);
103
+ } else {
104
+ $query[$prefix . '.' . $index] = $param->filter($v);
105
+ }
106
+ }
107
+ }
108
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Command/JsonCommand.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Command;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\OperationCommand;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Curl\CurlHandle;
21
+ /**
22
+ * Adds AWS JSON body functionality to dynamically generated HTTP requests
23
+ */
24
+ class JsonCommand extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\OperationCommand
25
+ {
26
+ /**
27
+ * {@inheritdoc}
28
+ */
29
+ protected function build()
30
+ {
31
+ parent::build();
32
+ // Ensure that the body of the request ALWAYS includes some JSON. By default, this is an empty object.
33
+ if (!$this->request->getBody()) {
34
+ $this->request->setBody('{}');
35
+ }
36
+ // Never send the Expect header when interacting with a JSON query service
37
+ $this->request->removeHeader('Expect');
38
+ // Always send JSON requests as a raw string rather than using streams to avoid issues with
39
+ // cURL error code 65: "necessary data rewind wasn't possible".
40
+ // This could be removed after PHP addresses https://bugs.php.net/bug.php?id=47204
41
+ $this->request->getCurlOptions()->set(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Curl\CurlHandle::BODY_AS_STRING, true);
42
+ }
43
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Command/QueryCommand.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Command;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\OperationCommand;
20
+ /**
21
+ * Adds AWS Query service serialization
22
+ */
23
+ class QueryCommand extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\OperationCommand
24
+ {
25
+ /**
26
+ * @var AwsQueryVisitor
27
+ */
28
+ protected static $queryVisitor;
29
+ /**
30
+ * @var XmlResponseLocationVisitor
31
+ */
32
+ protected static $xmlVisitor;
33
+ /**
34
+ * Register the aws.query visitor
35
+ */
36
+ protected function init()
37
+ {
38
+ // @codeCoverageIgnoreStart
39
+ if (!self::$queryVisitor) {
40
+ self::$queryVisitor = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Command\AwsQueryVisitor();
41
+ }
42
+ if (!self::$xmlVisitor) {
43
+ self::$xmlVisitor = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Command\XmlResponseLocationVisitor();
44
+ }
45
+ // @codeCoverageIgnoreEnd
46
+ $this->getRequestSerializer()->addVisitor('aws.query', self::$queryVisitor);
47
+ $this->getResponseParser()->addVisitor('xml', self::$xmlVisitor);
48
+ }
49
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Command/XmlResponseLocationVisitor.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Command;
4
+
5
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\Operation;
6
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface;
7
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response;
8
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\Parameter;
9
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\LocationVisitor\Response\XmlVisitor;
10
+ /**
11
+ * Class used for custom AWS XML response parsing of query services
12
+ */
13
+ class XmlResponseLocationVisitor extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\LocationVisitor\Response\XmlVisitor
14
+ {
15
+ /**
16
+ * {@inheritdoc}
17
+ */
18
+ public function before(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface $command, array &$result)
19
+ {
20
+ parent::before($command, $result);
21
+ // Unwrapped wrapped responses
22
+ $operation = $command->getOperation();
23
+ if ($operation->getServiceDescription()->getData('resultWrapped')) {
24
+ $wrappingNode = $operation->getName() . 'Result';
25
+ if (isset($result[$wrappingNode])) {
26
+ $result = $result[$wrappingNode] + $result;
27
+ unset($result[$wrappingNode]);
28
+ }
29
+ }
30
+ }
31
+ /**
32
+ * Accounts for wrapper nodes
33
+ * {@inheritdoc}
34
+ */
35
+ public function visit(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface $command, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response $response, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Description\Parameter $param, &$value, $context = null)
36
+ {
37
+ parent::visit($command, $response, $param, $value, $context);
38
+ // Account for wrapper nodes (e.g. RDS, ElastiCache, etc)
39
+ if ($param->getData('wrapper')) {
40
+ $wireName = $param->getWireName();
41
+ $value += $value[$wireName];
42
+ unset($value[$wireName]);
43
+ }
44
+ }
45
+ /**
46
+ * Filter used when converting XML maps into associative arrays in service descriptions
47
+ *
48
+ * @param array $value Value to filter
49
+ * @param string $entryName Name of each entry
50
+ * @param string $keyName Name of each key
51
+ * @param string $valueName Name of each value
52
+ *
53
+ * @return array Returns the map of the XML data
54
+ */
55
+ public static function xmlMap($value, $entryName, $keyName, $valueName)
56
+ {
57
+ $result = array();
58
+ foreach ($value as $entry) {
59
+ $result[$entry[$keyName]] = $entry[$valueName];
60
+ }
61
+ return $result;
62
+ }
63
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/AbstractCredentialsDecorator.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials;
18
+
19
+ /**
20
+ * Abstract credentials decorator
21
+ */
22
+ class AbstractCredentialsDecorator implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface
23
+ {
24
+ /**
25
+ * @var CredentialsInterface Wrapped credentials object
26
+ */
27
+ protected $credentials;
28
+ /**
29
+ * Constructs a new BasicAWSCredentials object, with the specified AWS
30
+ * access key and AWS secret key
31
+ *
32
+ * @param CredentialsInterface $credentials
33
+ */
34
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials)
35
+ {
36
+ $this->credentials = $credentials;
37
+ }
38
+ /**
39
+ * {@inheritdoc}
40
+ */
41
+ public function serialize()
42
+ {
43
+ return $this->credentials->serialize();
44
+ }
45
+ /**
46
+ * {@inheritdoc}
47
+ */
48
+ public function unserialize($serialized)
49
+ {
50
+ $this->credentials = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\Credentials('', '');
51
+ $this->credentials->unserialize($serialized);
52
+ }
53
+ /**
54
+ * {@inheritdoc}
55
+ */
56
+ public function getAccessKeyId()
57
+ {
58
+ return $this->credentials->getAccessKeyId();
59
+ }
60
+ /**
61
+ * {@inheritdoc}
62
+ */
63
+ public function getSecretKey()
64
+ {
65
+ return $this->credentials->getSecretKey();
66
+ }
67
+ /**
68
+ * {@inheritdoc}
69
+ */
70
+ public function getSecurityToken()
71
+ {
72
+ return $this->credentials->getSecurityToken();
73
+ }
74
+ /**
75
+ * {@inheritdoc}
76
+ */
77
+ public function getExpiration()
78
+ {
79
+ return $this->credentials->getExpiration();
80
+ }
81
+ /**
82
+ * {@inheritdoc}
83
+ */
84
+ public function isExpired()
85
+ {
86
+ return $this->credentials->isExpired();
87
+ }
88
+ /**
89
+ * {@inheritdoc}
90
+ */
91
+ public function setAccessKeyId($key)
92
+ {
93
+ $this->credentials->setAccessKeyId($key);
94
+ return $this;
95
+ }
96
+ /**
97
+ * {@inheritdoc}
98
+ */
99
+ public function setSecretKey($secret)
100
+ {
101
+ $this->credentials->setSecretKey($secret);
102
+ return $this;
103
+ }
104
+ /**
105
+ * {@inheritdoc}
106
+ */
107
+ public function setSecurityToken($token)
108
+ {
109
+ $this->credentials->setSecurityToken($token);
110
+ return $this;
111
+ }
112
+ /**
113
+ * {@inheritdoc}
114
+ */
115
+ public function setExpiration($timestamp)
116
+ {
117
+ $this->credentials->setExpiration($timestamp);
118
+ return $this;
119
+ }
120
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/AbstractRefreshableCredentials.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials;
18
+
19
+ /**
20
+ * Abstract decorator to provide a foundation for refreshable credentials
21
+ */
22
+ abstract class AbstractRefreshableCredentials extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\AbstractCredentialsDecorator
23
+ {
24
+ /**
25
+ * Get the underlying credentials, refreshing if necessary.
26
+ *
27
+ * @return Credentials
28
+ */
29
+ public function getCredentials()
30
+ {
31
+ if ($this->credentials->isExpired()) {
32
+ $this->refresh();
33
+ }
34
+ return new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\Credentials($this->credentials->getAccessKeyId(), $this->credentials->getSecretKey(), $this->credentials->getSecurityToken(), $this->credentials->getExpiration());
35
+ }
36
+ /**
37
+ * {@inheritdoc}
38
+ */
39
+ public function getAccessKeyId()
40
+ {
41
+ if ($this->credentials->isExpired()) {
42
+ $this->refresh();
43
+ }
44
+ return $this->credentials->getAccessKeyId();
45
+ }
46
+ /**
47
+ * {@inheritdoc}
48
+ */
49
+ public function getSecretKey()
50
+ {
51
+ if ($this->credentials->isExpired()) {
52
+ $this->refresh();
53
+ }
54
+ return $this->credentials->getSecretKey();
55
+ }
56
+ /**
57
+ * {@inheritdoc}
58
+ */
59
+ public function getSecurityToken()
60
+ {
61
+ if ($this->credentials->isExpired()) {
62
+ $this->refresh();
63
+ }
64
+ return $this->credentials->getSecurityToken();
65
+ }
66
+ /**
67
+ * {@inheritdoc}
68
+ */
69
+ public function serialize()
70
+ {
71
+ if ($this->credentials->isExpired()) {
72
+ $this->refresh();
73
+ }
74
+ return $this->credentials->serialize();
75
+ }
76
+ /**
77
+ * Attempt to get new credentials
78
+ */
79
+ protected abstract function refresh();
80
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/CacheableCredentials.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Cache\CacheAdapterInterface;
20
+ /**
21
+ * Credentials decorator used to implement caching credentials
22
+ */
23
+ class CacheableCredentials extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\AbstractRefreshableCredentials
24
+ {
25
+ /**
26
+ * @var CacheAdapterInterface Cache adapter used to store credentials
27
+ */
28
+ protected $cache;
29
+ /**
30
+ * @var string Cache key used to store the credentials
31
+ */
32
+ protected $cacheKey;
33
+ /**
34
+ * CacheableCredentials is a decorator that decorates other credentials
35
+ *
36
+ * @param CredentialsInterface $credentials Credentials to adapt
37
+ * @param CacheAdapterInterface $cache Cache to use to store credentials
38
+ * @param string $cacheKey Cache key of the credentials
39
+ */
40
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Cache\CacheAdapterInterface $cache, $cacheKey)
41
+ {
42
+ $this->cache = $cache;
43
+ $this->cacheKey = $cacheKey;
44
+ parent::__construct($credentials);
45
+ }
46
+ /**
47
+ * Attempt to get new credentials from cache or from the adapted object
48
+ */
49
+ protected function refresh()
50
+ {
51
+ if (!($cache = $this->cache->fetch($this->cacheKey))) {
52
+ // The credentials were not found, so try again and cache if new
53
+ $this->credentials->getAccessKeyId();
54
+ if (!$this->credentials->isExpired()) {
55
+ // The credentials were updated, so cache them
56
+ $this->cache->save($this->cacheKey, $this->credentials, $this->credentials->getExpiration() - time());
57
+ }
58
+ } else {
59
+ // The credentials were found in cache, so update the adapter object
60
+ // if the cached credentials are not expired
61
+ if (!$cache->isExpired()) {
62
+ $this->credentials->setAccessKeyId($cache->getAccessKeyId());
63
+ $this->credentials->setSecretKey($cache->getSecretKey());
64
+ $this->credentials->setSecurityToken($cache->getSecurityToken());
65
+ $this->credentials->setExpiration($cache->getExpiration());
66
+ }
67
+ }
68
+ }
69
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/Credentials.php ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions as Options;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RequiredExtensionNotLoadedException;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\FromConfigInterface;
24
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Cache\CacheAdapterInterface;
25
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Cache\DoctrineCacheAdapter;
26
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection;
27
+ /**
28
+ * Basic implementation of the AWSCredentials interface that allows callers to
29
+ * pass in the AWS access key and secret access in the constructor.
30
+ */
31
+ class Credentials implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\FromConfigInterface
32
+ {
33
+ const ENV_KEY = 'AWS_ACCESS_KEY_ID';
34
+ const ENV_SECRET = 'AWS_SECRET_KEY';
35
+ const ENV_SECRET_ACCESS_KEY = 'AWS_SECRET_ACCESS_KEY';
36
+ const ENV_PROFILE = 'AWS_PROFILE';
37
+ /** @var string AWS Access Key ID */
38
+ protected $key;
39
+ /** @var string AWS Secret Access Key */
40
+ protected $secret;
41
+ /** @var string AWS Security Token */
42
+ protected $token;
43
+ /** @var int Time to die of token */
44
+ protected $ttd;
45
+ /**
46
+ * Get the available keys for the factory method
47
+ *
48
+ * @return array
49
+ */
50
+ public static function getConfigDefaults()
51
+ {
52
+ return array(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::KEY => null, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SECRET => null, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::TOKEN => null, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::TOKEN_TTD => null, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::PROFILE => null, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::CREDENTIALS_CACHE => null, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::CREDENTIALS_CACHE_KEY => null, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::CREDENTIALS_CLIENT => null);
53
+ }
54
+ /**
55
+ * Factory method for creating new credentials. This factory method will
56
+ * create the appropriate credentials object with appropriate decorators
57
+ * based on the passed configuration options.
58
+ *
59
+ * @param array $config Options to use when instantiating the credentials
60
+ *
61
+ * @return CredentialsInterface
62
+ * @throws InvalidArgumentException If the caching options are invalid
63
+ * @throws RuntimeException If using the default cache and APC is disabled
64
+ */
65
+ public static function factory($config = array())
66
+ {
67
+ // Add default key values
68
+ foreach (self::getConfigDefaults() as $key => $value) {
69
+ if (!isset($config[$key])) {
70
+ $config[$key] = $value;
71
+ }
72
+ }
73
+ // Set up the cache
74
+ $cache = $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::CREDENTIALS_CACHE];
75
+ $cacheKey = $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::CREDENTIALS_CACHE_KEY] ?: 'credentials_' . ($config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::KEY] ?: crc32(gethostname()));
76
+ if ($cacheKey && $cache instanceof CacheAdapterInterface && ($cached = self::createFromCache($cache, $cacheKey))) {
77
+ return $cached;
78
+ }
79
+ // Create the credentials object
80
+ if (!$config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::KEY] || !$config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SECRET]) {
81
+ $credentials = self::createFromEnvironment($config);
82
+ } else {
83
+ // Instantiate using short or long term credentials
84
+ $credentials = new static($config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::KEY], $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SECRET], $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::TOKEN], $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::TOKEN_TTD]);
85
+ }
86
+ // Check if the credentials are refreshable, and if so, configure caching
87
+ $cache = $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::CREDENTIALS_CACHE];
88
+ if ($cacheKey && $cache) {
89
+ $credentials = self::createCache($credentials, $cache, $cacheKey);
90
+ }
91
+ return $credentials;
92
+ }
93
+ /**
94
+ * Create credentials from the credentials ini file in the HOME directory.
95
+ *
96
+ * @param string|null $profile Pass a specific profile to use. If no
97
+ * profile is specified we will attempt to use
98
+ * the value specified in the AWS_PROFILE
99
+ * environment variable. If AWS_PROFILE is not
100
+ * set, the "default" profile is used.
101
+ * @param string|null $filename Pass a string to specify the location of the
102
+ * credentials files. If null is passed, the
103
+ * SDK will attempt to find the configuration
104
+ * file at in your HOME directory at
105
+ * ~/.aws/credentials.
106
+ * @return CredentialsInterface
107
+ * @throws \RuntimeException if the file cannot be found, if the file is
108
+ * invalid, or if the profile is invalid.
109
+ */
110
+ public static function fromIni($profile = null, $filename = null)
111
+ {
112
+ if (!$filename) {
113
+ $filename = self::getHomeDir() . '/.aws/credentials';
114
+ }
115
+ if (!$profile) {
116
+ $profile = self::getEnvVar(self::ENV_PROFILE) ?: 'default';
117
+ }
118
+ if (!is_readable($filename) || ($data = parse_ini_file($filename, true)) === false) {
119
+ throw new \RuntimeException("Invalid AWS credentials file: {$filename}.");
120
+ }
121
+ if (!isset($data[$profile]['aws_access_key_id']) || !isset($data[$profile]['aws_secret_access_key'])) {
122
+ throw new \RuntimeException("Invalid AWS credentials profile {$profile} in {$filename}.");
123
+ }
124
+ return new self($data[$profile]['aws_access_key_id'], $data[$profile]['aws_secret_access_key'], isset($data[$profile]['aws_security_token']) ? $data[$profile]['aws_security_token'] : null);
125
+ }
126
+ /**
127
+ * Constructs a new BasicAWSCredentials object, with the specified AWS
128
+ * access key and AWS secret key
129
+ *
130
+ * @param string $accessKeyId AWS access key ID
131
+ * @param string $secretAccessKey AWS secret access key
132
+ * @param string $token Security token to use
133
+ * @param int $expiration UNIX timestamp for when credentials expire
134
+ */
135
+ public function __construct($accessKeyId, $secretAccessKey, $token = null, $expiration = null)
136
+ {
137
+ $this->key = trim($accessKeyId);
138
+ $this->secret = trim($secretAccessKey);
139
+ $this->token = $token;
140
+ $this->ttd = $expiration;
141
+ }
142
+ public function serialize()
143
+ {
144
+ return json_encode(array(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::KEY => $this->key, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SECRET => $this->secret, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::TOKEN => $this->token, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::TOKEN_TTD => $this->ttd));
145
+ }
146
+ public function unserialize($serialized)
147
+ {
148
+ $data = json_decode($serialized, true);
149
+ $this->key = $data[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::KEY];
150
+ $this->secret = $data[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SECRET];
151
+ $this->token = $data[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::TOKEN];
152
+ $this->ttd = $data[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::TOKEN_TTD];
153
+ }
154
+ public function getAccessKeyId()
155
+ {
156
+ return $this->key;
157
+ }
158
+ public function getSecretKey()
159
+ {
160
+ return $this->secret;
161
+ }
162
+ public function getSecurityToken()
163
+ {
164
+ return $this->token;
165
+ }
166
+ public function getExpiration()
167
+ {
168
+ return $this->ttd;
169
+ }
170
+ public function isExpired()
171
+ {
172
+ return $this->ttd !== null && time() >= $this->ttd;
173
+ }
174
+ public function setAccessKeyId($key)
175
+ {
176
+ $this->key = $key;
177
+ return $this;
178
+ }
179
+ public function setSecretKey($secret)
180
+ {
181
+ $this->secret = $secret;
182
+ return $this;
183
+ }
184
+ public function setSecurityToken($token)
185
+ {
186
+ $this->token = $token;
187
+ return $this;
188
+ }
189
+ public function setExpiration($timestamp)
190
+ {
191
+ $this->ttd = $timestamp;
192
+ return $this;
193
+ }
194
+ /**
195
+ * When no keys are provided, attempt to create them based on the
196
+ * environment or instance profile credentials.
197
+ *
198
+ * @param array|Collection $config
199
+ *
200
+ * @return CredentialsInterface
201
+ */
202
+ private static function createFromEnvironment($config)
203
+ {
204
+ // Get key and secret from ENV variables
205
+ $envKey = self::getEnvVar(self::ENV_KEY);
206
+ if (!($envSecret = self::getEnvVar(self::ENV_SECRET))) {
207
+ // Use AWS_SECRET_ACCESS_KEY if AWS_SECRET_KEY was not set
208
+ $envSecret = self::getEnvVar(self::ENV_SECRET_ACCESS_KEY);
209
+ }
210
+ // Use credentials from the environment variables if available
211
+ if ($envKey && $envSecret) {
212
+ return new static($envKey, $envSecret);
213
+ }
214
+ try {
215
+ // Use credentials from the INI file in HOME directory if available
216
+ return self::fromIni($config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::PROFILE]);
217
+ } catch (\RuntimeException $e) {
218
+ // Otherwise, try using instance profile credentials (available on EC2 instances)
219
+ return new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\RefreshableInstanceProfileCredentials(new static('', '', '', 1), $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::CREDENTIALS_CLIENT]);
220
+ }
221
+ }
222
+ private static function createFromCache(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Cache\CacheAdapterInterface $cache, $cacheKey)
223
+ {
224
+ $cached = $cache->fetch($cacheKey);
225
+ if ($cached instanceof CredentialsInterface && !$cached->isExpired()) {
226
+ return new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CacheableCredentials($cached, $cache, $cacheKey);
227
+ }
228
+ return null;
229
+ }
230
+ private static function createCache(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials, $cache, $cacheKey)
231
+ {
232
+ if ($cache === 'true' || $cache === true) {
233
+ // If no cache adapter was provided, then create one for the user
234
+ // @codeCoverageIgnoreStart
235
+ if (!extension_loaded('apc')) {
236
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RequiredExtensionNotLoadedException('PHP has not been compiled with APC. Unable to cache ' . 'the credentials.');
237
+ } elseif (!class_exists('DeliciousBrains\\WP_Offload_S3\\Aws2\\Doctrine\\Common\\Cache\\ApcCache')) {
238
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException('Cannot set ' . \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::CREDENTIALS_CACHE . ' to true because the Doctrine cache component is ' . 'not installed. Either install doctrine/cache or pass in an instantiated ' . 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Guzzle\\Cache\\CacheAdapterInterface object');
239
+ }
240
+ // @codeCoverageIgnoreEnd
241
+ $cache = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Cache\DoctrineCacheAdapter(new \DeliciousBrains\WP_Offload_S3\Aws2\Doctrine\Common\Cache\ApcCache());
242
+ } elseif (!$cache instanceof CacheAdapterInterface) {
243
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('Unable to utilize caching with the specified options');
244
+ }
245
+ // Decorate the credentials with a cache
246
+ return new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CacheableCredentials($credentials, $cache, $cacheKey);
247
+ }
248
+ private static function getHomeDir()
249
+ {
250
+ // On Linux/Unix-like systems, use the HOME environment variable
251
+ if ($homeDir = self::getEnvVar('HOME')) {
252
+ return $homeDir;
253
+ }
254
+ // Get the HOMEDRIVE and HOMEPATH values for Windows hosts
255
+ $homeDrive = self::getEnvVar('HOMEDRIVE');
256
+ $homePath = self::getEnvVar('HOMEPATH');
257
+ return $homeDrive && $homePath ? $homeDrive . $homePath : null;
258
+ }
259
+ /**
260
+ * Fetches the value of an environment variable by checking $_SERVER and getenv().
261
+ *
262
+ * @param string $var Name of the environment variable
263
+ *
264
+ * @return mixed|null
265
+ */
266
+ private static function getEnvVar($var)
267
+ {
268
+ return isset($_SERVER[$var]) ? $_SERVER[$var] : getenv($var);
269
+ }
270
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/CredentialsInterface.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials;
18
+
19
+ /**
20
+ * Provides access to the AWS credentials used for accessing AWS services: AWS
21
+ * access key ID, secret access key, and security token. These credentials are
22
+ * used to securely sign requests to AWS services.
23
+ */
24
+ interface CredentialsInterface extends \Serializable
25
+ {
26
+ /**
27
+ * Returns the AWS access key ID for this credentials object.
28
+ *
29
+ * @return string
30
+ */
31
+ public function getAccessKeyId();
32
+ /**
33
+ * Returns the AWS secret access key for this credentials object.
34
+ *
35
+ * @return string
36
+ */
37
+ public function getSecretKey();
38
+ /**
39
+ * Get the associated security token if available
40
+ *
41
+ * @return string|null
42
+ */
43
+ public function getSecurityToken();
44
+ /**
45
+ * Get the UNIX timestamp in which the credentials will expire
46
+ *
47
+ * @return int|null
48
+ */
49
+ public function getExpiration();
50
+ /**
51
+ * Set the AWS access key ID for this credentials object.
52
+ *
53
+ * @param string $key AWS access key ID
54
+ *
55
+ * @return self
56
+ */
57
+ public function setAccessKeyId($key);
58
+ /**
59
+ * Set the AWS secret access key for this credentials object.
60
+ *
61
+ * @param string $secret AWS secret access key
62
+ *
63
+ * @return CredentialsInterface
64
+ */
65
+ public function setSecretKey($secret);
66
+ /**
67
+ * Set the security token to use with this credentials object
68
+ *
69
+ * @param string $token Security token
70
+ *
71
+ * @return self
72
+ */
73
+ public function setSecurityToken($token);
74
+ /**
75
+ * Set the UNIX timestamp in which the credentials will expire
76
+ *
77
+ * @param int $timestamp UNIX timestamp expiration
78
+ *
79
+ * @return self
80
+ */
81
+ public function setExpiration($timestamp);
82
+ /**
83
+ * Check if the credentials are expired
84
+ *
85
+ * @return bool
86
+ */
87
+ public function isExpired();
88
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/NullCredentials.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials;
4
+
5
+ /**
6
+ * A blank set of credentials. AWS clients must be provided credentials, but
7
+ * there are some types of requests that do not need authentication. This class
8
+ * can be used to pivot on that scenario, and also serve as a mock credentials
9
+ * object when testing
10
+ *
11
+ * @codeCoverageIgnore
12
+ */
13
+ class NullCredentials implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface
14
+ {
15
+ public function getAccessKeyId()
16
+ {
17
+ return '';
18
+ }
19
+ public function getSecretKey()
20
+ {
21
+ return '';
22
+ }
23
+ public function getSecurityToken()
24
+ {
25
+ return null;
26
+ }
27
+ public function getExpiration()
28
+ {
29
+ return null;
30
+ }
31
+ public function isExpired()
32
+ {
33
+ return false;
34
+ }
35
+ public function serialize()
36
+ {
37
+ return 'N;';
38
+ }
39
+ public function unserialize($serialized)
40
+ {
41
+ // Nothing to do here.
42
+ }
43
+ public function setAccessKeyId($key)
44
+ {
45
+ // Nothing to do here.
46
+ }
47
+ public function setSecretKey($secret)
48
+ {
49
+ // Nothing to do here.
50
+ }
51
+ public function setSecurityToken($token)
52
+ {
53
+ // Nothing to do here.
54
+ }
55
+ public function setExpiration($timestamp)
56
+ {
57
+ // Nothing to do here.
58
+ }
59
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Credentials/RefreshableInstanceProfileCredentials.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\InstanceMetadata\InstanceMetadataClient;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InstanceProfileCredentialsException;
21
+ /**
22
+ * Credentials decorator used to implement retrieving credentials from the
23
+ * EC2 metadata server
24
+ */
25
+ class RefreshableInstanceProfileCredentials extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\AbstractRefreshableCredentials
26
+ {
27
+ /**
28
+ * @var InstanceMetadataClient
29
+ */
30
+ protected $client;
31
+ /** @var bool */
32
+ private $customClient;
33
+ /**
34
+ * Constructs a new instance profile credentials decorator
35
+ *
36
+ * @param CredentialsInterface $credentials Credentials to adapt
37
+ * @param InstanceMetadataClient $client Client used to get new credentials
38
+ */
39
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\InstanceMetadata\InstanceMetadataClient $client = null)
40
+ {
41
+ parent::__construct($credentials);
42
+ $this->setClient($client);
43
+ }
44
+ public function setClient(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\InstanceMetadata\InstanceMetadataClient $client = null)
45
+ {
46
+ $this->customClient = null !== $client;
47
+ $this->client = $client ?: \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\InstanceMetadata\InstanceMetadataClient::factory();
48
+ }
49
+ public function serialize()
50
+ {
51
+ $serializable = array('credentials' => parent::serialize(), 'customClient' => $this->customClient);
52
+ if ($this->customClient) {
53
+ $serializable['client'] = serialize($this->client);
54
+ }
55
+ return json_encode($serializable);
56
+ }
57
+ public function unserialize($value)
58
+ {
59
+ $serialized = json_decode($value, true);
60
+ parent::unserialize($serialized['credentials']);
61
+ $this->customClient = $serialized['customClient'];
62
+ $this->client = $this->customClient ? unserialize($serialized['client']) : \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\InstanceMetadata\InstanceMetadataClient::factory();
63
+ }
64
+ /**
65
+ * Attempt to get new credentials from the instance profile
66
+ *
67
+ * @throws InstanceProfileCredentialsException On error
68
+ */
69
+ protected function refresh()
70
+ {
71
+ $credentials = $this->client->getInstanceProfileCredentials();
72
+ // Expire the token 5 minutes early to pre-fetch before expiring.
73
+ $this->credentials->setAccessKeyId($credentials->getAccessKeyId())->setSecretKey($credentials->getSecretKey())->setSecurityToken($credentials->getSecurityToken())->setExpiration($credentials->getExpiration() - 300);
74
+ }
75
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common;
18
+
19
+ /**
20
+ * Represents an enumerable set of values
21
+ */
22
+ abstract class Enum
23
+ {
24
+ /**
25
+ * @var array A cache of all enum values to increase performance
26
+ */
27
+ protected static $cache = array();
28
+ /**
29
+ * Returns the names (or keys) of all of constants in the enum
30
+ *
31
+ * @return array
32
+ */
33
+ public static function keys()
34
+ {
35
+ return array_keys(static::values());
36
+ }
37
+ /**
38
+ * Return the names and values of all the constants in the enum
39
+ *
40
+ * @return array
41
+ */
42
+ public static function values()
43
+ {
44
+ $class = get_called_class();
45
+ if (!isset(self::$cache[$class])) {
46
+ $reflected = new \ReflectionClass($class);
47
+ self::$cache[$class] = $reflected->getConstants();
48
+ }
49
+ return self::$cache[$class];
50
+ }
51
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/ClientOptions.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
20
+ /**
21
+ * Contains enumerable default factory options that can be passed to a client's factory method
22
+ */
23
+ class ClientOptions extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
24
+ {
25
+ /**
26
+ * AWS Access Key ID
27
+ *
28
+ * @deprecated Use "credentials" instead.
29
+ */
30
+ const KEY = 'key';
31
+ /**
32
+ * AWS secret access key
33
+ *
34
+ * @deprecated Use "credentials" instead.
35
+ */
36
+ const SECRET = 'secret';
37
+ /**
38
+ * Custom AWS security token to use with request authentication.
39
+ *
40
+ * @deprecated Use "credentials" instead.
41
+ */
42
+ const TOKEN = 'token';
43
+ /**
44
+ * Provide an array of "key", "secret", and "token" or an instance of
45
+ * `Aws\Common\Credentials\CredentialsInterface`.
46
+ */
47
+ const CREDENTIALS = 'credentials';
48
+ /**
49
+ * @var string Name of a credential profile to read from your ~/.aws/credentials file
50
+ */
51
+ const PROFILE = 'profile';
52
+ /**
53
+ * @var string UNIX timestamp for when the custom credentials expire
54
+ */
55
+ const TOKEN_TTD = 'token.ttd';
56
+ /**
57
+ * @var string Used to cache credentials when using providers that require HTTP requests. Set the trueto use the
58
+ * default APC cache or provide a `Guzzle\Cache\CacheAdapterInterface` object.
59
+ */
60
+ const CREDENTIALS_CACHE = 'credentials.cache';
61
+ /**
62
+ * @var string Optional custom cache key to use with the credentials
63
+ */
64
+ const CREDENTIALS_CACHE_KEY = 'credentials.cache.key';
65
+ /**
66
+ * @var string Pass this option to specify a custom `Guzzle\Http\ClientInterface` to use if your credentials require
67
+ * a HTTP request (e.g. RefreshableInstanceProfileCredentials)
68
+ */
69
+ const CREDENTIALS_CLIENT = 'credentials.client';
70
+ /**
71
+ * @var string Region name (e.g. 'us-east-1', 'us-west-1', 'us-west-2', 'eu-west-1', etc...)
72
+ */
73
+ const REGION = 'region';
74
+ /**
75
+ * @var string URI Scheme of the base URL (e.g. 'https', 'http').
76
+ */
77
+ const SCHEME = 'scheme';
78
+ /**
79
+ * @var string Specify the name of the service
80
+ */
81
+ const SERVICE = 'service';
82
+ /**
83
+ * Instead of using a `region` and `scheme`, you can specify a custom base
84
+ * URL for the client.
85
+ *
86
+ * @deprecated Use the "endpoint" option instead.
87
+ */
88
+ const BASE_URL = 'base_url';
89
+ /**
90
+ * @var string You can optionally provide a custom signature implementation used to sign requests
91
+ */
92
+ const SIGNATURE = 'signature';
93
+ /**
94
+ * @var string Set to explicitly override the service name used in signatures
95
+ */
96
+ const SIGNATURE_SERVICE = 'signature.service';
97
+ /**
98
+ * @var string Set to explicitly override the region name used in signatures
99
+ */
100
+ const SIGNATURE_REGION = 'signature.region';
101
+ /**
102
+ * @var string Option key holding an exponential backoff plugin
103
+ */
104
+ const BACKOFF = 'client.backoff';
105
+ /**
106
+ * @var string Option key holding the exponential backoff retries
107
+ */
108
+ const BACKOFF_RETRIES = 'client.backoff.retries';
109
+ /**
110
+ * @var string `Guzzle\Log\LogAdapterInterface` object used to log backoff retries. Use 'debug' to emit PHP
111
+ * warnings when a retry is issued.
112
+ */
113
+ const BACKOFF_LOGGER = 'client.backoff.logger';
114
+ /**
115
+ * @var string Optional template to use for exponential backoff log messages. See
116
+ * `Guzzle\Plugin\Backoff\BackoffLogger` for formatting information.
117
+ */
118
+ const BACKOFF_LOGGER_TEMPLATE = 'client.backoff.logger.template';
119
+ /**
120
+ * Set to true to use the bundled CA cert or pass the full path to an SSL
121
+ * certificate bundle. This option should be modified when you encounter
122
+ * curl error code 60. Set to "system" to use the cacert bundle on your
123
+ * system.
124
+ */
125
+ const SSL_CERT = 'ssl.certificate_authority';
126
+ /**
127
+ * @var string Service description to use with the client
128
+ */
129
+ const SERVICE_DESCRIPTION = 'service.description';
130
+ /**
131
+ * @var string Whether or not modeled responses have transformations applied to them
132
+ */
133
+ const MODEL_PROCESSING = 'command.model_processing';
134
+ /**
135
+ * @var bool Set to false to disable validation
136
+ */
137
+ const VALIDATION = 'validation';
138
+ /**
139
+ * @var string API version used by the client
140
+ */
141
+ const VERSION = 'version';
142
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/DateFormat.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
20
+ /**
21
+ * Contains enumerable date format values used in the SDK
22
+ */
23
+ class DateFormat extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
24
+ {
25
+ const ISO8601 = 'Ymd\\THis\\Z';
26
+ const ISO8601_S3 = 'Y-m-d\\TH:i:s\\Z';
27
+ const RFC1123 = 'D, d M Y H:i:s \\G\\M\\T';
28
+ const RFC2822 = \DateTime::RFC2822;
29
+ const SHORT = 'Ymd';
30
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/Region.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
20
+ /**
21
+ * Contains enumerable region code values. These should be useful in most cases,
22
+ * with Amazon S3 being the most notable exception
23
+ *
24
+ * @link http://docs.aws.amazon.com/general/latest/gr/rande.html AWS Regions and Endpoints
25
+ */
26
+ class Region extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
27
+ {
28
+ const US_EAST_1 = 'us-east-1';
29
+ const VIRGINIA = 'us-east-1';
30
+ const NORTHERN_VIRGINIA = 'us-east-1';
31
+ const US_WEST_1 = 'us-west-1';
32
+ const CALIFORNIA = 'us-west-1';
33
+ const NORTHERN_CALIFORNIA = 'us-west-1';
34
+ const US_WEST_2 = 'us-west-2';
35
+ const OREGON = 'us-west-2';
36
+ const EU_WEST_1 = 'eu-west-1';
37
+ const IRELAND = 'eu-west-1';
38
+ const EU_CENTRAL_1 = 'eu-central-1';
39
+ const FRANKFURT = 'eu-central-1';
40
+ const AP_SOUTHEAST_1 = 'ap-southeast-1';
41
+ const SINGAPORE = 'ap-southeast-1';
42
+ const AP_SOUTHEAST_2 = 'ap-southeast-2';
43
+ const SYDNEY = 'ap-southeast-2';
44
+ const AP_NORTHEAST_1 = 'ap-northeast-1';
45
+ const TOKYO = 'ap-northeast-1';
46
+ const SA_EAST_1 = 'sa-east-1';
47
+ const SAO_PAULO = 'sa-east-1';
48
+ const CN_NORTH_1 = 'cn-north-1';
49
+ const BEIJING = 'cn-north-1';
50
+ const US_GOV_WEST_1 = 'us-gov-west-1';
51
+ const GOV_CLOUD_US = 'us-gov-west-1';
52
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/Size.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
20
+ /**
21
+ * Contains enumerable byte-size values
22
+ */
23
+ class Size extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
24
+ {
25
+ const B = 1;
26
+ const BYTE = 1;
27
+ const BYTES = 1;
28
+ const KB = 1024;
29
+ const KILOBYTE = 1024;
30
+ const KILOBYTES = 1024;
31
+ const MB = 1048576;
32
+ const MEGABYTE = 1048576;
33
+ const MEGABYTES = 1048576;
34
+ const GB = 1073741824;
35
+ const GIGABYTE = 1073741824;
36
+ const GIGABYTES = 1073741824;
37
+ const TB = 1099511627776;
38
+ const TERABYTE = 1099511627776;
39
+ const TERABYTES = 1099511627776;
40
+ const PB = 1125899906842624;
41
+ const PETABYTE = 1125899906842624;
42
+ const PETABYTES = 1125899906842624;
43
+ const EB = 1152921504606846976;
44
+ const EXABYTE = 1152921504606846976;
45
+ const EXABYTES = 1152921504606846976;
46
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/Time.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
20
+ /**
21
+ * Contains enumerable time values
22
+ */
23
+ class Time extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
24
+ {
25
+ const SECOND = 1;
26
+ const SECONDS = 1;
27
+ const MINUTE = 60;
28
+ const MINUTES = 60;
29
+ const HOUR = 3600;
30
+ const HOURS = 3600;
31
+ const DAY = 86400;
32
+ const DAYS = 86400;
33
+ const WEEK = 604800;
34
+ const WEEKS = 604800;
35
+ const MONTH = 2592000;
36
+ const MONTHS = 2592000;
37
+ const YEAR = 31557600;
38
+ const YEARS = 31557600;
39
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Enum/UaString.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
20
+ /**
21
+ * User-Agent header strings for various high level operations
22
+ */
23
+ class UaString extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
24
+ {
25
+ /**
26
+ * @var string Name of the option used to add to the UA string
27
+ */
28
+ const OPTION = 'ua.append';
29
+ /**
30
+ * @var string Resource iterator
31
+ */
32
+ const ITERATOR = 'ITR';
33
+ /**
34
+ * @var string Resource waiter
35
+ */
36
+ const WAITER = 'WTR';
37
+ /**
38
+ * @var string Session handlers (e.g. Amazon DynamoDB session handler)
39
+ */
40
+ const SESSION = 'SES';
41
+ /**
42
+ * @var string Multipart upload helper for Amazon S3
43
+ */
44
+ const MULTIPART_UPLOAD = 'MUP';
45
+ /**
46
+ * @var string Command executed during a batch transfer
47
+ */
48
+ const BATCH = 'BAT';
49
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/AwsExceptionInterface.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
18
+
19
+ /**
20
+ * "Marker Interface" implemented by every exception in the AWS SDK
21
+ */
22
+ interface AwsExceptionInterface
23
+ {
24
+ public function getCode();
25
+ public function getLine();
26
+ public function getFile();
27
+ public function getMessage();
28
+ public function getPrevious();
29
+ public function getTrace();
30
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/BadMethodCallException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
18
+
19
+ /**
20
+ * AWS SDK namespaced version of the SPL BadMethodCallException.
21
+ */
22
+ class BadMethodCallException extends \BadMethodCallException implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\AwsExceptionInterface
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/DomainException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
18
+
19
+ /**
20
+ * AWS SDK namespaced version of the SPL DomainException.
21
+ */
22
+ class DomainException extends \DomainException implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\AwsExceptionInterface
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/ExceptionFactoryInterface.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response;
21
+ /**
22
+ * Interface used to create AWS exception
23
+ */
24
+ interface ExceptionFactoryInterface
25
+ {
26
+ /**
27
+ * Returns an AWS service specific exception
28
+ *
29
+ * @param RequestInterface $request Unsuccessful request
30
+ * @param Response $response Unsuccessful response that was encountered
31
+ *
32
+ * @return \Exception|AwsExceptionInterface
33
+ */
34
+ public function fromResponse(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response $response);
35
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/ExceptionListener.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Symfony\Component\EventDispatcher\EventSubscriberInterface;
21
+ /**
22
+ * Converts generic Guzzle response exceptions into AWS specific exceptions
23
+ */
24
+ class ExceptionListener implements \DeliciousBrains\WP_Offload_S3\Aws2\Symfony\Component\EventDispatcher\EventSubscriberInterface
25
+ {
26
+ /**
27
+ * @var ExceptionFactoryInterface Factory used to create new exceptions
28
+ */
29
+ protected $factory;
30
+ /**
31
+ * @param ExceptionFactoryInterface $factory Factory used to create exceptions
32
+ */
33
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\ExceptionFactoryInterface $factory)
34
+ {
35
+ $this->factory = $factory;
36
+ }
37
+ /**
38
+ * {@inheritdoc}
39
+ */
40
+ public static function getSubscribedEvents()
41
+ {
42
+ return array('request.error' => array('onRequestError', -1));
43
+ }
44
+ /**
45
+ * Throws a more meaningful request exception if available
46
+ *
47
+ * @param Event $event Event emitted
48
+ */
49
+ public function onRequestError(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event $event)
50
+ {
51
+ $e = $this->factory->fromResponse($event['request'], $event['response']);
52
+ $event->stopPropagation();
53
+ throw $e;
54
+ }
55
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/InstanceProfileCredentialsException.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException;
20
+ /**
21
+ * Exception thrown when an error occurs with instance profile credentials
22
+ */
23
+ class InstanceProfileCredentialsException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException
24
+ {
25
+ /**
26
+ * @var string
27
+ */
28
+ protected $statusCode;
29
+ /**
30
+ * Set the error response code received from the instance metadata
31
+ *
32
+ * @param string $code Response code
33
+ */
34
+ public function setStatusCode($code)
35
+ {
36
+ $this->statusCode = $code;
37
+ }
38
+ /**
39
+ * Get the error response code from the service
40
+ *
41
+ * @return string|null
42
+ */
43
+ public function getStatusCode()
44
+ {
45
+ return $this->statusCode;
46
+ }
47
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/InvalidArgumentException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
18
+
19
+ /**
20
+ * AWS SDK namespaced version of the SPL InvalidArgumentException.
21
+ */
22
+ class InvalidArgumentException extends \InvalidArgumentException implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\AwsExceptionInterface
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/LogicException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
18
+
19
+ /**
20
+ * AWS SDK namespaced version of the SPL LogicException.
21
+ */
22
+ class LogicException extends \LogicException implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\AwsExceptionInterface
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/MultipartUploadException.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\TransferStateInterface;
20
+ /**
21
+ * Thrown when a {@see Aws\Common\MultipartUpload\TransferInterface} object encounters an error during transfer
22
+ */
23
+ class MultipartUploadException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException
24
+ {
25
+ /**
26
+ * @var TransferStateInterface State of the transfer when the error was encountered
27
+ */
28
+ protected $state;
29
+ /**
30
+ * @param TransferStateInterface $state Transfer state
31
+ * @param \Exception $exception Last encountered exception
32
+ */
33
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\TransferStateInterface $state, \Exception $exception = null)
34
+ {
35
+ parent::__construct('An error was encountered while performing a multipart upload: ' . $exception->getMessage(), 0, $exception);
36
+ $this->state = $state;
37
+ }
38
+ /**
39
+ * Get the state of the transfer
40
+ *
41
+ * @return TransferStateInterface
42
+ */
43
+ public function getState()
44
+ {
45
+ return $this->state;
46
+ }
47
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/NamespaceExceptionFactory.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\ExceptionParserInterface;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response;
22
+ /**
23
+ * Attempts to create exceptions by inferring the name from the code and a base
24
+ * namespace that contains exceptions. Exception classes are expected to be in
25
+ * upper camelCase and always end in 'Exception'. 'Exception' will be appended
26
+ * if it is not present in the exception code.
27
+ */
28
+ class NamespaceExceptionFactory implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\ExceptionFactoryInterface
29
+ {
30
+ /**
31
+ * @var ExceptionParserInterface $parser Parser used to parse responses
32
+ */
33
+ protected $parser;
34
+ /**
35
+ * @var string Base namespace containing exception classes
36
+ */
37
+ protected $baseNamespace;
38
+ /**
39
+ * @var string Default class to instantiate if a match is not found
40
+ */
41
+ protected $defaultException;
42
+ /**
43
+ * @param ExceptionParserInterface $parser Parser used to parse exceptions
44
+ * @param string $baseNamespace Namespace containing exceptions
45
+ * @param string $defaultException Default class to use if one is not mapped
46
+ */
47
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\ExceptionParserInterface $parser, $baseNamespace, $defaultException = 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Common\\Exception\\ServiceResponseException')
48
+ {
49
+ $this->parser = $parser;
50
+ $this->baseNamespace = $baseNamespace;
51
+ $this->defaultException = $defaultException;
52
+ }
53
+ /**
54
+ * {@inheritdoc}
55
+ */
56
+ public function fromResponse(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response $response)
57
+ {
58
+ $parts = $this->parser->parse($request, $response);
59
+ // Removing leading 'AWS.' and embedded periods
60
+ $className = $this->baseNamespace . '\\' . str_replace(array('AWS.', '.'), '', $parts['code']);
61
+ if (substr($className, -9) !== 'Exception') {
62
+ $className .= 'Exception';
63
+ }
64
+ $className = class_exists($className) ? $className : $this->defaultException;
65
+ return $this->createException($className, $request, $response, $parts);
66
+ }
67
+ /**
68
+ * Create an prepare an exception object
69
+ *
70
+ * @param string $className Name of the class to create
71
+ * @param RequestInterface $request Request
72
+ * @param Response $response Response received
73
+ * @param array $parts Parsed exception data
74
+ *
75
+ * @return \Exception
76
+ */
77
+ protected function createException($className, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response $response, array $parts)
78
+ {
79
+ $class = new $className($parts['message']);
80
+ if ($class instanceof ServiceResponseException) {
81
+ $class->setExceptionCode($parts['code']);
82
+ $class->setExceptionType($parts['type']);
83
+ $class->setResponse($response);
84
+ $class->setRequest($request);
85
+ $class->setRequestId($parts['request_id']);
86
+ }
87
+ return $class;
88
+ }
89
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/OutOfBoundsException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
18
+
19
+ /**
20
+ * AWS SDK namespaced version of the SPL OverflowException.
21
+ */
22
+ class OutOfBoundsException extends \OutOfBoundsException implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\AwsExceptionInterface
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/OverflowException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
18
+
19
+ /**
20
+ * AWS SDK namespaced version of the SPL OverflowException.
21
+ */
22
+ class OverflowException extends \OverflowException implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\AwsExceptionInterface
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/Parser/AbstractJsonExceptionParser.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response;
21
+ /**
22
+ * Parses JSON encoded exception responses
23
+ */
24
+ abstract class AbstractJsonExceptionParser implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\ExceptionParserInterface
25
+ {
26
+ /**
27
+ * {@inheritdoc}
28
+ */
29
+ public function parse(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response $response)
30
+ {
31
+ // Build array of default error data
32
+ $data = array('code' => null, 'message' => null, 'type' => $response->isClientError() ? 'client' : 'server', 'request_id' => (string) $response->getHeader('x-amzn-RequestId'), 'parsed' => null);
33
+ // Parse the json and normalize key casings
34
+ if (null !== ($json = json_decode($response->getBody(true), true))) {
35
+ $data['parsed'] = array_change_key_case($json);
36
+ }
37
+ // Do additional, protocol-specific parsing and return the result
38
+ $data = $this->doParse($data, $response);
39
+ // Remove "Fault" suffix from exception names
40
+ if (isset($data['code']) && strpos($data['code'], 'Fault')) {
41
+ $data['code'] = preg_replace('/^([a-zA-Z]+)Fault$/', '$1', $data['code']);
42
+ }
43
+ return $data;
44
+ }
45
+ /**
46
+ * Pull relevant exception data out of the parsed json
47
+ *
48
+ * @param array $data The exception data
49
+ * @param Response $response The response from the service containing the error
50
+ *
51
+ * @return array
52
+ */
53
+ protected abstract function doParse(array $data, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response $response);
54
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/Parser/DefaultXmlExceptionParser.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response;
21
+ /**
22
+ * Parses default XML exception responses
23
+ */
24
+ class DefaultXmlExceptionParser implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\ExceptionParserInterface
25
+ {
26
+ public function parse(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response $response)
27
+ {
28
+ $data = array('code' => null, 'message' => null, 'type' => $response->isClientError() ? 'client' : 'server', 'request_id' => null, 'parsed' => null);
29
+ $body = $response->getBody(true);
30
+ if (!$body) {
31
+ $this->parseHeaders($request, $response, $data);
32
+ return $data;
33
+ }
34
+ try {
35
+ $xml = new \SimpleXMLElement($body);
36
+ $this->parseBody($xml, $data);
37
+ return $data;
38
+ } catch (\Exception $e) {
39
+ // Gracefully handle parse errors. This could happen when the
40
+ // server responds with a non-XML response (e.g., private beta
41
+ // services).
42
+ $data['code'] = 'PhpInternalXmlParseError';
43
+ $data['message'] = 'A non-XML response was received';
44
+ return $data;
45
+ }
46
+ }
47
+ /**
48
+ * Parses additional exception information from the response headers
49
+ *
50
+ * @param RequestInterface $request Request that was issued
51
+ * @param Response $response The response from the request
52
+ * @param array $data The current set of exception data
53
+ */
54
+ protected function parseHeaders(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response $response, array &$data)
55
+ {
56
+ $data['message'] = $response->getStatusCode() . ' ' . $response->getReasonPhrase();
57
+ if ($requestId = $response->getHeader('x-amz-request-id')) {
58
+ $data['request_id'] = $requestId;
59
+ $data['message'] .= " (Request-ID: {$requestId})";
60
+ }
61
+ }
62
+ /**
63
+ * Parses additional exception information from the response body
64
+ *
65
+ * @param \SimpleXMLElement $body The response body as XML
66
+ * @param array $data The current set of exception data
67
+ */
68
+ protected function parseBody(\SimpleXMLElement $body, array &$data)
69
+ {
70
+ $data['parsed'] = $body;
71
+ $namespaces = $body->getDocNamespaces();
72
+ if (isset($namespaces[''])) {
73
+ // Account for the default namespace being defined and PHP not being able to handle it :(
74
+ $body->registerXPathNamespace('ns', $namespaces['']);
75
+ $prefix = 'ns:';
76
+ } else {
77
+ $prefix = '';
78
+ }
79
+ if ($tempXml = $body->xpath("//{$prefix}Code[1]")) {
80
+ $data['code'] = (string) $tempXml[0];
81
+ }
82
+ if ($tempXml = $body->xpath("//{$prefix}Message[1]")) {
83
+ $data['message'] = (string) $tempXml[0];
84
+ }
85
+ $tempXml = $body->xpath("//{$prefix}RequestId[1]");
86
+ if (empty($tempXml)) {
87
+ $tempXml = $body->xpath("//{$prefix}RequestID[1]");
88
+ }
89
+ if (isset($tempXml[0])) {
90
+ $data['request_id'] = (string) $tempXml[0];
91
+ }
92
+ }
93
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/Parser/ExceptionParserInterface.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response;
21
+ /**
22
+ * Interface used to parse exceptions into an associative array of data
23
+ */
24
+ interface ExceptionParserInterface
25
+ {
26
+ /**
27
+ * Parses an exception into an array of data containing at minimum the
28
+ * following array keys:
29
+ * - type: Exception type
30
+ * - code: Exception code
31
+ * - message: Exception message
32
+ * - request_id: Request ID
33
+ * - parsed: The parsed representation of the data (array, SimpleXMLElement, etc)
34
+ *
35
+ * @param RequestInterface $request
36
+ * @param Response $response Unsuccessful response
37
+ *
38
+ * @return array
39
+ */
40
+ public function parse(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response $response);
41
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/Parser/JsonQueryExceptionParser.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response;
20
+ /**
21
+ * Parses JSON encoded exception responses from query services
22
+ */
23
+ class JsonQueryExceptionParser extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\AbstractJsonExceptionParser
24
+ {
25
+ /**
26
+ * {@inheritdoc}
27
+ */
28
+ protected function doParse(array $data, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response $response)
29
+ {
30
+ if ($json = $data['parsed']) {
31
+ if (isset($json['__type'])) {
32
+ $parts = explode('#', $json['__type']);
33
+ $data['code'] = isset($parts[1]) ? $parts[1] : $parts[0];
34
+ }
35
+ $data['message'] = isset($json['message']) ? $json['message'] : null;
36
+ }
37
+ return $data;
38
+ }
39
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/Parser/JsonRestExceptionParser.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response;
20
+ /**
21
+ * Parses JSON encoded exception responses from REST services
22
+ */
23
+ class JsonRestExceptionParser extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\AbstractJsonExceptionParser
24
+ {
25
+ /**
26
+ * {@inheritdoc}
27
+ */
28
+ protected function doParse(array $data, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response $response)
29
+ {
30
+ // Merge in error data from the JSON body
31
+ if ($json = $data['parsed']) {
32
+ $data = array_replace($data, $json);
33
+ }
34
+ // Correct error type from services like Amazon Glacier
35
+ if (!empty($data['type'])) {
36
+ $data['type'] = strtolower($data['type']);
37
+ }
38
+ // Retrieve the error code from services like Amazon Elastic Transcoder
39
+ if ($code = (string) $response->getHeader('x-amzn-ErrorType')) {
40
+ $data['code'] = substr($code, 0, strpos($code, ':'));
41
+ }
42
+ return $data;
43
+ }
44
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/RequiredExtensionNotLoadedException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
18
+
19
+ /**
20
+ * Thrown when a particular PHP extension is required to execute the guarded logic, but the extension is not loaded
21
+ */
22
+ class RequiredExtensionNotLoadedException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/RuntimeException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
18
+
19
+ /**
20
+ * AWS SDK namespaced version of the SPL RuntimeException.
21
+ */
22
+ class RuntimeException extends \RuntimeException implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\AwsExceptionInterface
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/ServiceResponseException.php ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response;
21
+ /**
22
+ * Default AWS exception
23
+ */
24
+ class ServiceResponseException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException
25
+ {
26
+ /**
27
+ * @var Response Response
28
+ */
29
+ protected $response;
30
+ /**
31
+ * @var RequestInterface Request
32
+ */
33
+ protected $request;
34
+ /**
35
+ * @var string Request ID
36
+ */
37
+ protected $requestId;
38
+ /**
39
+ * @var string Exception type (client / server)
40
+ */
41
+ protected $exceptionType;
42
+ /**
43
+ * @var string Exception code
44
+ */
45
+ protected $exceptionCode;
46
+ /**
47
+ * Set the exception code
48
+ *
49
+ * @param string $code Exception code
50
+ */
51
+ public function setExceptionCode($code)
52
+ {
53
+ $this->exceptionCode = $code;
54
+ }
55
+ /**
56
+ * Get the exception code
57
+ *
58
+ * @return string|null
59
+ */
60
+ public function getExceptionCode()
61
+ {
62
+ return $this->exceptionCode;
63
+ }
64
+ /**
65
+ * Set the exception type
66
+ *
67
+ * @param string $type Exception type
68
+ */
69
+ public function setExceptionType($type)
70
+ {
71
+ $this->exceptionType = $type;
72
+ }
73
+ /**
74
+ * Get the exception type (one of client or server)
75
+ *
76
+ * @return string|null
77
+ */
78
+ public function getExceptionType()
79
+ {
80
+ return $this->exceptionType;
81
+ }
82
+ /**
83
+ * Set the request ID
84
+ *
85
+ * @param string $id Request ID
86
+ */
87
+ public function setRequestId($id)
88
+ {
89
+ $this->requestId = $id;
90
+ }
91
+ /**
92
+ * Get the Request ID
93
+ *
94
+ * @return string|null
95
+ */
96
+ public function getRequestId()
97
+ {
98
+ return $this->requestId;
99
+ }
100
+ /**
101
+ * Set the associated response
102
+ *
103
+ * @param Response $response Response
104
+ */
105
+ public function setResponse(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response $response)
106
+ {
107
+ $this->response = $response;
108
+ }
109
+ /**
110
+ * Get the associated response object
111
+ *
112
+ * @return Response|null
113
+ */
114
+ public function getResponse()
115
+ {
116
+ return $this->response;
117
+ }
118
+ /**
119
+ * Set the associated request
120
+ *
121
+ * @param RequestInterface $request
122
+ */
123
+ public function setRequest(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request)
124
+ {
125
+ $this->request = $request;
126
+ }
127
+ /**
128
+ * Get the associated request object
129
+ *
130
+ * @return RequestInterface|null
131
+ */
132
+ public function getRequest()
133
+ {
134
+ return $this->request;
135
+ }
136
+ /**
137
+ * Get the status code of the response
138
+ *
139
+ * @return int|null
140
+ */
141
+ public function getStatusCode()
142
+ {
143
+ return $this->response ? $this->response->getStatusCode() : null;
144
+ }
145
+ /**
146
+ * Cast to a string
147
+ *
148
+ * @return string
149
+ */
150
+ public function __toString()
151
+ {
152
+ $message = get_class($this) . ': ' . 'AWS Error Code: ' . $this->getExceptionCode() . ', ' . 'Status Code: ' . $this->getStatusCode() . ', ' . 'AWS Request ID: ' . $this->getRequestId() . ', ' . 'AWS Error Type: ' . $this->getExceptionType() . ', ' . 'AWS Error Message: ' . $this->getMessage();
153
+ // Add the User-Agent if available
154
+ if ($this->request) {
155
+ $message .= ', ' . 'User-Agent: ' . $this->request->getHeader('User-Agent');
156
+ }
157
+ return $message;
158
+ }
159
+ /**
160
+ * Get the request ID of the error. This value is only present if a
161
+ * response was received, and is not present in the event of a networking
162
+ * error.
163
+ *
164
+ * Same as `getRequestId()` method, but matches the interface for SDKv3.
165
+ *
166
+ * @return string|null Returns null if no response was received
167
+ */
168
+ public function getAwsRequestId()
169
+ {
170
+ return $this->requestId;
171
+ }
172
+ /**
173
+ * Get the AWS error type.
174
+ *
175
+ * Same as `getExceptionType()` method, but matches the interface for SDKv3.
176
+ *
177
+ * @return string|null Returns null if no response was received
178
+ */
179
+ public function getAwsErrorType()
180
+ {
181
+ return $this->exceptionType;
182
+ }
183
+ /**
184
+ * Get the AWS error code.
185
+ *
186
+ * Same as `getExceptionCode()` method, but matches the interface for SDKv3.
187
+ *
188
+ * @return string|null Returns null if no response was received
189
+ */
190
+ public function getAwsErrorCode()
191
+ {
192
+ return $this->exceptionCode;
193
+ }
194
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/TransferException.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Exception\CurlException;
20
+ /**
21
+ * Transfer request exception
22
+ */
23
+ class TransferException extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Exception\CurlException implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\AwsExceptionInterface
24
+ {
25
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Exception/UnexpectedValueException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception;
18
+
19
+ /**
20
+ * AWS SDK namespaced version of the SPL UnexpectedValueException.
21
+ */
22
+ class UnexpectedValueException extends \UnexpectedValueException implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\AwsExceptionInterface
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Facade/Facade.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Aws;
20
+ /**
21
+ * Base facade class that handles the delegation logic
22
+ *
23
+ * @deprecated "Facades" are being removed in version 3.0 of the SDK.
24
+ */
25
+ abstract class Facade implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\FacadeInterface
26
+ {
27
+ /** @var Aws */
28
+ protected static $serviceBuilder;
29
+ /**
30
+ * Mounts the facades by extracting information from the service builder config and using creating class aliases
31
+ *
32
+ * @param string|null $targetNamespace Namespace that the facades should be mounted to. Defaults to global namespace
33
+ *
34
+ * @param Aws $serviceBuilder
35
+ */
36
+ public static function mountFacades(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Aws $serviceBuilder, $targetNamespace = null)
37
+ {
38
+ self::$serviceBuilder = $serviceBuilder;
39
+ require_once __DIR__ . '/facade-classes.php';
40
+ foreach ($serviceBuilder->getConfig() as $service) {
41
+ if (isset($service['alias'], $service['class'])) {
42
+ $facadeClass = __NAMESPACE__ . '\\' . $service['alias'];
43
+ $facadeAlias = ltrim($targetNamespace . '\\' . $service['alias'], '\\');
44
+ if (!class_exists($facadeAlias) && class_exists($facadeClass)) {
45
+ // @codeCoverageIgnoreStart
46
+ class_alias($facadeClass, $facadeAlias);
47
+ // @codeCoverageIgnoreEnd
48
+ }
49
+ }
50
+ }
51
+ }
52
+ /**
53
+ * Returns the instance of the client that the facade operates on
54
+ *
55
+ * @return \Aws\Common\Client\AwsClientInterface
56
+ */
57
+ public static function getClient()
58
+ {
59
+ return self::$serviceBuilder->get(static::getServiceBuilderKey());
60
+ }
61
+ public static function __callStatic($method, $args)
62
+ {
63
+ return call_user_func_array(array(self::getClient(), $method), $args);
64
+ }
65
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Facade/FacadeInterface.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade;
18
+
19
+ /**
20
+ * Interface that defines a client facade. Facades are convenient static classes that allow you to run client methods
21
+ * statically on a default instance from the service builder. The facades themselves are aliased into the global
22
+ * namespace for ease of use.
23
+ *
24
+ * @deprecated "Facades" are being removed in version 3.0 of the SDK.
25
+ */
26
+ interface FacadeInterface
27
+ {
28
+ /**
29
+ * Returns the key used to access the client instance from the Service Builder
30
+ *
31
+ * @return string
32
+ */
33
+ public static function getServiceBuilderKey();
34
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Facade/facade-classes.php ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade;
18
+
19
+ /**
20
+ * The following classes are used to implement the static client facades and are aliased into the global namespaced. We
21
+ * discourage the use of these classes directly by their full namespace since they are not autoloaded and are considered
22
+ * an implementation detail that could possibly be changed in the future.
23
+ */
24
+ // @codeCoverageIgnoreStart
25
+ class AutoScaling extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
26
+ {
27
+ public static function getServiceBuilderKey()
28
+ {
29
+ return 'autoscaling';
30
+ }
31
+ }
32
+ class CloudFormation extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
33
+ {
34
+ public static function getServiceBuilderKey()
35
+ {
36
+ return 'cloudformation';
37
+ }
38
+ }
39
+ class CloudFront extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
40
+ {
41
+ public static function getServiceBuilderKey()
42
+ {
43
+ return 'cloudfront';
44
+ }
45
+ }
46
+ class CloudSearch extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
47
+ {
48
+ public static function getServiceBuilderKey()
49
+ {
50
+ return 'cloudsearch';
51
+ }
52
+ }
53
+ class CloudTrail extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
54
+ {
55
+ public static function getServiceBuilderKey()
56
+ {
57
+ return 'cloudtrail';
58
+ }
59
+ }
60
+ class CloudWatch extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
61
+ {
62
+ public static function getServiceBuilderKey()
63
+ {
64
+ return 'cloudwatch';
65
+ }
66
+ }
67
+ class DataPipeline extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
68
+ {
69
+ public static function getServiceBuilderKey()
70
+ {
71
+ return 'datapipeline';
72
+ }
73
+ }
74
+ class DirectConnect extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
75
+ {
76
+ public static function getServiceBuilderKey()
77
+ {
78
+ return 'directconnect';
79
+ }
80
+ }
81
+ class DynamoDb extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
82
+ {
83
+ public static function getServiceBuilderKey()
84
+ {
85
+ return 'dynamodb';
86
+ }
87
+ }
88
+ class Ec2 extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
89
+ {
90
+ public static function getServiceBuilderKey()
91
+ {
92
+ return 'ec2';
93
+ }
94
+ }
95
+ class ElastiCache extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
96
+ {
97
+ public static function getServiceBuilderKey()
98
+ {
99
+ return 'elasticache';
100
+ }
101
+ }
102
+ class ElasticBeanstalk extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
103
+ {
104
+ public static function getServiceBuilderKey()
105
+ {
106
+ return 'elasticbeanstalk';
107
+ }
108
+ }
109
+ class ElasticLoadBalancing extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
110
+ {
111
+ public static function getServiceBuilderKey()
112
+ {
113
+ return 'elasticloadbalancing';
114
+ }
115
+ }
116
+ class ElasticTranscoder extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
117
+ {
118
+ public static function getServiceBuilderKey()
119
+ {
120
+ return 'elastictranscoder';
121
+ }
122
+ }
123
+ class Emr extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
124
+ {
125
+ public static function getServiceBuilderKey()
126
+ {
127
+ return 'emr';
128
+ }
129
+ }
130
+ class Glacier extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
131
+ {
132
+ public static function getServiceBuilderKey()
133
+ {
134
+ return 'glacier';
135
+ }
136
+ }
137
+ class Iam extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
138
+ {
139
+ public static function getServiceBuilderKey()
140
+ {
141
+ return 'iam';
142
+ }
143
+ }
144
+ class ImportExport extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
145
+ {
146
+ public static function getServiceBuilderKey()
147
+ {
148
+ return 'importexport';
149
+ }
150
+ }
151
+ class Kinesis extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
152
+ {
153
+ public static function getServiceBuilderKey()
154
+ {
155
+ return 'kinesis';
156
+ }
157
+ }
158
+ class OpsWorks extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
159
+ {
160
+ public static function getServiceBuilderKey()
161
+ {
162
+ return 'opsworks';
163
+ }
164
+ }
165
+ class Rds extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
166
+ {
167
+ public static function getServiceBuilderKey()
168
+ {
169
+ return 'rds';
170
+ }
171
+ }
172
+ class Redshift extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
173
+ {
174
+ public static function getServiceBuilderKey()
175
+ {
176
+ return 'redshift';
177
+ }
178
+ }
179
+ class Route53 extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
180
+ {
181
+ public static function getServiceBuilderKey()
182
+ {
183
+ return 'route53';
184
+ }
185
+ }
186
+ class S3 extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
187
+ {
188
+ public static function getServiceBuilderKey()
189
+ {
190
+ return 's3';
191
+ }
192
+ }
193
+ class SimpleDb extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
194
+ {
195
+ public static function getServiceBuilderKey()
196
+ {
197
+ return 'sdb';
198
+ }
199
+ }
200
+ class Ses extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
201
+ {
202
+ public static function getServiceBuilderKey()
203
+ {
204
+ return 'ses';
205
+ }
206
+ }
207
+ class Sns extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
208
+ {
209
+ public static function getServiceBuilderKey()
210
+ {
211
+ return 'sns';
212
+ }
213
+ }
214
+ class Sqs extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
215
+ {
216
+ public static function getServiceBuilderKey()
217
+ {
218
+ return 'sqs';
219
+ }
220
+ }
221
+ class StorageGateway extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
222
+ {
223
+ public static function getServiceBuilderKey()
224
+ {
225
+ return 'storagegateway';
226
+ }
227
+ }
228
+ class Sts extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
229
+ {
230
+ public static function getServiceBuilderKey()
231
+ {
232
+ return 'sts';
233
+ }
234
+ }
235
+ class Support extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
236
+ {
237
+ public static function getServiceBuilderKey()
238
+ {
239
+ return 'support';
240
+ }
241
+ }
242
+ class Swf extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Facade\Facade
243
+ {
244
+ public static function getServiceBuilderKey()
245
+ {
246
+ return 'swf';
247
+ }
248
+ }
249
+ // @codeCoverageIgnoreEnd
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Hash/ChunkHash.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Hash;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\LogicException;
20
+ /**
21
+ * Encapsulates the creation of a hash from streamed chunks of data
22
+ */
23
+ class ChunkHash implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Hash\ChunkHashInterface
24
+ {
25
+ /**
26
+ * @var resource The hash context as created by `hash_init()`
27
+ */
28
+ protected $context;
29
+ /**
30
+ * @var string The resulting hash in hex form
31
+ */
32
+ protected $hash;
33
+ /**
34
+ * @var string The resulting hash in binary form
35
+ */
36
+ protected $hashRaw;
37
+ /**
38
+ * {@inheritdoc}
39
+ */
40
+ public function __construct($algorithm = self::DEFAULT_ALGORITHM)
41
+ {
42
+ \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Hash\HashUtils::validateAlgorithm($algorithm);
43
+ $this->context = hash_init($algorithm);
44
+ }
45
+ /**
46
+ * {@inheritdoc}
47
+ */
48
+ public function addData($data)
49
+ {
50
+ if (!$this->context) {
51
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\LogicException('You may not add more data to a finalized chunk hash.');
52
+ }
53
+ hash_update($this->context, $data);
54
+ return $this;
55
+ }
56
+ /**
57
+ * {@inheritdoc}
58
+ */
59
+ public function getHash($returnBinaryForm = false)
60
+ {
61
+ if (!$this->hash) {
62
+ $this->hashRaw = hash_final($this->context, true);
63
+ $this->hash = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Hash\HashUtils::binToHex($this->hashRaw);
64
+ $this->context = null;
65
+ }
66
+ return $returnBinaryForm ? $this->hashRaw : $this->hash;
67
+ }
68
+ /**
69
+ * {@inheritdoc}
70
+ */
71
+ public function __clone()
72
+ {
73
+ if ($this->context) {
74
+ $this->context = hash_copy($this->context);
75
+ }
76
+ }
77
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Hash/ChunkHashInterface.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Hash;
18
+
19
+ /**
20
+ * Interface for objects that encapsulate the creation of a hash from streamed chunks of data
21
+ */
22
+ interface ChunkHashInterface
23
+ {
24
+ const DEFAULT_ALGORITHM = 'sha256';
25
+ /**
26
+ * Constructs the chunk hash and sets the algorithm to use for hashing
27
+ *
28
+ * @param string $algorithm A valid hash algorithm name as returned by `hash_algos()`
29
+ *
30
+ * @return self
31
+ */
32
+ public function __construct($algorithm = 'sha256');
33
+ /**
34
+ * Add a chunk of data to be hashed
35
+ *
36
+ * @param string $data Data to be hashed
37
+ *
38
+ * @return self
39
+ */
40
+ public function addData($data);
41
+ /**
42
+ * Return the results of the hash
43
+ *
44
+ * @param bool $returnBinaryForm If true, returns the hash in binary form instead of hex form
45
+ *
46
+ * @return string
47
+ */
48
+ public function getHash($returnBinaryForm = false);
49
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Hash/HashUtils.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Hash;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
20
+ /**
21
+ * Contains hashing utilities
22
+ */
23
+ class HashUtils
24
+ {
25
+ /**
26
+ * Converts a hash in hex form to binary form
27
+ *
28
+ * @param string $hash Hash in hex form
29
+ *
30
+ * @return string Hash in binary form
31
+ */
32
+ public static function hexToBin($hash)
33
+ {
34
+ // If using PHP 5.4, there is a native function to convert from hex to binary
35
+ static $useNative;
36
+ if ($useNative === null) {
37
+ $useNative = function_exists('hex2bin');
38
+ }
39
+ if (!$useNative && strlen($hash) % 2 !== 0) {
40
+ $hash = '0' . $hash;
41
+ }
42
+ return $useNative ? hex2bin($hash) : pack("H*", $hash);
43
+ }
44
+ /**
45
+ * Converts a hash in binary form to hex form
46
+ *
47
+ * @param string $hash Hash in binary form
48
+ *
49
+ * @return string Hash in hex form
50
+ */
51
+ public static function binToHex($hash)
52
+ {
53
+ return bin2hex($hash);
54
+ }
55
+ /**
56
+ * Checks if the algorithm specified exists and throws an exception if it does not
57
+ *
58
+ * @param string $algorithm Name of the algorithm to validate
59
+ *
60
+ * @return bool
61
+ * @throws InvalidArgumentException if the algorithm doesn't exist
62
+ */
63
+ public static function validateAlgorithm($algorithm)
64
+ {
65
+ if (!in_array($algorithm, hash_algos(), true)) {
66
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException("The hashing algorithm specified ({$algorithm}) does not exist.");
67
+ }
68
+ return true;
69
+ }
70
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Hash/TreeHash.php ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Hash;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\Size;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\LogicException;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBody;
23
+ /**
24
+ * Encapsulates the creation of a tree hash from streamed chunks of data
25
+ */
26
+ class TreeHash implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Hash\ChunkHashInterface
27
+ {
28
+ /**
29
+ * @var string The algorithm used for hashing
30
+ */
31
+ protected $algorithm;
32
+ /**
33
+ * @var array Set of binary checksums from which the tree hash is derived
34
+ */
35
+ protected $checksums = array();
36
+ /**
37
+ * @var string The resulting hash in hex form
38
+ */
39
+ protected $hash;
40
+ /**
41
+ * @var string The resulting hash in binary form
42
+ */
43
+ protected $hashRaw;
44
+ /**
45
+ * Create a tree hash from an array of existing tree hash checksums
46
+ *
47
+ * @param array $checksums Set of checksums
48
+ * @param bool $inBinaryForm Whether or not the checksums are already in binary form
49
+ * @param string $algorithm A valid hash algorithm name as returned by `hash_algos()`
50
+ *
51
+ * @return TreeHash
52
+ */
53
+ public static function fromChecksums(array $checksums, $inBinaryForm = false, $algorithm = self::DEFAULT_ALGORITHM)
54
+ {
55
+ $treeHash = new self($algorithm);
56
+ // Convert checksums to binary form if provided in hex form and add them to the tree hash
57
+ $treeHash->checksums = $inBinaryForm ? $checksums : array_map('DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Common\\Hash\\HashUtils::hexToBin', $checksums);
58
+ // Pre-calculate hash
59
+ $treeHash->getHash();
60
+ return $treeHash;
61
+ }
62
+ /**
63
+ * Create a tree hash from a content body
64
+ *
65
+ * @param string|resource|EntityBody $content Content to create a tree hash for
66
+ * @param string $algorithm A valid hash algorithm name as returned by `hash_algos()`
67
+ *
68
+ * @return TreeHash
69
+ */
70
+ public static function fromContent($content, $algorithm = self::DEFAULT_ALGORITHM)
71
+ {
72
+ $treeHash = new self($algorithm);
73
+ // Read the data in 1MB chunks and add to tree hash
74
+ $content = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBody::factory($content);
75
+ while ($data = $content->read(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\Size::MB)) {
76
+ $treeHash->addData($data);
77
+ }
78
+ // Pre-calculate hash
79
+ $treeHash->getHash();
80
+ return $treeHash;
81
+ }
82
+ /**
83
+ * Validates an entity body with a tree hash checksum
84
+ *
85
+ * @param string|resource|EntityBody $content Content to create a tree hash for
86
+ * @param string $checksum The checksum to use for validation
87
+ * @param string $algorithm A valid hash algorithm name as returned by `hash_algos()`
88
+ *
89
+ * @return bool
90
+ */
91
+ public static function validateChecksum($content, $checksum, $algorithm = self::DEFAULT_ALGORITHM)
92
+ {
93
+ $treeHash = self::fromContent($content, $algorithm);
94
+ return $checksum === $treeHash->getHash();
95
+ }
96
+ /**
97
+ * {@inheritdoc}
98
+ */
99
+ public function __construct($algorithm = self::DEFAULT_ALGORITHM)
100
+ {
101
+ \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Hash\HashUtils::validateAlgorithm($algorithm);
102
+ $this->algorithm = $algorithm;
103
+ }
104
+ /**
105
+ * {@inheritdoc}
106
+ * @throws LogicException if the root tree hash is already calculated
107
+ * @throws InvalidArgumentException if the data is larger than 1MB
108
+ */
109
+ public function addData($data)
110
+ {
111
+ // Error if hash is already calculated
112
+ if ($this->hash) {
113
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\LogicException('You may not add more data to a finalized tree hash.');
114
+ }
115
+ // Make sure that only 1MB chunks or smaller get passed in
116
+ if (strlen($data) > \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\Size::MB) {
117
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('The chunk of data added is too large for tree hashing.');
118
+ }
119
+ // Store the raw hash of this data segment
120
+ $this->checksums[] = hash($this->algorithm, $data, true);
121
+ return $this;
122
+ }
123
+ /**
124
+ * Add a checksum to the tree hash directly
125
+ *
126
+ * @param string $checksum The checksum to add
127
+ * @param bool $inBinaryForm Whether or not the checksum is already in binary form
128
+ *
129
+ * @return self
130
+ * @throws LogicException if the root tree hash is already calculated
131
+ */
132
+ public function addChecksum($checksum, $inBinaryForm = false)
133
+ {
134
+ // Error if hash is already calculated
135
+ if ($this->hash) {
136
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\LogicException('You may not add more checksums to a finalized tree hash.');
137
+ }
138
+ // Convert the checksum to binary form if necessary
139
+ $this->checksums[] = $inBinaryForm ? $checksum : \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Hash\HashUtils::hexToBin($checksum);
140
+ return $this;
141
+ }
142
+ /**
143
+ * {@inheritdoc}
144
+ */
145
+ public function getHash($returnBinaryForm = false)
146
+ {
147
+ if (!$this->hash) {
148
+ // Perform hashes up the tree to arrive at the root checksum of the tree hash
149
+ $hashes = $this->checksums;
150
+ while (count($hashes) > 1) {
151
+ $sets = array_chunk($hashes, 2);
152
+ $hashes = array();
153
+ foreach ($sets as $set) {
154
+ $hashes[] = count($set) === 1 ? $set[0] : hash($this->algorithm, $set[0] . $set[1], true);
155
+ }
156
+ }
157
+ $this->hashRaw = $hashes[0];
158
+ $this->hash = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Hash\HashUtils::binToHex($this->hashRaw);
159
+ }
160
+ return $returnBinaryForm ? $this->hashRaw : $this->hash;
161
+ }
162
+ /**
163
+ * @return array Array of raw checksums composing the tree hash
164
+ */
165
+ public function getChecksums()
166
+ {
167
+ return $this->checksums;
168
+ }
169
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/HostNameUtils.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Url;
20
+ /**
21
+ * Utility class for parsing regions and services from URLs
22
+ */
23
+ class HostNameUtils
24
+ {
25
+ const DEFAULT_REGION = 'us-east-1';
26
+ const DEFAULT_GOV_REGION = 'us-gov-west-1';
27
+ /**
28
+ * Parse the AWS region name from a URL
29
+ *
30
+ *
31
+ * @param Url $url HTTP URL
32
+ *
33
+ * @return string
34
+ * @link http://docs.aws.amazon.com/general/latest/gr/rande.html
35
+ */
36
+ public static function parseRegionName(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Url $url)
37
+ {
38
+ // If we don't recognize the domain, just return the default
39
+ if (substr($url->getHost(), -14) != '.amazonaws.com') {
40
+ return self::DEFAULT_REGION;
41
+ }
42
+ $serviceAndRegion = substr($url->getHost(), 0, -14);
43
+ // Special handling for S3 regions
44
+ $separator = strpos($serviceAndRegion, 's3') === 0 ? '-' : '.';
45
+ $separatorPos = strpos($serviceAndRegion, $separator);
46
+ // If don't detect a separator, then return the default region
47
+ if ($separatorPos === false) {
48
+ return self::DEFAULT_REGION;
49
+ }
50
+ $region = substr($serviceAndRegion, $separatorPos + 1);
51
+ // All GOV regions currently use the default GOV region
52
+ if ($region == 'us-gov') {
53
+ return self::DEFAULT_GOV_REGION;
54
+ }
55
+ return $region;
56
+ }
57
+ /**
58
+ * Parse the AWS service name from a URL
59
+ *
60
+ * @param Url $url HTTP URL
61
+ *
62
+ * @return string Returns a service name (or empty string)
63
+ * @link http://docs.aws.amazon.com/general/latest/gr/rande.html
64
+ */
65
+ public static function parseServiceName(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Url $url)
66
+ {
67
+ // The service name is the first part of the host
68
+ $parts = explode('.', $url->getHost(), 2);
69
+ // Special handling for S3
70
+ if (stripos($parts[0], 's3') === 0) {
71
+ return 's3';
72
+ }
73
+ return $parts[0];
74
+ }
75
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/InstanceMetadata/InstanceMetadataClient.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\InstanceMetadata;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions as Options;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InstanceProfileCredentialsException;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\Credentials;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AbstractClient;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection;
24
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestFactory;
25
+ /**
26
+ * Client used for interacting with the Amazon EC2 instance metadata server
27
+ */
28
+ class InstanceMetadataClient extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AbstractClient
29
+ {
30
+ /**
31
+ * Factory method to create a new InstanceMetadataClient using an array
32
+ * of configuration options.
33
+ *
34
+ * The configuration options accepts the following array keys and values:
35
+ * - base_url: Override the base URL of the instance metadata server
36
+ * - version: Version of the metadata server to interact with
37
+ *
38
+ * @param array|Collection $config Configuration options
39
+ *
40
+ * @return InstanceMetadataClient
41
+ */
42
+ public static function factory($config = array())
43
+ {
44
+ $config = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection::fromConfig($config, array(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BASE_URL => 'http://169.254.169.254/{version}/', 'version' => 'latest', 'request.options' => array('connect_timeout' => 5, 'timeout' => 10)), array('base_url', 'version'));
45
+ return new self($config);
46
+ }
47
+ /**
48
+ * Constructor override
49
+ */
50
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection $config)
51
+ {
52
+ $this->setConfig($config);
53
+ $this->setBaseUrl($config->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BASE_URL));
54
+ $this->defaultHeaders = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection();
55
+ $this->setRequestFactory(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestFactory::getInstance());
56
+ }
57
+ /**
58
+ * Get instance profile credentials
59
+ *
60
+ * @return Credentials
61
+ * @throws InstanceProfileCredentialsException
62
+ */
63
+ public function getInstanceProfileCredentials()
64
+ {
65
+ try {
66
+ $request = $this->get('meta-data/iam/security-credentials/');
67
+ $credentials = trim($request->send()->getBody(true));
68
+ $result = $this->get("meta-data/iam/security-credentials/{$credentials}")->send()->json();
69
+ } catch (\Exception $e) {
70
+ $message = sprintf('Error retrieving credentials from the instance profile metadata server. When you are' . ' not running inside of Amazon EC2, you must provide your AWS access key ID and secret access key in' . ' the "key" and "secret" options when creating a client or provide an instantiated' . ' Aws\\Common\\Credentials\\CredentialsInterface object. (%s)', $e->getMessage());
71
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InstanceProfileCredentialsException($message, $e->getCode());
72
+ }
73
+ // Ensure that the status code was successful
74
+ if ($result['Code'] !== 'Success') {
75
+ $e = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InstanceProfileCredentialsException('Unexpected response code: ' . $result['Code']);
76
+ $e->setStatusCode($result['Code']);
77
+ throw $e;
78
+ }
79
+ return new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\Credentials($result['AccessKeyId'], $result['SecretAccessKey'], $result['Token'], strtotime($result['Expiration']));
80
+ }
81
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/InstanceMetadata/Waiter/ServiceAvailable.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\InstanceMetadata\Waiter;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\AbstractResourceWaiter;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Exception\CurlException;
21
+ /**
22
+ * Waits until the instance metadata service is responding. Will send up to
23
+ * 4 requests with a 5 second delay between each try. Each try can last up to
24
+ * 11 seconds to complete if the service is not responding.
25
+ *
26
+ * @codeCoverageIgnore
27
+ */
28
+ class ServiceAvailable extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\AbstractResourceWaiter
29
+ {
30
+ protected $interval = 5;
31
+ protected $maxAttempts = 4;
32
+ /**
33
+ * {@inheritdoc}
34
+ */
35
+ public function doWait()
36
+ {
37
+ $request = $this->client->get();
38
+ try {
39
+ $request->getCurlOptions()->set(CURLOPT_CONNECTTIMEOUT, 10)->set(CURLOPT_TIMEOUT, 10);
40
+ $request->send();
41
+ return true;
42
+ } catch (CurlException $e) {
43
+ return false;
44
+ }
45
+ }
46
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Iterator/AwsResourceIterator.php ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Iterator;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\UaString as Ua;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\Model;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\ResourceIterator;
23
+ /**
24
+ * Iterate over a client command
25
+ */
26
+ class AwsResourceIterator extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\ResourceIterator
27
+ {
28
+ /**
29
+ * @var Model Result of a command
30
+ */
31
+ protected $lastResult = null;
32
+ /**
33
+ * Provides access to the most recent result obtained by the iterator. This makes it easier to extract any
34
+ * additional information from the result which you do not have access to from the values emitted by the iterator
35
+ *
36
+ * @return Model|null
37
+ */
38
+ public function getLastResult()
39
+ {
40
+ return $this->lastResult;
41
+ }
42
+ /**
43
+ * {@inheritdoc}
44
+ * This AWS specific version of the resource iterator provides a default implementation of the typical AWS iterator
45
+ * process. It relies on configuration and extension to implement the operation-specific logic of handling results
46
+ * and nextTokens. This method will loop until resources are acquired or there are no more iterations available.
47
+ */
48
+ protected function sendRequest()
49
+ {
50
+ do {
51
+ // Prepare the request including setting the next token
52
+ $this->prepareRequest();
53
+ if ($this->nextToken) {
54
+ $this->applyNextToken();
55
+ }
56
+ // Execute the request and handle the results
57
+ $this->command->add(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\UaString::OPTION, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\UaString::ITERATOR);
58
+ $this->lastResult = $this->command->getResult();
59
+ $resources = $this->handleResults($this->lastResult);
60
+ $this->determineNextToken($this->lastResult);
61
+ // If no resources collected, prepare to reiterate before yielding
62
+ if ($reiterate = empty($resources) && $this->nextToken) {
63
+ $this->command = clone $this->originalCommand;
64
+ }
65
+ } while ($reiterate);
66
+ return $resources;
67
+ }
68
+ protected function prepareRequest()
69
+ {
70
+ // Get the limit parameter key to set
71
+ $limitKey = $this->get('limit_key');
72
+ if ($limitKey && ($limit = $this->command->get($limitKey))) {
73
+ $pageSize = $this->calculatePageSize();
74
+ // If the limit of the command is different than the pageSize of the iterator, use the smaller value
75
+ if ($limit && $pageSize) {
76
+ $realLimit = min($limit, $pageSize);
77
+ $this->command->set($limitKey, $realLimit);
78
+ }
79
+ }
80
+ }
81
+ protected function handleResults(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\Model $result)
82
+ {
83
+ $results = array();
84
+ // Get the result key that contains the results
85
+ if ($resultKey = $this->get('result_key')) {
86
+ $results = $this->getValueFromResult($result, $resultKey) ?: array();
87
+ }
88
+ return $results;
89
+ }
90
+ protected function applyNextToken()
91
+ {
92
+ // Get the token parameter key to set
93
+ if ($tokenParam = $this->get('input_token')) {
94
+ // Set the next token. Works with multi-value tokens
95
+ if (is_array($tokenParam)) {
96
+ if (is_array($this->nextToken) && count($tokenParam) === count($this->nextToken)) {
97
+ foreach (array_combine($tokenParam, $this->nextToken) as $param => $token) {
98
+ $this->command->set($param, $token);
99
+ }
100
+ } else {
101
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException('The definition of the iterator\'s token parameter and the actual token ' . 'value are not compatible.');
102
+ }
103
+ } else {
104
+ $this->command->set($tokenParam, $this->nextToken);
105
+ }
106
+ }
107
+ }
108
+ protected function determineNextToken(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\Model $result)
109
+ {
110
+ $this->nextToken = null;
111
+ // If the value of "more_results" is true or there is no "more_results" to check, then try to get the next token
112
+ $moreKey = $this->get('more_results');
113
+ if ($moreKey === null || $this->getValueFromResult($result, $moreKey)) {
114
+ // Get the token key to check
115
+ if ($tokenKey = $this->get('output_token')) {
116
+ // Get the next token's value. Works with multi-value tokens
117
+ if (is_array($tokenKey)) {
118
+ $this->nextToken = array();
119
+ foreach ($tokenKey as $key) {
120
+ $this->nextToken[] = $this->getValueFromResult($result, $key);
121
+ }
122
+ } else {
123
+ $this->nextToken = $this->getValueFromResult($result, $tokenKey);
124
+ }
125
+ }
126
+ }
127
+ }
128
+ /**
129
+ * Extracts the value from the result using Collection::getPath. Also adds some additional logic for keys that need
130
+ * to access n-1 indexes (e.g., ImportExport, Kinesis). The n-1 logic only works for the known cases. We will switch
131
+ * to a jmespath implementation in the future to cover all cases
132
+ *
133
+ * @param Model $result
134
+ * @param string $key
135
+ *
136
+ * @return mixed|null
137
+ */
138
+ protected function getValueFromResult(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\Model $result, $key)
139
+ {
140
+ // Special handling for keys that need to access n-1 indexes
141
+ if (strpos($key, '#') !== false) {
142
+ $keyParts = explode('#', $key, 2);
143
+ $items = $result->getPath(trim($keyParts[0], '/'));
144
+ if ($items && is_array($items)) {
145
+ $index = count($items) - 1;
146
+ $key = strtr($key, array('#' => $index));
147
+ }
148
+ }
149
+ // Get the value
150
+ return $result->getPath($key);
151
+ }
152
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Iterator/AwsResourceIteratorFactory.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Iterator;
4
+
5
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
6
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection;
7
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface;
8
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\ResourceIteratorFactoryInterface;
9
+ /**
10
+ * Resource iterator factory used to instantiate the default AWS resource iterator with the correct configuration or
11
+ * use a concrete iterator class if one exists
12
+ */
13
+ class AwsResourceIteratorFactory implements \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\ResourceIteratorFactoryInterface
14
+ {
15
+ /**
16
+ * @var array Default configuration values for iterators
17
+ */
18
+ protected static $defaultIteratorConfig = array('input_token' => null, 'output_token' => null, 'limit_key' => null, 'result_key' => null, 'more_results' => null);
19
+ /**
20
+ * @var array Legacy configuration options mapped to their new names
21
+ */
22
+ private static $legacyConfigOptions = array('token_param' => 'input_token', 'token_key' => 'output_token', 'limit_param' => 'limit_key', 'more_key' => 'more_results');
23
+ /**
24
+ * @var array Iterator configuration for each iterable operation
25
+ */
26
+ protected $config;
27
+ /**
28
+ * @var ResourceIteratorFactoryInterface Another factory that will be used first to instantiate the iterator
29
+ */
30
+ protected $primaryIteratorFactory;
31
+ /**
32
+ * @param array $config An array of configuration values for the factory
33
+ * @param ResourceIteratorFactoryInterface $primaryIteratorFactory Another factory to use for chain of command
34
+ */
35
+ public function __construct(array $config, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\ResourceIteratorFactoryInterface $primaryIteratorFactory = null)
36
+ {
37
+ $this->primaryIteratorFactory = $primaryIteratorFactory;
38
+ $this->config = array();
39
+ foreach ($config as $name => $operation) {
40
+ $this->config[$name] = $operation + self::$defaultIteratorConfig;
41
+ }
42
+ }
43
+ public function build(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface $command, array $options = array())
44
+ {
45
+ // Get the configuration data for the command
46
+ $commandName = $command->getName();
47
+ $commandSupported = isset($this->config[$commandName]);
48
+ $options = $this->translateLegacyConfigOptions($options);
49
+ $options += $commandSupported ? $this->config[$commandName] : array();
50
+ // Instantiate the iterator using the primary factory (if one was provided)
51
+ if ($this->primaryIteratorFactory && $this->primaryIteratorFactory->canBuild($command)) {
52
+ $iterator = $this->primaryIteratorFactory->build($command, $options);
53
+ } elseif (!$commandSupported) {
54
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException("Iterator was not found for {$commandName}.");
55
+ } else {
56
+ // Instantiate a generic AWS resource iterator
57
+ $iterator = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Iterator\AwsResourceIterator($command, $options);
58
+ }
59
+ return $iterator;
60
+ }
61
+ public function canBuild(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface $command)
62
+ {
63
+ if ($this->primaryIteratorFactory) {
64
+ return $this->primaryIteratorFactory->canBuild($command);
65
+ } else {
66
+ return isset($this->config[$command->getName()]);
67
+ }
68
+ }
69
+ /**
70
+ * @param array $config The config for a single operation
71
+ *
72
+ * @return array The modified config with legacy options translated
73
+ */
74
+ private function translateLegacyConfigOptions($config)
75
+ {
76
+ foreach (self::$legacyConfigOptions as $legacyOption => $newOption) {
77
+ if (isset($config[$legacyOption])) {
78
+ $config[$newOption] = $config[$legacyOption];
79
+ unset($config[$legacyOption]);
80
+ }
81
+ }
82
+ return $config;
83
+ }
84
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/AbstractTransfer.php ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AwsClientInterface;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\MultipartUploadException;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\AbstractHasDispatcher;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBody;
24
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBodyInterface;
25
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\OperationCommand;
26
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\Model;
27
+ /**
28
+ * Abstract class for transfer commonalities
29
+ */
30
+ abstract class AbstractTransfer extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\AbstractHasDispatcher implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\TransferInterface
31
+ {
32
+ const BEFORE_UPLOAD = 'multipart_upload.before_upload';
33
+ const AFTER_UPLOAD = 'multipart_upload.after_upload';
34
+ const BEFORE_PART_UPLOAD = 'multipart_upload.before_part_upload';
35
+ const AFTER_PART_UPLOAD = 'multipart_upload.after_part_upload';
36
+ const AFTER_ABORT = 'multipart_upload.after_abort';
37
+ const AFTER_COMPLETE = 'multipart_upload.after_complete';
38
+ /**
39
+ * @var AwsClientInterface Client used for the transfers
40
+ */
41
+ protected $client;
42
+ /**
43
+ * @var TransferStateInterface State of the transfer
44
+ */
45
+ protected $state;
46
+ /**
47
+ * @var EntityBody Data source of the transfer
48
+ */
49
+ protected $source;
50
+ /**
51
+ * @var array Associative array of options
52
+ */
53
+ protected $options;
54
+ /**
55
+ * @var int Size of each part to upload
56
+ */
57
+ protected $partSize;
58
+ /**
59
+ * @var bool Whether or not the transfer has been stopped
60
+ */
61
+ protected $stopped = false;
62
+ /**
63
+ * Construct a new transfer object
64
+ *
65
+ * @param AwsClientInterface $client Client used for the transfers
66
+ * @param TransferStateInterface $state State used to track transfer
67
+ * @param EntityBody $source Data source of the transfer
68
+ * @param array $options Array of options to apply
69
+ */
70
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AwsClientInterface $client, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\TransferStateInterface $state, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBody $source, array $options = array())
71
+ {
72
+ $this->client = $client;
73
+ $this->state = $state;
74
+ $this->source = $source;
75
+ $this->options = $options;
76
+ $this->init();
77
+ $this->partSize = $this->calculatePartSize();
78
+ }
79
+ public function __invoke()
80
+ {
81
+ return $this->upload();
82
+ }
83
+ /**
84
+ * {@inheritdoc}
85
+ */
86
+ public static function getAllEvents()
87
+ {
88
+ return array(self::BEFORE_PART_UPLOAD, self::AFTER_UPLOAD, self::BEFORE_PART_UPLOAD, self::AFTER_PART_UPLOAD, self::AFTER_ABORT, self::AFTER_COMPLETE);
89
+ }
90
+ /**
91
+ * {@inheritdoc}
92
+ */
93
+ public function abort()
94
+ {
95
+ $command = $this->getAbortCommand();
96
+ $result = $command->getResult();
97
+ $this->state->setAborted(true);
98
+ $this->stop();
99
+ $this->dispatch(self::AFTER_ABORT, $this->getEventData($command));
100
+ return $result;
101
+ }
102
+ /**
103
+ * {@inheritdoc}
104
+ */
105
+ public function stop()
106
+ {
107
+ $this->stopped = true;
108
+ return $this->state;
109
+ }
110
+ /**
111
+ * {@inheritdoc}
112
+ */
113
+ public function getState()
114
+ {
115
+ return $this->state;
116
+ }
117
+ /**
118
+ * Get the array of options associated with the transfer
119
+ *
120
+ * @return array
121
+ */
122
+ public function getOptions()
123
+ {
124
+ return $this->options;
125
+ }
126
+ /**
127
+ * Set an option on the transfer
128
+ *
129
+ * @param string $option Name of the option
130
+ * @param mixed $value Value to set
131
+ *
132
+ * @return self
133
+ */
134
+ public function setOption($option, $value)
135
+ {
136
+ $this->options[$option] = $value;
137
+ return $this;
138
+ }
139
+ /**
140
+ * Get the source body of the upload
141
+ *
142
+ * @return EntityBodyInterface
143
+ */
144
+ public function getSource()
145
+ {
146
+ return $this->source;
147
+ }
148
+ /**
149
+ * {@inheritdoc}
150
+ * @throws MultipartUploadException when an error is encountered. Use getLastException() to get more information.
151
+ * @throws RuntimeException when attempting to upload an aborted transfer
152
+ */
153
+ public function upload()
154
+ {
155
+ if ($this->state->isAborted()) {
156
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException('The transfer has been aborted and cannot be uploaded');
157
+ }
158
+ $this->stopped = false;
159
+ $eventData = $this->getEventData();
160
+ $this->dispatch(self::BEFORE_UPLOAD, $eventData);
161
+ try {
162
+ $this->transfer();
163
+ $this->dispatch(self::AFTER_UPLOAD, $eventData);
164
+ if ($this->stopped) {
165
+ return null;
166
+ } else {
167
+ $result = $this->complete();
168
+ $this->dispatch(self::AFTER_COMPLETE, $eventData);
169
+ }
170
+ } catch (\Exception $e) {
171
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\MultipartUploadException($this->state, $e);
172
+ }
173
+ return $result;
174
+ }
175
+ /**
176
+ * Get an array used for event notifications
177
+ *
178
+ * @param OperationCommand $command Command to include in event data
179
+ *
180
+ * @return array
181
+ */
182
+ protected function getEventData(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\OperationCommand $command = null)
183
+ {
184
+ $data = array('transfer' => $this, 'source' => $this->source, 'options' => $this->options, 'client' => $this->client, 'part_size' => $this->partSize, 'state' => $this->state);
185
+ if ($command) {
186
+ $data['command'] = $command;
187
+ }
188
+ return $data;
189
+ }
190
+ /**
191
+ * Hook to initialize the transfer
192
+ */
193
+ protected function init()
194
+ {
195
+ }
196
+ /**
197
+ * Determine the upload part size based on the size of the source data and
198
+ * taking into account the acceptable minimum and maximum part sizes.
199
+ *
200
+ * @return int The part size
201
+ */
202
+ protected abstract function calculatePartSize();
203
+ /**
204
+ * Complete the multipart upload
205
+ *
206
+ * @return Model Returns the result of the complete multipart upload command
207
+ */
208
+ protected abstract function complete();
209
+ /**
210
+ * Hook to implement in subclasses to perform the actual transfer
211
+ */
212
+ protected abstract function transfer();
213
+ /**
214
+ * Fetches the abort command fom the concrete implementation
215
+ *
216
+ * @return OperationCommand
217
+ */
218
+ protected abstract function getAbortCommand();
219
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/AbstractTransferState.php ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException;
20
+ /**
21
+ * State of a multipart upload
22
+ */
23
+ abstract class AbstractTransferState implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\TransferStateInterface
24
+ {
25
+ /**
26
+ * @var UploadIdInterface Object holding params used to identity the upload part
27
+ */
28
+ protected $uploadId;
29
+ /**
30
+ * @var array Array of parts where the part number is the index
31
+ */
32
+ protected $parts = array();
33
+ /**
34
+ * @var bool Whether or not the transfer was aborted
35
+ */
36
+ protected $aborted = false;
37
+ /**
38
+ * Construct a new transfer state object
39
+ *
40
+ * @param UploadIdInterface $uploadId Upload identifier object
41
+ */
42
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\UploadIdInterface $uploadId)
43
+ {
44
+ $this->uploadId = $uploadId;
45
+ }
46
+ /**
47
+ * {@inheritdoc}
48
+ */
49
+ public function getUploadId()
50
+ {
51
+ return $this->uploadId;
52
+ }
53
+ /**
54
+ * Get a data value from the transfer state's uploadId
55
+ *
56
+ * @param string $key Key to retrieve (e.g. Bucket, Key, UploadId, etc)
57
+ *
58
+ * @return string|null
59
+ */
60
+ public function getFromId($key)
61
+ {
62
+ $params = $this->uploadId->toParams();
63
+ return isset($params[$key]) ? $params[$key] : null;
64
+ }
65
+ /**
66
+ * {@inheritdoc}
67
+ */
68
+ public function getPart($partNumber)
69
+ {
70
+ return isset($this->parts[$partNumber]) ? $this->parts[$partNumber] : null;
71
+ }
72
+ /**
73
+ * {@inheritdoc}
74
+ */
75
+ public function addPart(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\UploadPartInterface $part)
76
+ {
77
+ $partNumber = $part->getPartNumber();
78
+ $this->parts[$partNumber] = $part;
79
+ return $this;
80
+ }
81
+ /**
82
+ * {@inheritdoc}
83
+ */
84
+ public function hasPart($partNumber)
85
+ {
86
+ return isset($this->parts[$partNumber]);
87
+ }
88
+ /**
89
+ * {@inheritdoc}
90
+ */
91
+ public function getPartNumbers()
92
+ {
93
+ return array_keys($this->parts);
94
+ }
95
+ /**
96
+ * {@inheritdoc}
97
+ */
98
+ public function setAborted($aborted)
99
+ {
100
+ $this->aborted = (bool) $aborted;
101
+ return $this;
102
+ }
103
+ /**
104
+ * {@inheritdoc}
105
+ */
106
+ public function isAborted()
107
+ {
108
+ return $this->aborted;
109
+ }
110
+ /**
111
+ * {@inheritdoc}
112
+ */
113
+ public function count()
114
+ {
115
+ return count($this->parts);
116
+ }
117
+ /**
118
+ * {@inheritdoc}
119
+ */
120
+ public function getIterator()
121
+ {
122
+ return new \ArrayIterator($this->parts);
123
+ }
124
+ /**
125
+ * {@inheritdoc}
126
+ */
127
+ public function serialize()
128
+ {
129
+ return serialize(get_object_vars($this));
130
+ }
131
+ /**
132
+ * {@inheritdoc}
133
+ */
134
+ public function unserialize($serialized)
135
+ {
136
+ $data = unserialize($serialized);
137
+ foreach (get_object_vars($this) as $property => $oldValue) {
138
+ if (array_key_exists($property, $data)) {
139
+ $this->{$property} = $data[$property];
140
+ } else {
141
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException("The {$property} property could be restored during unserialization.");
142
+ }
143
+ }
144
+ }
145
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/AbstractUploadBuilder.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AwsClientInterface;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBody;
22
+ /**
23
+ * Easily create a multipart uploader used to quickly and reliably upload a
24
+ * large file or data stream to Amazon S3 using multipart uploads
25
+ */
26
+ abstract class AbstractUploadBuilder
27
+ {
28
+ /**
29
+ * @var AwsClientInterface Client used to transfer requests
30
+ */
31
+ protected $client;
32
+ /**
33
+ * @var TransferStateInterface State of the transfer
34
+ */
35
+ protected $state;
36
+ /**
37
+ * @var EntityBody Source of the data
38
+ */
39
+ protected $source;
40
+ /**
41
+ * @var array Array of headers to set on the object
42
+ */
43
+ protected $headers = array();
44
+ /**
45
+ * Return a new instance of the UploadBuilder
46
+ *
47
+ * @return static
48
+ */
49
+ public static function newInstance()
50
+ {
51
+ return new static();
52
+ }
53
+ /**
54
+ * Set the client used to connect to the AWS service
55
+ *
56
+ * @param AwsClientInterface $client Client to use
57
+ *
58
+ * @return $this
59
+ */
60
+ public function setClient(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AwsClientInterface $client)
61
+ {
62
+ $this->client = $client;
63
+ return $this;
64
+ }
65
+ /**
66
+ * Set the state of the upload. This is useful for resuming from a previously started multipart upload.
67
+ * You must use a local file stream as the data source if you wish to resume from a previous upload.
68
+ *
69
+ * @param TransferStateInterface|string $state Pass a TransferStateInterface object or the ID of the initiated
70
+ * multipart upload. When an ID is passed, the builder will create a
71
+ * state object using the data from a ListParts API response.
72
+ *
73
+ * @return $this
74
+ */
75
+ public function resumeFrom($state)
76
+ {
77
+ $this->state = $state;
78
+ return $this;
79
+ }
80
+ /**
81
+ * Set the data source of the transfer
82
+ *
83
+ * @param resource|string|EntityBody $source Source of the transfer. Pass a string to transfer from a file on disk.
84
+ * You can also stream from a resource returned from fopen or a Guzzle
85
+ * {@see EntityBody} object.
86
+ *
87
+ * @return $this
88
+ * @throws InvalidArgumentException when the source cannot be found or opened
89
+ */
90
+ public function setSource($source)
91
+ {
92
+ // Use the contents of a file as the data source
93
+ if (is_string($source)) {
94
+ if (!file_exists($source)) {
95
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException("File does not exist: {$source}");
96
+ }
97
+ // Clear the cache so that we send accurate file sizes
98
+ clearstatcache(true, $source);
99
+ $source = fopen($source, 'r');
100
+ }
101
+ $this->source = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBody::factory($source);
102
+ if ($this->source->isSeekable() && $this->source->getSize() == 0) {
103
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('Empty body provided to upload builder');
104
+ }
105
+ return $this;
106
+ }
107
+ /**
108
+ * Specify the headers to set on the upload
109
+ *
110
+ * @param array $headers Headers to add to the uploaded object
111
+ *
112
+ * @return $this
113
+ */
114
+ public function setHeaders(array $headers)
115
+ {
116
+ $this->headers = $headers;
117
+ return $this;
118
+ }
119
+ /**
120
+ * Build the appropriate uploader based on the builder options
121
+ *
122
+ * @return TransferInterface
123
+ */
124
+ public abstract function build();
125
+ /**
126
+ * Initiate the multipart upload
127
+ *
128
+ * @return TransferStateInterface
129
+ */
130
+ protected abstract function initiateMultipartUpload();
131
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/AbstractUploadId.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
20
+ /**
21
+ * An object that encapsulates the data identifying an upload
22
+ */
23
+ abstract class AbstractUploadId implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\UploadIdInterface
24
+ {
25
+ /**
26
+ * @var array Expected values (with defaults)
27
+ */
28
+ protected static $expectedValues = array();
29
+ /**
30
+ * @var array Params representing the identifying information
31
+ */
32
+ protected $data = array();
33
+ /**
34
+ * {@inheritdoc}
35
+ */
36
+ public static function fromParams($data)
37
+ {
38
+ $uploadId = new static();
39
+ $uploadId->loadData($data);
40
+ return $uploadId;
41
+ }
42
+ /**
43
+ * {@inheritdoc}
44
+ */
45
+ public function toParams()
46
+ {
47
+ return $this->data;
48
+ }
49
+ /**
50
+ * {@inheritdoc}
51
+ */
52
+ public function serialize()
53
+ {
54
+ return serialize($this->data);
55
+ }
56
+ /**
57
+ * {@inheritdoc}
58
+ */
59
+ public function unserialize($serialized)
60
+ {
61
+ $this->loadData(unserialize($serialized));
62
+ }
63
+ /**
64
+ * Loads an array of data into the UploadId by extracting only the needed keys
65
+ *
66
+ * @param array $data Data to load
67
+ *
68
+ * @throws InvalidArgumentException if a required key is missing
69
+ */
70
+ protected function loadData($data)
71
+ {
72
+ $data = array_replace(static::$expectedValues, array_intersect_key($data, static::$expectedValues));
73
+ foreach ($data as $key => $value) {
74
+ if (isset($data[$key])) {
75
+ $this->data[$key] = $data[$key];
76
+ } else {
77
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException("A required key [{$key}] was missing from the UploadId.");
78
+ }
79
+ }
80
+ }
81
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/AbstractUploadPart.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
20
+ /**
21
+ * An object that encapsulates the data for an upload part
22
+ */
23
+ abstract class AbstractUploadPart implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\UploadPartInterface
24
+ {
25
+ /**
26
+ * @var array A map of external array keys to internal property names
27
+ */
28
+ protected static $keyMap = array();
29
+ /**
30
+ * @var int The number of the upload part representing its order in the overall upload
31
+ */
32
+ protected $partNumber;
33
+ /**
34
+ * {@inheritdoc}
35
+ */
36
+ public static function fromArray($data)
37
+ {
38
+ $part = new static();
39
+ $part->loadData($data);
40
+ return $part;
41
+ }
42
+ /**
43
+ * {@inheritdoc}
44
+ */
45
+ public function getPartNumber()
46
+ {
47
+ return $this->partNumber;
48
+ }
49
+ /**
50
+ * {@inheritdoc}
51
+ */
52
+ public function toArray()
53
+ {
54
+ $array = array();
55
+ foreach (static::$keyMap as $key => $property) {
56
+ $array[$key] = $this->{$property};
57
+ }
58
+ return $array;
59
+ }
60
+ /**
61
+ * {@inheritdoc}
62
+ */
63
+ public function serialize()
64
+ {
65
+ return serialize($this->toArray());
66
+ }
67
+ /**
68
+ * {@inheritdoc}
69
+ */
70
+ public function unserialize($serialized)
71
+ {
72
+ $this->loadData(unserialize($serialized));
73
+ }
74
+ /**
75
+ * Loads an array of data into the upload part by extracting only the needed keys
76
+ *
77
+ * @param array|\Traversable $data Data to load into the upload part value object
78
+ *
79
+ * @throws InvalidArgumentException if a required key is missing
80
+ */
81
+ protected function loadData($data)
82
+ {
83
+ foreach (static::$keyMap as $key => $property) {
84
+ if (isset($data[$key])) {
85
+ $this->{$property} = $data[$key];
86
+ } else {
87
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException("A required key [{$key}] was missing from the upload part.");
88
+ }
89
+ }
90
+ }
91
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/TransferInterface.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\HasDispatcherInterface;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\Model;
21
+ /**
22
+ * Interface for transferring the contents of a data source to an AWS service via a multipart upload interface
23
+ */
24
+ interface TransferInterface extends HasDispatcherInterface
25
+ {
26
+ /**
27
+ * Upload the source to using a multipart upload
28
+ *
29
+ * @return Model|null Result of the complete multipart upload command or null if uploading was stopped
30
+ */
31
+ public function upload();
32
+ /**
33
+ * Abort the upload
34
+ *
35
+ * @return Model Returns the result of the abort multipart upload command
36
+ */
37
+ public function abort();
38
+ /**
39
+ * Get the current state of the upload
40
+ *
41
+ * @return TransferStateInterface
42
+ */
43
+ public function getState();
44
+ /**
45
+ * Stop the transfer and retrieve the current state.
46
+ *
47
+ * This allows you to stop and later resume a long running transfer if needed.
48
+ *
49
+ * @return TransferStateInterface
50
+ */
51
+ public function stop();
52
+ /**
53
+ * Set an option on the transfer object
54
+ *
55
+ * @param string $option Option to set
56
+ * @param mixed $value The value to set
57
+ *
58
+ * @return self
59
+ */
60
+ public function setOption($option, $value);
61
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/TransferStateInterface.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AwsClientInterface;
20
+ /**
21
+ * State of a multipart upload
22
+ */
23
+ interface TransferStateInterface extends \Countable, \IteratorAggregate, \Serializable
24
+ {
25
+ /**
26
+ * Create the transfer state from the results of list parts request
27
+ *
28
+ * @param AwsClientInterface $client Client used to send the request
29
+ * @param UploadIdInterface $uploadId Params needed to identify the upload and form the request
30
+ *
31
+ * @return self
32
+ */
33
+ public static function fromUploadId(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AwsClientInterface $client, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\UploadIdInterface $uploadId);
34
+ /**
35
+ * Get the params used to identify an upload part
36
+ *
37
+ * @return UploadIdInterface
38
+ */
39
+ public function getUploadId();
40
+ /**
41
+ * Get the part information of a specific part
42
+ *
43
+ * @param int $partNumber Part to retrieve
44
+ *
45
+ * @return UploadPartInterface
46
+ */
47
+ public function getPart($partNumber);
48
+ /**
49
+ * Add a part to the transfer state
50
+ *
51
+ * @param UploadPartInterface $part The part to add
52
+ *
53
+ * @return self
54
+ */
55
+ public function addPart(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\UploadPartInterface $part);
56
+ /**
57
+ * Check if a specific part has been uploaded
58
+ *
59
+ * @param int $partNumber Part to check
60
+ *
61
+ * @return bool
62
+ */
63
+ public function hasPart($partNumber);
64
+ /**
65
+ * Get a list of all of the uploaded part numbers
66
+ *
67
+ * @return array
68
+ */
69
+ public function getPartNumbers();
70
+ /**
71
+ * Set whether or not the transfer has been aborted
72
+ *
73
+ * @param bool $aborted Set to true to mark the transfer as aborted
74
+ *
75
+ * @return self
76
+ */
77
+ public function setAborted($aborted);
78
+ /**
79
+ * Check if the transfer has been marked as aborted
80
+ *
81
+ * @return bool
82
+ */
83
+ public function isAborted();
84
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/UploadIdInterface.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload;
18
+
19
+ /**
20
+ * An object that encapsulates the data identifying an upload
21
+ */
22
+ interface UploadIdInterface extends \Serializable
23
+ {
24
+ /**
25
+ * Create an UploadId from an array
26
+ *
27
+ * @param array $data Data representing the upload identification
28
+ *
29
+ * @return self
30
+ */
31
+ public static function fromParams($data);
32
+ /**
33
+ * Returns the array form of the upload identification for use as command params
34
+ *
35
+ * @return array
36
+ */
37
+ public function toParams();
38
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Model/MultipartUpload/UploadPartInterface.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload;
18
+
19
+ /**
20
+ * An object that encapsulates the data for an upload part
21
+ */
22
+ interface UploadPartInterface extends \Serializable
23
+ {
24
+ /**
25
+ * Create an upload part from an array
26
+ *
27
+ * @param array|\Traversable $data Data representing the upload part
28
+ *
29
+ * @return self
30
+ */
31
+ public static function fromArray($data);
32
+ /**
33
+ * Returns the part number of the upload part which is used as an identifier
34
+ *
35
+ * @return int
36
+ */
37
+ public function getPartNumber();
38
+ /**
39
+ * Returns the array form of the upload part
40
+ *
41
+ * @return array
42
+ */
43
+ public function toArray();
44
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Resources/aws-config.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ return array('class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Common\\Aws', 'services' => array('default_settings' => array('params' => array()), 'autoscaling' => array('alias' => 'AutoScaling', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\AutoScaling\\AutoScalingClient'), 'cloudformation' => array('alias' => 'CloudFormation', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\CloudFormation\\CloudFormationClient'), 'cloudfront' => array('alias' => 'CloudFront', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\CloudFront\\CloudFrontClient'), 'cloudfront_20120505' => array('extends' => 'cloudfront', 'params' => array('version' => '2012-05-05')), 'cloudhsm' => array('alias' => 'CloudHsm', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\CloudHsm\\CloudHsmClient'), 'cloudsearch' => array('alias' => 'CloudSearch', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\CloudSearch\\CloudSearchClient'), 'cloudsearch_20110201' => array('extends' => 'cloudsearch', 'params' => array('version' => '2011-02-01')), 'cloudsearchdomain' => array('alias' => 'CloudSearchDomain', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\CloudSearchDomain\\CloudSearchDomainClient'), 'cloudtrail' => array('alias' => 'CloudTrail', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\CloudTrail\\CloudTrailClient'), 'cloudwatch' => array('alias' => 'CloudWatch', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\CloudWatch\\CloudWatchClient'), 'cloudwatchlogs' => array('alias' => 'CloudWatchLogs', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\CloudWatchLogs\\CloudWatchLogsClient'), 'cognito-identity' => array('alias' => 'CognitoIdentity', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\CognitoIdentity\\CognitoIdentityClient'), 'cognitoidentity' => array('extends' => 'cognito-identity'), 'cognito-sync' => array('alias' => 'CognitoSync', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\CognitoSync\\CognitoSyncClient'), 'cognitosync' => array('extends' => 'cognito-sync'), 'codecommit' => array('alias' => 'CodeCommit', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\CodeCommit\\CodeCommitClient'), 'codedeploy' => array('alias' => 'CodeDeploy', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\CodeDeploy\\CodeDeployClient'), 'codepipeline' => array('alias' => 'CodePipeline', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\CodePipeline\\CodePipelineClient'), 'config' => array('alias' => 'ConfigService', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\ConfigService\\ConfigServiceClient'), 'datapipeline' => array('alias' => 'DataPipeline', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\DataPipeline\\DataPipelineClient'), 'devicefarm' => array('alias' => 'DeviceFarm', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\DeviceFarm\\DeviceFarmClient'), 'directconnect' => array('alias' => 'DirectConnect', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\DirectConnect\\DirectConnectClient'), 'ds' => array('alias' => 'DirectoryService', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\DirectoryService\\DirectoryServiceClient'), 'dynamodb' => array('alias' => 'DynamoDb', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\DynamoDb\\DynamoDbClient'), 'dynamodb_20111205' => array('extends' => 'dynamodb', 'params' => array('version' => '2011-12-05')), 'dynamodbstreams' => array('alias' => 'DynamoDbStreams', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\DynamoDbStreams\\DynamoDbStreamsClient'), 'ec2' => array('alias' => 'Ec2', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Ec2\\Ec2Client'), 'ecs' => array('alias' => 'Ecs', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Ecs\\EcsClient'), 'elasticache' => array('alias' => 'ElastiCache', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\ElastiCache\\ElastiCacheClient'), 'elasticbeanstalk' => array('alias' => 'ElasticBeanstalk', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\ElasticBeanstalk\\ElasticBeanstalkClient'), 'efs' => array('alias' => 'Efs', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Efs\\EfsClient'), 'elasticloadbalancing' => array('alias' => 'ElasticLoadBalancing', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\ElasticLoadBalancing\\ElasticLoadBalancingClient'), 'elastictranscoder' => array('alias' => 'ElasticTranscoder', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\ElasticTranscoder\\ElasticTranscoderClient'), 'emr' => array('alias' => 'Emr', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Emr\\EmrClient'), 'glacier' => array('alias' => 'Glacier', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Glacier\\GlacierClient'), 'kinesis' => array('alias' => 'Kinesis', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Kinesis\\KinesisClient'), 'kms' => array('alias' => 'Kms', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Kms\\KmsClient'), 'lambda' => array('alias' => 'Lambda', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Lambda\\LambdaClient'), 'iam' => array('alias' => 'Iam', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Iam\\IamClient'), 'importexport' => array('alias' => 'ImportExport', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\ImportExport\\ImportExportClient'), 'machinelearning' => array('alias' => 'MachineLearning', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\MachineLearning\\MachineLearningClient'), 'opsworks' => array('alias' => 'OpsWorks', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\OpsWorks\\OpsWorksClient'), 'rds' => array('alias' => 'Rds', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Rds\\RdsClient'), 'redshift' => array('alias' => 'Redshift', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Redshift\\RedshiftClient'), 'route53' => array('alias' => 'Route53', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Route53\\Route53Client'), 'route53domains' => array('alias' => 'Route53Domains', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Route53Domains\\Route53DomainsClient'), 's3' => array('alias' => 'S3', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\S3Client'), 'sdb' => array('alias' => 'SimpleDb', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\SimpleDb\\SimpleDbClient'), 'ses' => array('alias' => 'Ses', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Ses\\SesClient'), 'sns' => array('alias' => 'Sns', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Sns\\SnsClient'), 'sqs' => array('alias' => 'Sqs', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Sqs\\SqsClient'), 'ssm' => array('alias' => 'Ssm', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Ssm\\SsmClient'), 'storagegateway' => array('alias' => 'StorageGateway', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\StorageGateway\\StorageGatewayClient'), 'sts' => array('alias' => 'Sts', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Sts\\StsClient'), 'support' => array('alias' => 'Support', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Support\\SupportClient'), 'swf' => array('alias' => 'Swf', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\Swf\\SwfClient'), 'workspaces' => array('alias' => 'WorkSpaces', 'extends' => 'default_settings', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\WorkSpaces\\WorkSpacesClient')));
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Resources/public-endpoints.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ return array('version' => 2, 'endpoints' => array('*/*' => array('endpoint' => '{service}.{region}.amazonaws.com'), 'cn-north-1/*' => array('endpoint' => '{service}.{region}.amazonaws.com.cn', 'signatureVersion' => 'v4'), 'us-gov-west-1/iam' => array('endpoint' => 'iam.us-gov.amazonaws.com'), 'us-gov-west-1/sts' => array('endpoint' => 'sts.us-gov-west-1.amazonaws.com'), 'us-gov-west-1/s3' => array('endpoint' => 's3-{region}.amazonaws.com'), '*/cloudfront' => array('endpoint' => 'cloudfront.amazonaws.com', 'credentialScope' => array('region' => 'us-east-1')), '*/iam' => array('endpoint' => 'iam.amazonaws.com', 'credentialScope' => array('region' => 'us-east-1')), '*/importexport' => array('endpoint' => 'importexport.amazonaws.com', 'credentialScope' => array('region' => 'us-east-1')), '*/route53' => array('endpoint' => 'route53.amazonaws.com', 'credentialScope' => array('region' => 'us-east-1')), '*/sts' => array('endpoint' => 'sts.amazonaws.com', 'credentialScope' => array('region' => 'us-east-1')), 'us-east-1/sdb' => array('endpoint' => 'sdb.amazonaws.com'), 'us-east-1/s3' => array('endpoint' => 's3.amazonaws.com'), 'us-west-1/s3' => array('endpoint' => 's3-{region}.amazonaws.com'), 'us-west-2/s3' => array('endpoint' => 's3-{region}.amazonaws.com'), 'eu-west-1/s3' => array('endpoint' => 's3-{region}.amazonaws.com'), 'ap-southeast-1/s3' => array('endpoint' => 's3-{region}.amazonaws.com'), 'ap-southeast-2/s3' => array('endpoint' => 's3-{region}.amazonaws.com'), 'ap-northeast-1/s3' => array('endpoint' => 's3-{region}.amazonaws.com'), 'sa-east-1/s3' => array('endpoint' => 's3-{region}.amazonaws.com')));
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Resources/sdk1-config.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ return array('includes' => array('_aws'), 'services' => array('sdk1_settings' => array('extends' => 'default_settings', 'params' => array('certificate_authority' => \false)), 'v1.autoscaling' => array('extends' => 'sdk1_settings', 'class' => 'AmazonAS'), 'v1.cloudformation' => array('extends' => 'sdk1_settings', 'class' => 'AmazonCloudFormation'), 'v1.cloudfront' => array('extends' => 'sdk1_settings', 'class' => 'AmazonCloudFront'), 'v1.cloudsearch' => array('extends' => 'sdk1_settings', 'class' => 'AmazonCloudSearch'), 'v1.cloudwatch' => array('extends' => 'sdk1_settings', 'class' => 'AmazonCloudWatch'), 'v1.dynamodb' => array('extends' => 'sdk1_settings', 'class' => 'AmazonDynamoDB'), 'v1.ec2' => array('extends' => 'sdk1_settings', 'class' => 'AmazonEC2'), 'v1.elasticache' => array('extends' => 'sdk1_settings', 'class' => 'AmazonElastiCache'), 'v1.elasticbeanstalk' => array('extends' => 'sdk1_settings', 'class' => 'AmazonElasticBeanstalk'), 'v1.elb' => array('extends' => 'sdk1_settings', 'class' => 'AmazonELB'), 'v1.emr' => array('extends' => 'sdk1_settings', 'class' => 'AmazonEMR'), 'v1.iam' => array('extends' => 'sdk1_settings', 'class' => 'AmazonIAM'), 'v1.importexport' => array('extends' => 'sdk1_settings', 'class' => 'AmazonImportExport'), 'v1.rds' => array('extends' => 'sdk1_settings', 'class' => 'AmazonRDS'), 'v1.s3' => array('extends' => 'sdk1_settings', 'class' => 'AmazonS3'), 'v1.sdb' => array('extends' => 'sdk1_settings', 'class' => 'AmazonSDB'), 'v1.ses' => array('extends' => 'sdk1_settings', 'class' => 'AmazonSES'), 'v1.sns' => array('extends' => 'sdk1_settings', 'class' => 'AmazonSNS'), 'v1.sqs' => array('extends' => 'sdk1_settings', 'class' => 'AmazonSQS'), 'v1.storagegateway' => array('extends' => 'sdk1_settings', 'class' => 'AmazonStorageGateway'), 'v1.sts' => array('extends' => 'sdk1_settings', 'class' => 'AmazonSTS'), 'v1.swf' => array('extends' => 'sdk1_settings', 'class' => 'AmazonSWF')));
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/RulesEndpointProvider.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common;
4
+
5
+ /**
6
+ * Provides endpoints based on a rules configuration file.
7
+ */
8
+ class RulesEndpointProvider
9
+ {
10
+ /** @var array */
11
+ private $patterns;
12
+ /**
13
+ * @param array $patterns Hash of endpoint patterns mapping to endpoint
14
+ * configurations.
15
+ */
16
+ public function __construct(array $patterns)
17
+ {
18
+ $this->patterns = $patterns;
19
+ }
20
+ /**
21
+ * Creates and returns the default RulesEndpointProvider based on the
22
+ * public rule sets.
23
+ *
24
+ * @return self
25
+ */
26
+ public static function fromDefaults()
27
+ {
28
+ return new self(require __DIR__ . '/Resources/public-endpoints.php');
29
+ }
30
+ public function __invoke(array $args = array())
31
+ {
32
+ if (!isset($args['service'])) {
33
+ throw new \InvalidArgumentException('Requires a "service" value');
34
+ }
35
+ if (!isset($args['region'])) {
36
+ throw new \InvalidArgumentException('Requires a "region" value');
37
+ }
38
+ foreach ($this->getKeys($args['region'], $args['service']) as $key) {
39
+ if (isset($this->patterns['endpoints'][$key])) {
40
+ return $this->expand($this->patterns['endpoints'][$key], $args);
41
+ }
42
+ }
43
+ throw new \RuntimeException('Could not resolve endpoint');
44
+ }
45
+ private function expand(array $config, array $args)
46
+ {
47
+ $scheme = isset($args['scheme']) ? $args['scheme'] : 'https';
48
+ $config['endpoint'] = $scheme . '://' . str_replace(array('{service}', '{region}'), array($args['service'], $args['region']), $config['endpoint']);
49
+ return $config;
50
+ }
51
+ private function getKeys($region, $service)
52
+ {
53
+ return array("{$region}/{$service}", "{$region}/*", "*/{$service}", "*/*");
54
+ }
55
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Signature/AbstractSignature.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
21
+ abstract class AbstractSignature implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureInterface
22
+ {
23
+ /**
24
+ * Provides the timestamp used for the class (used for mocking PHP's time() function)
25
+ *
26
+ * @return int
27
+ */
28
+ protected function getTimestamp()
29
+ {
30
+ return time();
31
+ }
32
+ /**
33
+ * @codeCoverageIgnore
34
+ */
35
+ public function createPresignedUrl(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials, $expires)
36
+ {
37
+ throw new \BadMethodCallException(__METHOD__ . ' not implemented');
38
+ }
39
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Signature/EndpointSignatureInterface.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature;
18
+
19
+ /**
20
+ * Interface for signatures that use specific region and service names when
21
+ * signing requests.
22
+ */
23
+ interface EndpointSignatureInterface extends SignatureInterface
24
+ {
25
+ /**
26
+ * Set the service name instead of inferring it from a request URL
27
+ *
28
+ * @param string $service Name of the service used when signing
29
+ *
30
+ * @return self
31
+ */
32
+ public function setServiceName($service);
33
+ /**
34
+ * Set the region name instead of inferring it from a request URL
35
+ *
36
+ * @param string $region Name of the region used when signing
37
+ *
38
+ * @return self
39
+ */
40
+ public function setRegionName($region);
41
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Signature/SignatureInterface.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
21
+ /**
22
+ * Interface used to provide interchangeable strategies for signing requests
23
+ * using the various AWS signature protocols.
24
+ */
25
+ interface SignatureInterface
26
+ {
27
+ /**
28
+ * Signs the specified request with an AWS signing protocol by using the
29
+ * provided AWS account credentials and adding the required headers to the
30
+ * request.
31
+ *
32
+ * @param RequestInterface $request Request to add a signature to
33
+ * @param CredentialsInterface $credentials Signing credentials
34
+ */
35
+ public function signRequest(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials);
36
+ /**
37
+ * Create a pre-signed URL
38
+ *
39
+ * @param RequestInterface $request Request to sign
40
+ * @param CredentialsInterface $credentials Credentials used to sign
41
+ * @param int|string|\DateTime $expires The time at which the URL should expire. This can be a Unix timestamp, a
42
+ * PHP DateTime object, or a string that can be evaluated by strtotime
43
+ * @return string
44
+ */
45
+ public function createPresignedUrl(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials, $expires);
46
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Signature/SignatureListener.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\AbstractRefreshableCredentials;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\NullCredentials;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Symfony\Component\EventDispatcher\EventSubscriberInterface;
24
+ /**
25
+ * Listener used to sign requests before they are sent over the wire
26
+ */
27
+ class SignatureListener implements \DeliciousBrains\WP_Offload_S3\Aws2\Symfony\Component\EventDispatcher\EventSubscriberInterface
28
+ {
29
+ /**
30
+ * @var CredentialsInterface
31
+ */
32
+ protected $credentials;
33
+ /**
34
+ * @var SignatureInterface
35
+ */
36
+ protected $signature;
37
+ /**
38
+ * Construct a new request signing plugin
39
+ *
40
+ * @param CredentialsInterface $credentials Credentials used to sign requests
41
+ * @param SignatureInterface $signature Signature implementation
42
+ */
43
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureInterface $signature)
44
+ {
45
+ $this->credentials = $credentials;
46
+ $this->signature = $signature;
47
+ }
48
+ /**
49
+ * {@inheritdoc}
50
+ */
51
+ public static function getSubscribedEvents()
52
+ {
53
+ return array('request.before_send' => array('onRequestBeforeSend', -255), 'client.credentials_changed' => array('onCredentialsChanged'));
54
+ }
55
+ /**
56
+ * Updates the listener with new credentials if the client is updated
57
+ *
58
+ * @param Event $event Event emitted
59
+ */
60
+ public function onCredentialsChanged(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event $event)
61
+ {
62
+ $this->credentials = $event['credentials'];
63
+ }
64
+ /**
65
+ * Signs requests before they are sent
66
+ *
67
+ * @param Event $event Event emitted
68
+ */
69
+ public function onRequestBeforeSend(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event $event)
70
+ {
71
+ $creds = $this->credentials instanceof AbstractRefreshableCredentials ? $this->credentials->getCredentials() : $this->credentials;
72
+ if (!$creds instanceof NullCredentials) {
73
+ $this->signature->signRequest($event['request'], $creds);
74
+ }
75
+ }
76
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Signature/SignatureV2.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
21
+ /**
22
+ * Implementation of Signature Version 2
23
+ * @link http://aws.amazon.com/articles/1928
24
+ */
25
+ class SignatureV2 extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\AbstractSignature
26
+ {
27
+ public function signRequest(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials)
28
+ {
29
+ // refresh the cached timestamp
30
+ $timestamp = $this->getTimestamp(true);
31
+ // set values we need in CanonicalizedParameterString
32
+ $this->addParameter($request, 'Timestamp', gmdate('c', $timestamp));
33
+ $this->addParameter($request, 'SignatureVersion', '2');
34
+ $this->addParameter($request, 'SignatureMethod', 'HmacSHA256');
35
+ $this->addParameter($request, 'AWSAccessKeyId', $credentials->getAccessKeyId());
36
+ if ($token = $credentials->getSecurityToken()) {
37
+ $this->addParameter($request, 'SecurityToken', $token);
38
+ }
39
+ // Get the path and ensure it's absolute
40
+ $path = '/' . ltrim($request->getUrl(true)->normalizePath()->getPath(), '/');
41
+ // build string to sign
42
+ $sign = $request->getMethod() . "\n" . $request->getHost() . "\n" . $path . "\n" . $this->getCanonicalizedParameterString($request);
43
+ // Add the string to sign to the request for debugging purposes
44
+ $request->getParams()->set('aws.string_to_sign', $sign);
45
+ $signature = base64_encode(hash_hmac('sha256', $sign, $credentials->getSecretKey(), true));
46
+ $this->addParameter($request, 'Signature', $signature);
47
+ }
48
+ /**
49
+ * Add a parameter key and value to the request according to type
50
+ *
51
+ * @param RequestInterface $request The request
52
+ * @param string $key The name of the parameter
53
+ * @param string $value The value of the parameter
54
+ */
55
+ public function addParameter(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, $key, $value)
56
+ {
57
+ if ($request->getMethod() == 'POST') {
58
+ $request->setPostField($key, $value);
59
+ } else {
60
+ $request->getQuery()->set($key, $value);
61
+ }
62
+ }
63
+ /**
64
+ * Get the canonicalized query/parameter string for a request
65
+ *
66
+ * @param RequestInterface $request Request used to build canonicalized string
67
+ *
68
+ * @return string
69
+ */
70
+ private function getCanonicalizedParameterString(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request)
71
+ {
72
+ if ($request->getMethod() == 'POST') {
73
+ $params = $request->getPostFields()->toArray();
74
+ } else {
75
+ $params = $request->getQuery()->toArray();
76
+ }
77
+ // Don't resign a previous signature value
78
+ unset($params['Signature']);
79
+ uksort($params, 'strcmp');
80
+ $str = '';
81
+ foreach ($params as $key => $val) {
82
+ $str .= rawurlencode($key) . '=' . rawurlencode($val) . '&';
83
+ }
84
+ return substr($str, 0, -1);
85
+ }
86
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Signature/SignatureV3Https.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\DateFormat;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
22
+ /**
23
+ * Implementation of Signature Version 3 HTTPS
24
+ * @link http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/RESTAuthentication.html
25
+ */
26
+ class SignatureV3Https extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\AbstractSignature
27
+ {
28
+ public function signRequest(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials)
29
+ {
30
+ // Add a date header if one is not set
31
+ if (!$request->hasHeader('date') && !$request->hasHeader('x-amz-date')) {
32
+ $request->setHeader('Date', gmdate(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\DateFormat::RFC1123, $this->getTimestamp()));
33
+ }
34
+ // Add the security token if one is present
35
+ if ($credentials->getSecurityToken()) {
36
+ $request->setHeader('x-amz-security-token', $credentials->getSecurityToken());
37
+ }
38
+ // Determine the string to sign
39
+ $stringToSign = (string) ($request->getHeader('Date') ?: $request->getHeader('x-amz-date'));
40
+ $request->getParams()->set('aws.string_to_sign', $stringToSign);
41
+ // Calculate the signature
42
+ $signature = base64_encode(hash_hmac('sha256', $stringToSign, $credentials->getSecretKey(), true));
43
+ // Add the authorization header to the request
44
+ $headerFormat = 'AWS3-HTTPS AWSAccessKeyId=%s,Algorithm=HmacSHA256,Signature=%s';
45
+ $request->setHeader('X-Amzn-Authorization', sprintf($headerFormat, $credentials->getAccessKeyId(), $signature));
46
+ }
47
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Signature/SignatureV4.php ADDED
@@ -0,0 +1,360 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\DateFormat;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\HostNameUtils;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\EntityEnclosingRequestInterface;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestFactory;
24
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
25
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\QueryString;
26
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Url;
27
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Stream\Stream;
28
+ /**
29
+ * Signature Version 4
30
+ * @link http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html
31
+ */
32
+ class SignatureV4 extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\AbstractSignature implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\EndpointSignatureInterface
33
+ {
34
+ /** @var string Cache of the default empty entity-body payload */
35
+ const DEFAULT_PAYLOAD = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855';
36
+ /** @var string Explicitly set service name */
37
+ protected $serviceName;
38
+ /** @var string Explicitly set region name */
39
+ protected $regionName;
40
+ /** @var int Maximum number of hashes to cache */
41
+ protected $maxCacheSize = 50;
42
+ /** @var array Cache of previously signed values */
43
+ protected $hashCache = array();
44
+ /** @var int Size of the hash cache */
45
+ protected $cacheSize = 0;
46
+ /**
47
+ * @param string $serviceName Bind the signing to a particular service name
48
+ * @param string $regionName Bind the signing to a particular region name
49
+ */
50
+ public function __construct($serviceName = null, $regionName = null)
51
+ {
52
+ $this->serviceName = $serviceName;
53
+ $this->regionName = $regionName;
54
+ }
55
+ /**
56
+ * Set the service name instead of inferring it from a request URL
57
+ *
58
+ * @param string $service Name of the service used when signing
59
+ *
60
+ * @return self
61
+ */
62
+ public function setServiceName($service)
63
+ {
64
+ $this->serviceName = $service;
65
+ return $this;
66
+ }
67
+ /**
68
+ * Set the region name instead of inferring it from a request URL
69
+ *
70
+ * @param string $region Name of the region used when signing
71
+ *
72
+ * @return self
73
+ */
74
+ public function setRegionName($region)
75
+ {
76
+ $this->regionName = $region;
77
+ return $this;
78
+ }
79
+ /**
80
+ * Set the maximum number of computed hashes to cache
81
+ *
82
+ * @param int $maxCacheSize Maximum number of hashes to cache
83
+ *
84
+ * @return self
85
+ */
86
+ public function setMaxCacheSize($maxCacheSize)
87
+ {
88
+ $this->maxCacheSize = $maxCacheSize;
89
+ return $this;
90
+ }
91
+ public function signRequest(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials)
92
+ {
93
+ $timestamp = $this->getTimestamp();
94
+ $longDate = gmdate(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\DateFormat::ISO8601, $timestamp);
95
+ $shortDate = substr($longDate, 0, 8);
96
+ // Remove any previously set Authorization headers so that retries work
97
+ $request->removeHeader('Authorization');
98
+ // Requires a x-amz-date header or Date
99
+ if ($request->hasHeader('x-amz-date') || !$request->hasHeader('Date')) {
100
+ $request->setHeader('x-amz-date', $longDate);
101
+ } else {
102
+ $request->setHeader('Date', gmdate(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\DateFormat::RFC1123, $timestamp));
103
+ }
104
+ // Add the security token if one is present
105
+ if ($credentials->getSecurityToken()) {
106
+ $request->setHeader('x-amz-security-token', $credentials->getSecurityToken());
107
+ }
108
+ // Parse the service and region or use one that is explicitly set
109
+ $region = $this->regionName;
110
+ $service = $this->serviceName;
111
+ if (!$region || !$service) {
112
+ $url = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Url::factory($request->getUrl());
113
+ $region = $region ?: \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\HostNameUtils::parseRegionName($url);
114
+ $service = $service ?: \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\HostNameUtils::parseServiceName($url);
115
+ }
116
+ $credentialScope = $this->createScope($shortDate, $region, $service);
117
+ $payload = $this->getPayload($request);
118
+ $signingContext = $this->createSigningContext($request, $payload);
119
+ $signingContext['string_to_sign'] = $this->createStringToSign($longDate, $credentialScope, $signingContext['canonical_request']);
120
+ // Calculate the signing key using a series of derived keys
121
+ $signingKey = $this->getSigningKey($shortDate, $region, $service, $credentials->getSecretKey());
122
+ $signature = hash_hmac('sha256', $signingContext['string_to_sign'], $signingKey);
123
+ $request->setHeader('Authorization', "AWS4-HMAC-SHA256 " . "Credential={$credentials->getAccessKeyId()}/{$credentialScope}, " . "SignedHeaders={$signingContext['signed_headers']}, Signature={$signature}");
124
+ // Add debug information to the request
125
+ $request->getParams()->set('aws.signature', $signingContext);
126
+ }
127
+ public function createPresignedUrl(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials, $expires)
128
+ {
129
+ $request = $this->createPresignedRequest($request, $credentials);
130
+ $query = $request->getQuery();
131
+ $httpDate = gmdate(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\DateFormat::ISO8601, $this->getTimestamp());
132
+ $shortDate = substr($httpDate, 0, 8);
133
+ $scope = $this->createScope($shortDate, $this->regionName, $this->serviceName);
134
+ $this->addQueryValues($scope, $request, $credentials, $expires);
135
+ $payload = $this->getPresignedPayload($request);
136
+ $context = $this->createSigningContext($request, $payload);
137
+ $stringToSign = $this->createStringToSign($httpDate, $scope, $context['canonical_request']);
138
+ $key = $this->getSigningKey($shortDate, $this->regionName, $this->serviceName, $credentials->getSecretKey());
139
+ $query['X-Amz-Signature'] = hash_hmac('sha256', $stringToSign, $key);
140
+ return $request->getUrl();
141
+ }
142
+ /**
143
+ * Converts a POST request to a GET request by moving POST fields into the
144
+ * query string.
145
+ *
146
+ * Useful for pre-signing query protocol requests.
147
+ *
148
+ * @param EntityEnclosingRequestInterface $request Request to clone
149
+ *
150
+ * @return RequestInterface
151
+ * @throws \InvalidArgumentException if the method is not POST
152
+ */
153
+ public static function convertPostToGet(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\EntityEnclosingRequestInterface $request)
154
+ {
155
+ if ($request->getMethod() !== 'POST') {
156
+ throw new \InvalidArgumentException('Expected a POST request but ' . 'received a ' . $request->getMethod() . ' request.');
157
+ }
158
+ $cloned = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestFactory::getInstance()->cloneRequestWithMethod($request, 'GET');
159
+ // Move POST fields to the query if they are present
160
+ foreach ($request->getPostFields() as $name => $value) {
161
+ $cloned->getQuery()->set($name, $value);
162
+ }
163
+ return $cloned;
164
+ }
165
+ /**
166
+ * Get the payload part of a signature from a request.
167
+ *
168
+ * @param RequestInterface $request
169
+ *
170
+ * @return string
171
+ */
172
+ protected function getPayload(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request)
173
+ {
174
+ // Calculate the request signature payload
175
+ if ($request->hasHeader('x-amz-content-sha256')) {
176
+ // Handle streaming operations (e.g. Glacier.UploadArchive)
177
+ return (string) $request->getHeader('x-amz-content-sha256');
178
+ }
179
+ if ($request instanceof EntityEnclosingRequestInterface) {
180
+ if ($request->getMethod() == 'POST' && count($request->getPostFields())) {
181
+ return hash('sha256', (string) $request->getPostFields());
182
+ } elseif ($body = $request->getBody()) {
183
+ return \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Stream\Stream::getHash($request->getBody(), 'sha256');
184
+ }
185
+ }
186
+ return self::DEFAULT_PAYLOAD;
187
+ }
188
+ /**
189
+ * Get the payload of a request for use with pre-signed URLs.
190
+ *
191
+ * @param RequestInterface $request
192
+ *
193
+ * @return string
194
+ */
195
+ protected function getPresignedPayload(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request)
196
+ {
197
+ return $this->getPayload($request);
198
+ }
199
+ protected function createCanonicalizedPath(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request)
200
+ {
201
+ $doubleEncoded = rawurlencode(ltrim($request->getPath(), '/'));
202
+ return '/' . str_replace('%2F', '/', $doubleEncoded);
203
+ }
204
+ private function createStringToSign($longDate, $credentialScope, $creq)
205
+ {
206
+ return "AWS4-HMAC-SHA256\n{$longDate}\n{$credentialScope}\n" . hash('sha256', $creq);
207
+ }
208
+ private function createPresignedRequest(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials)
209
+ {
210
+ // POST requests can be sent as GET requests instead by moving the
211
+ // POST fields into the query string.
212
+ if ($request instanceof EntityEnclosingRequestInterface && $request->getMethod() === 'POST' && strpos($request->getHeader('Content-Type'), 'application/x-www-form-urlencoded') === 0) {
213
+ $sr = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestFactory::getInstance()->cloneRequestWithMethod($request, 'GET');
214
+ // Move POST fields to the query if they are present
215
+ foreach ($request->getPostFields() as $name => $value) {
216
+ $sr->getQuery()->set($name, $value);
217
+ }
218
+ } else {
219
+ $sr = clone $request;
220
+ }
221
+ // Make sure to handle temporary credentials
222
+ if ($token = $credentials->getSecurityToken()) {
223
+ $sr->setHeader('X-Amz-Security-Token', $token);
224
+ $sr->getQuery()->set('X-Amz-Security-Token', $token);
225
+ }
226
+ $this->moveHeadersToQuery($sr);
227
+ return $sr;
228
+ }
229
+ /**
230
+ * Create the canonical representation of a request
231
+ *
232
+ * @param RequestInterface $request Request to canonicalize
233
+ * @param string $payload Request payload (typically the value
234
+ * of the x-amz-content-sha256 header.
235
+ *
236
+ * @return array Returns an array of context information including:
237
+ * - canonical_request
238
+ * - signed_headers
239
+ */
240
+ private function createSigningContext(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, $payload)
241
+ {
242
+ $signable = array('host' => true, 'date' => true, 'content-md5' => true);
243
+ // Normalize the path as required by SigV4 and ensure it's absolute
244
+ $canon = $request->getMethod() . "\n" . $this->createCanonicalizedPath($request) . "\n" . $this->getCanonicalizedQueryString($request) . "\n";
245
+ $canonHeaders = array();
246
+ foreach ($request->getHeaders()->getAll() as $key => $values) {
247
+ $key = strtolower($key);
248
+ if (isset($signable[$key]) || substr($key, 0, 6) === 'x-amz-') {
249
+ $values = $values->toArray();
250
+ if (count($values) == 1) {
251
+ $values = $values[0];
252
+ } else {
253
+ sort($values);
254
+ $values = implode(',', $values);
255
+ }
256
+ $canonHeaders[$key] = $key . ':' . preg_replace('/\\s+/', ' ', $values);
257
+ }
258
+ }
259
+ ksort($canonHeaders);
260
+ $signedHeadersString = implode(';', array_keys($canonHeaders));
261
+ $canon .= implode("\n", $canonHeaders) . "\n\n" . $signedHeadersString . "\n" . $payload;
262
+ return array('canonical_request' => $canon, 'signed_headers' => $signedHeadersString);
263
+ }
264
+ /**
265
+ * Get a hash for a specific key and value. If the hash was previously
266
+ * cached, return it
267
+ *
268
+ * @param string $shortDate Short date
269
+ * @param string $region Region name
270
+ * @param string $service Service name
271
+ * @param string $secretKey Secret Access Key
272
+ *
273
+ * @return string
274
+ */
275
+ private function getSigningKey($shortDate, $region, $service, $secretKey)
276
+ {
277
+ $cacheKey = $shortDate . '_' . $region . '_' . $service . '_' . $secretKey;
278
+ // Retrieve the hash form the cache or create it and add it to the cache
279
+ if (!isset($this->hashCache[$cacheKey])) {
280
+ // When the cache size reaches the max, then just clear the cache
281
+ if (++$this->cacheSize > $this->maxCacheSize) {
282
+ $this->hashCache = array();
283
+ $this->cacheSize = 0;
284
+ }
285
+ $dateKey = hash_hmac('sha256', $shortDate, 'AWS4' . $secretKey, true);
286
+ $regionKey = hash_hmac('sha256', $region, $dateKey, true);
287
+ $serviceKey = hash_hmac('sha256', $service, $regionKey, true);
288
+ $this->hashCache[$cacheKey] = hash_hmac('sha256', 'aws4_request', $serviceKey, true);
289
+ }
290
+ return $this->hashCache[$cacheKey];
291
+ }
292
+ /**
293
+ * Get the canonicalized query string for a request
294
+ *
295
+ * @param RequestInterface $request
296
+ * @return string
297
+ */
298
+ private function getCanonicalizedQueryString(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request)
299
+ {
300
+ $queryParams = $request->getQuery()->getAll();
301
+ unset($queryParams['X-Amz-Signature']);
302
+ if (empty($queryParams)) {
303
+ return '';
304
+ }
305
+ $qs = '';
306
+ ksort($queryParams);
307
+ foreach ($queryParams as $key => $values) {
308
+ if (is_array($values)) {
309
+ sort($values);
310
+ } elseif ($values === 0) {
311
+ $values = array('0');
312
+ } elseif (!$values) {
313
+ $values = array('');
314
+ }
315
+ foreach ((array) $values as $value) {
316
+ if ($value === \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\QueryString::BLANK) {
317
+ $value = '';
318
+ }
319
+ $qs .= rawurlencode($key) . '=' . rawurlencode($value) . '&';
320
+ }
321
+ }
322
+ return substr($qs, 0, -1);
323
+ }
324
+ private function convertExpires($expires)
325
+ {
326
+ if ($expires instanceof \DateTime) {
327
+ $expires = $expires->getTimestamp();
328
+ } elseif (!is_numeric($expires)) {
329
+ $expires = strtotime($expires);
330
+ }
331
+ $duration = $expires - time();
332
+ // Ensure that the duration of the signature is not longer than a week
333
+ if ($duration > 604800) {
334
+ throw new \InvalidArgumentException('The expiration date of a ' . 'signature version 4 presigned URL must be less than one ' . 'week');
335
+ }
336
+ return $duration;
337
+ }
338
+ private function createScope($shortDate, $region, $service)
339
+ {
340
+ return $shortDate . '/' . $region . '/' . $service . '/aws4_request';
341
+ }
342
+ private function addQueryValues($scope, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials, $expires)
343
+ {
344
+ $credential = $credentials->getAccessKeyId() . '/' . $scope;
345
+ // Set query params required for pre-signed URLs
346
+ $request->getQuery()->set('X-Amz-Algorithm', 'AWS4-HMAC-SHA256')->set('X-Amz-Credential', $credential)->set('X-Amz-Date', gmdate('Ymd\\THis\\Z', $this->getTimestamp()))->set('X-Amz-SignedHeaders', 'Host')->set('X-Amz-Expires', $this->convertExpires($expires));
347
+ }
348
+ private function moveHeadersToQuery(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request)
349
+ {
350
+ $query = $request->getQuery();
351
+ foreach ($request->getHeaders() as $name => $header) {
352
+ if (substr($name, 0, 5) == 'x-amz') {
353
+ $query[$header->getName()] = (string) $header;
354
+ }
355
+ if ($name !== 'host') {
356
+ $request->removeHeader($name);
357
+ }
358
+ }
359
+ }
360
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/AbstractResourceWaiter.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AwsClientInterface;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException;
21
+ /**
22
+ * Abstract waiter implementation used to wait on resources
23
+ */
24
+ abstract class AbstractResourceWaiter extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\AbstractWaiter implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\ResourceWaiterInterface
25
+ {
26
+ /**
27
+ * @var AwsClientInterface
28
+ */
29
+ protected $client;
30
+ /**
31
+ * {@inheritdoc}
32
+ */
33
+ public function setClient(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AwsClientInterface $client)
34
+ {
35
+ $this->client = $client;
36
+ return $this;
37
+ }
38
+ /**
39
+ * {@inheritdoc}
40
+ */
41
+ public function wait()
42
+ {
43
+ if (!$this->client) {
44
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException('No client has been specified on the waiter');
45
+ }
46
+ parent::wait();
47
+ }
48
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/AbstractWaiter.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\AbstractHasDispatcher;
21
+ /**
22
+ * Abstract wait implementation
23
+ */
24
+ abstract class AbstractWaiter extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\AbstractHasDispatcher implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterInterface
25
+ {
26
+ protected $attempts = 0;
27
+ protected $config = array();
28
+ /**
29
+ * {@inheritdoc}
30
+ */
31
+ public static function getAllEvents()
32
+ {
33
+ return array(
34
+ // About to check if the waiter needs to wait
35
+ 'waiter.before_attempt',
36
+ // About to sleep
37
+ 'waiter.before_wait',
38
+ );
39
+ }
40
+ /**
41
+ * The max attempts allowed by the waiter
42
+ *
43
+ * @return int
44
+ */
45
+ public function getMaxAttempts()
46
+ {
47
+ return isset($this->config[self::MAX_ATTEMPTS]) ? $this->config[self::MAX_ATTEMPTS] : 10;
48
+ }
49
+ /**
50
+ * Get the amount of time in seconds to delay between attempts
51
+ *
52
+ * @return int
53
+ */
54
+ public function getInterval()
55
+ {
56
+ return isset($this->config[self::INTERVAL]) ? $this->config[self::INTERVAL] : 0;
57
+ }
58
+ /**
59
+ * {@inheritdoc}
60
+ */
61
+ public function setMaxAttempts($maxAttempts)
62
+ {
63
+ $this->config[self::MAX_ATTEMPTS] = $maxAttempts;
64
+ return $this;
65
+ }
66
+ /**
67
+ * {@inheritdoc}
68
+ */
69
+ public function setInterval($interval)
70
+ {
71
+ $this->config[self::INTERVAL] = $interval;
72
+ return $this;
73
+ }
74
+ /**
75
+ * Set config options associated with the waiter
76
+ *
77
+ * @param array $config Options to set
78
+ *
79
+ * @return self
80
+ */
81
+ public function setConfig(array $config)
82
+ {
83
+ if (isset($config['waiter.before_attempt'])) {
84
+ $this->getEventDispatcher()->addListener('waiter.before_attempt', $config['waiter.before_attempt']);
85
+ unset($config['waiter.before_attempt']);
86
+ }
87
+ if (isset($config['waiter.before_wait'])) {
88
+ $this->getEventDispatcher()->addListener('waiter.before_wait', $config['waiter.before_wait']);
89
+ unset($config['waiter.before_wait']);
90
+ }
91
+ $this->config = $config;
92
+ return $this;
93
+ }
94
+ /**
95
+ * {@inheritdoc}
96
+ */
97
+ public function wait()
98
+ {
99
+ $this->attempts = 0;
100
+ do {
101
+ $this->dispatch('waiter.before_attempt', array('waiter' => $this, 'config' => $this->config));
102
+ if ($this->doWait()) {
103
+ break;
104
+ }
105
+ if (++$this->attempts >= $this->getMaxAttempts()) {
106
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException('Wait method never resolved to true after ' . $this->attempts . ' attempts');
107
+ }
108
+ $this->dispatch('waiter.before_wait', array('waiter' => $this, 'config' => $this->config));
109
+ if ($this->getInterval()) {
110
+ usleep($this->getInterval() * 1000000);
111
+ }
112
+ } while (1);
113
+ }
114
+ /**
115
+ * Method to implement in subclasses
116
+ *
117
+ * @return bool Return true when successful, false on failure
118
+ */
119
+ protected abstract function doWait();
120
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/CallableWaiter.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException;
21
+ /**
22
+ * Callable wait implementation
23
+ */
24
+ class CallableWaiter extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\AbstractWaiter
25
+ {
26
+ /**
27
+ * @var callable Callable function
28
+ */
29
+ protected $callable;
30
+ /**
31
+ * @var array Additional context for the callable function
32
+ */
33
+ protected $context = array();
34
+ /**
35
+ * Set the callable function to call in each wait attempt
36
+ *
37
+ * @param callable $callable Callable function
38
+ *
39
+ * @return self
40
+ * @throws InvalidArgumentException when the method is not callable
41
+ */
42
+ public function setCallable($callable)
43
+ {
44
+ if (!is_callable($callable)) {
45
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('Value is not callable');
46
+ }
47
+ $this->callable = $callable;
48
+ return $this;
49
+ }
50
+ /**
51
+ * Set additional context for the callable function. This data will be passed into the callable function as the
52
+ * second argument
53
+ *
54
+ * @param array $context Additional context
55
+ *
56
+ * @return self
57
+ */
58
+ public function setContext(array $context)
59
+ {
60
+ $this->context = $context;
61
+ return $this;
62
+ }
63
+ /**
64
+ * {@inheritdoc}
65
+ */
66
+ public function doWait()
67
+ {
68
+ if (!$this->callable) {
69
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException('No callable was specified for the wait method');
70
+ }
71
+ return call_user_func($this->callable, $this->attempts, $this->context);
72
+ }
73
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/CompositeWaiterFactory.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
20
+ /**
21
+ * Factory that utilizes multiple factories for creating waiters
22
+ */
23
+ class CompositeWaiterFactory implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterFactoryInterface
24
+ {
25
+ /**
26
+ * @var array Array of factories
27
+ */
28
+ protected $factories;
29
+ /**
30
+ * @param array $factories Array of factories used to instantiate waiters
31
+ */
32
+ public function __construct(array $factories)
33
+ {
34
+ $this->factories = $factories;
35
+ }
36
+ /**
37
+ * {@inheritdoc}
38
+ */
39
+ public function build($waiter)
40
+ {
41
+ if (!($factory = $this->getFactory($waiter))) {
42
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException("Waiter was not found matching {$waiter}.");
43
+ }
44
+ return $factory->build($waiter);
45
+ }
46
+ /**
47
+ * {@inheritdoc}
48
+ */
49
+ public function canBuild($waiter)
50
+ {
51
+ return (bool) $this->getFactory($waiter);
52
+ }
53
+ /**
54
+ * Add a factory to the composite factory
55
+ *
56
+ * @param WaiterFactoryInterface $factory Factory to add
57
+ *
58
+ * @return self
59
+ */
60
+ public function addFactory(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterFactoryInterface $factory)
61
+ {
62
+ $this->factories[] = $factory;
63
+ return $this;
64
+ }
65
+ /**
66
+ * Get the factory that matches the waiter name
67
+ *
68
+ * @param string $waiter Name of the waiter
69
+ *
70
+ * @return WaiterFactoryInterface|bool
71
+ */
72
+ protected function getFactory($waiter)
73
+ {
74
+ foreach ($this->factories as $factory) {
75
+ if ($factory->canBuild($waiter)) {
76
+ return $factory;
77
+ }
78
+ }
79
+ return false;
80
+ }
81
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/ConfigResourceWaiter.php ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\ServiceResponseException;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\Model;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Exception\ValidationException;
24
+ /**
25
+ * Resource waiter driven by configuration options
26
+ */
27
+ class ConfigResourceWaiter extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\AbstractResourceWaiter
28
+ {
29
+ /**
30
+ * @var WaiterConfig Waiter configuration
31
+ */
32
+ protected $waiterConfig;
33
+ /**
34
+ * @param WaiterConfig $waiterConfig Waiter configuration
35
+ */
36
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfig $waiterConfig)
37
+ {
38
+ $this->waiterConfig = $waiterConfig;
39
+ $this->setInterval($waiterConfig->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfig::INTERVAL));
40
+ $this->setMaxAttempts($waiterConfig->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfig::MAX_ATTEMPTS));
41
+ }
42
+ /**
43
+ * {@inheritdoc}
44
+ */
45
+ public function setConfig(array $config)
46
+ {
47
+ foreach ($config as $key => $value) {
48
+ if (substr($key, 0, 7) == 'waiter.') {
49
+ $this->waiterConfig->set(substr($key, 7), $value);
50
+ }
51
+ }
52
+ if (!isset($config[self::INTERVAL])) {
53
+ $config[self::INTERVAL] = $this->waiterConfig->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfig::INTERVAL);
54
+ }
55
+ if (!isset($config[self::MAX_ATTEMPTS])) {
56
+ $config[self::MAX_ATTEMPTS] = $this->waiterConfig->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfig::MAX_ATTEMPTS);
57
+ }
58
+ return parent::setConfig($config);
59
+ }
60
+ /**
61
+ * Get the waiter's configuration data
62
+ *
63
+ * @return WaiterConfig
64
+ */
65
+ public function getWaiterConfig()
66
+ {
67
+ return $this->waiterConfig;
68
+ }
69
+ /**
70
+ * {@inheritdoc}
71
+ */
72
+ protected function doWait()
73
+ {
74
+ $params = $this->config;
75
+ // remove waiter settings from the operation's input
76
+ foreach (array_keys($params) as $key) {
77
+ if (substr($key, 0, 7) == 'waiter.') {
78
+ unset($params[$key]);
79
+ }
80
+ }
81
+ $operation = $this->client->getCommand($this->waiterConfig->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfig::OPERATION), $params);
82
+ try {
83
+ return $this->checkResult($this->client->execute($operation));
84
+ } catch (ValidationException $e) {
85
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException($this->waiterConfig->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfig::WAITER_NAME) . ' waiter validation failed: ' . $e->getMessage(), $e->getCode(), $e);
86
+ } catch (ServiceResponseException $e) {
87
+ // Check if this exception satisfies a success or failure acceptor
88
+ $transition = $this->checkErrorAcceptor($e);
89
+ if (null !== $transition) {
90
+ return $transition;
91
+ }
92
+ // Check if this exception should be ignored
93
+ foreach ((array) $this->waiterConfig->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfig::IGNORE_ERRORS) as $ignore) {
94
+ if ($e->getExceptionCode() == $ignore) {
95
+ // This exception is ignored, so it counts as a failed attempt rather than a fast-fail
96
+ return false;
97
+ }
98
+ }
99
+ // Allow non-ignore exceptions to bubble through
100
+ throw $e;
101
+ }
102
+ }
103
+ /**
104
+ * Check if an exception satisfies a success or failure acceptor
105
+ *
106
+ * @param ServiceResponseException $e
107
+ *
108
+ * @return bool|null Returns true for success, false for failure, and null for no transition
109
+ */
110
+ protected function checkErrorAcceptor(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\ServiceResponseException $e)
111
+ {
112
+ if ($this->waiterConfig->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfig::SUCCESS_TYPE) == 'error') {
113
+ if ($e->getExceptionCode() == $this->waiterConfig->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfig::SUCCESS_VALUE)) {
114
+ // Mark as a success
115
+ return true;
116
+ }
117
+ }
118
+ // Mark as an attempt
119
+ return null;
120
+ }
121
+ /**
122
+ * Check to see if the response model satisfies a success or failure state
123
+ *
124
+ * @param Model $result Result model
125
+ *
126
+ * @return bool
127
+ * @throws RuntimeException
128
+ */
129
+ protected function checkResult(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\Model $result)
130
+ {
131
+ // Check if the result evaluates to true based on the path and output model
132
+ if ($this->waiterConfig->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfig::SUCCESS_TYPE) == 'output' && $this->checkPath($result, $this->waiterConfig->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfig::SUCCESS_PATH), $this->waiterConfig->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfig::SUCCESS_VALUE))) {
133
+ return true;
134
+ }
135
+ // It did not finish waiting yet. Determine if we need to fail-fast based on the failure acceptor.
136
+ if ($this->waiterConfig->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfig::FAILURE_TYPE) == 'output') {
137
+ $failureValue = $this->waiterConfig->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfig::FAILURE_VALUE);
138
+ if ($failureValue) {
139
+ $key = $this->waiterConfig->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfig::FAILURE_PATH);
140
+ if ($this->checkPath($result, $key, $failureValue, false)) {
141
+ // Determine which of the results triggered the failure
142
+ $triggered = array_intersect((array) $this->waiterConfig->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfig::FAILURE_VALUE), array_unique((array) $result->getPath($key)));
143
+ // fast fail because the failure case was satisfied
144
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException('A resource entered into an invalid state of "' . implode(', ', $triggered) . '" while waiting with the "' . $this->waiterConfig->get(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfig::WAITER_NAME) . '" waiter.');
145
+ }
146
+ }
147
+ }
148
+ return false;
149
+ }
150
+ /**
151
+ * Check to see if the path of the output key is satisfied by the value
152
+ *
153
+ * @param Model $model Result model
154
+ * @param string $key Key to check
155
+ * @param string $checkValue Compare the key to the value
156
+ * @param bool $all Set to true to ensure all value match or false to only match one
157
+ *
158
+ * @return bool
159
+ */
160
+ protected function checkPath(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\Model $model, $key = null, $checkValue = array(), $all = true)
161
+ {
162
+ // If no key is set, then just assume true because the request succeeded
163
+ if (!$key) {
164
+ return true;
165
+ }
166
+ if (!($result = $model->getPath($key))) {
167
+ return false;
168
+ }
169
+ $total = $matches = 0;
170
+ foreach ((array) $result as $value) {
171
+ $total++;
172
+ foreach ((array) $checkValue as $check) {
173
+ if ($value == $check) {
174
+ $matches++;
175
+ break;
176
+ }
177
+ }
178
+ }
179
+ // When matching all values, ensure that the match count matches the total count
180
+ if ($all && $total != $matches) {
181
+ return false;
182
+ }
183
+ return $matches > 0;
184
+ }
185
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/ResourceWaiterInterface.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AwsClientInterface;
20
+ /**
21
+ * Interface used in conjunction with clients to wait on a resource
22
+ */
23
+ interface ResourceWaiterInterface extends WaiterInterface
24
+ {
25
+ /**
26
+ * Set the client associated with the waiter
27
+ *
28
+ * @param AwsClientInterface $client Client to use with the waiter
29
+ *
30
+ * @return self
31
+ */
32
+ public function setClient(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AwsClientInterface $client);
33
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/WaiterClassFactory.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Inflection\Inflector;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Inflection\InflectorInterface;
22
+ /**
23
+ * Factory for creating {@see WaiterInterface} objects using a convention of
24
+ * storing waiter classes in the Waiter folder of a client class namespace using
25
+ * a snake_case to CamelCase conversion (e.g. camel_case => CamelCase).
26
+ */
27
+ class WaiterClassFactory implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterFactoryInterface
28
+ {
29
+ /**
30
+ * @var array List of namespaces used to look for classes
31
+ */
32
+ protected $namespaces;
33
+ /**
34
+ * @var InflectorInterface Inflector used to inflect class names
35
+ */
36
+ protected $inflector;
37
+ /**
38
+ * @param array|string $namespaces Namespaces of waiter objects
39
+ * @param InflectorInterface $inflector Inflector used to resolve class names
40
+ */
41
+ public function __construct($namespaces = array(), \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Inflection\InflectorInterface $inflector = null)
42
+ {
43
+ $this->namespaces = (array) $namespaces;
44
+ $this->inflector = $inflector ?: \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Inflection\Inflector::getDefault();
45
+ }
46
+ /**
47
+ * Registers a namespace to check for Waiters
48
+ *
49
+ * @param string $namespace Namespace which contains Waiter classes
50
+ *
51
+ * @return self
52
+ */
53
+ public function registerNamespace($namespace)
54
+ {
55
+ array_unshift($this->namespaces, $namespace);
56
+ return $this;
57
+ }
58
+ /**
59
+ * {@inheritdoc}
60
+ */
61
+ public function build($waiter)
62
+ {
63
+ if (!($className = $this->getClassName($waiter))) {
64
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException("Waiter was not found matching {$waiter}.");
65
+ }
66
+ return new $className();
67
+ }
68
+ /**
69
+ * {@inheritdoc}
70
+ */
71
+ public function canBuild($waiter)
72
+ {
73
+ return $this->getClassName($waiter) !== null;
74
+ }
75
+ /**
76
+ * Get the name of a waiter class
77
+ *
78
+ * @param string $waiter Waiter name
79
+ *
80
+ * @return string|null
81
+ */
82
+ protected function getClassName($waiter)
83
+ {
84
+ $waiterName = $this->inflector->camel($waiter);
85
+ // Determine the name of the class to load
86
+ $className = null;
87
+ foreach ($this->namespaces as $namespace) {
88
+ $potentialClassName = $namespace . '\\' . $waiterName;
89
+ if (class_exists($potentialClassName)) {
90
+ return $potentialClassName;
91
+ }
92
+ }
93
+ return null;
94
+ }
95
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/WaiterConfig.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection;
20
+ /**
21
+ * Configuration info of a waiter object
22
+ */
23
+ class WaiterConfig extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection
24
+ {
25
+ const WAITER_NAME = 'name';
26
+ const MAX_ATTEMPTS = 'max_attempts';
27
+ const INTERVAL = 'interval';
28
+ const OPERATION = 'operation';
29
+ const IGNORE_ERRORS = 'ignore_errors';
30
+ const DESCRIPTION = 'description';
31
+ const SUCCESS_TYPE = 'success.type';
32
+ const SUCCESS_PATH = 'success.path';
33
+ const SUCCESS_VALUE = 'success.value';
34
+ const FAILURE_TYPE = 'failure.type';
35
+ const FAILURE_PATH = 'failure.path';
36
+ const FAILURE_VALUE = 'failure.value';
37
+ /**
38
+ * @param array $data Array of configuration directives
39
+ */
40
+ public function __construct(array $data = array())
41
+ {
42
+ $this->data = $data;
43
+ $this->extractConfig();
44
+ }
45
+ /**
46
+ * Create the command configuration variables
47
+ */
48
+ protected function extractConfig()
49
+ {
50
+ // Populate success.* and failure.* if specified in acceptor.*
51
+ foreach ($this->data as $key => $value) {
52
+ if (substr($key, 0, 9) == 'acceptor.') {
53
+ $name = substr($key, 9);
54
+ if (!isset($this->data["success.{$name}"])) {
55
+ $this->data["success.{$name}"] = $value;
56
+ }
57
+ if (!isset($this->data["failure.{$name}"])) {
58
+ $this->data["failure.{$name}"] = $value;
59
+ }
60
+ unset($this->data[$key]);
61
+ }
62
+ }
63
+ }
64
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/WaiterConfigFactory.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Inflection\Inflector;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Inflection\InflectorInterface;
22
+ /**
23
+ * Factory for creating {@see WaiterInterface} objects using a configuration DSL.
24
+ */
25
+ class WaiterConfigFactory implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterFactoryInterface
26
+ {
27
+ /**
28
+ * @var array Configuration directives
29
+ */
30
+ protected $config;
31
+ /**
32
+ * @var InflectorInterface Inflector used to inflect class names
33
+ */
34
+ protected $inflector;
35
+ /**
36
+ * @param array $config Array of configuration directives
37
+ * @param InflectorInterface $inflector Inflector used to resolve class names
38
+ */
39
+ public function __construct(array $config, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Inflection\InflectorInterface $inflector = null)
40
+ {
41
+ $this->config = $config;
42
+ $this->inflector = $inflector ?: \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Inflection\Inflector::getDefault();
43
+ }
44
+ /**
45
+ * {@inheritdoc}
46
+ */
47
+ public function build($waiter)
48
+ {
49
+ return new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\ConfigResourceWaiter($this->getWaiterConfig($waiter));
50
+ }
51
+ /**
52
+ * {@inheritdoc}
53
+ */
54
+ public function canBuild($waiter)
55
+ {
56
+ return isset($this->config[$waiter]) || isset($this->config[$this->inflector->camel($waiter)]);
57
+ }
58
+ /**
59
+ * Get waiter configuration data, taking __default__ and extensions into account
60
+ *
61
+ * @param string $name Waiter name
62
+ *
63
+ * @return WaiterConfig
64
+ * @throws InvalidArgumentException
65
+ */
66
+ protected function getWaiterConfig($name)
67
+ {
68
+ if (!$this->canBuild($name)) {
69
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('No waiter found matching "' . $name . '"');
70
+ }
71
+ // inflect the name if needed
72
+ $name = isset($this->config[$name]) ? $name : $this->inflector->camel($name);
73
+ $waiter = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfig($this->config[$name]);
74
+ $waiter['name'] = $name;
75
+ // Always use __default__ as the basis if it's set
76
+ if (isset($this->config['__default__'])) {
77
+ $parentWaiter = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter\WaiterConfig($this->config['__default__']);
78
+ $waiter = $parentWaiter->overwriteWith($waiter);
79
+ }
80
+ // Allow for configuration extensions
81
+ if (isset($this->config[$name]['extends'])) {
82
+ $waiter = $this->getWaiterConfig($this->config[$name]['extends'])->overwriteWith($waiter);
83
+ }
84
+ return $waiter;
85
+ }
86
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/WaiterFactoryInterface.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter;
18
+
19
+ /**
20
+ * Waiter factory used to create waiter objects by short names
21
+ */
22
+ interface WaiterFactoryInterface
23
+ {
24
+ /**
25
+ * Create a waiter by name
26
+ *
27
+ * @param string $waiter Name of the waiter to create
28
+ *
29
+ * @return WaiterInterface
30
+ */
31
+ public function build($waiter);
32
+ /**
33
+ * Check if the factory can create a waiter by a specific name
34
+ *
35
+ * @param string $waiter Name of the waiter to check
36
+ *
37
+ * @return bool
38
+ */
39
+ public function canBuild($waiter);
40
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/Common/Waiter/WaiterInterface.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Waiter;
18
+
19
+ /**
20
+ * WaiterInterface used to wait on something to be in a particular state
21
+ */
22
+ interface WaiterInterface
23
+ {
24
+ const INTERVAL = 'waiter.interval';
25
+ const MAX_ATTEMPTS = 'waiter.max_attempts';
26
+ /**
27
+ * Set the maximum number of attempts to make when waiting
28
+ *
29
+ * @param int $maxAttempts Max number of attempts
30
+ *
31
+ * @return self
32
+ */
33
+ public function setMaxAttempts($maxAttempts);
34
+ /**
35
+ * Set the amount of time to interval between attempts
36
+ *
37
+ * @param int $interval Interval in seconds
38
+ *
39
+ * @return self
40
+ */
41
+ public function setInterval($interval);
42
+ /**
43
+ * Set configuration options associated with the waiter
44
+ *
45
+ * @param array $config Configuration options to set
46
+ *
47
+ * @return self
48
+ */
49
+ public function setConfig(array $config);
50
+ /**
51
+ * Begin the waiting loop
52
+ *
53
+ * @throw RuntimeException if the method never resolves to true
54
+ */
55
+ public function wait();
56
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/AcpListener.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\Acp;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Symfony\Component\EventDispatcher\EventSubscriberInterface;
23
+ /**
24
+ * Listener used to add an Access Control Policy to a request
25
+ */
26
+ class AcpListener implements \DeliciousBrains\WP_Offload_S3\Aws2\Symfony\Component\EventDispatcher\EventSubscriberInterface
27
+ {
28
+ /**
29
+ * {@inheritdoc}
30
+ */
31
+ public static function getSubscribedEvents()
32
+ {
33
+ return array('command.before_prepare' => array('onCommandBeforePrepare', -255));
34
+ }
35
+ /**
36
+ * An event handler for constructing ACP definitions.
37
+ *
38
+ * @param Event $event The event to respond to.
39
+ *
40
+ * @throws InvalidArgumentException
41
+ */
42
+ public function onCommandBeforePrepare(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event $event)
43
+ {
44
+ /** @var \Guzzle\Service\Command\AbstractCommand $command */
45
+ $command = $event['command'];
46
+ $operation = $command->getOperation();
47
+ if ($operation->hasParam('ACP') && $command->hasKey('ACP')) {
48
+ if ($acp = $command->get('ACP')) {
49
+ // Ensure that the correct object was passed
50
+ if (!$acp instanceof Acp) {
51
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('ACP must be an instance of Aws\\S3\\Model\\Acp');
52
+ }
53
+ // Check if the user specified both an ACP and Grants
54
+ if ($command->hasKey('Grants')) {
55
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('Use either the ACP parameter or the Grants parameter. Do not use both.');
56
+ }
57
+ // Add the correct headers/body based parameters to the command
58
+ if ($operation->hasParam('Grants')) {
59
+ $command->overwriteWith($acp->toArray());
60
+ } else {
61
+ $acp->updateCommand($command);
62
+ }
63
+ }
64
+ // Remove the ACP parameter
65
+ $command->remove('ACP');
66
+ }
67
+ }
68
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/BucketStyleListener.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Symfony\Component\EventDispatcher\EventSubscriberInterface;
21
+ /**
22
+ * Listener used to change the way in which buckets are referenced (path/virtual style) based on context
23
+ */
24
+ class BucketStyleListener implements \DeliciousBrains\WP_Offload_S3\Aws2\Symfony\Component\EventDispatcher\EventSubscriberInterface
25
+ {
26
+ private static $exclusions = array('GetBucketLocation' => true);
27
+ public static function getSubscribedEvents()
28
+ {
29
+ return array('command.after_prepare' => array('onCommandAfterPrepare', -255));
30
+ }
31
+ /**
32
+ * Changes how buckets are referenced in the HTTP request
33
+ *
34
+ * @param Event $event Event emitted
35
+ */
36
+ public function onCommandAfterPrepare(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event $event)
37
+ {
38
+ $command = $event['command'];
39
+ $bucket = $command['Bucket'];
40
+ $request = $command->getRequest();
41
+ $pathStyle = false;
42
+ // Skip operations that do not need the bucket moved to the host.
43
+ if (isset(self::$exclusions[$command->getName()])) {
44
+ return;
45
+ }
46
+ if ($key = $command['Key']) {
47
+ // Modify the command Key to account for the {/Key*} explosion into an array
48
+ if (is_array($key)) {
49
+ $command['Key'] = $key = implode('/', $key);
50
+ }
51
+ }
52
+ // Set the key and bucket on the request
53
+ $request->getParams()->set('bucket', $bucket)->set('key', $key);
54
+ // Switch to virtual if PathStyle is disabled, or not a DNS compatible bucket name, or the scheme is
55
+ // http, or the scheme is https and there are no dots in the host header (avoids SSL issues)
56
+ if (!$command['PathStyle'] && $command->getClient()->isValidBucketName($bucket) && !($command->getRequest()->getScheme() == 'https' && strpos($bucket, '.'))) {
57
+ // Switch to virtual hosted bucket
58
+ $request->setHost($bucket . '.' . $request->getHost());
59
+ $request->setPath(preg_replace("#^/{$bucket}#", '', $request->getPath()));
60
+ } else {
61
+ $pathStyle = true;
62
+ }
63
+ if (!$bucket) {
64
+ $request->getParams()->set('s3.resource', '/');
65
+ } elseif ($pathStyle) {
66
+ // Path style does not need a trailing slash
67
+ $request->getParams()->set('s3.resource', '/' . rawurlencode($bucket) . ($key ? '/' . \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\S3Client::encodeKey($key) : ''));
68
+ } else {
69
+ // Bucket style needs a trailing slash
70
+ $request->getParams()->set('s3.resource', '/' . rawurlencode($bucket) . ($key ? '/' . \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\S3Client::encodeKey($key) : '/'));
71
+ }
72
+ }
73
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Command/S3Command.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Command;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\OperationCommand;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\Model;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event;
22
+ /**
23
+ * Adds functionality to Amazon S3 commands:
24
+ * - Adds the PutObject URL to a response
25
+ * - Allows creating a Pre-signed URL from any command
26
+ */
27
+ class S3Command extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\OperationCommand
28
+ {
29
+ /**
30
+ * Create a pre-signed URL for the operation
31
+ *
32
+ * @param int|string $expires The Unix timestamp to expire at or a string that can be evaluated by strtotime
33
+ *
34
+ * @return string
35
+ */
36
+ public function createPresignedUrl($expires)
37
+ {
38
+ return $this->client->createPresignedUrl($this->prepare(), $expires);
39
+ }
40
+ /**
41
+ * {@inheritdoc}
42
+ */
43
+ protected function process()
44
+ {
45
+ $request = $this->getRequest();
46
+ $response = $this->getResponse();
47
+ // Dispatch an error if a 301 redirect occurred
48
+ if ($response->getStatusCode() == 301) {
49
+ $this->getClient()->getEventDispatcher()->dispatch('request.error', new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event(array('request' => $this->getRequest(), 'response' => $response)));
50
+ }
51
+ parent::process();
52
+ // Set the GetObject URL if using the PutObject operation
53
+ if ($this->result instanceof Model && $this->getName() == 'PutObject') {
54
+ $this->result->set('ObjectURL', $request->getUrl());
55
+ }
56
+ }
57
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/CannedAcl.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
20
+ /**
21
+ * Contains enumerable CannedAcl values
22
+ */
23
+ class CannedAcl extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
24
+ {
25
+ const PRIVATE_ACCESS = 'private';
26
+ const PUBLIC_READ = 'public-read';
27
+ const PUBLIC_READ_WRITE = 'public-read-write';
28
+ const AUTHENTICATED_READ = 'authenticated-read';
29
+ const BUCKET_OWNER_READ = 'bucket-owner-read';
30
+ const BUCKET_OWNER_FULL_CONTROL = 'bucket-owner-full-control';
31
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/EncodingType.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
20
+ /**
21
+ * Contains enumerable EncodingType values
22
+ */
23
+ class EncodingType extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
24
+ {
25
+ const URL = 'url';
26
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/Event.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
20
+ /**
21
+ * Contains enumerable Event values
22
+ */
23
+ class Event extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
24
+ {
25
+ const REDUCED_REDUNDANCY_LOST_OBJECT = 's3:ReducedRedundancyLostObject';
26
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/GranteeType.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
20
+ /**
21
+ * Contains enumerable GranteeType values
22
+ */
23
+ class GranteeType extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
24
+ {
25
+ const USER = 'CanonicalUser';
26
+ const EMAIL = 'AmazonCustomerByEmail';
27
+ const GROUP = 'Group';
28
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/Group.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
20
+ /**
21
+ * Contains enumerable Amazon S3 group options for ACL grantees
22
+ */
23
+ class Group extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
24
+ {
25
+ const AUTHENTICATED_USERS = 'http://acs.amazonaws.com/groups/global/AuthenticatedUsers';
26
+ const ALL_USERS = 'http://acs.amazonaws.com/groups/global/AllUsers';
27
+ const LOG_DELIVERY = 'http://acs.amazonaws.com/groups/s3/LogDelivery';
28
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/MFADelete.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
20
+ /**
21
+ * Contains enumerable MFADelete values
22
+ */
23
+ class MFADelete extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
24
+ {
25
+ const ENABLED = 'Enabled';
26
+ const DISABLED = 'Disabled';
27
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/MetadataDirective.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
20
+ /**
21
+ * Contains enumerable MetadataDirective values
22
+ */
23
+ class MetadataDirective extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
24
+ {
25
+ const COPY = 'COPY';
26
+ const REPLACE = 'REPLACE';
27
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/Payer.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
20
+ /**
21
+ * Contains enumerable Payer values
22
+ */
23
+ class Payer extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
24
+ {
25
+ const REQUESTER = 'Requester';
26
+ const BUCKET_OWNER = 'BucketOwner';
27
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/Permission.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
20
+ /**
21
+ * Contains enumerable Permission values
22
+ */
23
+ class Permission extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
24
+ {
25
+ const FULL_CONTROL = 'FULL_CONTROL';
26
+ const WRITE = 'WRITE';
27
+ const WRITE_ACP = 'WRITE_ACP';
28
+ const READ = 'READ';
29
+ const READ_ACP = 'READ_ACP';
30
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/Protocol.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
20
+ /**
21
+ * Contains enumerable Protocol values
22
+ */
23
+ class Protocol extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
24
+ {
25
+ const HTTP = 'http';
26
+ const HTTPS = 'https';
27
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/ServerSideEncryption.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
20
+ /**
21
+ * Contains enumerable ServerSideEncryption values
22
+ */
23
+ class ServerSideEncryption extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
24
+ {
25
+ const AES256 = 'AES256';
26
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/Status.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
20
+ /**
21
+ * Contains enumerable Status values
22
+ */
23
+ class Status extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
24
+ {
25
+ const ENABLED = 'Enabled';
26
+ const SUSPENDED = 'Suspended';
27
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/Storage.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
20
+ /**
21
+ * Contains enumerable Amazon S3 storage options
22
+ */
23
+ class Storage extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
24
+ {
25
+ const STANDARD = 'STANDARD';
26
+ const REDUCED = 'REDUCED_REDUNDANCY';
27
+ const GLACIER = 'GLACIER';
28
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Enum/StorageClass.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum;
20
+ /**
21
+ * Contains enumerable StorageClass values
22
+ */
23
+ class StorageClass extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum
24
+ {
25
+ const STANDARD = 'STANDARD';
26
+ const REDUCED_REDUNDANCY = 'REDUCED_REDUNDANCY';
27
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/AccessDeniedException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Access Denied
21
+ */
22
+ class AccessDeniedException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/AccountProblemException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * There is a problem with your AWS account that prevents the operation from completing successfully. Please use Contact Us.
21
+ */
22
+ class AccountProblemException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/AmbiguousGrantByEmailAddressException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The e-mail address you provided is associated with more than one account.
21
+ */
22
+ class AmbiguousGrantByEmailAddressException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/BadDigestException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The Content-MD5 you specified did not match what we received.
21
+ */
22
+ class BadDigestException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/BucketAlreadyExistsException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again.
21
+ */
22
+ class BucketAlreadyExistsException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/BucketAlreadyOwnedByYouException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Your previous request to create the named bucket succeeded and you already own it.
21
+ */
22
+ class BucketAlreadyOwnedByYouException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/BucketNotEmptyException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The bucket you tried to delete is not empty.
21
+ */
22
+ class BucketNotEmptyException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/CredentialsNotSupportedException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * This request does not support credentials.
21
+ */
22
+ class CredentialsNotSupportedException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/CrossLocationLoggingProhibitedException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Cross location logging not allowed. Buckets in one geographic location cannot log information to a bucket in another location.
21
+ */
22
+ class CrossLocationLoggingProhibitedException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/DeleteMultipleObjectsException.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Exception thrown when errors occur in a DeleteMultipleObjects request
21
+ */
22
+ class DeleteMultipleObjectsException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ /**
25
+ * @var array Array of errors
26
+ */
27
+ protected $errors = array();
28
+ /**
29
+ * @param array $errors Array of errors
30
+ */
31
+ public function __construct(array $errors = array())
32
+ {
33
+ parent::__construct('Unable to delete certain keys when executing a DeleteMultipleObjects request');
34
+ $this->errors = $errors;
35
+ }
36
+ /**
37
+ * Get the errored objects
38
+ *
39
+ * @return array Returns an array of associative arrays, each containing
40
+ * a 'Code', 'Message', and 'Key' key.
41
+ */
42
+ public function getErrors()
43
+ {
44
+ return $this->errors;
45
+ }
46
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/EntityTooLargeException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Your proposed upload exceeds the maximum allowed object size.
21
+ */
22
+ class EntityTooLargeException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/EntityTooSmallException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Your proposed upload is smaller than the minimum allowed object size.
21
+ */
22
+ class EntityTooSmallException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/ExpiredTokenException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The provided token has expired.
21
+ */
22
+ class ExpiredTokenException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/IllegalVersioningConfigurationException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Indicates that the Versioning configuration specified in the request is invalid.
21
+ */
22
+ class IllegalVersioningConfigurationException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/IncompleteBodyException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * You did not provide the number of bytes specified by the Content-Length HTTP header
21
+ */
22
+ class IncompleteBodyException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/IncorrectNumberOfFilesInPostRequestException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * POST requires exactly one file upload per request.
21
+ */
22
+ class IncorrectNumberOfFilesInPostRequestException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InlineDataTooLargeException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Inline data exceeds the maximum allowed size.
21
+ */
22
+ class InlineDataTooLargeException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InternalErrorException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * We encountered an internal error. Please try again.
21
+ */
22
+ class InternalErrorException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidAccessKeyIdException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The AWS Access Key Id you provided does not exist in our records.
21
+ */
22
+ class InvalidAccessKeyIdException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidAddressingHeaderException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * You must specify the Anonymous role.
21
+ */
22
+ class InvalidAddressingHeaderException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidArgumentException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Invalid Argument
21
+ */
22
+ class InvalidArgumentException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidBucketNameException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The specified bucket is not valid.
21
+ */
22
+ class InvalidBucketNameException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidBucketStateException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The request is not valid with the current state of the bucket.
21
+ */
22
+ class InvalidBucketStateException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidDigestException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The Content-MD5 you specified was an invalid.
21
+ */
22
+ class InvalidDigestException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidLocationConstraintException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The specified location constraint is not valid. For more information about Regions, see How to Select a Region for Your Buckets.
21
+ */
22
+ class InvalidLocationConstraintException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidPartException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * One or more of the specified parts could not be found. The part might not have been uploaded, or the specified entity tag might not have matched the part's entity tag.
21
+ */
22
+ class InvalidPartException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidPartOrderException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The list of parts was not in ascending order.Parts list must specified in order by part number.
21
+ */
22
+ class InvalidPartOrderException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidPayerException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * All access to this object has been disabled.
21
+ */
22
+ class InvalidPayerException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidPolicyDocumentException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The content of the form does not meet the conditions specified in the policy document.
21
+ */
22
+ class InvalidPolicyDocumentException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidRangeException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The requested range cannot be satisfied.
21
+ */
22
+ class InvalidRangeException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidRequestException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * SOAP requests must be made over an HTTPS connection.
21
+ */
22
+ class InvalidRequestException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidSOAPRequestException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The SOAP request body is invalid.
21
+ */
22
+ class InvalidSOAPRequestException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidSecurityException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The provided security credentials are not valid.
21
+ */
22
+ class InvalidSecurityException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidStorageClassException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The storage class you specified is not valid.
21
+ */
22
+ class InvalidStorageClassException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidTagErrorException.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The Tag provided was not a valid tag. This can occur if the Tag did not pass input validation. See the
21
+ * CostAllocation docs for a description of valid tags.
22
+ */
23
+ class InvalidTagErrorException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
24
+ {
25
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidTargetBucketForLoggingException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The target bucket for logging does not exist, is not owned by you, or does not have the appropriate grants for the log-delivery group.
21
+ */
22
+ class InvalidTargetBucketForLoggingException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidTokenException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The provided token is malformed or otherwise invalid.
21
+ */
22
+ class InvalidTokenException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/InvalidURIException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Couldn't parse the specified URI.
21
+ */
22
+ class InvalidURIException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/KeyTooLongException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Your key is too long.
21
+ */
22
+ class KeyTooLongException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MalformedACLErrorException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The XML you provided was not well-formed or did not validate against our published schema.
21
+ */
22
+ class MalformedACLErrorException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MalformedPOSTRequestException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The body of your POST request is not well-formed multipart/form-data.
21
+ */
22
+ class MalformedPOSTRequestException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MalformedXMLException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * This happens when the user sends a malformed xml (xml that doesn't conform to the published xsd) for the configuration. The error message is, "The XML you provided was not well-formed or did not validate against our published schema."
21
+ */
22
+ class MalformedXMLException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MaxMessageLengthExceededException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Your request was too big.
21
+ */
22
+ class MaxMessageLengthExceededException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MaxPostPreDataLengthExceededErrorException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Your POST request fields preceding the upload file were too large.
21
+ */
22
+ class MaxPostPreDataLengthExceededErrorException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MetadataTooLargeException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Your metadata headers exceed the maximum allowed metadata size.
21
+ */
22
+ class MetadataTooLargeException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MethodNotAllowedException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The specified method is not allowed against this resource.
21
+ */
22
+ class MethodNotAllowedException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MissingAttachmentException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * A SOAP attachment was expected, but none were found.
21
+ */
22
+ class MissingAttachmentException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MissingContentLengthException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * You must provide the Content-Length HTTP header.
21
+ */
22
+ class MissingContentLengthException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MissingRequestBodyErrorException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * This happens when the user sends an empty xml document as a request. The error message is, "Request body is empty."
21
+ */
22
+ class MissingRequestBodyErrorException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MissingSecurityElementException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The SOAP 1.1 request is missing a security element.
21
+ */
22
+ class MissingSecurityElementException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/MissingSecurityHeaderException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Your request was missing a required header.
21
+ */
22
+ class MissingSecurityHeaderException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoLoggingStatusForKeyException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * There is no such thing as a logging status sub-resource for a key.
21
+ */
22
+ class NoLoggingStatusForKeyException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchBucketException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The specified bucket does not exist.
21
+ */
22
+ class NoSuchBucketException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchBucketPolicyException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The specified bucket policy does not exist.
21
+ */
22
+ class NoSuchBucketPolicyException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchCORSConfigurationException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The specified bucket does not have a CORs configuration.
21
+ */
22
+ class NoSuchCORSConfigurationException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchKeyException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The specified key does not exist.
21
+ */
22
+ class NoSuchKeyException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchLifecycleConfigurationException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The lifecycle configuration does not exist.
21
+ */
22
+ class NoSuchLifecycleConfigurationException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchTagSetException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * There is no TagSet associated with the bucket.
21
+ */
22
+ class NoSuchTagSetException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchUploadException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The specified multipart upload does not exist.
21
+ */
22
+ class NoSuchUploadException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchVersionException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Indicates that the version ID specified in the request does not match an existing version.
21
+ */
22
+ class NoSuchVersionException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NoSuchWebsiteConfigurationException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The specified bucket does not have a website configuration.
21
+ */
22
+ class NoSuchWebsiteConfigurationException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NotImplementedException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * A header you provided implies functionality that is not implemented.
21
+ */
22
+ class NotImplementedException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NotSignedUpException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Your account is not signed up for the Amazon S3 service. You must sign up before you can use Amazon S3. You can sign up at the following URL: http://aws.amazon.com/s3
21
+ */
22
+ class NotSignedUpException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/NotSuchBucketPolicyException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The specified bucket does not have a bucket policy.
21
+ */
22
+ class NotSuchBucketPolicyException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/ObjectAlreadyInActiveTierErrorException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * This operation is not allowed against this storage tier
21
+ */
22
+ class ObjectAlreadyInActiveTierErrorException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/ObjectNotInActiveTierErrorException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The source object of the COPY operation is not in the active tier and is only stored in Amazon Glacier.
21
+ */
22
+ class ObjectNotInActiveTierErrorException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/OperationAbortedException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * A conflicting conditional operation is currently in progress against this resource. Please try again.
21
+ */
22
+ class OperationAbortedException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/Parser/S3ExceptionParser.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\Parser;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\DefaultXmlExceptionParser;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response;
22
+ /**
23
+ * Parses S3 exception responses
24
+ */
25
+ class S3ExceptionParser extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\Parser\DefaultXmlExceptionParser
26
+ {
27
+ /**
28
+ * {@inheritdoc}
29
+ */
30
+ public function parse(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response $response)
31
+ {
32
+ $data = parent::parse($request, $response);
33
+ if ($response->getStatusCode() === 301) {
34
+ $data['type'] = 'client';
35
+ if (isset($data['message'], $data['parsed'])) {
36
+ $data['message'] = rtrim($data['message'], '.') . ': "' . $data['parsed']->Endpoint . '".';
37
+ }
38
+ }
39
+ return $data;
40
+ }
41
+ /**
42
+ * {@inheritdoc}
43
+ */
44
+ protected function parseHeaders(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response $response, array &$data)
45
+ {
46
+ parent::parseHeaders($request, $response, $data);
47
+ // Get the request
48
+ $status = $response->getStatusCode();
49
+ $method = $request->getMethod();
50
+ // Attempt to determine code for 403s and 404s
51
+ if ($status === 403) {
52
+ $data['code'] = 'AccessDenied';
53
+ } elseif ($method === 'HEAD' && $status === 404) {
54
+ $path = explode('/', trim($request->getPath(), '/'));
55
+ $host = explode('.', $request->getHost());
56
+ $bucket = count($host) === 4 ? $host[0] : array_shift($path);
57
+ $object = array_shift($path);
58
+ if ($bucket && $object) {
59
+ $data['code'] = 'NoSuchKey';
60
+ } elseif ($bucket) {
61
+ $data['code'] = 'NoSuchBucket';
62
+ }
63
+ }
64
+ }
65
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/PermanentRedirectException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
21
+ */
22
+ class PermanentRedirectException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/PreconditionFailedException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * At least one of the preconditions you specified did not hold.
21
+ */
22
+ class PreconditionFailedException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/RedirectException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Temporary redirect.
21
+ */
22
+ class RedirectException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/RequestIsNotMultiPartContentException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Bucket POST must be of the enclosure-type multipart/form-data.
21
+ */
22
+ class RequestIsNotMultiPartContentException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/RequestTimeTooSkewedException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The difference between the request time and the server's time is too large.
21
+ */
22
+ class RequestTimeTooSkewedException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/RequestTimeoutException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Your socket connection to the server was not read from or written to within the timeout period.
21
+ */
22
+ class RequestTimeoutException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/RequestTorrentOfBucketErrorException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Requesting the torrent file of a bucket is not permitted.
21
+ */
22
+ class RequestTorrentOfBucketErrorException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/S3Exception.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\ServiceResponseException;
20
+ /**
21
+ * Default service exception class
22
+ */
23
+ class S3Exception extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\ServiceResponseException
24
+ {
25
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/ServiceUnavailableException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Please reduce your request rate.
21
+ */
22
+ class ServiceUnavailableException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/SignatureDoesNotMatchException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. For more information, see REST Authentication and SOAP Authentication for details.
21
+ */
22
+ class SignatureDoesNotMatchException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/SlowDownException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * Please reduce your request rate.
21
+ */
22
+ class SlowDownException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/TemporaryRedirectException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * You are being redirected to the bucket while DNS updates.
21
+ */
22
+ class TemporaryRedirectException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/TokenRefreshRequiredException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The provided token must be refreshed.
21
+ */
22
+ class TokenRefreshRequiredException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/TooManyBucketsException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * You have attempted to create more buckets than allowed.
21
+ */
22
+ class TooManyBucketsException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/UnexpectedContentException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * This request does not support content.
21
+ */
22
+ class UnexpectedContentException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/UnresolvableGrantByEmailAddressException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The e-mail address you provided does not match any account on record.
21
+ */
22
+ class UnresolvableGrantByEmailAddressException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Exception/UserKeyMustBeSpecifiedException.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception;
18
+
19
+ /**
20
+ * The bucket POST must contain the specified field name. If it is specified, please check the order of the fields.
21
+ */
22
+ class UserKeyMustBeSpecifiedException extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception
23
+ {
24
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/IncompleteMultipartUploadChecker.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3;
4
+
5
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Exception\HttpException;
6
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
7
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\EntityEnclosingRequestInterface;
8
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response;
9
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffStrategyInterface;
10
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\AbstractBackoffStrategy;
11
+ /**
12
+ * Retries CompleteMultipartUpload requests in the case of failure.
13
+ *
14
+ * From the S3 API Documentation:
15
+ *
16
+ * Processing of a Complete Multipart Upload request could take several
17
+ * minutes to complete. After Amazon S3 begins processing the request, it
18
+ * sends an HTTP response header that specifies a 200 OK response. While
19
+ * processing is in progress, Amazon S3 periodically sends whitespace
20
+ * characters to keep the connection from timing out. Because a request
21
+ * could fail after the initial 200 OK response has been sent, it is
22
+ * important that you check the response body to determine whether the
23
+ * request succeeded. Note that if Complete Multipart Upload fails,
24
+ * applications should be prepared to retry the failed requests.
25
+ */
26
+ class IncompleteMultipartUploadChecker extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\AbstractBackoffStrategy
27
+ {
28
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffStrategyInterface $next = null)
29
+ {
30
+ if ($next) {
31
+ $this->setNext($next);
32
+ }
33
+ }
34
+ public function makesDecision()
35
+ {
36
+ return true;
37
+ }
38
+ protected function getDelay($retries, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response $response = null, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Exception\HttpException $e = null)
39
+ {
40
+ if ($response && $request->getMethod() === 'POST' && $request instanceof EntityEnclosingRequestInterface && $response->getStatusCode() == 200 && strpos($request->getBody(), '<CompleteMultipartUpload xmlns') !== false && strpos($response->getBody(), '<CompleteMultipartUploadResult xmlns') === false) {
41
+ return true;
42
+ }
43
+ }
44
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Iterator/ListBucketsIterator.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Iterator;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Iterator\AwsResourceIterator;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\Model;
21
+ /**
22
+ * Iterator for the S3 ListBuckets command
23
+ *
24
+ * This iterator includes the following additional options:
25
+ *
26
+ * - names_only: Set to true to receive only the object/prefix names
27
+ */
28
+ class ListBucketsIterator extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Iterator\AwsResourceIterator
29
+ {
30
+ /**
31
+ * {@inheritdoc}
32
+ */
33
+ protected function handleResults(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\Model $result)
34
+ {
35
+ // Get the results
36
+ $buckets = $result->get('Buckets') ?: array();
37
+ // If only the names_only set, change arrays to a string
38
+ if ($this->get('names_only')) {
39
+ foreach ($buckets as &$bucket) {
40
+ $bucket = $bucket['Name'];
41
+ }
42
+ }
43
+ return $buckets;
44
+ }
45
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Iterator/ListMultipartUploadsIterator.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Iterator;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\Model;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Iterator\AwsResourceIterator;
21
+ /**
22
+ * Iterator for the S3 ListMultipartUploads command
23
+ *
24
+ * This iterator includes the following additional options:
25
+ *
26
+ * - return_prefixes: Set to true to return both prefixes and uploads
27
+ */
28
+ class ListMultipartUploadsIterator extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Iterator\AwsResourceIterator
29
+ {
30
+ /**
31
+ * {@inheritdoc}
32
+ */
33
+ protected function handleResults(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\Model $result)
34
+ {
35
+ // Get the list of uploads
36
+ $uploads = $result->get('Uploads') ?: array();
37
+ // If there are prefixes and we want them, merge them in
38
+ if ($this->get('return_prefixes') && $result->hasKey('CommonPrefixes')) {
39
+ $uploads = array_merge($uploads, $result->get('CommonPrefixes'));
40
+ }
41
+ return $uploads;
42
+ }
43
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Iterator/ListObjectVersionsIterator.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Iterator;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Iterator\AwsResourceIterator;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\Model;
21
+ /**
22
+ * Iterator for an S3 ListObjectVersions command
23
+ *
24
+ * This iterator includes the following additional options:
25
+ *
26
+ * - return_prefixes: Set to true to receive both prefixes and versions in results
27
+ */
28
+ class ListObjectVersionsIterator extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Iterator\AwsResourceIterator
29
+ {
30
+ /**
31
+ * {@inheritdoc}
32
+ */
33
+ protected function handleResults(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\Model $result)
34
+ {
35
+ // Get the list of object versions
36
+ $versions = $result->get('Versions') ?: array();
37
+ $deleteMarkers = $result->get('DeleteMarkers') ?: array();
38
+ $versions = array_merge($versions, $deleteMarkers);
39
+ // If there are prefixes and we want them, merge them in
40
+ if ($this->get('return_prefixes') && $result->hasKey('CommonPrefixes')) {
41
+ $versions = array_merge($versions, $result->get('CommonPrefixes'));
42
+ }
43
+ return $versions;
44
+ }
45
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Iterator/ListObjectsIterator.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Iterator;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Iterator\AwsResourceIterator;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\Model;
21
+ /**
22
+ * Iterator for an S3 ListObjects command
23
+ *
24
+ * This iterator includes the following additional options:
25
+ *
26
+ * - return_prefixes: Set to true to receive both prefixes and objects in results
27
+ * - sort_results: Set to true to sort mixed (object/prefix) results
28
+ * - names_only: Set to true to receive only the object/prefix names
29
+ */
30
+ class ListObjectsIterator extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Iterator\AwsResourceIterator
31
+ {
32
+ protected function handleResults(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\Model $result)
33
+ {
34
+ // Get the list of objects and record the last key
35
+ $objects = $result->get('Contents') ?: array();
36
+ $numObjects = count($objects);
37
+ $lastKey = $numObjects ? $objects[$numObjects - 1]['Key'] : false;
38
+ if ($lastKey && !$result->hasKey($this->get('output_token'))) {
39
+ $result->set($this->get('output_token'), $lastKey);
40
+ }
41
+ // Closure for getting the name of an object or prefix
42
+ $getName = function ($object) {
43
+ return isset($object['Key']) ? $object['Key'] : $object['Prefix'];
44
+ };
45
+ // If common prefixes returned (i.e. a delimiter was set) and they need to be returned, there is more to do
46
+ if ($this->get('return_prefixes') && $result->hasKey('CommonPrefixes')) {
47
+ // Collect and format the prefixes to include with the objects
48
+ $objects = array_merge($objects, $result->get('CommonPrefixes'));
49
+ // Sort the objects and prefixes to maintain alphabetical order, but only if some of each were returned
50
+ if ($this->get('sort_results') && $lastKey && $objects) {
51
+ usort($objects, function ($object1, $object2) use($getName) {
52
+ return strcmp($getName($object1), $getName($object2));
53
+ });
54
+ }
55
+ }
56
+ // If only the names are desired, iterate through the results and convert the arrays to the object/prefix names
57
+ if ($this->get('names_only')) {
58
+ $objects = array_map($getName, $objects);
59
+ }
60
+ return $objects;
61
+ }
62
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Iterator/OpendirIterator.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Iterator;
18
+
19
+ /**
20
+ * Provides an iterator around an opendir resource. This is useful when you need to provide context to an opendir so
21
+ * you can't use RecursiveDirectoryIterator
22
+ */
23
+ class OpendirIterator implements \Iterator
24
+ {
25
+ /** @var resource */
26
+ protected $dirHandle;
27
+ /** @var \SplFileInfo */
28
+ protected $currentFile;
29
+ /** @var int */
30
+ protected $key = -1;
31
+ /** @var string */
32
+ protected $filePrefix;
33
+ /**
34
+ * @param resource $dirHandle Opened directory handled returned from opendir
35
+ * @param string $filePrefix Prefix to add to each filename
36
+ */
37
+ public function __construct($dirHandle, $filePrefix = '')
38
+ {
39
+ $this->filePrefix = $filePrefix;
40
+ $this->dirHandle = $dirHandle;
41
+ $this->next();
42
+ }
43
+ public function __destruct()
44
+ {
45
+ if ($this->dirHandle) {
46
+ closedir($this->dirHandle);
47
+ }
48
+ }
49
+ public function rewind()
50
+ {
51
+ $this->key = 0;
52
+ rewinddir($this->dirHandle);
53
+ }
54
+ public function current()
55
+ {
56
+ return $this->currentFile;
57
+ }
58
+ public function next()
59
+ {
60
+ if ($file = readdir($this->dirHandle)) {
61
+ $this->currentFile = new \SplFileInfo($this->filePrefix . $file);
62
+ } else {
63
+ $this->currentFile = false;
64
+ }
65
+ $this->key++;
66
+ }
67
+ public function key()
68
+ {
69
+ return $this->key;
70
+ }
71
+ public function valid()
72
+ {
73
+ return $this->currentFile !== false;
74
+ }
75
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/Acp.php ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\OverflowException;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\ToArrayInterface;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\AbstractCommand;
23
+ /**
24
+ * Amazon S3 Access Control Policy (ACP)
25
+ */
26
+ class Acp implements \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\ToArrayInterface, \IteratorAggregate, \Countable
27
+ {
28
+ /**
29
+ * @var \SplObjectStorage List of grants on the ACP
30
+ */
31
+ protected $grants = array();
32
+ /**
33
+ * @var Grantee The owner of the ACP
34
+ */
35
+ protected $owner;
36
+ /**
37
+ * Constructs an ACP
38
+ *
39
+ * @param Grantee $owner ACP policy owner
40
+ * @param array|\Traversable $grants List of grants for the ACP
41
+ */
42
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\Grantee $owner, $grants = null)
43
+ {
44
+ $this->setOwner($owner);
45
+ $this->setGrants($grants);
46
+ }
47
+ /**
48
+ * Create an Acp object from an array. This can be used to create an ACP from a response to a GetObject/Bucket ACL
49
+ * operation.
50
+ *
51
+ * @param array $data Array of ACP data
52
+ *
53
+ * @return Acp
54
+ */
55
+ public static function fromArray(array $data)
56
+ {
57
+ $builder = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\AcpBuilder();
58
+ $builder->setOwner((string) $data['Owner']['ID'], $data['Owner']['DisplayName']);
59
+ // Add each Grantee to the ACP
60
+ foreach ($data['Grants'] as $grant) {
61
+ $permission = $grant['Permission'];
62
+ // Determine the type for response bodies that are missing the Type parameter
63
+ if (!isset($grant['Grantee']['Type'])) {
64
+ if (isset($grant['Grantee']['ID'])) {
65
+ $grant['Grantee']['Type'] = 'CanonicalUser';
66
+ } elseif (isset($grant['Grantee']['URI'])) {
67
+ $grant['Grantee']['Type'] = 'Group';
68
+ } else {
69
+ $grant['Grantee']['Type'] = 'AmazonCustomerByEmail';
70
+ }
71
+ }
72
+ switch ($grant['Grantee']['Type']) {
73
+ case 'Group':
74
+ $builder->addGrantForGroup($permission, $grant['Grantee']['URI']);
75
+ break;
76
+ case 'AmazonCustomerByEmail':
77
+ $builder->addGrantForEmail($permission, $grant['Grantee']['EmailAddress']);
78
+ break;
79
+ case 'CanonicalUser':
80
+ $builder->addGrantForUser($permission, $grant['Grantee']['ID'], $grant['Grantee']['DisplayName']);
81
+ }
82
+ }
83
+ return $builder->build();
84
+ }
85
+ /**
86
+ * Set the owner of the ACP policy
87
+ *
88
+ * @param Grantee $owner ACP policy owner
89
+ *
90
+ * @return $this
91
+ *
92
+ * @throws InvalidArgumentException if the grantee does not have an ID set
93
+ */
94
+ public function setOwner(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\Grantee $owner)
95
+ {
96
+ if (!$owner->isCanonicalUser()) {
97
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('The owner must have an ID set.');
98
+ }
99
+ $this->owner = $owner;
100
+ return $this;
101
+ }
102
+ /**
103
+ * Get the owner of the ACP policy
104
+ *
105
+ * @return Grantee
106
+ */
107
+ public function getOwner()
108
+ {
109
+ return $this->owner;
110
+ }
111
+ /**
112
+ * Set the grants for the ACP
113
+ *
114
+ * @param array|\Traversable $grants List of grants for the ACP
115
+ *
116
+ * @return $this
117
+ *
118
+ * @throws InvalidArgumentException
119
+ */
120
+ public function setGrants($grants = array())
121
+ {
122
+ $this->grants = new \SplObjectStorage();
123
+ if ($grants) {
124
+ if (is_array($grants) || $grants instanceof \Traversable) {
125
+ /** @var Grant $grant */
126
+ foreach ($grants as $grant) {
127
+ $this->addGrant($grant);
128
+ }
129
+ } else {
130
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('Grants must be passed in as an array or Traversable object.');
131
+ }
132
+ }
133
+ return $this;
134
+ }
135
+ /**
136
+ * Get all of the grants
137
+ *
138
+ * @return \SplObjectStorage
139
+ */
140
+ public function getGrants()
141
+ {
142
+ return $this->grants;
143
+ }
144
+ /**
145
+ * Add a Grant
146
+ *
147
+ * @param Grant $grant Grant to add
148
+ *
149
+ * @return $this
150
+ */
151
+ public function addGrant(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\Grant $grant)
152
+ {
153
+ if (count($this->grants) < 100) {
154
+ $this->grants->attach($grant);
155
+ } else {
156
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\OverflowException('An ACP may contain up to 100 grants.');
157
+ }
158
+ return $this;
159
+ }
160
+ /**
161
+ * Get the total number of attributes
162
+ *
163
+ * @return int
164
+ */
165
+ public function count()
166
+ {
167
+ return count($this->grants);
168
+ }
169
+ /**
170
+ * Returns the grants for iteration
171
+ *
172
+ * @return \SplObjectStorage
173
+ */
174
+ public function getIterator()
175
+ {
176
+ return $this->grants;
177
+ }
178
+ /**
179
+ * Applies grant headers to a command's parameters
180
+ *
181
+ * @param AbstractCommand $command Command to be updated
182
+ *
183
+ * @return $this
184
+ */
185
+ public function updateCommand(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\AbstractCommand $command)
186
+ {
187
+ $parameters = array();
188
+ foreach ($this->grants as $grant) {
189
+ /** @var Grant $grant */
190
+ $parameters = array_merge_recursive($parameters, $grant->getParameterArray());
191
+ }
192
+ foreach ($parameters as $name => $values) {
193
+ $command->set($name, implode(', ', (array) $values));
194
+ }
195
+ return $this;
196
+ }
197
+ /**
198
+ * {@inheritdoc}
199
+ */
200
+ public function toArray()
201
+ {
202
+ $grants = array();
203
+ foreach ($this->grants as $grant) {
204
+ $grants[] = $grant->toArray();
205
+ }
206
+ return array('Owner' => array('ID' => $this->owner->getId(), 'DisplayName' => $this->owner->getDisplayName()), 'Grants' => $grants);
207
+ }
208
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/AcpBuilder.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\GranteeType;
20
+ /**
21
+ * Builder for creating Access Control Policies
22
+ */
23
+ class AcpBuilder
24
+ {
25
+ /**
26
+ * @var Grantee The owner for the ACL
27
+ */
28
+ protected $owner;
29
+ /**
30
+ * @var array An array of Grant objects for the ACL
31
+ */
32
+ protected $grants = array();
33
+ /**
34
+ * Static method for chainable instantiation
35
+ *
36
+ * @return static
37
+ */
38
+ public static function newInstance()
39
+ {
40
+ return new static();
41
+ }
42
+ /**
43
+ * Sets the owner to be set on the ACL
44
+ *
45
+ * @param string $id Owner identifier
46
+ * @param string $displayName Owner display name
47
+ *
48
+ * @return $this
49
+ */
50
+ public function setOwner($id, $displayName = null)
51
+ {
52
+ $this->owner = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\Grantee($id, $displayName ?: $id, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\GranteeType::USER);
53
+ return $this;
54
+ }
55
+ /**
56
+ * Create and store a Grant with a CanonicalUser Grantee for the ACL
57
+ *
58
+ * @param string $permission Permission for the Grant
59
+ * @param string $id Grantee identifier
60
+ * @param string $displayName Grantee display name
61
+ *
62
+ * @return $this
63
+ */
64
+ public function addGrantForUser($permission, $id, $displayName = null)
65
+ {
66
+ $grantee = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\Grantee($id, $displayName ?: $id, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\GranteeType::USER);
67
+ $this->addGrant($permission, $grantee);
68
+ return $this;
69
+ }
70
+ /**
71
+ * Create and store a Grant with a AmazonCustomerByEmail Grantee for the ACL
72
+ *
73
+ * @param string $permission Permission for the Grant
74
+ * @param string $email Grantee email address
75
+ *
76
+ * @return $this
77
+ */
78
+ public function addGrantForEmail($permission, $email)
79
+ {
80
+ $grantee = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\Grantee($email, null, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\GranteeType::EMAIL);
81
+ $this->addGrant($permission, $grantee);
82
+ return $this;
83
+ }
84
+ /**
85
+ * Create and store a Grant with a Group Grantee for the ACL
86
+ *
87
+ * @param string $permission Permission for the Grant
88
+ * @param string $group Grantee group
89
+ *
90
+ * @return $this
91
+ */
92
+ public function addGrantForGroup($permission, $group)
93
+ {
94
+ $grantee = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\Grantee($group, null, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\GranteeType::GROUP);
95
+ $this->addGrant($permission, $grantee);
96
+ return $this;
97
+ }
98
+ /**
99
+ * Create and store a Grant for the ACL
100
+ *
101
+ * @param string $permission Permission for the Grant
102
+ * @param Grantee $grantee The Grantee for the Grant
103
+ *
104
+ * @return $this
105
+ */
106
+ public function addGrant($permission, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\Grantee $grantee)
107
+ {
108
+ $this->grants[] = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\Grant($grantee, $permission);
109
+ return $this;
110
+ }
111
+ /**
112
+ * Builds the ACP and returns it
113
+ *
114
+ * @return Acp
115
+ */
116
+ public function build()
117
+ {
118
+ return new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\Acp($this->owner, $this->grants);
119
+ }
120
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/ClearBucket.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AwsClientInterface;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\AbstractHasDispatcher;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Batch\FlushingBatch;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Batch\ExceptionBufferingBatch;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Batch\NotifyingBatch;
24
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Exception\ExceptionCollection;
25
+ /**
26
+ * Class used to clear the contents of a bucket or the results of an iterator
27
+ */
28
+ class ClearBucket extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\AbstractHasDispatcher
29
+ {
30
+ /**
31
+ * @var string Event emitted when a batch request has completed
32
+ */
33
+ const AFTER_DELETE = 'clear_bucket.after_delete';
34
+ /**
35
+ * @var string Event emitted before the bucket is cleared
36
+ */
37
+ const BEFORE_CLEAR = 'clear_bucket.before_clear';
38
+ /**
39
+ * @var string Event emitted after the bucket is cleared
40
+ */
41
+ const AFTER_CLEAR = 'clear_bucket.after_clear';
42
+ /**
43
+ * @var AwsClientInterface Client used to execute the requests
44
+ */
45
+ protected $client;
46
+ /**
47
+ * @var AbstractS3ResourceIterator Iterator used to yield keys
48
+ */
49
+ protected $iterator;
50
+ /**
51
+ * @var string MFA used with each request
52
+ */
53
+ protected $mfa;
54
+ /**
55
+ * @param AwsClientInterface $client Client used to execute requests
56
+ * @param string $bucket Name of the bucket to clear
57
+ */
58
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AwsClientInterface $client, $bucket)
59
+ {
60
+ $this->client = $client;
61
+ $this->bucket = $bucket;
62
+ }
63
+ /**
64
+ * {@inheritdoc}
65
+ */
66
+ public static function getAllEvents()
67
+ {
68
+ return array(self::AFTER_DELETE, self::BEFORE_CLEAR, self::AFTER_CLEAR);
69
+ }
70
+ /**
71
+ * Set the bucket that is to be cleared
72
+ *
73
+ * @param string $bucket Name of the bucket to clear
74
+ *
75
+ * @return $this
76
+ */
77
+ public function setBucket($bucket)
78
+ {
79
+ $this->bucket = $bucket;
80
+ return $this;
81
+ }
82
+ /**
83
+ * Get the iterator used to yield the keys to be deleted. A default iterator
84
+ * will be created and returned if no iterator has been explicitly set.
85
+ *
86
+ * @return \Iterator
87
+ */
88
+ public function getIterator()
89
+ {
90
+ if (!$this->iterator) {
91
+ $this->iterator = $this->client->getIterator('ListObjectVersions', array('Bucket' => $this->bucket));
92
+ }
93
+ return $this->iterator;
94
+ }
95
+ /**
96
+ * Sets a different iterator to use than the default iterator. This can be helpful when you wish to delete
97
+ * only specific keys from a bucket (e.g. keys that match a certain prefix or delimiter, or perhaps keys that
98
+ * pass through a filtered, decorated iterator).
99
+ *
100
+ * @param \Iterator $iterator Iterator used to yield the keys to be deleted
101
+ *
102
+ * @return $this
103
+ */
104
+ public function setIterator(\Iterator $iterator)
105
+ {
106
+ $this->iterator = $iterator;
107
+ return $this;
108
+ }
109
+ /**
110
+ * Set the MFA token to send with each request
111
+ *
112
+ * @param string $mfa MFA token to send with each request. The value is the concatenation of the authentication
113
+ * device's serial number, a space, and the value displayed on your authentication device.
114
+ *
115
+ * @return $this
116
+ */
117
+ public function setMfa($mfa)
118
+ {
119
+ $this->mfa = $mfa;
120
+ return $this;
121
+ }
122
+ /**
123
+ * Clear the bucket
124
+ *
125
+ * @return int Returns the number of deleted keys
126
+ * @throws ExceptionCollection
127
+ */
128
+ public function clear()
129
+ {
130
+ $that = $this;
131
+ $batch = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\DeleteObjectsBatch::factory($this->client, $this->bucket, $this->mfa);
132
+ $batch = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Batch\NotifyingBatch($batch, function ($items) use($that) {
133
+ $that->dispatch(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\ClearBucket::AFTER_DELETE, array('keys' => $items));
134
+ });
135
+ $batch = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Batch\FlushingBatch(new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Batch\ExceptionBufferingBatch($batch), 1000);
136
+ // Let any listeners know that the bucket is about to be cleared
137
+ $this->dispatch(self::BEFORE_CLEAR, array('iterator' => $this->getIterator(), 'batch' => $batch, 'mfa' => $this->mfa));
138
+ $deleted = 0;
139
+ foreach ($this->getIterator() as $object) {
140
+ if (isset($object['VersionId'])) {
141
+ $versionId = $object['VersionId'] == 'null' ? null : $object['VersionId'];
142
+ } else {
143
+ $versionId = null;
144
+ }
145
+ $batch->addKey($object['Key'], $versionId);
146
+ $deleted++;
147
+ }
148
+ $batch->flush();
149
+ // If any errors were encountered, then throw an ExceptionCollection
150
+ if (count($batch->getExceptions())) {
151
+ $e = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Exception\ExceptionCollection();
152
+ foreach ($batch->getExceptions() as $exception) {
153
+ $e->add($exception->getPrevious());
154
+ }
155
+ throw $e;
156
+ }
157
+ // Let any listeners know that the bucket was cleared
158
+ $this->dispatch(self::AFTER_CLEAR, array('deleted' => $deleted));
159
+ return $deleted;
160
+ }
161
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/DeleteObjectsBatch.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AwsClientInterface;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\AbstractCommand;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Batch\BatchBuilder;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Batch\BatchSizeDivisor;
24
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Batch\AbstractBatchDecorator;
25
+ /**
26
+ * The DeleteObjectsBatch is a BatchDecorator for Guzzle that implements a
27
+ * queue for deleting keys from an Amazon S3 bucket. You can add DeleteObject
28
+ * or an array of [Key => %s, VersionId => %s] and call flush when the objects
29
+ * should be deleted.
30
+ */
31
+ class DeleteObjectsBatch extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Batch\AbstractBatchDecorator
32
+ {
33
+ /**
34
+ * Factory for creating a DeleteObjectsBatch
35
+ *
36
+ * @param AwsClientInterface $client Client used to transfer requests
37
+ * @param string $bucket Bucket that contains the objects to delete
38
+ * @param string $mfa MFA token to use with the request
39
+ *
40
+ * @return static
41
+ */
42
+ public static function factory(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AwsClientInterface $client, $bucket, $mfa = null)
43
+ {
44
+ $batch = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Batch\BatchBuilder::factory()->createBatchesWith(new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Batch\BatchSizeDivisor(1000))->transferWith(new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\DeleteObjectsTransfer($client, $bucket, $mfa))->build();
45
+ return new static($batch);
46
+ }
47
+ /**
48
+ * Add an object to be deleted
49
+ *
50
+ * @param string $key Key of the object
51
+ * @param string $versionId VersionID of the object
52
+ *
53
+ * @return $this
54
+ */
55
+ public function addKey($key, $versionId = null)
56
+ {
57
+ return $this->add(array('Key' => $key, 'VersionId' => $versionId));
58
+ }
59
+ /**
60
+ * {@inheritdoc}
61
+ */
62
+ public function add($item)
63
+ {
64
+ if ($item instanceof AbstractCommand && $item->getName() == 'DeleteObject') {
65
+ $item = array('Key' => $item['Key'], 'VersionId' => $item['VersionId']);
66
+ }
67
+ if (!is_array($item) || !isset($item['Key'])) {
68
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('Item must be a DeleteObject command or array containing a Key and VersionId key.');
69
+ }
70
+ return parent::add($item);
71
+ }
72
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/DeleteObjectsTransfer.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AwsClientInterface;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\OverflowException;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\UaString as Ua;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\InvalidArgumentException;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\DeleteMultipleObjectsException;
24
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Batch\BatchTransferInterface;
25
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface;
26
+ /**
27
+ * Transfer logic for deleting multiple objects from an Amazon S3 bucket in a
28
+ * single request
29
+ */
30
+ class DeleteObjectsTransfer implements \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Batch\BatchTransferInterface
31
+ {
32
+ /**
33
+ * @var AwsClientInterface The Amazon S3 client for doing transfers
34
+ */
35
+ protected $client;
36
+ /**
37
+ * @var string Bucket from which to delete the objects
38
+ */
39
+ protected $bucket;
40
+ /**
41
+ * @var string MFA token to apply to the request
42
+ */
43
+ protected $mfa;
44
+ /**
45
+ * Constructs a transfer using the injected client
46
+ *
47
+ * @param AwsClientInterface $client Client used to transfer the requests
48
+ * @param string $bucket Name of the bucket that stores the objects
49
+ * @param string $mfa MFA token used when contacting the Amazon S3 API
50
+ */
51
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AwsClientInterface $client, $bucket, $mfa = null)
52
+ {
53
+ $this->client = $client;
54
+ $this->bucket = $bucket;
55
+ $this->mfa = $mfa;
56
+ }
57
+ /**
58
+ * Set a new MFA token value
59
+ *
60
+ * @param string $token MFA token
61
+ *
62
+ * @return $this
63
+ */
64
+ public function setMfa($token)
65
+ {
66
+ $this->mfa = $token;
67
+ return $this;
68
+ }
69
+ /**
70
+ * {@inheritdoc}
71
+ * @throws OverflowException if a batch has more than 1000 items
72
+ * @throws InvalidArgumentException when an invalid batch item is encountered
73
+ */
74
+ public function transfer(array $batch)
75
+ {
76
+ if (empty($batch)) {
77
+ return;
78
+ }
79
+ if (count($batch) > 1000) {
80
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\OverflowException('Batches should be divided into chunks of no larger than 1000 keys');
81
+ }
82
+ $del = array();
83
+ $command = $this->client->getCommand('DeleteObjects', array('Bucket' => $this->bucket, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\UaString::OPTION => \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\UaString::BATCH));
84
+ if ($this->mfa) {
85
+ $command->getRequestHeaders()->set('x-amz-mfa', $this->mfa);
86
+ }
87
+ foreach ($batch as $object) {
88
+ // Ensure that the batch item is valid
89
+ if (!is_array($object) || !isset($object['Key'])) {
90
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\InvalidArgumentException('Invalid batch item encountered: ' . var_export($batch, true));
91
+ }
92
+ $del[] = array('Key' => $object['Key'], 'VersionId' => isset($object['VersionId']) ? $object['VersionId'] : null);
93
+ }
94
+ $command['Objects'] = $del;
95
+ $command->execute();
96
+ $this->processResponse($command);
97
+ }
98
+ /**
99
+ * Process the response of the DeleteMultipleObjects request
100
+ *
101
+ * @paramCommandInterface $command Command executed
102
+ */
103
+ protected function processResponse(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface $command)
104
+ {
105
+ $result = $command->getResult();
106
+ // Ensure that the objects were deleted successfully
107
+ if (!empty($result['Errors'])) {
108
+ $errors = $result['Errors'];
109
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\DeleteMultipleObjectsException($errors);
110
+ }
111
+ }
112
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/Grant.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\Permission;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\ToArrayInterface;
22
+ /**
23
+ * Amazon S3 Grant model
24
+ */
25
+ class Grant implements \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\ToArrayInterface
26
+ {
27
+ /**
28
+ * @var array A map of permissions to operation parameters
29
+ */
30
+ protected static $parameterMap = array(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\Permission::READ => 'GrantRead', \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\Permission::WRITE => 'GrantWrite', \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\Permission::READ_ACP => 'GrantReadACP', \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\Permission::WRITE_ACP => 'GrantWriteACP', \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\Permission::FULL_CONTROL => 'GrantFullControl');
31
+ /**
32
+ * @var Grantee The grantee affected by the grant
33
+ */
34
+ protected $grantee;
35
+ /**
36
+ * @var string The permission set by the grant
37
+ */
38
+ protected $permission;
39
+ /**
40
+ * Constructs an ACL
41
+ *
42
+ * @param Grantee $grantee Affected grantee
43
+ * @param string $permission Permission applied
44
+ */
45
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\Grantee $grantee, $permission)
46
+ {
47
+ $this->setGrantee($grantee);
48
+ $this->setPermission($permission);
49
+ }
50
+ /**
51
+ * Set the grantee affected by the grant
52
+ *
53
+ * @param Grantee $grantee Affected grantee
54
+ *
55
+ * @return $this
56
+ */
57
+ public function setGrantee(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\Grantee $grantee)
58
+ {
59
+ $this->grantee = $grantee;
60
+ return $this;
61
+ }
62
+ /**
63
+ * Get the grantee affected by the grant
64
+ *
65
+ * @return Grantee
66
+ */
67
+ public function getGrantee()
68
+ {
69
+ return $this->grantee;
70
+ }
71
+ /**
72
+ * Set the permission set by the grant
73
+ *
74
+ * @param string $permission Permission applied
75
+ *
76
+ * @return $this
77
+ *
78
+ * @throws InvalidArgumentException
79
+ */
80
+ public function setPermission($permission)
81
+ {
82
+ $valid = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\Permission::values();
83
+ if (!in_array($permission, $valid)) {
84
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('The permission must be one of ' . 'the following: ' . implode(', ', $valid) . '.');
85
+ }
86
+ $this->permission = $permission;
87
+ return $this;
88
+ }
89
+ /**
90
+ * Get the permission set by the grant
91
+ *
92
+ * @return string
93
+ */
94
+ public function getPermission()
95
+ {
96
+ return $this->permission;
97
+ }
98
+ /**
99
+ * Returns an array of the operation parameter and value to set on the operation
100
+ *
101
+ * @return array
102
+ */
103
+ public function getParameterArray()
104
+ {
105
+ return array(self::$parameterMap[$this->permission] => $this->grantee->getHeaderValue());
106
+ }
107
+ /**
108
+ * {@inheritdoc}
109
+ */
110
+ public function toArray()
111
+ {
112
+ return array('Grantee' => $this->grantee->toArray(), 'Permission' => $this->permission);
113
+ }
114
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/Grantee.php ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\Group;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\GranteeType;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\UnexpectedValueException;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\LogicException;
24
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\ToArrayInterface;
25
+ /**
26
+ * Amazon S3 Grantee model
27
+ */
28
+ class Grantee implements \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\ToArrayInterface
29
+ {
30
+ /**
31
+ * @var array A map of grantee types to grant header value prefixes
32
+ */
33
+ protected static $headerMap = array(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\GranteeType::USER => 'id', \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\GranteeType::EMAIL => 'emailAddress', \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\GranteeType::GROUP => 'uri');
34
+ /**
35
+ * @var string The account ID, email, or URL identifying the grantee
36
+ */
37
+ protected $id;
38
+ /**
39
+ * @var string The display name of the grantee
40
+ */
41
+ protected $displayName;
42
+ /**
43
+ * @var string The type of the grantee (CanonicalUser or Group)
44
+ */
45
+ protected $type;
46
+ /**
47
+ * Constructs a Grantee
48
+ *
49
+ * @param string $id Grantee identifier
50
+ * @param string $displayName Grantee display name
51
+ * @param string $expectedType The expected type of the grantee
52
+ */
53
+ public function __construct($id, $displayName = null, $expectedType = null)
54
+ {
55
+ $this->type = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\GranteeType::USER;
56
+ $this->setId($id, $expectedType);
57
+ $this->setDisplayName($displayName);
58
+ }
59
+ /**
60
+ * Sets the account ID, email, or URL identifying the grantee
61
+ *
62
+ * @param string $id Grantee identifier
63
+ * @param string $expectedType The expected type of the grantee
64
+ *
65
+ * @return Grantee
66
+ *
67
+ * @throws UnexpectedValueException if $expectedType is set and the grantee
68
+ * is not of that type after instantiation
69
+ * @throws InvalidArgumentException when the ID provided is not a string
70
+ */
71
+ public function setId($id, $expectedType = null)
72
+ {
73
+ if (in_array($id, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\Group::values())) {
74
+ $this->type = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\GranteeType::GROUP;
75
+ } elseif (!is_string($id)) {
76
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('The grantee ID must be provided as a string value.');
77
+ }
78
+ if (strpos($id, '@') !== false) {
79
+ $this->type = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\GranteeType::EMAIL;
80
+ }
81
+ if ($expectedType && $expectedType !== $this->type) {
82
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\UnexpectedValueException('The type of the grantee after ' . 'setting the ID did not match the specified, expected type "' . $expectedType . '" but received "' . $this->type . '".');
83
+ }
84
+ $this->id = $id;
85
+ return $this;
86
+ }
87
+ /**
88
+ * Gets the grantee identifier
89
+ *
90
+ * @return string
91
+ */
92
+ public function getId()
93
+ {
94
+ return $this->id;
95
+ }
96
+ /**
97
+ * Gets the grantee email address (if it is set)
98
+ *
99
+ * @return null|string
100
+ */
101
+ public function getEmailAddress()
102
+ {
103
+ return $this->isAmazonCustomerByEmail() ? $this->id : null;
104
+ }
105
+ /**
106
+ * Gets the grantee URI (if it is set)
107
+ *
108
+ * @return null|string
109
+ */
110
+ public function getGroupUri()
111
+ {
112
+ return $this->isGroup() ? $this->id : null;
113
+ }
114
+ /**
115
+ * Sets the display name of the grantee
116
+ *
117
+ * @param string $displayName Grantee name
118
+ *
119
+ * @return Grantee
120
+ *
121
+ * @throws LogicException when the grantee type not CanonicalUser
122
+ */
123
+ public function setDisplayName($displayName)
124
+ {
125
+ if ($this->type === \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\GranteeType::USER) {
126
+ if (empty($displayName) || !is_string($displayName)) {
127
+ $displayName = $this->id;
128
+ }
129
+ $this->displayName = $displayName;
130
+ } else {
131
+ if ($displayName) {
132
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\LogicException('The display name can only be set ' . 'for grantees specified by ID.');
133
+ }
134
+ }
135
+ return $this;
136
+ }
137
+ /**
138
+ * Gets the grantee display name
139
+ *
140
+ * @return string
141
+ */
142
+ public function getDisplayName()
143
+ {
144
+ return $this->displayName;
145
+ }
146
+ /**
147
+ * Gets the grantee type (determined by ID)
148
+ *
149
+ * @return string
150
+ */
151
+ public function getType()
152
+ {
153
+ return $this->type;
154
+ }
155
+ /**
156
+ * Returns true if this grantee object represents a canonical user by ID
157
+ *
158
+ * @return bool
159
+ */
160
+ public function isCanonicalUser()
161
+ {
162
+ return $this->type === \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\GranteeType::USER;
163
+ }
164
+ /**
165
+ * Returns true if this grantee object represents a customer by email
166
+ *
167
+ * @return bool
168
+ */
169
+ public function isAmazonCustomerByEmail()
170
+ {
171
+ return $this->type === \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\GranteeType::EMAIL;
172
+ }
173
+ /**
174
+ * Returns true if this grantee object represents a group by URL
175
+ *
176
+ * @return bool
177
+ */
178
+ public function isGroup()
179
+ {
180
+ return $this->type === \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\GranteeType::GROUP;
181
+ }
182
+ /**
183
+ * Returns the value used in headers to specify this grantee
184
+ *
185
+ * @return string
186
+ */
187
+ public function getHeaderValue()
188
+ {
189
+ $key = static::$headerMap[$this->type];
190
+ return "{$key}=\"{$this->id}\"";
191
+ }
192
+ /**
193
+ * {@inheritdoc}
194
+ */
195
+ public function toArray()
196
+ {
197
+ $result = array('Type' => $this->type);
198
+ switch ($this->type) {
199
+ case \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\GranteeType::USER:
200
+ $result['ID'] = $this->id;
201
+ $result['DisplayName'] = $this->displayName;
202
+ break;
203
+ case \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\GranteeType::EMAIL:
204
+ $result['EmailAddress'] = $this->id;
205
+ break;
206
+ case \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Enum\GranteeType::GROUP:
207
+ $result['URI'] = $this->id;
208
+ }
209
+ return $result;
210
+ }
211
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/MultipartUpload/AbstractTransfer.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\UaString as Ua;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\AbstractTransfer as CommonAbstractTransfer;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\OperationCommand;
23
+ /**
24
+ * Abstract class for transfer commonalities
25
+ */
26
+ abstract class AbstractTransfer extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\AbstractTransfer
27
+ {
28
+ // An S3 upload part can be anywhere from 5 MB to 5 GB, but you can only have 10000 parts per upload
29
+ const MIN_PART_SIZE = 5242880;
30
+ const MAX_PART_SIZE = 5368709120;
31
+ const MAX_PARTS = 10000;
32
+ /**
33
+ * {@inheritdoc}
34
+ * @throws RuntimeException if the part size can not be calculated from the provided data
35
+ */
36
+ protected function init()
37
+ {
38
+ // Merge provided options onto the default option values
39
+ $this->options = array_replace(array('min_part_size' => self::MIN_PART_SIZE, 'part_md5' => true), $this->options);
40
+ // Make sure the part size can be calculated somehow
41
+ if (!$this->options['min_part_size'] && !$this->source->getContentLength()) {
42
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException('The ContentLength of the data source could not be determined, and no ' . 'min_part_size option was provided');
43
+ }
44
+ }
45
+ /**
46
+ * {@inheritdoc}
47
+ */
48
+ protected function calculatePartSize()
49
+ {
50
+ $partSize = $this->source->getContentLength() ? (int) ceil($this->source->getContentLength() / self::MAX_PARTS) : self::MIN_PART_SIZE;
51
+ $partSize = max($this->options['min_part_size'], $partSize);
52
+ $partSize = min($partSize, self::MAX_PART_SIZE);
53
+ $partSize = max($partSize, self::MIN_PART_SIZE);
54
+ return $partSize;
55
+ }
56
+ /**
57
+ * {@inheritdoc}
58
+ */
59
+ protected function complete()
60
+ {
61
+ /** @var UploadPart $part */
62
+ $parts = array();
63
+ foreach ($this->state as $part) {
64
+ $parts[] = array('PartNumber' => $part->getPartNumber(), 'ETag' => $part->getETag());
65
+ }
66
+ $params = $this->state->getUploadId()->toParams();
67
+ $params[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\UaString::OPTION] = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\UaString::MULTIPART_UPLOAD;
68
+ $params['Parts'] = $parts;
69
+ $command = $this->client->getCommand('CompleteMultipartUpload', $params);
70
+ return $command->getResult();
71
+ }
72
+ /**
73
+ * {@inheritdoc}
74
+ */
75
+ protected function getAbortCommand()
76
+ {
77
+ $params = $this->state->getUploadId()->toParams();
78
+ $params[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\UaString::OPTION] = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\UaString::MULTIPART_UPLOAD;
79
+ /** @var OperationCommand $command */
80
+ $command = $this->client->getCommand('AbortMultipartUpload', $params);
81
+ return $command;
82
+ }
83
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/MultipartUpload/ParallelTransfer.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\DateFormat;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\UaString as Ua;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBody;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\ReadLimitEntityBody;
24
+ /**
25
+ * Transfers multipart upload parts in parallel
26
+ */
27
+ class ParallelTransfer extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload\AbstractTransfer
28
+ {
29
+ /**
30
+ * {@inheritdoc}
31
+ */
32
+ protected function init()
33
+ {
34
+ parent::init();
35
+ if (!$this->source->isLocal() || $this->source->getWrapper() != 'plainfile') {
36
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException('The source data must be a local file stream when uploading in parallel.');
37
+ }
38
+ if (empty($this->options['concurrency'])) {
39
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException('The `concurrency` option must be specified when instantiating.');
40
+ }
41
+ }
42
+ /**
43
+ * {@inheritdoc}
44
+ */
45
+ protected function transfer()
46
+ {
47
+ $totalParts = (int) ceil($this->source->getContentLength() / $this->partSize);
48
+ $concurrency = min($totalParts, $this->options['concurrency']);
49
+ $partsToSend = $this->prepareParts($concurrency);
50
+ $eventData = $this->getEventData();
51
+ while (!$this->stopped && count($this->state) < $totalParts) {
52
+ $currentTotal = count($this->state);
53
+ $commands = array();
54
+ for ($i = 0; $i < $concurrency && $i + $currentTotal < $totalParts; $i++) {
55
+ // Move the offset to the correct position
56
+ $partsToSend[$i]->setOffset(($currentTotal + $i) * $this->partSize);
57
+ // @codeCoverageIgnoreStart
58
+ if ($partsToSend[$i]->getContentLength() == 0) {
59
+ break;
60
+ }
61
+ // @codeCoverageIgnoreEnd
62
+ $params = $this->state->getUploadId()->toParams();
63
+ $eventData['command'] = $this->client->getCommand('UploadPart', array_replace($params, array('PartNumber' => count($this->state) + 1 + $i, 'Body' => $partsToSend[$i], 'ContentMD5' => (bool) $this->options['part_md5'], \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\UaString::OPTION => \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\UaString::MULTIPART_UPLOAD)));
64
+ $commands[] = $eventData['command'];
65
+ // Notify any listeners of the part upload
66
+ $this->dispatch(self::BEFORE_PART_UPLOAD, $eventData);
67
+ }
68
+ // Allow listeners to stop the transfer if needed
69
+ if ($this->stopped) {
70
+ break;
71
+ }
72
+ // Execute each command, iterate over the results, and add to the transfer state
73
+ /** @var \Guzzle\Service\Command\OperationCommand $command */
74
+ foreach ($this->client->execute($commands) as $command) {
75
+ $this->state->addPart(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload\UploadPart::fromArray(array('PartNumber' => $command['PartNumber'], 'ETag' => $command->getResponse()->getEtag(), 'Size' => (int) $command->getRequest()->getBody()->getContentLength(), 'LastModified' => gmdate(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\DateFormat::RFC2822))));
76
+ $eventData['command'] = $command;
77
+ // Notify any listeners the the part was uploaded
78
+ $this->dispatch(self::AFTER_PART_UPLOAD, $eventData);
79
+ }
80
+ }
81
+ }
82
+ /**
83
+ * Prepare the entity body handles to use while transferring
84
+ *
85
+ * @param int $concurrency Number of parts to prepare
86
+ *
87
+ * @return array Parts to send
88
+ */
89
+ protected function prepareParts($concurrency)
90
+ {
91
+ $url = $this->source->getUri();
92
+ // Use the source EntityBody as the first part
93
+ $parts = array(new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\ReadLimitEntityBody($this->source, $this->partSize));
94
+ // Open EntityBody handles for each part to upload in parallel
95
+ for ($i = 1; $i < $concurrency; $i++) {
96
+ $parts[] = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\ReadLimitEntityBody(new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBody(fopen($url, 'r')), $this->partSize);
97
+ }
98
+ return $parts;
99
+ }
100
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/MultipartUpload/SerialTransfer.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\DateFormat;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\Size;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\UaString as Ua;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBody;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\ReadLimitEntityBody;
24
+ /**
25
+ * Transfers multipart upload parts serially
26
+ */
27
+ class SerialTransfer extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload\AbstractTransfer
28
+ {
29
+ /**
30
+ * {@inheritdoc}
31
+ */
32
+ protected function transfer()
33
+ {
34
+ while (!$this->stopped && !$this->source->isConsumed()) {
35
+ if ($this->source->getContentLength() && $this->source->isSeekable()) {
36
+ // If the stream is seekable and the Content-Length known, then stream from the data source
37
+ $body = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\ReadLimitEntityBody($this->source, $this->partSize, $this->source->ftell());
38
+ } else {
39
+ // We need to read the data source into a temporary buffer before streaming
40
+ $body = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBody::factory();
41
+ while ($body->getContentLength() < $this->partSize && $body->write($this->source->read(max(1, min(10 * \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\Size::KB, $this->partSize - $body->getContentLength()))))) {
42
+ }
43
+ }
44
+ // @codeCoverageIgnoreStart
45
+ if ($body->getContentLength() == 0) {
46
+ break;
47
+ }
48
+ // @codeCoverageIgnoreEnd
49
+ $params = $this->state->getUploadId()->toParams();
50
+ $command = $this->client->getCommand('UploadPart', array_replace($params, array('PartNumber' => count($this->state) + 1, 'Body' => $body, 'ContentMD5' => (bool) $this->options['part_md5'], \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\UaString::OPTION => \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\UaString::MULTIPART_UPLOAD)));
51
+ // Notify observers that the part is about to be uploaded
52
+ $eventData = $this->getEventData();
53
+ $eventData['command'] = $command;
54
+ $this->dispatch(self::BEFORE_PART_UPLOAD, $eventData);
55
+ // Allow listeners to stop the transfer if needed
56
+ if ($this->stopped) {
57
+ break;
58
+ }
59
+ $response = $command->getResponse();
60
+ $this->state->addPart(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload\UploadPart::fromArray(array('PartNumber' => $command['PartNumber'], 'ETag' => $response->getEtag(), 'Size' => $body->getContentLength(), 'LastModified' => gmdate(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\DateFormat::RFC2822))));
61
+ // Notify observers that the part was uploaded
62
+ $this->dispatch(self::AFTER_PART_UPLOAD, $eventData);
63
+ }
64
+ }
65
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/MultipartUpload/TransferState.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AwsClientInterface;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\AbstractTransferState;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\UploadIdInterface;
22
+ /**
23
+ * State of a multipart upload
24
+ */
25
+ class TransferState extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\AbstractTransferState
26
+ {
27
+ /**
28
+ * {@inheritdoc}
29
+ */
30
+ public static function fromUploadId(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AwsClientInterface $client, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\UploadIdInterface $uploadId)
31
+ {
32
+ $transferState = new self($uploadId);
33
+ foreach ($client->getIterator('ListParts', $uploadId->toParams()) as $part) {
34
+ $transferState->addPart(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload\UploadPart::fromArray($part));
35
+ }
36
+ return $transferState;
37
+ }
38
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/MultipartUpload/UploadBuilder.php ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\UaString as Ua;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\AbstractUploadBuilder;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\Acp;
23
+ /**
24
+ * Easily create a multipart uploader used to quickly and reliably upload a
25
+ * large file or data stream to Amazon S3 using multipart uploads
26
+ */
27
+ class UploadBuilder extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\AbstractUploadBuilder
28
+ {
29
+ /**
30
+ * @var int Concurrency level to transfer the parts
31
+ */
32
+ protected $concurrency = 1;
33
+ /**
34
+ * @var int Minimum part size to upload
35
+ */
36
+ protected $minPartSize = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload\AbstractTransfer::MIN_PART_SIZE;
37
+ /**
38
+ * @var string MD5 hash of the entire body to transfer
39
+ */
40
+ protected $md5;
41
+ /**
42
+ * @var bool Whether or not to calculate the entire MD5 hash of the object
43
+ */
44
+ protected $calculateEntireMd5 = false;
45
+ /**
46
+ * @var bool Whether or not to calculate MD5 hash of each part
47
+ */
48
+ protected $calculatePartMd5 = true;
49
+ /**
50
+ * @var array Array of initiate command options
51
+ */
52
+ protected $commandOptions = array();
53
+ /**
54
+ * @var array Array of transfer options
55
+ */
56
+ protected $transferOptions = array();
57
+ /**
58
+ * Set the bucket to upload the object to
59
+ *
60
+ * @param string $bucket Name of the bucket
61
+ *
62
+ * @return $this
63
+ */
64
+ public function setBucket($bucket)
65
+ {
66
+ return $this->setOption('Bucket', $bucket);
67
+ }
68
+ /**
69
+ * Set the key of the object
70
+ *
71
+ * @param string $key Key of the object to upload
72
+ *
73
+ * @return $this
74
+ */
75
+ public function setKey($key)
76
+ {
77
+ return $this->setOption('Key', $key);
78
+ }
79
+ /**
80
+ * Set the minimum acceptable part size
81
+ *
82
+ * @param int $minSize Minimum acceptable part size in bytes
83
+ *
84
+ * @return $this
85
+ */
86
+ public function setMinPartSize($minSize)
87
+ {
88
+ $this->minPartSize = (int) max((int) $minSize, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload\AbstractTransfer::MIN_PART_SIZE);
89
+ return $this;
90
+ }
91
+ /**
92
+ * Set the concurrency level to use when uploading parts. This affects how
93
+ * many parts are uploaded in parallel. You must use a local file as your
94
+ * data source when using a concurrency greater than 1
95
+ *
96
+ * @param int $concurrency Concurrency level
97
+ *
98
+ * @return $this
99
+ */
100
+ public function setConcurrency($concurrency)
101
+ {
102
+ $this->concurrency = $concurrency;
103
+ return $this;
104
+ }
105
+ /**
106
+ * Explicitly set the MD5 hash of the entire body
107
+ *
108
+ * @param string $md5 MD5 hash of the entire body
109
+ *
110
+ * @return $this
111
+ */
112
+ public function setMd5($md5)
113
+ {
114
+ $this->md5 = $md5;
115
+ return $this;
116
+ }
117
+ /**
118
+ * Set to true to have the builder calculate the MD5 hash of the entire data
119
+ * source before initiating a multipart upload (this could be an expensive
120
+ * operation). This setting can ony be used with seekable data sources.
121
+ *
122
+ * @param bool $calculateMd5 Set to true to calculate the MD5 hash of the body
123
+ *
124
+ * @return $this
125
+ */
126
+ public function calculateMd5($calculateMd5)
127
+ {
128
+ $this->calculateEntireMd5 = (bool) $calculateMd5;
129
+ return $this;
130
+ }
131
+ /**
132
+ * Specify whether or not to calculate the MD5 hash of each uploaded part.
133
+ * This setting defaults to true.
134
+ *
135
+ * @param bool $usePartMd5 Set to true to calculate the MD5 has of each part
136
+ *
137
+ * @return $this
138
+ */
139
+ public function calculatePartMd5($usePartMd5)
140
+ {
141
+ $this->calculatePartMd5 = (bool) $usePartMd5;
142
+ return $this;
143
+ }
144
+ /**
145
+ * Set the ACP to use on the object
146
+ *
147
+ * @param Acp $acp ACP to set on the object
148
+ *
149
+ * @return $this
150
+ */
151
+ public function setAcp(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\Acp $acp)
152
+ {
153
+ return $this->setOption('ACP', $acp);
154
+ }
155
+ /**
156
+ * Set an option to pass to the initial CreateMultipartUpload operation
157
+ *
158
+ * @param string $name Option name
159
+ * @param string $value Option value
160
+ *
161
+ * @return $this
162
+ */
163
+ public function setOption($name, $value)
164
+ {
165
+ $this->commandOptions[$name] = $value;
166
+ return $this;
167
+ }
168
+ /**
169
+ * Add an array of options to pass to the initial CreateMultipartUpload operation
170
+ *
171
+ * @param array $options Array of CreateMultipartUpload operation parameters
172
+ *
173
+ * @return $this
174
+ */
175
+ public function addOptions(array $options)
176
+ {
177
+ $this->commandOptions = array_replace($this->commandOptions, $options);
178
+ return $this;
179
+ }
180
+ /**
181
+ * Set an array of transfer options to apply to the upload transfer object
182
+ *
183
+ * @param array $options Transfer options
184
+ *
185
+ * @return $this
186
+ */
187
+ public function setTransferOptions(array $options)
188
+ {
189
+ $this->transferOptions = $options;
190
+ return $this;
191
+ }
192
+ /**
193
+ * {@inheritdoc}
194
+ * @throws InvalidArgumentException when attempting to resume a transfer using a non-seekable stream
195
+ * @throws InvalidArgumentException when missing required properties (bucket, key, client, source)
196
+ */
197
+ public function build()
198
+ {
199
+ if ($this->state instanceof TransferState) {
200
+ $this->commandOptions = array_replace($this->commandOptions, $this->state->getUploadId()->toParams());
201
+ }
202
+ if (!isset($this->commandOptions['Bucket']) || !isset($this->commandOptions['Key']) || !$this->client || !$this->source) {
203
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('You must specify a Bucket, Key, client, and source.');
204
+ }
205
+ if ($this->state && !$this->source->isSeekable()) {
206
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('You cannot resume a transfer using a non-seekable source.');
207
+ }
208
+ // If no state was set, then create one by initiating or loading a multipart upload
209
+ if (is_string($this->state)) {
210
+ $this->state = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload\TransferState::fromUploadId($this->client, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload\UploadId::fromParams(array('Bucket' => $this->commandOptions['Bucket'], 'Key' => $this->commandOptions['Key'], 'UploadId' => $this->state)));
211
+ } elseif (!$this->state) {
212
+ $this->state = $this->initiateMultipartUpload();
213
+ }
214
+ $options = array_replace(array('min_part_size' => $this->minPartSize, 'part_md5' => (bool) $this->calculatePartMd5, 'concurrency' => $this->concurrency), $this->transferOptions);
215
+ return $this->concurrency > 1 ? new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload\ParallelTransfer($this->client, $this->state, $this->source, $options) : new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload\SerialTransfer($this->client, $this->state, $this->source, $options);
216
+ }
217
+ /**
218
+ * {@inheritdoc}
219
+ */
220
+ protected function initiateMultipartUpload()
221
+ {
222
+ // Determine Content-Type
223
+ if (!isset($this->commandOptions['ContentType'])) {
224
+ if ($mimeType = $this->source->getContentType()) {
225
+ $this->commandOptions['ContentType'] = $mimeType;
226
+ }
227
+ }
228
+ $params = array_replace(array(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\UaString::OPTION => \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\UaString::MULTIPART_UPLOAD, 'command.headers' => $this->headers, 'Metadata' => array()), $this->commandOptions);
229
+ // Calculate the MD5 hash if none was set and it is asked of the builder
230
+ if ($this->calculateEntireMd5) {
231
+ $this->md5 = $this->source->getContentMd5();
232
+ }
233
+ // If an MD5 is specified, then add it to the custom headers of the request
234
+ // so that it will be returned when downloading the object from Amazon S3
235
+ if ($this->md5) {
236
+ $params['Metadata']['x-amz-Content-MD5'] = $this->md5;
237
+ }
238
+ $result = $this->client->getCommand('CreateMultipartUpload', $params)->execute();
239
+ // Create a new state based on the initiated upload
240
+ $params['UploadId'] = $result['UploadId'];
241
+ return new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload\TransferState(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload\UploadId::fromParams($params));
242
+ }
243
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/MultipartUpload/UploadId.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\AbstractUploadId;
20
+ /**
21
+ * An object that encapsulates the identification for a Glacier upload part
22
+ * @codeCoverageIgnore
23
+ */
24
+ class UploadId extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\AbstractUploadId
25
+ {
26
+ /**
27
+ * {@inheritdoc}
28
+ */
29
+ protected static $expectedValues = array('Bucket' => false, 'Key' => false, 'UploadId' => false);
30
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/MultipartUpload/UploadPart.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\AbstractUploadPart;
20
+ /**
21
+ * An object that encapsulates the data for a Glacier upload operation
22
+ */
23
+ class UploadPart extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\AbstractUploadPart
24
+ {
25
+ /**
26
+ * {@inheritdoc}
27
+ */
28
+ protected static $keyMap = array('PartNumber' => 'partNumber', 'ETag' => 'eTag', 'LastModified' => 'lastModified', 'Size' => 'size');
29
+ /**
30
+ * @var string The ETag for this part
31
+ */
32
+ protected $eTag;
33
+ /**
34
+ * @var string The last modified date
35
+ */
36
+ protected $lastModified;
37
+ /**
38
+ * @var int The size (or content-length) in bytes of the upload body
39
+ */
40
+ protected $size;
41
+ /**
42
+ * @return string
43
+ */
44
+ public function getETag()
45
+ {
46
+ return $this->eTag;
47
+ }
48
+ /**
49
+ * @return string
50
+ */
51
+ public function getLastModified()
52
+ {
53
+ return $this->lastModified;
54
+ }
55
+ /**
56
+ * @return int
57
+ */
58
+ public function getSize()
59
+ {
60
+ return $this->size;
61
+ }
62
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Model/PostObject.php ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\DateFormat;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\S3Client;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Url;
23
+ /**
24
+ * Encapsulates the logic for getting the data for an S3 object POST upload form
25
+ */
26
+ class PostObject extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection
27
+ {
28
+ /**
29
+ * @var S3Client The S3 client being used to sign the policy
30
+ */
31
+ protected $client;
32
+ /**
33
+ * @var string The bucket name where the object will be posted
34
+ */
35
+ protected $bucket;
36
+ /**
37
+ * @var array The <form> tag attributes as an array
38
+ */
39
+ protected $formAttributes;
40
+ /**
41
+ * @var array The form's <input> elements as an array
42
+ */
43
+ protected $formInputs;
44
+ /**
45
+ * @var string The raw json policy
46
+ */
47
+ protected $jsonPolicy;
48
+ /**
49
+ * Constructs the PostObject
50
+ *
51
+ * The options array accepts the following keys:
52
+ *
53
+ * - acl: The access control setting to apply to the uploaded file. Accepts any of the
54
+ * CannedAcl constants
55
+ * - Cache-Control: The Cache-Control HTTP header value to apply to the uploaded file
56
+ * - Content-Disposition: The Content-Disposition HTTP header value to apply to the uploaded file
57
+ * - Content-Encoding: The Content-Encoding HTTP header value to apply to the uploaded file
58
+ * - Content-Type: The Content-Type HTTP header value to apply to the uploaded file. The default
59
+ * value is `application/octet-stream`
60
+ * - Expires: The Expires HTTP header value to apply to the uploaded file
61
+ * - key: The location where the file should be uploaded to. The default value is
62
+ * `^${filename}` which will use the name of the uploaded file
63
+ * - policy: A raw policy in JSON format. By default, the PostObject creates one for you
64
+ * - policy_callback: A callback used to modify the policy before encoding and signing it. The
65
+ * method signature for the callback should accept an array of the policy data as
66
+ * the 1st argument, (optionally) the PostObject as the 2nd argument, and return
67
+ * the policy data with the desired modifications.
68
+ * - success_action_redirect: The URI for Amazon S3 to redirect to upon successful upload
69
+ * - success_action_status: The status code for Amazon S3 to return upon successful upload
70
+ * - ttd: The expiration time for the generated upload form data
71
+ * - x-amz-meta-*: Any custom meta tag that should be set to the object
72
+ * - x-amz-server-side-encryption: The server-side encryption mechanism to use
73
+ * - x-amz-storage-class: The storage setting to apply to the object
74
+ * - x-amz-server-side​-encryption​-customer-algorithm: The SSE-C algorithm
75
+ * - x-amz-server-side​-encryption​-customer-key: The SSE-C customer secret key
76
+ * - x-amz-server-side​-encryption​-customer-key-MD5: The MD5 hash of the SSE-C customer secret key
77
+ *
78
+ * For the Cache-Control, Content-Disposition, Content-Encoding,
79
+ * Content-Type, Expires, and key options, to use a "starts-with" comparison
80
+ * instead of an equals comparison, prefix the value with a ^ (carat)
81
+ * character
82
+ *
83
+ * @param S3Client $client
84
+ * @param $bucket
85
+ * @param array $options
86
+ */
87
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\S3Client $client, $bucket, array $options = array())
88
+ {
89
+ $this->setClient($client);
90
+ $this->setBucket($bucket);
91
+ parent::__construct($options);
92
+ }
93
+ /**
94
+ * Analyzes the provided data and turns it into useful data that can be
95
+ * consumed and used to build an upload form
96
+ *
97
+ * @return PostObject
98
+ */
99
+ public function prepareData()
100
+ {
101
+ // Validate required options
102
+ $options = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection::fromConfig($this->data, array('ttd' => '+1 hour', 'key' => '^${filename}'));
103
+ // Format ttd option
104
+ $ttd = $options['ttd'];
105
+ $ttd = is_numeric($ttd) ? (int) $ttd : strtotime($ttd);
106
+ unset($options['ttd']);
107
+ // If a policy or policy callback were provided, extract those from the options
108
+ $rawJsonPolicy = $options['policy'];
109
+ $policyCallback = $options['policy_callback'];
110
+ unset($options['policy'], $options['policy_callback']);
111
+ // Setup policy document
112
+ $policy = array('expiration' => gmdate(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\DateFormat::ISO8601_S3, $ttd), 'conditions' => array(array('bucket' => $this->bucket)));
113
+ // Configure the endpoint/action
114
+ $url = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Url::factory($this->client->getBaseUrl());
115
+ if ($url->getScheme() === 'https' && strpos($this->bucket, '.') !== false) {
116
+ // Use path-style URLs
117
+ $url->setPath($this->bucket);
118
+ } else {
119
+ // Use virtual-style URLs
120
+ $url->setHost($this->bucket . '.' . $url->getHost());
121
+ }
122
+ // Setup basic form
123
+ $this->formAttributes = array('action' => (string) $url, 'method' => 'POST', 'enctype' => 'multipart/form-data');
124
+ $this->formInputs = array('AWSAccessKeyId' => $this->client->getCredentials()->getAccessKeyId());
125
+ // Add success action status
126
+ $status = (int) $options->get('success_action_status');
127
+ if ($status && in_array($status, array(200, 201, 204))) {
128
+ $this->formInputs['success_action_status'] = (string) $status;
129
+ $policy['conditions'][] = array('success_action_status' => (string) $status);
130
+ unset($options['success_action_status']);
131
+ }
132
+ // Add other options
133
+ foreach ($options as $key => $value) {
134
+ $value = (string) $value;
135
+ if ($value[0] === '^') {
136
+ $value = substr($value, 1);
137
+ $this->formInputs[$key] = $value;
138
+ $value = preg_replace('/\\$\\{(\\w*)\\}/', '', $value);
139
+ $policy['conditions'][] = array('starts-with', '$' . $key, $value);
140
+ } else {
141
+ $this->formInputs[$key] = $value;
142
+ $policy['conditions'][] = array($key => $value);
143
+ }
144
+ }
145
+ // Handle the policy
146
+ $policy = is_callable($policyCallback) ? $policyCallback($policy, $this) : $policy;
147
+ $this->jsonPolicy = $rawJsonPolicy ?: json_encode($policy);
148
+ $this->applyPolicy();
149
+ return $this;
150
+ }
151
+ /**
152
+ * Sets the S3 client
153
+ *
154
+ * @param S3Client $client
155
+ *
156
+ * @return PostObject
157
+ */
158
+ public function setClient(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\S3Client $client)
159
+ {
160
+ $this->client = $client;
161
+ return $this;
162
+ }
163
+ /**
164
+ * Gets the S3 client
165
+ *
166
+ * @return S3Client
167
+ */
168
+ public function getClient()
169
+ {
170
+ return $this->client;
171
+ }
172
+ /**
173
+ * Sets the bucket and makes sure it is a valid bucket name
174
+ *
175
+ * @param string $bucket
176
+ *
177
+ * @return PostObject
178
+ */
179
+ public function setBucket($bucket)
180
+ {
181
+ $this->bucket = $bucket;
182
+ return $this;
183
+ }
184
+ /**
185
+ * Gets the bucket name
186
+ *
187
+ * @return string
188
+ */
189
+ public function getBucket()
190
+ {
191
+ return $this->bucket;
192
+ }
193
+ /**
194
+ * Gets the form attributes as an array
195
+ *
196
+ * @return array
197
+ */
198
+ public function getFormAttributes()
199
+ {
200
+ return $this->formAttributes;
201
+ }
202
+ /**
203
+ * Gets the form inputs as an array
204
+ *
205
+ * @return array
206
+ */
207
+ public function getFormInputs()
208
+ {
209
+ return $this->formInputs;
210
+ }
211
+ /**
212
+ * Gets the raw JSON policy
213
+ *
214
+ * @return string
215
+ */
216
+ public function getJsonPolicy()
217
+ {
218
+ return $this->jsonPolicy;
219
+ }
220
+ /**
221
+ * Handles the encoding, singing, and injecting of the policy
222
+ */
223
+ protected function applyPolicy()
224
+ {
225
+ $jsonPolicy64 = base64_encode($this->jsonPolicy);
226
+ $this->formInputs['policy'] = $jsonPolicy64;
227
+ $this->formInputs['signature'] = base64_encode(hash_hmac('sha1', $jsonPolicy64, $this->client->getCredentials()->getSecretKey(), true));
228
+ }
229
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Resources/s3-2006-03-01.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ return array('apiVersion' => '2006-03-01', 'endpointPrefix' => 's3', 'serviceFullName' => 'Amazon Simple Storage Service', 'serviceAbbreviation' => 'Amazon S3', 'serviceType' => 'rest-xml', 'timestampFormat' => 'rfc822', 'globalEndpoint' => 's3.amazonaws.com', 'signatureVersion' => 's3', 'namespace' => 'S3', 'regions' => array('us-east-1' => array('http' => \true, 'https' => \true, 'hostname' => 's3.amazonaws.com'), 'us-west-1' => array('http' => \true, 'https' => \true, 'hostname' => 's3-us-west-1.amazonaws.com'), 'us-west-2' => array('http' => \true, 'https' => \true, 'hostname' => 's3-us-west-2.amazonaws.com'), 'eu-west-1' => array('http' => \true, 'https' => \true, 'hostname' => 's3-eu-west-1.amazonaws.com'), 'eu-central-1' => array('http' => \true, 'https' => \true, 'hostname' => 's3-eu-central-1.amazonaws.com'), 'ap-northeast-1' => array('http' => \true, 'https' => \true, 'hostname' => 's3-ap-northeast-1.amazonaws.com'), 'ap-southeast-1' => array('http' => \true, 'https' => \true, 'hostname' => 's3-ap-southeast-1.amazonaws.com'), 'ap-southeast-2' => array('http' => \true, 'https' => \true, 'hostname' => 's3-ap-southeast-2.amazonaws.com'), 'sa-east-1' => array('http' => \true, 'https' => \true, 'hostname' => 's3-sa-east-1.amazonaws.com'), 'cn-north-1' => array('http' => \true, 'https' => \true, 'hostname' => 's3.cn-north-1.amazonaws.com.cn'), 'us-gov-west-1' => array('http' => \true, 'https' => \true, 'hostname' => 's3-us-gov-west-1.amazonaws.com')), 'operations' => array('AbortMultipartUpload' => array('httpMethod' => 'DELETE', 'uri' => '/{Bucket}{/Key*}', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'AbortMultipartUploadOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadAbort.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'Key' => array('required' => \true, 'type' => 'string', 'location' => 'uri', 'minLength' => 1, 'filters' => array('DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\S3Client::explodeKey')), 'UploadId' => array('required' => \true, 'type' => 'string', 'location' => 'query', 'sentAs' => 'uploadId'), 'RequestPayer' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-payer')), 'errorResponses' => array(array('reason' => 'The specified multipart upload does not exist.', 'class' => 'NoSuchUploadException'))), 'CompleteMultipartUpload' => array('httpMethod' => 'POST', 'uri' => '/{Bucket}{/Key*}', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'CompleteMultipartUploadOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadComplete.html', 'data' => array('xmlRoot' => array('name' => 'CompleteMultipartUpload', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/'))), 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'Key' => array('required' => \true, 'type' => 'string', 'location' => 'uri', 'minLength' => 1, 'filters' => array('DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\S3Client::explodeKey')), 'Parts' => array('type' => 'array', 'location' => 'xml', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'CompletedPart', 'type' => 'object', 'sentAs' => 'Part', 'properties' => array('ETag' => array('type' => 'string'), 'PartNumber' => array('type' => 'numeric')))), 'UploadId' => array('required' => \true, 'type' => 'string', 'location' => 'query', 'sentAs' => 'uploadId'), 'RequestPayer' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-payer'), 'command.expects' => array('static' => \true, 'default' => 'application/xml'))), 'CopyObject' => array('httpMethod' => 'PUT', 'uri' => '/{Bucket}{/Key*}', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'CopyObjectOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectCOPY.html', 'data' => array('xmlRoot' => array('name' => 'CopyObjectRequest', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/'))), 'parameters' => array('ACL' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-acl'), 'Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'CacheControl' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Cache-Control'), 'ContentDisposition' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Disposition'), 'ContentEncoding' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Encoding'), 'ContentLanguage' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Language'), 'ContentType' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Type'), 'CopySource' => array('required' => \true, 'type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-copy-source'), 'CopySourceIfMatch' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-copy-source-if-match'), 'CopySourceIfModifiedSince' => array('type' => array('object', 'string', 'integer'), 'format' => 'date-time-http', 'location' => 'header', 'sentAs' => 'x-amz-copy-source-if-modified-since'), 'CopySourceIfNoneMatch' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-copy-source-if-none-match'), 'CopySourceIfUnmodifiedSince' => array('type' => array('object', 'string', 'integer'), 'format' => 'date-time-http', 'location' => 'header', 'sentAs' => 'x-amz-copy-source-if-unmodified-since'), 'Expires' => array('type' => array('object', 'string', 'integer'), 'format' => 'date-time-http', 'location' => 'header'), 'GrantFullControl' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-full-control'), 'GrantRead' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-read'), 'GrantReadACP' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-read-acp'), 'GrantWriteACP' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-write-acp'), 'Key' => array('required' => \true, 'type' => 'string', 'location' => 'uri', 'minLength' => 1, 'filters' => array('DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\S3Client::explodeKey')), 'Metadata' => array('type' => 'object', 'location' => 'header', 'sentAs' => 'x-amz-meta-', 'additionalProperties' => array('type' => 'string')), 'MetadataDirective' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-metadata-directive'), 'ServerSideEncryption' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption'), 'StorageClass' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-storage-class'), 'WebsiteRedirectLocation' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-website-redirect-location'), 'SSECustomerAlgorithm' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm'), 'SSECustomerKey' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-key'), 'SSECustomerKeyMD5' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5'), 'SSEKMSKeyId' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id'), 'CopySourceSSECustomerAlgorithm' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-copy-source-server-side-encryption-customer-algorithm'), 'CopySourceSSECustomerKey' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-copy-source-server-side-encryption-customer-key'), 'CopySourceSSECustomerKeyMD5' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-copy-source-server-side-encryption-customer-key-MD5'), 'RequestPayer' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-payer'), 'ACP' => array('type' => 'object', 'additionalProperties' => \true), 'command.expects' => array('static' => \true, 'default' => 'application/xml')), 'errorResponses' => array(array('reason' => 'The source object of the COPY operation is not in the active tier and is only stored in Amazon Glacier.', 'class' => 'ObjectNotInActiveTierErrorException'))), 'CreateBucket' => array('httpMethod' => 'PUT', 'uri' => '/{Bucket}', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'CreateBucketOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUT.html', 'data' => array('xmlRoot' => array('name' => 'CreateBucketConfiguration', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/'))), 'parameters' => array('ACL' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-acl'), 'Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'LocationConstraint' => array('type' => 'string', 'location' => 'xml'), 'GrantFullControl' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-full-control'), 'GrantRead' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-read'), 'GrantReadACP' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-read-acp'), 'GrantWrite' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-write'), 'GrantWriteACP' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-write-acp'), 'ACP' => array('type' => 'object', 'additionalProperties' => \true)), 'errorResponses' => array(array('reason' => 'The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again.', 'class' => 'BucketAlreadyExistsException'))), 'CreateMultipartUpload' => array('httpMethod' => 'POST', 'uri' => '/{Bucket}{/Key*}?uploads', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'CreateMultipartUploadOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadInitiate.html', 'data' => array('xmlRoot' => array('name' => 'CreateMultipartUploadRequest', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/'))), 'parameters' => array('ACL' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-acl'), 'Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'CacheControl' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Cache-Control'), 'ContentDisposition' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Disposition'), 'ContentEncoding' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Encoding'), 'ContentLanguage' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Language'), 'ContentType' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Type'), 'Expires' => array('type' => array('object', 'string', 'integer'), 'format' => 'date-time-http', 'location' => 'header'), 'GrantFullControl' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-full-control'), 'GrantRead' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-read'), 'GrantReadACP' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-read-acp'), 'GrantWriteACP' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-write-acp'), 'Key' => array('required' => \true, 'type' => 'string', 'location' => 'uri', 'minLength' => 1, 'filters' => array('DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\S3Client::explodeKey')), 'Metadata' => array('type' => 'object', 'location' => 'header', 'sentAs' => 'x-amz-meta-', 'additionalProperties' => array('type' => 'string')), 'ServerSideEncryption' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption'), 'StorageClass' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-storage-class'), 'WebsiteRedirectLocation' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-website-redirect-location'), 'SSECustomerAlgorithm' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm'), 'SSECustomerKey' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-key'), 'SSECustomerKeyMD5' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5'), 'SSEKMSKeyId' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id'), 'RequestPayer' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-payer'), 'ACP' => array('type' => 'object', 'additionalProperties' => \true), 'command.expects' => array('static' => \true, 'default' => 'application/xml'))), 'DeleteBucket' => array('httpMethod' => 'DELETE', 'uri' => '/{Bucket}', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'DeleteBucketOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketDELETE.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'))), 'DeleteBucketCors' => array('httpMethod' => 'DELETE', 'uri' => '/{Bucket}?cors', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'DeleteBucketCorsOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketDELETEcors.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'))), 'DeleteBucketLifecycle' => array('httpMethod' => 'DELETE', 'uri' => '/{Bucket}?lifecycle', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'DeleteBucketLifecycleOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketDELETElifecycle.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'))), 'DeleteBucketPolicy' => array('httpMethod' => 'DELETE', 'uri' => '/{Bucket}?policy', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'DeleteBucketPolicyOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketDELETEpolicy.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'))), 'DeleteBucketReplication' => array('httpMethod' => 'DELETE', 'uri' => '/{Bucket}?replication', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'DeleteBucketReplicationOutput', 'responseType' => 'model', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'))), 'DeleteBucketTagging' => array('httpMethod' => 'DELETE', 'uri' => '/{Bucket}?tagging', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'DeleteBucketTaggingOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketDELETEtagging.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'))), 'DeleteBucketWebsite' => array('httpMethod' => 'DELETE', 'uri' => '/{Bucket}?website', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'DeleteBucketWebsiteOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketDELETEwebsite.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'))), 'DeleteObject' => array('httpMethod' => 'DELETE', 'uri' => '/{Bucket}{/Key*}', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'DeleteObjectOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectDELETE.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'Key' => array('required' => \true, 'type' => 'string', 'location' => 'uri', 'minLength' => 1, 'filters' => array('DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\S3Client::explodeKey')), 'MFA' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-mfa'), 'VersionId' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'versionId'), 'RequestPayer' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-payer'))), 'DeleteObjects' => array('httpMethod' => 'POST', 'uri' => '/{Bucket}?delete', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'DeleteObjectsOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/multiobjectdeleteapi.html', 'data' => array('xmlRoot' => array('name' => 'Delete', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/')), 'contentMd5' => \true), 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'Objects' => array('required' => \true, 'type' => 'array', 'location' => 'xml', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'ObjectIdentifier', 'type' => 'object', 'sentAs' => 'Object', 'properties' => array('Key' => array('required' => \true, 'type' => 'string', 'minLength' => 1), 'VersionId' => array('type' => 'string')))), 'Quiet' => array('type' => 'boolean', 'format' => 'boolean-string', 'location' => 'xml'), 'MFA' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-mfa'), 'RequestPayer' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-payer'), 'command.expects' => array('static' => \true, 'default' => 'application/xml'))), 'GetBucketAcl' => array('httpMethod' => 'GET', 'uri' => '/{Bucket}?acl', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'GetBucketAclOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETacl.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'command.expects' => array('static' => \true, 'default' => 'application/xml'))), 'GetBucketCors' => array('httpMethod' => 'GET', 'uri' => '/{Bucket}?cors', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'GetBucketCorsOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETcors.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'command.expects' => array('static' => \true, 'default' => 'application/xml'))), 'GetBucketLifecycle' => array('httpMethod' => 'GET', 'uri' => '/{Bucket}?lifecycle', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'GetBucketLifecycleOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETlifecycle.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'command.expects' => array('static' => \true, 'default' => 'application/xml'))), 'GetBucketLifecycleConfiguration' => array('httpMethod' => 'GET', 'uri' => '/{Bucket}?lifecycle', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'GetBucketLifecycleConfigurationOutput', 'responseType' => 'model', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'command.expects' => array('static' => \true, 'default' => 'application/xml'))), 'GetBucketLocation' => array('httpMethod' => 'GET', 'uri' => '/{Bucket}?location', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'GetBucketLocationOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETlocation.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'))), 'GetBucketLogging' => array('httpMethod' => 'GET', 'uri' => '/{Bucket}?logging', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'GetBucketLoggingOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETlogging.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'command.expects' => array('static' => \true, 'default' => 'application/xml'))), 'GetBucketNotification' => array('httpMethod' => 'GET', 'uri' => '/{Bucket}?notification', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'NotificationConfigurationDeprecated', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETnotification.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'command.expects' => array('static' => \true, 'default' => 'application/xml'))), 'GetBucketNotificationConfiguration' => array('httpMethod' => 'GET', 'uri' => '/{Bucket}?notification', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'NotificationConfiguration', 'responseType' => 'model', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'command.expects' => array('static' => \true, 'default' => 'application/xml'))), 'GetBucketPolicy' => array('httpMethod' => 'GET', 'uri' => '/{Bucket}?policy', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'GetBucketPolicyOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETpolicy.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'))), 'GetBucketReplication' => array('httpMethod' => 'GET', 'uri' => '/{Bucket}?replication', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'GetBucketReplicationOutput', 'responseType' => 'model', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'command.expects' => array('static' => \true, 'default' => 'application/xml'))), 'GetBucketRequestPayment' => array('httpMethod' => 'GET', 'uri' => '/{Bucket}?requestPayment', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'GetBucketRequestPaymentOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTrequestPaymentGET.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'command.expects' => array('static' => \true, 'default' => 'application/xml'))), 'GetBucketTagging' => array('httpMethod' => 'GET', 'uri' => '/{Bucket}?tagging', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'GetBucketTaggingOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETtagging.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'command.expects' => array('static' => \true, 'default' => 'application/xml'))), 'GetBucketVersioning' => array('httpMethod' => 'GET', 'uri' => '/{Bucket}?versioning', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'GetBucketVersioningOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETversioningStatus.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'command.expects' => array('static' => \true, 'default' => 'application/xml'))), 'GetBucketWebsite' => array('httpMethod' => 'GET', 'uri' => '/{Bucket}?website', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'GetBucketWebsiteOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETwebsite.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'command.expects' => array('static' => \true, 'default' => 'application/xml'))), 'GetObject' => array('httpMethod' => 'GET', 'uri' => '/{Bucket}{/Key*}', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'GetObjectOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectGET.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'IfMatch' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'If-Match'), 'IfModifiedSince' => array('type' => array('object', 'string', 'integer'), 'format' => 'date-time-http', 'location' => 'header', 'sentAs' => 'If-Modified-Since'), 'IfNoneMatch' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'If-None-Match'), 'IfUnmodifiedSince' => array('type' => array('object', 'string', 'integer'), 'format' => 'date-time-http', 'location' => 'header', 'sentAs' => 'If-Unmodified-Since'), 'Key' => array('required' => \true, 'type' => 'string', 'location' => 'uri', 'minLength' => 1, 'filters' => array('DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\S3Client::explodeKey')), 'Range' => array('type' => 'string', 'location' => 'header'), 'ResponseCacheControl' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'response-cache-control'), 'ResponseContentDisposition' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'response-content-disposition'), 'ResponseContentEncoding' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'response-content-encoding'), 'ResponseContentLanguage' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'response-content-language'), 'ResponseContentType' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'response-content-type'), 'ResponseExpires' => array('type' => array('object', 'string', 'integer'), 'format' => 'date-time-http', 'location' => 'query', 'sentAs' => 'response-expires'), 'VersionId' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'versionId'), 'SSECustomerAlgorithm' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm'), 'SSECustomerKey' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-key'), 'SSECustomerKeyMD5' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5'), 'RequestPayer' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-payer'), 'SaveAs' => array('location' => 'response_body')), 'errorResponses' => array(array('reason' => 'The specified key does not exist.', 'class' => 'NoSuchKeyException'))), 'GetObjectAcl' => array('httpMethod' => 'GET', 'uri' => '/{Bucket}{/Key*}?acl', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'GetObjectAclOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectGETacl.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'Key' => array('required' => \true, 'type' => 'string', 'location' => 'uri', 'minLength' => 1, 'filters' => array('DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\S3Client::explodeKey')), 'VersionId' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'versionId'), 'RequestPayer' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-payer'), 'command.expects' => array('static' => \true, 'default' => 'application/xml')), 'errorResponses' => array(array('reason' => 'The specified key does not exist.', 'class' => 'NoSuchKeyException'))), 'GetObjectTorrent' => array('httpMethod' => 'GET', 'uri' => '/{Bucket}{/Key*}?torrent', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'GetObjectTorrentOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectGETtorrent.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'Key' => array('required' => \true, 'type' => 'string', 'location' => 'uri', 'minLength' => 1, 'filters' => array('DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\S3Client::explodeKey')), 'RequestPayer' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-payer'))), 'HeadBucket' => array('httpMethod' => 'HEAD', 'uri' => '/{Bucket}', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'HeadBucketOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketHEAD.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri')), 'errorResponses' => array(array('reason' => 'The specified bucket does not exist.', 'class' => 'NoSuchBucketException'))), 'HeadObject' => array('httpMethod' => 'HEAD', 'uri' => '/{Bucket}{/Key*}', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'HeadObjectOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectHEAD.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'IfMatch' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'If-Match'), 'IfModifiedSince' => array('type' => array('object', 'string', 'integer'), 'format' => 'date-time-http', 'location' => 'header', 'sentAs' => 'If-Modified-Since'), 'IfNoneMatch' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'If-None-Match'), 'IfUnmodifiedSince' => array('type' => array('object', 'string', 'integer'), 'format' => 'date-time-http', 'location' => 'header', 'sentAs' => 'If-Unmodified-Since'), 'Key' => array('required' => \true, 'type' => 'string', 'location' => 'uri', 'minLength' => 1, 'filters' => array('DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\S3Client::explodeKey')), 'Range' => array('type' => 'string', 'location' => 'header'), 'VersionId' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'versionId'), 'SSECustomerAlgorithm' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm'), 'SSECustomerKey' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-key'), 'SSECustomerKeyMD5' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5'), 'RequestPayer' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-payer')), 'errorResponses' => array(array('reason' => 'The specified key does not exist.', 'class' => 'NoSuchKeyException'))), 'ListBuckets' => array('httpMethod' => 'GET', 'uri' => '/', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'ListBucketsOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTServiceGET.html', 'parameters' => array('command.expects' => array('static' => \true, 'default' => 'application/xml'))), 'ListMultipartUploads' => array('httpMethod' => 'GET', 'uri' => '/{Bucket}?uploads', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'ListMultipartUploadsOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadListMPUpload.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'Delimiter' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'delimiter'), 'EncodingType' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'encoding-type'), 'KeyMarker' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'key-marker'), 'MaxUploads' => array('type' => 'numeric', 'location' => 'query', 'sentAs' => 'max-uploads'), 'Prefix' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'prefix'), 'UploadIdMarker' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'upload-id-marker'), 'command.expects' => array('static' => \true, 'default' => 'application/xml'))), 'ListObjectVersions' => array('httpMethod' => 'GET', 'uri' => '/{Bucket}?versions', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'ListObjectVersionsOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETVersion.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'Delimiter' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'delimiter'), 'EncodingType' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'encoding-type'), 'KeyMarker' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'key-marker'), 'MaxKeys' => array('type' => 'numeric', 'location' => 'query', 'sentAs' => 'max-keys'), 'Prefix' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'prefix'), 'VersionIdMarker' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'version-id-marker'), 'command.expects' => array('static' => \true, 'default' => 'application/xml'))), 'ListObjects' => array('httpMethod' => 'GET', 'uri' => '/{Bucket}', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'ListObjectsOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGET.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'Delimiter' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'delimiter'), 'EncodingType' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'encoding-type'), 'Marker' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'marker'), 'MaxKeys' => array('type' => 'numeric', 'location' => 'query', 'sentAs' => 'max-keys'), 'Prefix' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'prefix'), 'command.expects' => array('static' => \true, 'default' => 'application/xml')), 'errorResponses' => array(array('reason' => 'The specified bucket does not exist.', 'class' => 'NoSuchBucketException'))), 'ListParts' => array('httpMethod' => 'GET', 'uri' => '/{Bucket}{/Key*}', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'ListPartsOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadListParts.html', 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'Key' => array('required' => \true, 'type' => 'string', 'location' => 'uri', 'minLength' => 1, 'filters' => array('DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\S3Client::explodeKey')), 'MaxParts' => array('type' => 'numeric', 'location' => 'query', 'sentAs' => 'max-parts'), 'PartNumberMarker' => array('type' => 'numeric', 'location' => 'query', 'sentAs' => 'part-number-marker'), 'UploadId' => array('required' => \true, 'type' => 'string', 'location' => 'query', 'sentAs' => 'uploadId'), 'RequestPayer' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-payer'), 'command.expects' => array('static' => \true, 'default' => 'application/xml'))), 'PutBucketAcl' => array('httpMethod' => 'PUT', 'uri' => '/{Bucket}?acl', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'PutBucketAclOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTacl.html', 'data' => array('xmlRoot' => array('name' => 'AccessControlPolicy', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/'))), 'parameters' => array('ACL' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-acl'), 'Grants' => array('type' => 'array', 'location' => 'xml', 'sentAs' => 'AccessControlList', 'items' => array('name' => 'Grant', 'type' => 'object', 'properties' => array('Grantee' => array('type' => 'object', 'properties' => array('DisplayName' => array('type' => 'string'), 'EmailAddress' => array('type' => 'string'), 'ID' => array('type' => 'string'), 'Type' => array('required' => \true, 'type' => 'string', 'sentAs' => 'xsi:type', 'data' => array('xmlAttribute' => \true, 'xmlNamespace' => 'http://www.w3.org/2001/XMLSchema-instance')), 'URI' => array('type' => 'string'))), 'Permission' => array('type' => 'string')))), 'Owner' => array('type' => 'object', 'location' => 'xml', 'properties' => array('DisplayName' => array('type' => 'string'), 'ID' => array('type' => 'string'))), 'Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'GrantFullControl' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-full-control'), 'GrantRead' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-read'), 'GrantReadACP' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-read-acp'), 'GrantWrite' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-write'), 'GrantWriteACP' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-write-acp'), 'ACP' => array('type' => 'object', 'additionalProperties' => \true))), 'PutBucketCors' => array('httpMethod' => 'PUT', 'uri' => '/{Bucket}?cors', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'PutBucketCorsOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTcors.html', 'data' => array('xmlRoot' => array('name' => 'CORSConfiguration', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/')), 'contentMd5' => \true), 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'CORSRules' => array('required' => \true, 'type' => 'array', 'location' => 'xml', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'CORSRule', 'type' => 'object', 'sentAs' => 'CORSRule', 'properties' => array('AllowedHeaders' => array('type' => 'array', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'AllowedHeader', 'type' => 'string', 'sentAs' => 'AllowedHeader')), 'AllowedMethods' => array('required' => \true, 'type' => 'array', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'AllowedMethod', 'type' => 'string', 'sentAs' => 'AllowedMethod')), 'AllowedOrigins' => array('required' => \true, 'type' => 'array', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'AllowedOrigin', 'type' => 'string', 'sentAs' => 'AllowedOrigin')), 'ExposeHeaders' => array('type' => 'array', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'ExposeHeader', 'type' => 'string', 'sentAs' => 'ExposeHeader')), 'MaxAgeSeconds' => array('type' => 'numeric')))))), 'PutBucketLifecycle' => array('httpMethod' => 'PUT', 'uri' => '/{Bucket}?lifecycle', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'PutBucketLifecycleOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlifecycle.html', 'data' => array('xmlRoot' => array('name' => 'LifecycleConfiguration', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/')), 'contentMd5' => \true), 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'Rules' => array('required' => \true, 'type' => 'array', 'location' => 'xml', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'Rule', 'type' => 'object', 'sentAs' => 'Rule', 'properties' => array('Expiration' => array('type' => 'object', 'properties' => array('Date' => array('type' => array('object', 'string', 'integer'), 'format' => 'date-time'), 'Days' => array('type' => 'numeric'))), 'ID' => array('type' => 'string'), 'Prefix' => array('required' => \true, 'type' => 'string'), 'Status' => array('required' => \true, 'type' => 'string'), 'Transition' => array('type' => 'object', 'properties' => array('Date' => array('type' => array('object', 'string', 'integer'), 'format' => 'date-time'), 'Days' => array('type' => 'numeric'), 'StorageClass' => array('type' => 'string'))), 'NoncurrentVersionTransition' => array('type' => 'object', 'properties' => array('NoncurrentDays' => array('type' => 'numeric'), 'StorageClass' => array('type' => 'string'))), 'NoncurrentVersionExpiration' => array('type' => 'object', 'properties' => array('NoncurrentDays' => array('type' => 'numeric')))))))), 'PutBucketLifecycleConfiguration' => array('httpMethod' => 'PUT', 'uri' => '/{Bucket}?lifecycle', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'PutBucketLifecycleConfigurationOutput', 'responseType' => 'model', 'data' => array('xmlRoot' => array('name' => 'LifecycleConfiguration', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/'))), 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'Rules' => array('required' => \true, 'type' => 'array', 'location' => 'xml', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'LifecycleRule', 'type' => 'object', 'sentAs' => 'Rule', 'properties' => array('Expiration' => array('type' => 'object', 'properties' => array('Date' => array('type' => array('object', 'string', 'integer'), 'format' => 'date-time-http'), 'Days' => array('type' => 'numeric'))), 'ID' => array('type' => 'string'), 'Prefix' => array('required' => \true, 'type' => 'string'), 'Status' => array('required' => \true, 'type' => 'string'), 'Transitions' => array('type' => 'array', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'Transition', 'type' => 'object', 'sentAs' => 'Transition', 'properties' => array('Date' => array('type' => array('object', 'string', 'integer'), 'format' => 'date-time-http'), 'Days' => array('type' => 'numeric'), 'StorageClass' => array('type' => 'string')))), 'NoncurrentVersionTransitions' => array('type' => 'array', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'NoncurrentVersionTransition', 'type' => 'object', 'sentAs' => 'NoncurrentVersionTransition', 'properties' => array('NoncurrentDays' => array('type' => 'numeric'), 'StorageClass' => array('type' => 'string')))), 'NoncurrentVersionExpiration' => array('type' => 'object', 'properties' => array('NoncurrentDays' => array('type' => 'numeric')))))))), 'PutBucketLogging' => array('httpMethod' => 'PUT', 'uri' => '/{Bucket}?logging', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'PutBucketLoggingOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlogging.html', 'data' => array('xmlRoot' => array('name' => 'BucketLoggingStatus', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/')), 'xmlAllowEmpty' => \true), 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'LoggingEnabled' => array('type' => 'object', 'location' => 'xml', 'properties' => array('TargetBucket' => array('type' => 'string'), 'TargetGrants' => array('type' => 'array', 'items' => array('name' => 'Grant', 'type' => 'object', 'properties' => array('Grantee' => array('type' => 'object', 'properties' => array('DisplayName' => array('type' => 'string'), 'EmailAddress' => array('type' => 'string'), 'ID' => array('type' => 'string'), 'Type' => array('required' => \true, 'type' => 'string', 'sentAs' => 'xsi:type', 'data' => array('xmlAttribute' => \true, 'xmlNamespace' => 'http://www.w3.org/2001/XMLSchema-instance')), 'URI' => array('type' => 'string'))), 'Permission' => array('type' => 'string')))), 'TargetPrefix' => array('type' => 'string'))))), 'PutBucketNotification' => array('httpMethod' => 'PUT', 'uri' => '/{Bucket}?notification', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'PutBucketNotificationOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTnotification.html', 'data' => array('xmlRoot' => array('name' => 'NotificationConfiguration', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/')), 'xmlAllowEmpty' => \true), 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'TopicConfiguration' => array('type' => 'object', 'location' => 'xml', 'properties' => array('Id' => array('type' => 'string'), 'Events' => array('type' => 'array', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'Event', 'type' => 'string')), 'Event' => array('type' => 'string'), 'Topic' => array('type' => 'string'))), 'QueueConfiguration' => array('type' => 'object', 'location' => 'xml', 'properties' => array('Id' => array('type' => 'string'), 'Event' => array('type' => 'string'), 'Events' => array('type' => 'array', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'Event', 'type' => 'string')), 'Queue' => array('type' => 'string'))), 'CloudFunctionConfiguration' => array('type' => 'object', 'location' => 'xml', 'properties' => array('Id' => array('type' => 'string'), 'Event' => array('type' => 'string'), 'Events' => array('type' => 'array', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'Event', 'type' => 'string')), 'CloudFunction' => array('type' => 'string'), 'InvocationRole' => array('type' => 'string'))))), 'PutBucketNotificationConfiguration' => array('httpMethod' => 'PUT', 'uri' => '/{Bucket}?notification', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'PutBucketNotificationConfigurationOutput', 'responseType' => 'model', 'data' => array('xmlRoot' => array('name' => 'NotificationConfiguration', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/'))), 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'TopicConfigurations' => array('type' => 'array', 'location' => 'xml', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'TopicConfiguration', 'type' => 'object', 'sentAs' => 'TopicConfiguration', 'properties' => array('Id' => array('type' => 'string'), 'TopicArn' => array('required' => \true, 'type' => 'string', 'sentAs' => 'Topic'), 'Events' => array('required' => \true, 'type' => 'array', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'Event', 'type' => 'string', 'sentAs' => 'Event')), 'Filter' => array('type' => 'object', 'properties' => array('Key' => array('type' => 'object', 'sentAs' => 'S3Key', 'properties' => array('FilterRules' => array('type' => 'array', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'FilterRule', 'type' => 'object', 'sentAs' => 'FilterRule', 'properties' => array('Name' => array('type' => 'string'), 'Value' => array('type' => 'string'))))))))))), 'QueueConfigurations' => array('type' => 'array', 'location' => 'xml', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'QueueConfiguration', 'type' => 'object', 'sentAs' => 'QueueConfiguration', 'properties' => array('Id' => array('type' => 'string'), 'QueueArn' => array('required' => \true, 'type' => 'string', 'sentAs' => 'Queue'), 'Events' => array('required' => \true, 'type' => 'array', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'Event', 'type' => 'string', 'sentAs' => 'Event')), 'Filter' => array('type' => 'object', 'properties' => array('Key' => array('type' => 'object', 'sentAs' => 'S3Key', 'properties' => array('FilterRules' => array('type' => 'array', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'FilterRule', 'type' => 'object', 'sentAs' => 'FilterRule', 'properties' => array('Name' => array('type' => 'string'), 'Value' => array('type' => 'string'))))))))))), 'LambdaFunctionConfigurations' => array('type' => 'array', 'location' => 'xml', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'LambdaFunctionConfiguration', 'type' => 'object', 'sentAs' => 'CloudFunctionConfiguration', 'properties' => array('Id' => array('type' => 'string'), 'LambdaFunctionArn' => array('required' => \true, 'type' => 'string', 'sentAs' => 'CloudFunction'), 'Events' => array('required' => \true, 'type' => 'array', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'Event', 'type' => 'string', 'sentAs' => 'Event')), 'Filter' => array('type' => 'object', 'properties' => array('Key' => array('type' => 'object', 'sentAs' => 'S3Key', 'properties' => array('FilterRules' => array('type' => 'array', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'FilterRule', 'type' => 'object', 'sentAs' => 'FilterRule', 'properties' => array('Name' => array('type' => 'string'), 'Value' => array('type' => 'string'))))))))))))), 'PutBucketPolicy' => array('httpMethod' => 'PUT', 'uri' => '/{Bucket}?policy', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'PutBucketPolicyOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTpolicy.html', 'data' => array('xmlRoot' => array('name' => 'PutBucketPolicyRequest', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/'))), 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'Policy' => array('required' => \true, 'type' => array('string', 'object'), 'location' => 'body'))), 'PutBucketReplication' => array('httpMethod' => 'PUT', 'uri' => '/{Bucket}?replication', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'PutBucketReplicationOutput', 'responseType' => 'model', 'data' => array('xmlRoot' => array('name' => 'ReplicationConfiguration', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/'))), 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'Role' => array('required' => \true, 'type' => 'string', 'location' => 'xml'), 'Rules' => array('required' => \true, 'type' => 'array', 'location' => 'xml', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'ReplicationRule', 'type' => 'object', 'sentAs' => 'Rule', 'properties' => array('ID' => array('type' => 'string'), 'Prefix' => array('required' => \true, 'type' => 'string'), 'Status' => array('required' => \true, 'type' => 'string'), 'Destination' => array('required' => \true, 'type' => 'object', 'properties' => array('Bucket' => array('required' => \true, 'type' => 'string'), 'StorageClass' => array('type' => 'string')))))))), 'PutBucketRequestPayment' => array('httpMethod' => 'PUT', 'uri' => '/{Bucket}?requestPayment', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'PutBucketRequestPaymentOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTrequestPaymentPUT.html', 'data' => array('xmlRoot' => array('name' => 'RequestPaymentConfiguration', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/'))), 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'Payer' => array('required' => \true, 'type' => 'string', 'location' => 'xml'))), 'PutBucketTagging' => array('httpMethod' => 'PUT', 'uri' => '/{Bucket}?tagging', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'PutBucketTaggingOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTtagging.html', 'data' => array('xmlRoot' => array('name' => 'Tagging', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/')), 'contentMd5' => \true), 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'TagSet' => array('required' => \true, 'type' => 'array', 'location' => 'xml', 'items' => array('name' => 'Tag', 'type' => 'object', 'properties' => array('Key' => array('required' => \true, 'type' => 'string', 'minLength' => 1), 'Value' => array('required' => \true, 'type' => 'string')))))), 'PutBucketVersioning' => array('httpMethod' => 'PUT', 'uri' => '/{Bucket}?versioning', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'PutBucketVersioningOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTVersioningStatus.html', 'data' => array('xmlRoot' => array('name' => 'VersioningConfiguration', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/'))), 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'MFA' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-mfa'), 'MFADelete' => array('type' => 'string', 'location' => 'xml', 'sentAs' => 'MfaDelete'), 'Status' => array('type' => 'string', 'location' => 'xml'))), 'PutBucketWebsite' => array('httpMethod' => 'PUT', 'uri' => '/{Bucket}?website', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'PutBucketWebsiteOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTwebsite.html', 'data' => array('xmlRoot' => array('name' => 'WebsiteConfiguration', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/')), 'xmlAllowEmpty' => \true), 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'ErrorDocument' => array('type' => 'object', 'location' => 'xml', 'properties' => array('Key' => array('required' => \true, 'type' => 'string', 'minLength' => 1))), 'IndexDocument' => array('type' => 'object', 'location' => 'xml', 'properties' => array('Suffix' => array('required' => \true, 'type' => 'string'))), 'RedirectAllRequestsTo' => array('type' => 'object', 'location' => 'xml', 'properties' => array('HostName' => array('required' => \true, 'type' => 'string'), 'Protocol' => array('type' => 'string'))), 'RoutingRules' => array('type' => 'array', 'location' => 'xml', 'items' => array('name' => 'RoutingRule', 'type' => 'object', 'properties' => array('Condition' => array('type' => 'object', 'properties' => array('HttpErrorCodeReturnedEquals' => array('type' => 'string'), 'KeyPrefixEquals' => array('type' => 'string'))), 'Redirect' => array('required' => \true, 'type' => 'object', 'properties' => array('HostName' => array('type' => 'string'), 'HttpRedirectCode' => array('type' => 'string'), 'Protocol' => array('type' => 'string'), 'ReplaceKeyPrefixWith' => array('type' => 'string'), 'ReplaceKeyWith' => array('type' => 'string')))))))), 'PutObject' => array('httpMethod' => 'PUT', 'uri' => '/{Bucket}{/Key*}', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'PutObjectOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html', 'data' => array('xmlRoot' => array('name' => 'PutObjectRequest', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/'))), 'parameters' => array('ACL' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-acl'), 'Body' => array('type' => array('string', 'object'), 'location' => 'body'), 'Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'CacheControl' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Cache-Control'), 'ContentDisposition' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Disposition'), 'ContentEncoding' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Encoding'), 'ContentLanguage' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Language'), 'ContentLength' => array('type' => 'numeric', 'location' => 'header', 'sentAs' => 'Content-Length'), 'ContentMD5' => array('type' => array('string', 'boolean'), 'location' => 'header', 'sentAs' => 'Content-MD5'), 'ContentType' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Type'), 'Expires' => array('type' => array('object', 'string', 'integer'), 'format' => 'date-time-http', 'location' => 'header'), 'GrantFullControl' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-full-control'), 'GrantRead' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-read'), 'GrantReadACP' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-read-acp'), 'GrantWriteACP' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-write-acp'), 'Key' => array('required' => \true, 'type' => 'string', 'location' => 'uri', 'minLength' => 1, 'filters' => array('DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\S3Client::explodeKey')), 'Metadata' => array('type' => 'object', 'location' => 'header', 'sentAs' => 'x-amz-meta-', 'additionalProperties' => array('type' => 'string')), 'ServerSideEncryption' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption'), 'StorageClass' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-storage-class'), 'WebsiteRedirectLocation' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-website-redirect-location'), 'SSECustomerAlgorithm' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm'), 'SSECustomerKey' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-key'), 'SSECustomerKeyMD5' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5'), 'SSEKMSKeyId' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id'), 'RequestPayer' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-payer'), 'ACP' => array('type' => 'object', 'additionalProperties' => \true))), 'PutObjectAcl' => array('httpMethod' => 'PUT', 'uri' => '/{Bucket}{/Key*}?acl', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'PutObjectAclOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUTacl.html', 'data' => array('xmlRoot' => array('name' => 'AccessControlPolicy', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/'))), 'parameters' => array('ACL' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-acl'), 'Grants' => array('type' => 'array', 'location' => 'xml', 'sentAs' => 'AccessControlList', 'items' => array('name' => 'Grant', 'type' => 'object', 'properties' => array('Grantee' => array('type' => 'object', 'properties' => array('DisplayName' => array('type' => 'string'), 'EmailAddress' => array('type' => 'string'), 'ID' => array('type' => 'string'), 'Type' => array('required' => \true, 'type' => 'string', 'sentAs' => 'xsi:type', 'data' => array('xmlAttribute' => \true, 'xmlNamespace' => 'http://www.w3.org/2001/XMLSchema-instance')), 'URI' => array('type' => 'string'))), 'Permission' => array('type' => 'string')))), 'Owner' => array('type' => 'object', 'location' => 'xml', 'properties' => array('DisplayName' => array('type' => 'string'), 'ID' => array('type' => 'string'))), 'Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'GrantFullControl' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-full-control'), 'GrantRead' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-read'), 'GrantReadACP' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-read-acp'), 'GrantWrite' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-write'), 'GrantWriteACP' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-grant-write-acp'), 'Key' => array('required' => \true, 'type' => 'string', 'location' => 'uri', 'minLength' => 1, 'filters' => array('DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\S3Client::explodeKey')), 'RequestPayer' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-payer'), 'ACP' => array('type' => 'object', 'additionalProperties' => \true)), 'errorResponses' => array(array('reason' => 'The specified key does not exist.', 'class' => 'NoSuchKeyException'))), 'RestoreObject' => array('httpMethod' => 'POST', 'uri' => '/{Bucket}{/Key*}?restore', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'RestoreObjectOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectRestore.html', 'data' => array('xmlRoot' => array('name' => 'RestoreRequest', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/'))), 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'Key' => array('required' => \true, 'type' => 'string', 'location' => 'uri', 'minLength' => 1, 'filters' => array('DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\S3Client::explodeKey')), 'VersionId' => array('type' => 'string', 'location' => 'query', 'sentAs' => 'versionId'), 'Days' => array('required' => \true, 'type' => 'numeric', 'location' => 'xml'), 'RequestPayer' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-payer')), 'errorResponses' => array(array('reason' => 'This operation is not allowed against this storage tier', 'class' => 'ObjectAlreadyInActiveTierErrorException'))), 'UploadPart' => array('httpMethod' => 'PUT', 'uri' => '/{Bucket}{/Key*}', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'UploadPartOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadUploadPart.html', 'data' => array('xmlRoot' => array('name' => 'UploadPartRequest', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/'))), 'parameters' => array('Body' => array('type' => array('string', 'object'), 'location' => 'body'), 'Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'ContentLength' => array('type' => 'numeric', 'location' => 'header', 'sentAs' => 'Content-Length'), 'ContentMD5' => array('type' => array('string', 'boolean'), 'location' => 'header', 'sentAs' => 'Content-MD5'), 'Key' => array('required' => \true, 'type' => 'string', 'location' => 'uri', 'minLength' => 1, 'filters' => array('DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\S3Client::explodeKey')), 'PartNumber' => array('required' => \true, 'type' => 'numeric', 'location' => 'query', 'sentAs' => 'partNumber'), 'UploadId' => array('required' => \true, 'type' => 'string', 'location' => 'query', 'sentAs' => 'uploadId'), 'ServerSideEncryption' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption'), 'SSECustomerAlgorithm' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm'), 'SSECustomerKey' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-key'), 'SSECustomerKeyMD5' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5'), 'RequestPayer' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-payer'))), 'UploadPartCopy' => array('httpMethod' => 'PUT', 'uri' => '/{Bucket}{/Key*}', 'class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\Command\\S3Command', 'responseClass' => 'UploadPartCopyOutput', 'responseType' => 'model', 'documentationUrl' => 'http://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadUploadPartCopy.html', 'data' => array('xmlRoot' => array('name' => 'UploadPartCopyRequest', 'namespaces' => array('http://s3.amazonaws.com/doc/2006-03-01/'))), 'parameters' => array('Bucket' => array('required' => \true, 'type' => 'string', 'location' => 'uri'), 'CopySource' => array('required' => \true, 'type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-copy-source'), 'CopySourceIfMatch' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-copy-source-if-match'), 'CopySourceIfModifiedSince' => array('type' => array('object', 'string', 'integer'), 'format' => 'date-time-http', 'location' => 'header', 'sentAs' => 'x-amz-copy-source-if-modified-since'), 'CopySourceIfNoneMatch' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-copy-source-if-none-match'), 'CopySourceIfUnmodifiedSince' => array('type' => array('object', 'string', 'integer'), 'format' => 'date-time-http', 'location' => 'header', 'sentAs' => 'x-amz-copy-source-if-unmodified-since'), 'CopySourceRange' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-copy-source-range'), 'Key' => array('required' => \true, 'type' => 'string', 'location' => 'uri', 'minLength' => 1, 'filters' => array('DeliciousBrains\\WP_Offload_S3\\Aws2\\Aws\\S3\\S3Client::explodeKey')), 'PartNumber' => array('required' => \true, 'type' => 'numeric', 'location' => 'query', 'sentAs' => 'partNumber'), 'UploadId' => array('required' => \true, 'type' => 'string', 'location' => 'query', 'sentAs' => 'uploadId'), 'SSECustomerAlgorithm' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm'), 'SSECustomerKey' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-key'), 'SSECustomerKeyMD5' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5'), 'CopySourceSSECustomerAlgorithm' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-copy-source-server-side-encryption-customer-algorithm'), 'CopySourceSSECustomerKey' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-copy-source-server-side-encryption-customer-key'), 'CopySourceSSECustomerKeyMD5' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-copy-source-server-side-encryption-customer-key-MD5'), 'RequestPayer' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-payer'), 'command.expects' => array('static' => \true, 'default' => 'application/xml')))), 'models' => array('AbortMultipartUploadOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestCharged' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-charged'), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'CompleteMultipartUploadOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('Location' => array('type' => 'string', 'location' => 'xml'), 'Bucket' => array('type' => 'string', 'location' => 'xml'), 'Key' => array('type' => 'string', 'location' => 'xml'), 'Expiration' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-expiration'), 'ETag' => array('type' => 'string', 'location' => 'xml'), 'ServerSideEncryption' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption'), 'VersionId' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-version-id'), 'SSEKMSKeyId' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id'), 'RequestCharged' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-charged'), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'CopyObjectOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('ETag' => array('type' => 'string', 'location' => 'xml'), 'LastModified' => array('type' => 'string', 'location' => 'xml'), 'Expiration' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-expiration'), 'CopySourceVersionId' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-copy-source-version-id'), 'VersionId' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-version-id'), 'ServerSideEncryption' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption'), 'SSECustomerAlgorithm' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm'), 'SSECustomerKeyMD5' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5'), 'SSEKMSKeyId' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id'), 'RequestCharged' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-charged'), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'CreateBucketOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('Location' => array('type' => 'string', 'location' => 'header'), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'CreateMultipartUploadOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('Bucket' => array('type' => 'string', 'location' => 'xml', 'sentAs' => 'Bucket'), 'Key' => array('type' => 'string', 'location' => 'xml'), 'UploadId' => array('type' => 'string', 'location' => 'xml'), 'ServerSideEncryption' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption'), 'SSECustomerAlgorithm' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm'), 'SSECustomerKeyMD5' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5'), 'SSEKMSKeyId' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id'), 'RequestCharged' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-charged'), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'DeleteBucketOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'DeleteBucketCorsOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'DeleteBucketLifecycleOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'DeleteBucketPolicyOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'DeleteBucketReplicationOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'DeleteBucketTaggingOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'DeleteBucketWebsiteOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'DeleteObjectOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('DeleteMarker' => array('type' => 'boolean', 'location' => 'header', 'sentAs' => 'x-amz-delete-marker'), 'VersionId' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-version-id'), 'RequestCharged' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-charged'), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'DeleteObjectsOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('Deleted' => array('type' => 'array', 'location' => 'xml', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'DeletedObject', 'type' => 'object', 'properties' => array('Key' => array('type' => 'string'), 'VersionId' => array('type' => 'string'), 'DeleteMarker' => array('type' => 'boolean'), 'DeleteMarkerVersionId' => array('type' => 'string')))), 'RequestCharged' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-charged'), 'Errors' => array('type' => 'array', 'location' => 'xml', 'sentAs' => 'Error', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'Error', 'type' => 'object', 'sentAs' => 'Error', 'properties' => array('Key' => array('type' => 'string'), 'VersionId' => array('type' => 'string'), 'Code' => array('type' => 'string'), 'Message' => array('type' => 'string')))), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'GetBucketAclOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('Owner' => array('type' => 'object', 'location' => 'xml', 'properties' => array('DisplayName' => array('type' => 'string'), 'ID' => array('type' => 'string'))), 'Grants' => array('type' => 'array', 'location' => 'xml', 'sentAs' => 'AccessControlList', 'items' => array('name' => 'Grant', 'type' => 'object', 'sentAs' => 'Grant', 'properties' => array('Grantee' => array('type' => 'object', 'properties' => array('DisplayName' => array('type' => 'string'), 'EmailAddress' => array('type' => 'string'), 'ID' => array('type' => 'string'), 'Type' => array('type' => 'string', 'sentAs' => 'xsi:type', 'data' => array('xmlAttribute' => \true, 'xmlNamespace' => 'http://www.w3.org/2001/XMLSchema-instance')), 'URI' => array('type' => 'string'))), 'Permission' => array('type' => 'string')))), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'GetBucketCorsOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('CORSRules' => array('type' => 'array', 'location' => 'xml', 'sentAs' => 'CORSRule', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'CORSRule', 'type' => 'object', 'sentAs' => 'CORSRule', 'properties' => array('AllowedHeaders' => array('type' => 'array', 'sentAs' => 'AllowedHeader', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'AllowedHeader', 'type' => 'string', 'sentAs' => 'AllowedHeader')), 'AllowedMethods' => array('type' => 'array', 'sentAs' => 'AllowedMethod', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'AllowedMethod', 'type' => 'string', 'sentAs' => 'AllowedMethod')), 'AllowedOrigins' => array('type' => 'array', 'sentAs' => 'AllowedOrigin', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'AllowedOrigin', 'type' => 'string', 'sentAs' => 'AllowedOrigin')), 'ExposeHeaders' => array('type' => 'array', 'sentAs' => 'ExposeHeader', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'ExposeHeader', 'type' => 'string', 'sentAs' => 'ExposeHeader')), 'MaxAgeSeconds' => array('type' => 'numeric')))), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'GetBucketLifecycleOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('Rules' => array('type' => 'array', 'location' => 'xml', 'sentAs' => 'Rule', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'Rule', 'type' => 'object', 'sentAs' => 'Rule', 'properties' => array('Expiration' => array('type' => 'object', 'properties' => array('Date' => array('type' => 'string'), 'Days' => array('type' => 'numeric'))), 'ID' => array('type' => 'string'), 'Prefix' => array('type' => 'string'), 'Status' => array('type' => 'string'), 'Transition' => array('type' => 'object', 'properties' => array('Date' => array('type' => 'string'), 'Days' => array('type' => 'numeric'), 'StorageClass' => array('type' => 'string'))), 'NoncurrentVersionTransition' => array('type' => 'object', 'properties' => array('NoncurrentDays' => array('type' => 'numeric'), 'StorageClass' => array('type' => 'string'))), 'NoncurrentVersionExpiration' => array('type' => 'object', 'properties' => array('NoncurrentDays' => array('type' => 'numeric')))))), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'GetBucketLifecycleConfigurationOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('Rules' => array('type' => 'array', 'location' => 'xml', 'sentAs' => 'Rule', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'LifecycleRule', 'type' => 'object', 'sentAs' => 'Rule', 'properties' => array('Expiration' => array('type' => 'object', 'properties' => array('Date' => array('type' => 'string'), 'Days' => array('type' => 'numeric'))), 'ID' => array('type' => 'string'), 'Prefix' => array('type' => 'string'), 'Status' => array('type' => 'string'), 'Transitions' => array('type' => 'array', 'sentAs' => 'Transition', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'Transition', 'type' => 'object', 'sentAs' => 'Transition', 'properties' => array('Date' => array('type' => 'string'), 'Days' => array('type' => 'numeric'), 'StorageClass' => array('type' => 'string')))), 'NoncurrentVersionTransitions' => array('type' => 'array', 'sentAs' => 'NoncurrentVersionTransition', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'NoncurrentVersionTransition', 'type' => 'object', 'sentAs' => 'NoncurrentVersionTransition', 'properties' => array('NoncurrentDays' => array('type' => 'numeric'), 'StorageClass' => array('type' => 'string')))), 'NoncurrentVersionExpiration' => array('type' => 'object', 'properties' => array('NoncurrentDays' => array('type' => 'numeric')))))), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'GetBucketLocationOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('Location' => array('type' => 'string', 'location' => 'body', 'filters' => array('strval', 'strip_tags', 'trim')))), 'GetBucketLoggingOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('LoggingEnabled' => array('type' => 'object', 'location' => 'xml', 'properties' => array('TargetBucket' => array('type' => 'string'), 'TargetGrants' => array('type' => 'array', 'items' => array('name' => 'Grant', 'type' => 'object', 'sentAs' => 'Grant', 'properties' => array('Grantee' => array('type' => 'object', 'properties' => array('DisplayName' => array('type' => 'string'), 'EmailAddress' => array('type' => 'string'), 'ID' => array('type' => 'string'), 'Type' => array('type' => 'string', 'sentAs' => 'xsi:type', 'data' => array('xmlAttribute' => \true, 'xmlNamespace' => 'http://www.w3.org/2001/XMLSchema-instance')), 'URI' => array('type' => 'string'))), 'Permission' => array('type' => 'string')))), 'TargetPrefix' => array('type' => 'string'))), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'NotificationConfigurationDeprecated' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('TopicConfiguration' => array('type' => 'object', 'location' => 'xml', 'properties' => array('Id' => array('type' => 'string'), 'Events' => array('type' => 'array', 'sentAs' => 'Event', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'Event', 'type' => 'string', 'sentAs' => 'Event')), 'Event' => array('type' => 'string'), 'Topic' => array('type' => 'string'))), 'QueueConfiguration' => array('type' => 'object', 'location' => 'xml', 'properties' => array('Id' => array('type' => 'string'), 'Event' => array('type' => 'string'), 'Events' => array('type' => 'array', 'sentAs' => 'Event', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'Event', 'type' => 'string', 'sentAs' => 'Event')), 'Queue' => array('type' => 'string'))), 'CloudFunctionConfiguration' => array('type' => 'object', 'location' => 'xml', 'properties' => array('Id' => array('type' => 'string'), 'Event' => array('type' => 'string'), 'Events' => array('type' => 'array', 'sentAs' => 'Event', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'Event', 'type' => 'string', 'sentAs' => 'Event')), 'CloudFunction' => array('type' => 'string'), 'InvocationRole' => array('type' => 'string'))), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'NotificationConfiguration' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('TopicConfigurations' => array('type' => 'array', 'location' => 'xml', 'sentAs' => 'TopicConfiguration', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'TopicConfiguration', 'type' => 'object', 'sentAs' => 'TopicConfiguration', 'properties' => array('Id' => array('type' => 'string'), 'TopicArn' => array('type' => 'string', 'sentAs' => 'Topic'), 'Events' => array('type' => 'array', 'sentAs' => 'Event', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'Event', 'type' => 'string', 'sentAs' => 'Event')), 'Filter' => array('type' => 'object', 'properties' => array('Key' => array('type' => 'object', 'sentAs' => 'S3Key', 'properties' => array('FilterRules' => array('type' => 'array', 'sentAs' => 'FilterRule', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'FilterRule', 'type' => 'object', 'sentAs' => 'FilterRule', 'properties' => array('Name' => array('type' => 'string'), 'Value' => array('type' => 'string'))))))))))), 'QueueConfigurations' => array('type' => 'array', 'location' => 'xml', 'sentAs' => 'QueueConfiguration', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'QueueConfiguration', 'type' => 'object', 'sentAs' => 'QueueConfiguration', 'properties' => array('Id' => array('type' => 'string'), 'QueueArn' => array('type' => 'string', 'sentAs' => 'Queue'), 'Events' => array('type' => 'array', 'sentAs' => 'Event', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'Event', 'type' => 'string', 'sentAs' => 'Event')), 'Filter' => array('type' => 'object', 'properties' => array('Key' => array('type' => 'object', 'sentAs' => 'S3Key', 'properties' => array('FilterRules' => array('type' => 'array', 'sentAs' => 'FilterRule', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'FilterRule', 'type' => 'object', 'sentAs' => 'FilterRule', 'properties' => array('Name' => array('type' => 'string'), 'Value' => array('type' => 'string'))))))))))), 'LambdaFunctionConfigurations' => array('type' => 'array', 'location' => 'xml', 'sentAs' => 'CloudFunctionConfiguration', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'LambdaFunctionConfiguration', 'type' => 'object', 'sentAs' => 'CloudFunctionConfiguration', 'properties' => array('Id' => array('type' => 'string'), 'LambdaFunctionArn' => array('type' => 'string', 'sentAs' => 'CloudFunction'), 'Events' => array('type' => 'array', 'sentAs' => 'Event', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'Event', 'type' => 'string', 'sentAs' => 'Event')), 'Filter' => array('type' => 'object', 'properties' => array('Key' => array('type' => 'object', 'sentAs' => 'S3Key', 'properties' => array('FilterRules' => array('type' => 'array', 'sentAs' => 'FilterRule', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'FilterRule', 'type' => 'object', 'sentAs' => 'FilterRule', 'properties' => array('Name' => array('type' => 'string'), 'Value' => array('type' => 'string'))))))))))), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'GetBucketPolicyOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('Policy' => array('type' => 'string', 'instanceOf' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Guzzle\\Http\\EntityBody', 'location' => 'body'), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'GetBucketReplicationOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('Role' => array('type' => 'string', 'location' => 'xml'), 'Rules' => array('type' => 'array', 'location' => 'xml', 'sentAs' => 'Rule', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'ReplicationRule', 'type' => 'object', 'sentAs' => 'Rule', 'properties' => array('ID' => array('type' => 'string'), 'Prefix' => array('type' => 'string'), 'Status' => array('type' => 'string'), 'Destination' => array('type' => 'object', 'properties' => array('Bucket' => array('type' => 'string'), 'StorageClass' => array('type' => 'string')))))), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'GetBucketRequestPaymentOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('Payer' => array('type' => 'string', 'location' => 'xml'), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'GetBucketTaggingOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('TagSet' => array('type' => 'array', 'location' => 'xml', 'items' => array('name' => 'Tag', 'type' => 'object', 'sentAs' => 'Tag', 'properties' => array('Key' => array('type' => 'string'), 'Value' => array('type' => 'string')))), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'GetBucketVersioningOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('Status' => array('type' => 'string', 'location' => 'xml'), 'MFADelete' => array('type' => 'string', 'location' => 'xml', 'sentAs' => 'MfaDelete'), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'GetBucketWebsiteOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RedirectAllRequestsTo' => array('type' => 'object', 'location' => 'xml', 'properties' => array('HostName' => array('type' => 'string'), 'Protocol' => array('type' => 'string'))), 'IndexDocument' => array('type' => 'object', 'location' => 'xml', 'properties' => array('Suffix' => array('type' => 'string'))), 'ErrorDocument' => array('type' => 'object', 'location' => 'xml', 'properties' => array('Key' => array('type' => 'string'))), 'RoutingRules' => array('type' => 'array', 'location' => 'xml', 'items' => array('name' => 'RoutingRule', 'type' => 'object', 'sentAs' => 'RoutingRule', 'properties' => array('Condition' => array('type' => 'object', 'properties' => array('HttpErrorCodeReturnedEquals' => array('type' => 'string'), 'KeyPrefixEquals' => array('type' => 'string'))), 'Redirect' => array('type' => 'object', 'properties' => array('HostName' => array('type' => 'string'), 'HttpRedirectCode' => array('type' => 'string'), 'Protocol' => array('type' => 'string'), 'ReplaceKeyPrefixWith' => array('type' => 'string'), 'ReplaceKeyWith' => array('type' => 'string')))))), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'GetObjectOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('Body' => array('type' => 'string', 'instanceOf' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Guzzle\\Http\\EntityBody', 'location' => 'body'), 'DeleteMarker' => array('type' => 'boolean', 'location' => 'header', 'sentAs' => 'x-amz-delete-marker'), 'AcceptRanges' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'accept-ranges'), 'Expiration' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-expiration'), 'Restore' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-restore'), 'LastModified' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Last-Modified'), 'ContentLength' => array('type' => 'numeric', 'location' => 'header', 'sentAs' => 'Content-Length'), 'ETag' => array('type' => 'string', 'location' => 'header'), 'MissingMeta' => array('type' => 'numeric', 'location' => 'header', 'sentAs' => 'x-amz-missing-meta'), 'VersionId' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-version-id'), 'CacheControl' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Cache-Control'), 'ContentDisposition' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Disposition'), 'ContentEncoding' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Encoding'), 'ContentLanguage' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Language'), 'ContentRange' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Range'), 'ContentType' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Type'), 'Expires' => array('type' => 'string', 'location' => 'header'), 'WebsiteRedirectLocation' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-website-redirect-location'), 'ServerSideEncryption' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption'), 'Metadata' => array('type' => 'object', 'location' => 'header', 'sentAs' => 'x-amz-meta-', 'additionalProperties' => array('type' => 'string')), 'SSECustomerAlgorithm' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm'), 'SSECustomerKeyMD5' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5'), 'SSEKMSKeyId' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id'), 'StorageClass' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-storage-class'), 'RequestCharged' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-charged'), 'ReplicationStatus' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-replication-status'), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'GetObjectAclOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('Owner' => array('type' => 'object', 'location' => 'xml', 'properties' => array('DisplayName' => array('type' => 'string'), 'ID' => array('type' => 'string'))), 'Grants' => array('type' => 'array', 'location' => 'xml', 'sentAs' => 'AccessControlList', 'items' => array('name' => 'Grant', 'type' => 'object', 'sentAs' => 'Grant', 'properties' => array('Grantee' => array('type' => 'object', 'properties' => array('DisplayName' => array('type' => 'string'), 'EmailAddress' => array('type' => 'string'), 'ID' => array('type' => 'string'), 'Type' => array('type' => 'string', 'sentAs' => 'xsi:type', 'data' => array('xmlAttribute' => \true, 'xmlNamespace' => 'http://www.w3.org/2001/XMLSchema-instance')), 'URI' => array('type' => 'string'))), 'Permission' => array('type' => 'string')))), 'RequestCharged' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-charged'), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'GetObjectTorrentOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('Body' => array('type' => 'string', 'instanceOf' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Guzzle\\Http\\EntityBody', 'location' => 'body'), 'RequestCharged' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-charged'), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'HeadBucketOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'HeadObjectOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('DeleteMarker' => array('type' => 'boolean', 'location' => 'header', 'sentAs' => 'x-amz-delete-marker'), 'AcceptRanges' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'accept-ranges'), 'Expiration' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-expiration'), 'Restore' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-restore'), 'LastModified' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Last-Modified'), 'ContentLength' => array('type' => 'numeric', 'location' => 'header', 'sentAs' => 'Content-Length'), 'ETag' => array('type' => 'string', 'location' => 'header'), 'MissingMeta' => array('type' => 'numeric', 'location' => 'header', 'sentAs' => 'x-amz-missing-meta'), 'VersionId' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-version-id'), 'CacheControl' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Cache-Control'), 'ContentDisposition' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Disposition'), 'ContentEncoding' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Encoding'), 'ContentLanguage' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Language'), 'ContentType' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Type'), 'Expires' => array('type' => 'string', 'location' => 'header'), 'WebsiteRedirectLocation' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-website-redirect-location'), 'ServerSideEncryption' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption'), 'Metadata' => array('type' => 'object', 'location' => 'header', 'sentAs' => 'x-amz-meta-', 'additionalProperties' => array('type' => 'string')), 'SSECustomerAlgorithm' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm'), 'SSECustomerKeyMD5' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5'), 'SSEKMSKeyId' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id'), 'StorageClass' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-storage-class'), 'RequestCharged' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-charged'), 'ReplicationStatus' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-replication-status'), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'ListBucketsOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('Buckets' => array('type' => 'array', 'location' => 'xml', 'items' => array('name' => 'Bucket', 'type' => 'object', 'sentAs' => 'Bucket', 'properties' => array('Name' => array('type' => 'string'), 'CreationDate' => array('type' => 'string')))), 'Owner' => array('type' => 'object', 'location' => 'xml', 'properties' => array('DisplayName' => array('type' => 'string'), 'ID' => array('type' => 'string'))), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'ListMultipartUploadsOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('Bucket' => array('type' => 'string', 'location' => 'xml'), 'KeyMarker' => array('type' => 'string', 'location' => 'xml'), 'UploadIdMarker' => array('type' => 'string', 'location' => 'xml'), 'NextKeyMarker' => array('type' => 'string', 'location' => 'xml'), 'Prefix' => array('type' => 'string', 'location' => 'xml'), 'Delimiter' => array('type' => 'string', 'location' => 'xml'), 'NextUploadIdMarker' => array('type' => 'string', 'location' => 'xml'), 'MaxUploads' => array('type' => 'numeric', 'location' => 'xml'), 'IsTruncated' => array('type' => 'boolean', 'location' => 'xml'), 'Uploads' => array('type' => 'array', 'location' => 'xml', 'sentAs' => 'Upload', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'MultipartUpload', 'type' => 'object', 'sentAs' => 'Upload', 'properties' => array('UploadId' => array('type' => 'string'), 'Key' => array('type' => 'string'), 'Initiated' => array('type' => 'string'), 'StorageClass' => array('type' => 'string'), 'Owner' => array('type' => 'object', 'properties' => array('DisplayName' => array('type' => 'string'), 'ID' => array('type' => 'string'))), 'Initiator' => array('type' => 'object', 'properties' => array('ID' => array('type' => 'string'), 'DisplayName' => array('type' => 'string')))))), 'CommonPrefixes' => array('type' => 'array', 'location' => 'xml', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'CommonPrefix', 'type' => 'object', 'properties' => array('Prefix' => array('type' => 'string')))), 'EncodingType' => array('type' => 'string', 'location' => 'xml'), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'ListObjectVersionsOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('IsTruncated' => array('type' => 'boolean', 'location' => 'xml'), 'KeyMarker' => array('type' => 'string', 'location' => 'xml'), 'VersionIdMarker' => array('type' => 'string', 'location' => 'xml'), 'NextKeyMarker' => array('type' => 'string', 'location' => 'xml'), 'NextVersionIdMarker' => array('type' => 'string', 'location' => 'xml'), 'Versions' => array('type' => 'array', 'location' => 'xml', 'sentAs' => 'Version', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'ObjectVersion', 'type' => 'object', 'sentAs' => 'Version', 'properties' => array('ETag' => array('type' => 'string'), 'Size' => array('type' => 'numeric'), 'StorageClass' => array('type' => 'string'), 'Key' => array('type' => 'string'), 'VersionId' => array('type' => 'string'), 'IsLatest' => array('type' => 'boolean'), 'LastModified' => array('type' => 'string'), 'Owner' => array('type' => 'object', 'properties' => array('DisplayName' => array('type' => 'string'), 'ID' => array('type' => 'string')))))), 'DeleteMarkers' => array('type' => 'array', 'location' => 'xml', 'sentAs' => 'DeleteMarker', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'DeleteMarkerEntry', 'type' => 'object', 'sentAs' => 'DeleteMarker', 'properties' => array('Owner' => array('type' => 'object', 'properties' => array('DisplayName' => array('type' => 'string'), 'ID' => array('type' => 'string'))), 'Key' => array('type' => 'string'), 'VersionId' => array('type' => 'string'), 'IsLatest' => array('type' => 'boolean'), 'LastModified' => array('type' => 'string')))), 'Name' => array('type' => 'string', 'location' => 'xml'), 'Prefix' => array('type' => 'string', 'location' => 'xml'), 'Delimiter' => array('type' => 'string', 'location' => 'xml'), 'MaxKeys' => array('type' => 'numeric', 'location' => 'xml'), 'CommonPrefixes' => array('type' => 'array', 'location' => 'xml', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'CommonPrefix', 'type' => 'object', 'properties' => array('Prefix' => array('type' => 'string')))), 'EncodingType' => array('type' => 'string', 'location' => 'xml'), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'ListObjectsOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('IsTruncated' => array('type' => 'boolean', 'location' => 'xml'), 'Marker' => array('type' => 'string', 'location' => 'xml'), 'NextMarker' => array('type' => 'string', 'location' => 'xml'), 'Contents' => array('type' => 'array', 'location' => 'xml', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'Object', 'type' => 'object', 'properties' => array('Key' => array('type' => 'string'), 'LastModified' => array('type' => 'string'), 'ETag' => array('type' => 'string'), 'Size' => array('type' => 'numeric'), 'StorageClass' => array('type' => 'string'), 'Owner' => array('type' => 'object', 'properties' => array('DisplayName' => array('type' => 'string'), 'ID' => array('type' => 'string')))))), 'Name' => array('type' => 'string', 'location' => 'xml'), 'Prefix' => array('type' => 'string', 'location' => 'xml'), 'Delimiter' => array('type' => 'string', 'location' => 'xml'), 'MaxKeys' => array('type' => 'numeric', 'location' => 'xml'), 'CommonPrefixes' => array('type' => 'array', 'location' => 'xml', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'CommonPrefix', 'type' => 'object', 'properties' => array('Prefix' => array('type' => 'string')))), 'EncodingType' => array('type' => 'string', 'location' => 'xml'), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'ListPartsOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('Bucket' => array('type' => 'string', 'location' => 'xml'), 'Key' => array('type' => 'string', 'location' => 'xml'), 'UploadId' => array('type' => 'string', 'location' => 'xml'), 'PartNumberMarker' => array('type' => 'numeric', 'location' => 'xml'), 'NextPartNumberMarker' => array('type' => 'numeric', 'location' => 'xml'), 'MaxParts' => array('type' => 'numeric', 'location' => 'xml'), 'IsTruncated' => array('type' => 'boolean', 'location' => 'xml'), 'Parts' => array('type' => 'array', 'location' => 'xml', 'sentAs' => 'Part', 'data' => array('xmlFlattened' => \true), 'items' => array('name' => 'Part', 'type' => 'object', 'sentAs' => 'Part', 'properties' => array('PartNumber' => array('type' => 'numeric'), 'LastModified' => array('type' => 'string'), 'ETag' => array('type' => 'string'), 'Size' => array('type' => 'numeric')))), 'Initiator' => array('type' => 'object', 'location' => 'xml', 'properties' => array('ID' => array('type' => 'string'), 'DisplayName' => array('type' => 'string'))), 'Owner' => array('type' => 'object', 'location' => 'xml', 'properties' => array('DisplayName' => array('type' => 'string'), 'ID' => array('type' => 'string'))), 'StorageClass' => array('type' => 'string', 'location' => 'xml'), 'RequestCharged' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-charged'), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'PutBucketAclOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'PutBucketCorsOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'PutBucketLifecycleOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'PutBucketLifecycleConfigurationOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'PutBucketLoggingOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'PutBucketNotificationOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'PutBucketNotificationConfigurationOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'PutBucketPolicyOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'PutBucketReplicationOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'PutBucketRequestPaymentOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'PutBucketTaggingOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'PutBucketVersioningOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'PutBucketWebsiteOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'PutObjectOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('Expiration' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-expiration'), 'ETag' => array('type' => 'string', 'location' => 'header'), 'ServerSideEncryption' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption'), 'VersionId' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-version-id'), 'SSECustomerAlgorithm' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm'), 'SSECustomerKeyMD5' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5'), 'SSEKMSKeyId' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id'), 'RequestCharged' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-charged'), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'), 'ObjectURL' => array())), 'PutObjectAclOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestCharged' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-charged'), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'RestoreObjectOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('RequestCharged' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-charged'), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'UploadPartOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('ServerSideEncryption' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption'), 'ETag' => array('type' => 'string', 'location' => 'header'), 'SSECustomerAlgorithm' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm'), 'SSECustomerKeyMD5' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5'), 'SSEKMSKeyId' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id'), 'RequestCharged' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-charged'), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id'))), 'UploadPartCopyOutput' => array('type' => 'object', 'additionalProperties' => \true, 'properties' => array('CopySourceVersionId' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-copy-source-version-id'), 'ETag' => array('type' => 'string', 'location' => 'xml'), 'LastModified' => array('type' => 'string', 'location' => 'xml'), 'ServerSideEncryption' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption'), 'SSECustomerAlgorithm' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-algorithm'), 'SSECustomerKeyMD5' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-customer-key-MD5'), 'SSEKMSKeyId' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-server-side-encryption-aws-kms-key-id'), 'RequestCharged' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-amz-request-charged'), 'RequestId' => array('location' => 'header', 'sentAs' => 'x-amz-request-id')))), 'iterators' => array('ListBuckets' => array('result_key' => 'Buckets'), 'ListMultipartUploads' => array('limit_key' => 'MaxUploads', 'more_results' => 'IsTruncated', 'output_token' => array('NextKeyMarker', 'NextUploadIdMarker'), 'input_token' => array('KeyMarker', 'UploadIdMarker'), 'result_key' => array('Uploads', 'CommonPrefixes')), 'ListObjectVersions' => array('more_results' => 'IsTruncated', 'limit_key' => 'MaxKeys', 'output_token' => array('NextKeyMarker', 'NextVersionIdMarker'), 'input_token' => array('KeyMarker', 'VersionIdMarker'), 'result_key' => array('Versions', 'DeleteMarkers', 'CommonPrefixes')), 'ListObjects' => array('more_results' => 'IsTruncated', 'limit_key' => 'MaxKeys', 'output_token' => 'NextMarker', 'input_token' => 'Marker', 'result_key' => array('Contents', 'CommonPrefixes')), 'ListParts' => array('more_results' => 'IsTruncated', 'limit_key' => 'MaxParts', 'output_token' => 'NextPartNumberMarker', 'input_token' => 'PartNumberMarker', 'result_key' => 'Parts')), 'waiters' => array('__default__' => array('interval' => 5, 'max_attempts' => 20), 'BucketExists' => array('operation' => 'HeadBucket', 'success.type' => 'output', 'ignore_errors' => array('NoSuchBucket')), 'BucketNotExists' => array('operation' => 'HeadBucket', 'success.type' => 'error', 'success.value' => 'NoSuchBucket'), 'ObjectExists' => array('operation' => 'HeadObject', 'success.type' => 'output', 'ignore_errors' => array('NoSuchKey')), 'ObjectNotExists' => array('operation' => 'HeadObject', 'success.type' => 'error', 'success.value' => 'NoSuchKey')));
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/ResumableDownload.php ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\UnexpectedValueException;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBody;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\ReadLimitEntityBody;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBodyInterface;
24
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\Model;
25
+ /**
26
+ * Allows you to resume the download of a partially downloaded object.
27
+ *
28
+ * Downloads objects from Amazon S3 in using "Range" downloads. This allows a partially downloaded object to be resumed
29
+ * so that only the remaining portion of the object is downloaded.
30
+ */
31
+ class ResumableDownload
32
+ {
33
+ /** @var S3Client The S3 client to use to download objects and issue HEAD requests */
34
+ protected $client;
35
+ /** @var Model Model object returned when the initial HeadObject operation was called */
36
+ protected $meta;
37
+ /** @var array Array of parameters to pass to a GetObject operation */
38
+ protected $params;
39
+ /** @var EntityBody Where the object will be downloaded */
40
+ protected $target;
41
+ /**
42
+ * @param S3Client $client Client to use when executing requests
43
+ * @param string $bucket Bucket that holds the object
44
+ * @param string $key Key of the object
45
+ * @param string|resource|EntityBodyInterface $target Where the object should be downloaded to. Pass a string to
46
+ * save the object to a file, pass a resource returned by
47
+ * fopen() to save the object to a stream resource, or pass a
48
+ * Guzzle EntityBody object to save the contents to an
49
+ * EntityBody.
50
+ * @param array $params Any additional GetObject or HeadObject parameters to use
51
+ * with each command issued by the client. (e.g. pass "Version"
52
+ * to download a specific version of an object)
53
+ * @throws RuntimeException if the target variable points to a file that cannot be opened
54
+ */
55
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\S3Client $client, $bucket, $key, $target, array $params = array())
56
+ {
57
+ $this->params = $params;
58
+ $this->client = $client;
59
+ $this->params['Bucket'] = $bucket;
60
+ $this->params['Key'] = $key;
61
+ // If a string is passed, then assume that the download should stream to a file on disk
62
+ if (is_string($target)) {
63
+ if (!($target = fopen($target, 'a+'))) {
64
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException("Unable to open {$target} for writing");
65
+ }
66
+ // Always append to the file
67
+ fseek($target, 0, SEEK_END);
68
+ }
69
+ // Get the metadata and Content-MD5 of the object
70
+ $this->target = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBody::factory($target);
71
+ }
72
+ /**
73
+ * Get the bucket of the download
74
+ *
75
+ * @return string
76
+ */
77
+ public function getBucket()
78
+ {
79
+ return $this->params['Bucket'];
80
+ }
81
+ /**
82
+ * Get the key of the download
83
+ *
84
+ * @return string
85
+ */
86
+ public function getKey()
87
+ {
88
+ return $this->params['Key'];
89
+ }
90
+ /**
91
+ * Get the file to which the contents are downloaded
92
+ *
93
+ * @return string
94
+ */
95
+ public function getFilename()
96
+ {
97
+ return $this->target->getUri();
98
+ }
99
+ /**
100
+ * Download the remainder of the object from Amazon S3
101
+ *
102
+ * Performs a message integrity check if possible
103
+ *
104
+ * @return Model
105
+ */
106
+ public function __invoke()
107
+ {
108
+ $command = $this->client->getCommand('HeadObject', $this->params);
109
+ $this->meta = $command->execute();
110
+ if ($this->target->ftell() >= $this->meta['ContentLength']) {
111
+ return false;
112
+ }
113
+ $this->meta['ContentMD5'] = (string) $command->getResponse()->getHeader('Content-MD5');
114
+ // Use a ReadLimitEntityBody so that rewinding the stream after an error does not cause the file pointer
115
+ // to enter an inconsistent state with the data being downloaded
116
+ $this->params['SaveAs'] = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\ReadLimitEntityBody($this->target, $this->meta['ContentLength'], $this->target->ftell());
117
+ $result = $this->getRemaining();
118
+ $this->checkIntegrity();
119
+ return $result;
120
+ }
121
+ /**
122
+ * Send the command to get the remainder of the object
123
+ *
124
+ * @return Model
125
+ */
126
+ protected function getRemaining()
127
+ {
128
+ $current = $this->target->ftell();
129
+ $targetByte = $this->meta['ContentLength'] - 1;
130
+ $this->params['Range'] = "bytes={$current}-{$targetByte}";
131
+ // Set the starting offset so that the body is never seeked to before this point in the event of a retry
132
+ $this->params['SaveAs']->setOffset($current);
133
+ $command = $this->client->getCommand('GetObject', $this->params);
134
+ return $command->execute();
135
+ }
136
+ /**
137
+ * Performs an MD5 message integrity check if possible
138
+ *
139
+ * @throws UnexpectedValueException if the message does not validate
140
+ */
141
+ protected function checkIntegrity()
142
+ {
143
+ if ($this->target->isReadable() && ($expected = $this->meta['ContentMD5'])) {
144
+ $actual = $this->target->getContentMd5();
145
+ if ($actual != $expected) {
146
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\UnexpectedValueException("Message integrity check failed. Expected {$expected} but got {$actual}.");
147
+ }
148
+ }
149
+ }
150
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/S3Client.php ADDED
@@ -0,0 +1,524 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AbstractClient;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\ClientBuilder;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\ExpiredCredentialsChecker;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\UploadBodyListener;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions as Options;
24
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException;
25
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException;
26
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureV4;
27
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\AbstractTransfer;
28
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\AccessDeniedException;
29
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\Parser\S3ExceptionParser;
30
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception;
31
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\ClearBucket;
32
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload\AbstractTransfer as AbstractMulti;
33
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload\UploadBuilder;
34
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\DownloadSyncBuilder;
35
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\UploadSyncBuilder;
36
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection;
37
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBody;
38
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
39
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Iterator\FilterIterator;
40
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffPlugin;
41
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\CurlBackoffStrategy;
42
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\ExponentialBackoffStrategy;
43
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\HttpBackoffStrategy;
44
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\TruncatedBackoffStrategy;
45
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface;
46
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\Factory\AliasFactory;
47
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\Factory\CompositeFactory;
48
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\Model;
49
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Resource\ResourceIteratorInterface;
50
+ /**
51
+ * Client to interact with Amazon Simple Storage Service
52
+ *
53
+ * @method S3SignatureInterface getSignature() Returns the signature implementation used with the client
54
+ * @method Model abortMultipartUpload(array $args = array()) {@command S3 AbortMultipartUpload}
55
+ * @method Model completeMultipartUpload(array $args = array()) {@command S3 CompleteMultipartUpload}
56
+ * @method Model copyObject(array $args = array()) {@command S3 CopyObject}
57
+ * @method Model createBucket(array $args = array()) {@command S3 CreateBucket}
58
+ * @method Model createMultipartUpload(array $args = array()) {@command S3 CreateMultipartUpload}
59
+ * @method Model deleteBucket(array $args = array()) {@command S3 DeleteBucket}
60
+ * @method Model deleteBucketCors(array $args = array()) {@command S3 DeleteBucketCors}
61
+ * @method Model deleteBucketLifecycle(array $args = array()) {@command S3 DeleteBucketLifecycle}
62
+ * @method Model deleteBucketPolicy(array $args = array()) {@command S3 DeleteBucketPolicy}
63
+ * @method Model deleteBucketReplication(array $args = array()) {@command S3 DeleteBucketReplication}
64
+ * @method Model deleteBucketTagging(array $args = array()) {@command S3 DeleteBucketTagging}
65
+ * @method Model deleteBucketWebsite(array $args = array()) {@command S3 DeleteBucketWebsite}
66
+ * @method Model deleteObject(array $args = array()) {@command S3 DeleteObject}
67
+ * @method Model deleteObjects(array $args = array()) {@command S3 DeleteObjects}
68
+ * @method Model getBucketAcl(array $args = array()) {@command S3 GetBucketAcl}
69
+ * @method Model getBucketCors(array $args = array()) {@command S3 GetBucketCors}
70
+ * @method Model getBucketLifecycle(array $args = array()) {@command S3 GetBucketLifecycle}
71
+ * @method Model getBucketLifecycleConfiguration(array $args = array()) {@command S3 GetBucketLifecycleConfiguration}
72
+ * @method Model getBucketLocation(array $args = array()) {@command S3 GetBucketLocation}
73
+ * @method Model getBucketLogging(array $args = array()) {@command S3 GetBucketLogging}
74
+ * @method Model getBucketNotification(array $args = array()) {@command S3 GetBucketNotification}
75
+ * @method Model getBucketNotificationConfiguration(array $args = array()) {@command S3 GetBucketNotificationConfiguration}
76
+ * @method Model getBucketPolicy(array $args = array()) {@command S3 GetBucketPolicy}
77
+ * @method Model getBucketReplication(array $args = array()) {@command S3 GetBucketReplication}
78
+ * @method Model getBucketRequestPayment(array $args = array()) {@command S3 GetBucketRequestPayment}
79
+ * @method Model getBucketTagging(array $args = array()) {@command S3 GetBucketTagging}
80
+ * @method Model getBucketVersioning(array $args = array()) {@command S3 GetBucketVersioning}
81
+ * @method Model getBucketWebsite(array $args = array()) {@command S3 GetBucketWebsite}
82
+ * @method Model getObject(array $args = array()) {@command S3 GetObject}
83
+ * @method Model getObjectAcl(array $args = array()) {@command S3 GetObjectAcl}
84
+ * @method Model getObjectTorrent(array $args = array()) {@command S3 GetObjectTorrent}
85
+ * @method Model headBucket(array $args = array()) {@command S3 HeadBucket}
86
+ * @method Model headObject(array $args = array()) {@command S3 HeadObject}
87
+ * @method Model listBuckets(array $args = array()) {@command S3 ListBuckets}
88
+ * @method Model listMultipartUploads(array $args = array()) {@command S3 ListMultipartUploads}
89
+ * @method Model listObjectVersions(array $args = array()) {@command S3 ListObjectVersions}
90
+ * @method Model listObjects(array $args = array()) {@command S3 ListObjects}
91
+ * @method Model listParts(array $args = array()) {@command S3 ListParts}
92
+ * @method Model putBucketAcl(array $args = array()) {@command S3 PutBucketAcl}
93
+ * @method Model putBucketCors(array $args = array()) {@command S3 PutBucketCors}
94
+ * @method Model putBucketLifecycle(array $args = array()) {@command S3 PutBucketLifecycle}
95
+ * @method Model putBucketLifecycleConfiguration(array $args = array()) {@command S3 PutBucketLifecycleConfiguration}
96
+ * @method Model putBucketLogging(array $args = array()) {@command S3 PutBucketLogging}
97
+ * @method Model putBucketNotification(array $args = array()) {@command S3 PutBucketNotification}
98
+ * @method Model putBucketNotificationConfiguration(array $args = array()) {@command S3 PutBucketNotificationConfiguration}
99
+ * @method Model putBucketPolicy(array $args = array()) {@command S3 PutBucketPolicy}
100
+ * @method Model putBucketReplication(array $args = array()) {@command S3 PutBucketReplication}
101
+ * @method Model putBucketRequestPayment(array $args = array()) {@command S3 PutBucketRequestPayment}
102
+ * @method Model putBucketTagging(array $args = array()) {@command S3 PutBucketTagging}
103
+ * @method Model putBucketVersioning(array $args = array()) {@command S3 PutBucketVersioning}
104
+ * @method Model putBucketWebsite(array $args = array()) {@command S3 PutBucketWebsite}
105
+ * @method Model putObject(array $args = array()) {@command S3 PutObject}
106
+ * @method Model putObjectAcl(array $args = array()) {@command S3 PutObjectAcl}
107
+ * @method Model restoreObject(array $args = array()) {@command S3 RestoreObject}
108
+ * @method Model uploadPart(array $args = array()) {@command S3 UploadPart}
109
+ * @method Model uploadPartCopy(array $args = array()) {@command S3 UploadPartCopy}
110
+ * @method waitUntilBucketExists(array $input) The input array uses the parameters of the HeadBucket operation and waiter specific settings
111
+ * @method waitUntilBucketNotExists(array $input) The input array uses the parameters of the HeadBucket operation and waiter specific settings
112
+ * @method waitUntilObjectExists(array $input) The input array uses the parameters of the HeadObject operation and waiter specific settings
113
+ * @method ResourceIteratorInterface getListBucketsIterator(array $args = array()) The input array uses the parameters of the ListBuckets operation
114
+ * @method ResourceIteratorInterface getListMultipartUploadsIterator(array $args = array()) The input array uses the parameters of the ListMultipartUploads operation
115
+ * @method ResourceIteratorInterface getListObjectVersionsIterator(array $args = array()) The input array uses the parameters of the ListObjectVersions operation
116
+ * @method ResourceIteratorInterface getListObjectsIterator(array $args = array()) The input array uses the parameters of the ListObjects operation
117
+ * @method ResourceIteratorInterface getListPartsIterator(array $args = array()) The input array uses the parameters of the ListParts operation
118
+ *
119
+ * @link http://docs.aws.amazon.com/aws-sdk-php/v2/guide/service-s3.html User guide
120
+ * @link http://docs.aws.amazon.com/aws-sdk-php/v2/api/class-Aws.S3.S3Client.html API docs
121
+ */
122
+ class S3Client extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\AbstractClient
123
+ {
124
+ const LATEST_API_VERSION = '2006-03-01';
125
+ /**
126
+ * @var array Aliases for S3 operations
127
+ */
128
+ protected static $commandAliases = array(
129
+ // REST API Docs Aliases
130
+ 'GetService' => 'ListBuckets',
131
+ 'GetBucket' => 'ListObjects',
132
+ 'PutBucket' => 'CreateBucket',
133
+ // SDK 1.x Aliases
134
+ 'GetBucketHeaders' => 'HeadBucket',
135
+ 'GetObjectHeaders' => 'HeadObject',
136
+ 'SetBucketAcl' => 'PutBucketAcl',
137
+ 'CreateObject' => 'PutObject',
138
+ 'DeleteObjects' => 'DeleteMultipleObjects',
139
+ 'PutObjectCopy' => 'CopyObject',
140
+ 'SetObjectAcl' => 'PutObjectAcl',
141
+ 'GetLogs' => 'GetBucketLogging',
142
+ 'GetVersioningStatus' => 'GetBucketVersioning',
143
+ 'SetBucketPolicy' => 'PutBucketPolicy',
144
+ 'CreateBucketNotification' => 'PutBucketNotification',
145
+ 'GetBucketNotifications' => 'GetBucketNotification',
146
+ 'CopyPart' => 'UploadPartCopy',
147
+ 'CreateWebsiteConfig' => 'PutBucketWebsite',
148
+ 'GetWebsiteConfig' => 'GetBucketWebsite',
149
+ 'DeleteWebsiteConfig' => 'DeleteBucketWebsite',
150
+ 'CreateObjectExpirationConfig' => 'PutBucketLifecycle',
151
+ 'GetObjectExpirationConfig' => 'GetBucketLifecycle',
152
+ 'DeleteObjectExpirationConfig' => 'DeleteBucketLifecycle',
153
+ );
154
+ protected $directory = __DIR__;
155
+ /**
156
+ * Factory method to create a new Amazon S3 client using an array of configuration options.
157
+ *
158
+ * @param array|Collection $config Client configuration data
159
+ *
160
+ * @return S3Client
161
+ * @link http://docs.aws.amazon.com/aws-sdk-php/v2/guide/configuration.html#client-configuration-options
162
+ */
163
+ public static function factory($config = array())
164
+ {
165
+ $exceptionParser = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\Parser\S3ExceptionParser();
166
+ // Configure the custom exponential backoff plugin for retrying S3 specific errors
167
+ if (!isset($config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BACKOFF])) {
168
+ $retries = isset($config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BACKOFF_RETRIES]) ? $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BACKOFF_RETRIES] : 3;
169
+ $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::BACKOFF] = static::createBackoffPlugin($exceptionParser, $retries);
170
+ }
171
+ $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SIGNATURE] = $signature = static::createSignature($config);
172
+ $client = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\ClientBuilder::factory(__NAMESPACE__)->setConfig($config)->setConfigDefaults(array(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::VERSION => self::LATEST_API_VERSION, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SERVICE_DESCRIPTION => __DIR__ . '/Resources/s3-%s.php'))->setExceptionParser($exceptionParser)->setIteratorsConfig(array('more_key' => 'IsTruncated', 'operations' => array('ListBuckets', 'ListMultipartUploads' => array('limit_param' => 'MaxUploads', 'token_param' => array('KeyMarker', 'UploadIdMarker'), 'token_key' => array('NextKeyMarker', 'NextUploadIdMarker')), 'ListObjects' => array('limit_param' => 'MaxKeys', 'token_param' => 'Marker', 'token_key' => 'NextMarker'), 'ListObjectVersions' => array('limit_param' => 'MaxKeys', 'token_param' => array('KeyMarker', 'VersionIdMarker'), 'token_key' => array('nextKeyMarker', 'nextVersionIdMarker')), 'ListParts' => array('limit_param' => 'MaxParts', 'result_key' => 'Parts', 'token_param' => 'PartNumberMarker', 'token_key' => 'NextPartNumberMarker'))))->build();
173
+ // Use virtual hosted buckets when possible
174
+ $client->addSubscriber(new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\BucketStyleListener());
175
+ // Ensure that ACP headers are applied when needed
176
+ $client->addSubscriber(new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\AcpListener());
177
+ // Validate and add required Content-MD5 hashes (e.g. DeleteObjects)
178
+ $client->addSubscriber(new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\S3Md5Listener($signature));
179
+ // Allow for specifying bodies with file paths and file handles
180
+ $client->addSubscriber(new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\UploadBodyListener(array('PutObject', 'UploadPart')));
181
+ // Ensures that if a SSE-CPK key is provided, the key and md5 are formatted correctly
182
+ $client->addSubscriber(new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\SseCpkListener());
183
+ // Add aliases for some S3 operations
184
+ $default = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\Factory\CompositeFactory::getDefaultChain($client);
185
+ $default->add(new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\Factory\AliasFactory($client, static::$commandAliases), 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Guzzle\\Service\\Command\\Factory\\ServiceDescriptionFactory');
186
+ $client->setCommandFactory($default);
187
+ return $client;
188
+ }
189
+ /**
190
+ * Create an Amazon S3 specific backoff plugin
191
+ *
192
+ * @param S3ExceptionParser $exceptionParser
193
+ *
194
+ * @return BackoffPlugin
195
+ */
196
+ private static function createBackoffPlugin(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\Parser\S3ExceptionParser $exceptionParser, $retries = 3)
197
+ {
198
+ return new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffPlugin(new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\TruncatedBackoffStrategy($retries, new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\IncompleteMultipartUploadChecker(new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\CurlBackoffStrategy(null, new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\HttpBackoffStrategy(null, new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\SocketTimeoutChecker(new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Client\ExpiredCredentialsChecker($exceptionParser, new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\ExponentialBackoffStrategy())))))));
199
+ }
200
+ /**
201
+ * Create an appropriate signature based on the configuration settings
202
+ *
203
+ * @param $config
204
+ *
205
+ * @return \Aws\Common\Signature\SignatureInterface
206
+ * @throws InvalidArgumentException
207
+ */
208
+ private static function createSignature($config)
209
+ {
210
+ $currentValue = isset($config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SIGNATURE]) ? $config[\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Enum\ClientOptions::SIGNATURE] : null;
211
+ // Force v4 if no value is provided, a region is in the config, and
212
+ // the region starts with "cn-" or "eu-central-".
213
+ $requiresV4 = !$currentValue && isset($config['region']) && (strpos($config['region'], 'eu-central-') === 0 || strpos($config['region'], 'cn-') === 0);
214
+ // Use the Amazon S3 signature V4 when the value is set to "v4" or when
215
+ // the value is not set and the region starts with "cn-".
216
+ if ($currentValue == 'v4' || $requiresV4) {
217
+ // Force SignatureV4 for specific regions or if specified in the config
218
+ $currentValue = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\S3SignatureV4('s3');
219
+ } elseif (!$currentValue || $currentValue == 's3') {
220
+ // Use the Amazon S3 signature by default
221
+ $currentValue = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\S3Signature();
222
+ }
223
+ // A region is require with v4
224
+ if ($currentValue instanceof SignatureV4 && !isset($config['region'])) {
225
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('A region must be specified ' . 'when using signature version 4');
226
+ }
227
+ return $currentValue;
228
+ }
229
+ /**
230
+ * Determine if a string is a valid name for a DNS compatible Amazon S3
231
+ * bucket, meaning the bucket can be used as a subdomain in a URL (e.g.,
232
+ * "<bucket>.s3.amazonaws.com").
233
+ *
234
+ * @param string $bucket The name of the bucket to check.
235
+ *
236
+ * @return bool TRUE if the bucket name is valid or FALSE if it is invalid.
237
+ */
238
+ public static function isValidBucketName($bucket)
239
+ {
240
+ $bucketLen = strlen($bucket);
241
+ if ($bucketLen < 3 || $bucketLen > 63 || preg_match('/(\\d+\\.){3}\\d+$/', $bucket) || !preg_match('/^[a-z0-9]([a-z0-9\\-\\.]*[a-z0-9])?$/', $bucket)) {
242
+ return false;
243
+ }
244
+ return true;
245
+ }
246
+ /**
247
+ * Create a pre-signed URL for a request
248
+ *
249
+ * @param RequestInterface $request Request to generate the URL for. Use the factory methods of the client to
250
+ * create this request object
251
+ * @param int|string|\DateTime $expires The time at which the URL should expire. This can be a Unix timestamp, a
252
+ * PHP DateTime object, or a string that can be evaluated by strtotime
253
+ *
254
+ * @return string
255
+ * @throws InvalidArgumentException if the request is not associated with this client object
256
+ */
257
+ public function createPresignedUrl(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, $expires)
258
+ {
259
+ if ($request->getClient() !== $this) {
260
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\InvalidArgumentException('The request object must be associated with the client. Use the ' . '$client->get(), $client->head(), $client->post(), $client->put(), etc. methods when passing in a ' . 'request object');
261
+ }
262
+ return $this->signature->createPresignedUrl($request, $this->credentials, $expires);
263
+ }
264
+ /**
265
+ * Returns the URL to an object identified by its bucket and key. If an expiration time is provided, the URL will
266
+ * be signed and set to expire at the provided time.
267
+ *
268
+ * Note: This method does not ensure that the generated URL is valid. For example, the bucket referenced may not
269
+ * exist, the key referenced may not exist, and the URL might include parameters that require it to be signed.
270
+ * If you need to use parameters that require a signed URL (e.g., ResponseCacheControl), then you must sign the
271
+ * URL either by providing an $expires argument or by signing the URL returned by this method in some other
272
+ * manner.
273
+ *
274
+ * @param string $bucket The name of the bucket where the object is located
275
+ * @param string $key The key of the object
276
+ * @param mixed $expires The time at which the URL should expire
277
+ * @param array $args Arguments to the GetObject command. Additionally you can specify a "Scheme" if you would
278
+ * like the URL to use a different scheme than what the client is configured to use
279
+ *
280
+ * @return string The URL to the object
281
+ */
282
+ public function getObjectUrl($bucket, $key, $expires = null, array $args = array())
283
+ {
284
+ $command = $this->getCommand('GetObject', $args + array('Bucket' => $bucket, 'Key' => $key));
285
+ if ($command->hasKey('Scheme')) {
286
+ $scheme = $command['Scheme'];
287
+ $request = $command->remove('Scheme')->prepare()->setScheme($scheme)->setPort(null);
288
+ } else {
289
+ $request = $command->prepare();
290
+ }
291
+ return $expires ? $this->createPresignedUrl($request, $expires) : $request->getUrl();
292
+ }
293
+ /**
294
+ * Helper used to clear the contents of a bucket. Use the {@see ClearBucket} object directly
295
+ * for more advanced options and control.
296
+ *
297
+ * @param string $bucket Name of the bucket to clear.
298
+ *
299
+ * @return int Returns the number of deleted keys
300
+ */
301
+ public function clearBucket($bucket)
302
+ {
303
+ $clear = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\ClearBucket($this, $bucket);
304
+ return $clear->clear();
305
+ }
306
+ /**
307
+ * Determines whether or not a bucket exists by name
308
+ *
309
+ * @param string $bucket The name of the bucket
310
+ * @param bool $accept403 Set to true if 403s are acceptable
311
+ * @param array $options Additional options to add to the executed command
312
+ *
313
+ * @return bool
314
+ */
315
+ public function doesBucketExist($bucket, $accept403 = true, array $options = array())
316
+ {
317
+ return $this->checkExistenceWithCommand($this->getCommand('HeadBucket', array_merge($options, array('Bucket' => $bucket))), $accept403);
318
+ }
319
+ /**
320
+ * Determines whether or not an object exists by name
321
+ *
322
+ * @param string $bucket The name of the bucket
323
+ * @param string $key The key of the object
324
+ * @param array $options Additional options to add to the executed command
325
+ *
326
+ * @return bool
327
+ */
328
+ public function doesObjectExist($bucket, $key, array $options = array())
329
+ {
330
+ return $this->checkExistenceWithCommand($this->getCommand('HeadObject', array_merge($options, array('Bucket' => $bucket, 'Key' => $key))));
331
+ }
332
+ /**
333
+ * Determines whether or not a bucket policy exists for a bucket
334
+ *
335
+ * @param string $bucket The name of the bucket
336
+ * @param array $options Additional options to add to the executed command
337
+ *
338
+ * @return bool
339
+ */
340
+ public function doesBucketPolicyExist($bucket, array $options = array())
341
+ {
342
+ return $this->checkExistenceWithCommand($this->getCommand('GetBucketPolicy', array_merge($options, array('Bucket' => $bucket))));
343
+ }
344
+ /**
345
+ * Raw URL encode a key and allow for '/' characters
346
+ *
347
+ * @param string $key Key to encode
348
+ *
349
+ * @return string Returns the encoded key
350
+ */
351
+ public static function encodeKey($key)
352
+ {
353
+ return str_replace('%2F', '/', rawurlencode($key));
354
+ }
355
+ /**
356
+ * Explode a prefixed key into an array of values
357
+ *
358
+ * @param string $key Key to explode
359
+ *
360
+ * @return array Returns the exploded
361
+ */
362
+ public static function explodeKey($key)
363
+ {
364
+ // Remove a leading slash if one is found
365
+ return explode('/', $key && $key[0] == '/' ? substr($key, 1) : $key);
366
+ }
367
+ /**
368
+ * Register the Amazon S3 stream wrapper and associates it with this client object
369
+ *
370
+ * @return $this
371
+ */
372
+ public function registerStreamWrapper()
373
+ {
374
+ \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\StreamWrapper::register($this);
375
+ return $this;
376
+ }
377
+ /**
378
+ * Upload a file, stream, or string to a bucket. If the upload size exceeds the specified threshold, the upload
379
+ * will be performed using parallel multipart uploads.
380
+ *
381
+ * @param string $bucket Bucket to upload the object
382
+ * @param string $key Key of the object
383
+ * @param mixed $body Object data to upload. Can be a Guzzle\Http\EntityBodyInterface, stream resource, or
384
+ * string of data to upload.
385
+ * @param string $acl ACL to apply to the object
386
+ * @param array $options Custom options used when executing commands:
387
+ * - params: Custom parameters to use with the upload. The parameters must map to a PutObject
388
+ * or InitiateMultipartUpload operation parameters.
389
+ * - min_part_size: Minimum size to allow for each uploaded part when performing a multipart upload.
390
+ * - concurrency: Maximum number of concurrent multipart uploads.
391
+ * - before_upload: Callback to invoke before each multipart upload. The callback will receive a
392
+ * Guzzle\Common\Event object with context.
393
+ *
394
+ * @see Aws\S3\Model\MultipartUpload\UploadBuilder for more options and customization
395
+ * @return \Guzzle\Service\Resource\Model Returns the modeled result of the performed operation
396
+ */
397
+ public function upload($bucket, $key, $body, $acl = 'private', array $options = array())
398
+ {
399
+ $body = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBody::factory($body);
400
+ $options = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection::fromConfig(array_change_key_case($options), array('min_part_size' => \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload\AbstractTransfer::MIN_PART_SIZE, 'params' => array(), 'concurrency' => $body->getWrapper() == 'plainfile' ? 3 : 1));
401
+ if ($body->getSize() < $options['min_part_size']) {
402
+ // Perform a simple PutObject operation
403
+ return $this->putObject(array('Bucket' => $bucket, 'Key' => $key, 'Body' => $body, 'ACL' => $acl) + $options['params']);
404
+ }
405
+ // Perform a multipart upload if the file is large enough
406
+ $transfer = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload\UploadBuilder::newInstance()->setBucket($bucket)->setKey($key)->setMinPartSize($options['min_part_size'])->setConcurrency($options['concurrency'])->setClient($this)->setSource($body)->setTransferOptions($options->toArray())->addOptions($options['params'])->setOption('ACL', $acl)->build();
407
+ if ($options['before_upload']) {
408
+ $transfer->getEventDispatcher()->addListener(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\AbstractTransfer::BEFORE_PART_UPLOAD, $options['before_upload']);
409
+ }
410
+ return $transfer->upload();
411
+ }
412
+ /**
413
+ * Recursively uploads all files in a given directory to a given bucket.
414
+ *
415
+ * @param string $directory Full path to a directory to upload
416
+ * @param string $bucket Name of the bucket
417
+ * @param string $keyPrefix Virtual directory key prefix to add to each upload
418
+ * @param array $options Associative array of upload options
419
+ * - params: Array of parameters to use with each PutObject operation performed during the transfer
420
+ * - base_dir: Base directory to remove from each object key
421
+ * - force: Set to true to upload every file, even if the file is already in Amazon S3 and has not changed
422
+ * - concurrency: Maximum number of parallel uploads (defaults to 10)
423
+ * - debug: Set to true or an fopen resource to enable debug mode to print information about each upload
424
+ * - multipart_upload_size: When the size of a file exceeds this value, the file will be uploaded using a
425
+ * multipart upload.
426
+ *
427
+ * @see Aws\S3\S3Sync\S3Sync for more options and customization
428
+ */
429
+ public function uploadDirectory($directory, $bucket, $keyPrefix = null, array $options = array())
430
+ {
431
+ $options = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection::fromConfig($options, array('base_dir' => realpath($directory) ?: $directory));
432
+ $builder = $options['builder'] ?: \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\UploadSyncBuilder::getInstance();
433
+ $builder->uploadFromDirectory($directory)->setClient($this)->setBucket($bucket)->setKeyPrefix($keyPrefix)->setConcurrency($options['concurrency'] ?: 5)->setBaseDir($options['base_dir'])->force($options['force'])->setOperationParams($options['params'] ?: array())->enableDebugOutput($options['debug']);
434
+ if ($options->hasKey('multipart_upload_size')) {
435
+ $builder->setMultipartUploadSize($options['multipart_upload_size']);
436
+ }
437
+ $builder->build()->transfer();
438
+ }
439
+ /**
440
+ * Downloads a bucket to the local filesystem
441
+ *
442
+ * @param string $directory Directory to download to
443
+ * @param string $bucket Bucket to download from
444
+ * @param string $keyPrefix Only download objects that use this key prefix
445
+ * @param array $options Associative array of download options
446
+ * - params: Array of parameters to use with each GetObject operation performed during the transfer
447
+ * - base_dir: Base directory to remove from each object key when storing in the local filesystem
448
+ * - force: Set to true to download every file, even if the file is already on the local filesystem and has not
449
+ * changed
450
+ * - concurrency: Maximum number of parallel downloads (defaults to 10)
451
+ * - debug: Set to true or a fopen resource to enable debug mode to print information about each download
452
+ * - allow_resumable: Set to true to allow previously interrupted downloads to be resumed using a Range GET
453
+ */
454
+ public function downloadBucket($directory, $bucket, $keyPrefix = '', array $options = array())
455
+ {
456
+ $options = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection($options);
457
+ $builder = $options['builder'] ?: \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\DownloadSyncBuilder::getInstance();
458
+ $builder->setDirectory($directory)->setClient($this)->setBucket($bucket)->setKeyPrefix($keyPrefix)->setConcurrency($options['concurrency'] ?: 10)->setBaseDir($options['base_dir'])->force($options['force'])->setOperationParams($options['params'] ?: array())->enableDebugOutput($options['debug']);
459
+ if ($options['allow_resumable']) {
460
+ $builder->allowResumableDownloads();
461
+ }
462
+ $builder->build()->transfer();
463
+ }
464
+ /**
465
+ * Deletes objects from Amazon S3 that match the result of a ListObjects operation. For example, this allows you
466
+ * to do things like delete all objects that match a specific key prefix.
467
+ *
468
+ * @param string $bucket Bucket that contains the object keys
469
+ * @param string $prefix Optionally delete only objects under this key prefix
470
+ * @param string $regex Delete only objects that match this regex
471
+ * @param array $options Options used when deleting the object:
472
+ * - before_delete: Callback to invoke before each delete. The callback will receive a
473
+ * Guzzle\Common\Event object with context.
474
+ *
475
+ * @see Aws\S3\S3Client::listObjects
476
+ * @see Aws\S3\Model\ClearBucket For more options or customization
477
+ * @return int Returns the number of deleted keys
478
+ * @throws RuntimeException if no prefix and no regex is given
479
+ */
480
+ public function deleteMatchingObjects($bucket, $prefix = '', $regex = '', array $options = array())
481
+ {
482
+ if (!$prefix && !$regex) {
483
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException('A prefix or regex is required, or use S3Client::clearBucket().');
484
+ }
485
+ $clear = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\ClearBucket($this, $bucket);
486
+ $iterator = $this->getIterator('ListObjects', array('Bucket' => $bucket, 'Prefix' => $prefix));
487
+ if ($regex) {
488
+ $iterator = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Iterator\FilterIterator($iterator, function ($current) use($regex) {
489
+ return preg_match($regex, $current['Key']);
490
+ });
491
+ }
492
+ $clear->setIterator($iterator);
493
+ if (isset($options['before_delete'])) {
494
+ $clear->getEventDispatcher()->addListener(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\ClearBucket::BEFORE_CLEAR, $options['before_delete']);
495
+ }
496
+ return $clear->clear();
497
+ }
498
+ /**
499
+ * Determines whether or not a resource exists using a command
500
+ *
501
+ * @param CommandInterface $command Command used to poll for the resource
502
+ * @param bool $accept403 Set to true if 403s are acceptable
503
+ *
504
+ * @return bool
505
+ * @throws S3Exception|\Exception if there is an unhandled exception
506
+ */
507
+ protected function checkExistenceWithCommand(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface $command, $accept403 = false)
508
+ {
509
+ try {
510
+ $command->execute();
511
+ $exists = true;
512
+ } catch (AccessDeniedException $e) {
513
+ $exists = (bool) $accept403;
514
+ } catch (S3Exception $e) {
515
+ $exists = false;
516
+ if ($e->getResponse()->getStatusCode() >= 500) {
517
+ // @codeCoverageIgnoreStart
518
+ throw $e;
519
+ // @codeCoverageIgnoreEnd
520
+ }
521
+ }
522
+ return $exists;
523
+ }
524
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/S3Md5Listener.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureV4;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureInterface;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Symfony\Component\EventDispatcher\EventSubscriberInterface;
24
+ /**
25
+ * Adds required and optional Content-MD5 headers
26
+ */
27
+ class S3Md5Listener implements \DeliciousBrains\WP_Offload_S3\Aws2\Symfony\Component\EventDispatcher\EventSubscriberInterface
28
+ {
29
+ /** @var S3SignatureInterface */
30
+ private $signature;
31
+ public static function getSubscribedEvents()
32
+ {
33
+ return array('command.after_prepare' => 'onCommandAfterPrepare');
34
+ }
35
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureInterface $signature)
36
+ {
37
+ $this->signature = $signature;
38
+ }
39
+ public function onCommandAfterPrepare(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event $event)
40
+ {
41
+ $command = $event['command'];
42
+ $operation = $command->getOperation();
43
+ if ($operation->getData('contentMd5')) {
44
+ // Add the MD5 if it is required for all signers
45
+ $this->addMd5($command);
46
+ } elseif ($operation->hasParam('ContentMD5')) {
47
+ $value = $command['ContentMD5'];
48
+ // Add a computed MD5 if the parameter is set to true or if
49
+ // not using Signature V4 and the value is not set (null).
50
+ if ($value === true || $value === null && !$this->signature instanceof SignatureV4) {
51
+ $this->addMd5($command);
52
+ }
53
+ }
54
+ }
55
+ private function addMd5(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface $command)
56
+ {
57
+ $request = $command->getRequest();
58
+ $body = $request->getBody();
59
+ if ($body && $body->getSize() > 0) {
60
+ if (false !== ($md5 = $body->getContentMd5(true, true))) {
61
+ $request->setHeader('Content-MD5', $md5);
62
+ }
63
+ }
64
+ }
65
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/S3Signature.php ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\QueryString;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Url;
23
+ /**
24
+ * Default Amazon S3 signature implementation
25
+ * @link http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html
26
+ */
27
+ class S3Signature implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\S3SignatureInterface
28
+ {
29
+ /**
30
+ * @var array Query string values that must be signed
31
+ */
32
+ protected $signableQueryString = array('acl', 'cors', 'delete', 'lifecycle', 'location', 'logging', 'notification', 'partNumber', 'policy', 'requestPayment', 'response-cache-control', 'response-content-disposition', 'response-content-encoding', 'response-content-language', 'response-content-type', 'response-expires', 'restore', 'tagging', 'torrent', 'uploadId', 'uploads', 'versionId', 'versioning', 'versions', 'website');
33
+ /** @var array Sorted headers that must be signed */
34
+ private $signableHeaders = array('Content-MD5', 'Content-Type');
35
+ public function signRequest(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials)
36
+ {
37
+ // Ensure that the signable query string parameters are sorted
38
+ sort($this->signableQueryString);
39
+ // Add the security token header if one is being used by the credentials
40
+ if ($token = $credentials->getSecurityToken()) {
41
+ $request->setHeader('x-amz-security-token', $token);
42
+ }
43
+ $request->removeHeader('x-amz-date');
44
+ $request->setHeader('Date', gmdate(\DateTime::RFC2822));
45
+ $stringToSign = $this->createCanonicalizedString($request);
46
+ $request->getParams()->set('aws.string_to_sign', $stringToSign);
47
+ $request->setHeader('Authorization', 'AWS ' . $credentials->getAccessKeyId() . ':' . $this->signString($stringToSign, $credentials));
48
+ }
49
+ public function createPresignedUrl(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials, $expires)
50
+ {
51
+ if ($expires instanceof \DateTime) {
52
+ $expires = $expires->getTimestamp();
53
+ } elseif (!is_numeric($expires)) {
54
+ $expires = strtotime($expires);
55
+ }
56
+ // Operate on a clone of the request, so the original is not altered
57
+ $request = clone $request;
58
+ // URL encoding already occurs in the URI template expansion. Undo that and encode using the same encoding as
59
+ // GET object, PUT object, etc.
60
+ $path = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\S3Client::encodeKey(rawurldecode($request->getPath()));
61
+ $request->setPath($path);
62
+ // Make sure to handle temporary credentials
63
+ if ($token = $credentials->getSecurityToken()) {
64
+ $request->setHeader('x-amz-security-token', $token);
65
+ $request->getQuery()->set('x-amz-security-token', $token);
66
+ }
67
+ // Set query params required for pre-signed URLs
68
+ $request->getQuery()->set('AWSAccessKeyId', $credentials->getAccessKeyId())->set('Expires', $expires)->set('Signature', $this->signString($this->createCanonicalizedString($request, $expires), $credentials));
69
+ // Move X-Amz-* headers to the query string
70
+ foreach ($request->getHeaders() as $name => $header) {
71
+ $name = strtolower($name);
72
+ if (strpos($name, 'x-amz-') === 0) {
73
+ $request->getQuery()->set($name, (string) $header);
74
+ $request->removeHeader($name);
75
+ }
76
+ }
77
+ return $request->getUrl();
78
+ }
79
+ public function signString($string, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials)
80
+ {
81
+ return base64_encode(hash_hmac('sha1', $string, $credentials->getSecretKey(), true));
82
+ }
83
+ public function createCanonicalizedString(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, $expires = null)
84
+ {
85
+ $buffer = $request->getMethod() . "\n";
86
+ // Add the interesting headers
87
+ foreach ($this->signableHeaders as $header) {
88
+ $buffer .= (string) $request->getHeader($header) . "\n";
89
+ }
90
+ // Choose dates from left to right based on what's set
91
+ $date = $expires ?: (string) $request->getHeader('date');
92
+ $buffer .= "{$date}\n" . $this->createCanonicalizedAmzHeaders($request) . $this->createCanonicalizedResource($request);
93
+ return $buffer;
94
+ }
95
+ /**
96
+ * Create a canonicalized AmzHeaders string for a signature.
97
+ *
98
+ * @param RequestInterface $request Request from which to gather headers
99
+ *
100
+ * @return string Returns canonicalized AMZ headers.
101
+ */
102
+ private function createCanonicalizedAmzHeaders(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request)
103
+ {
104
+ $headers = array();
105
+ foreach ($request->getHeaders() as $name => $header) {
106
+ $name = strtolower($name);
107
+ if (strpos($name, 'x-amz-') === 0) {
108
+ $value = trim((string) $header);
109
+ if ($value || $value === '0') {
110
+ $headers[$name] = $name . ':' . $value;
111
+ }
112
+ }
113
+ }
114
+ if (!$headers) {
115
+ return '';
116
+ }
117
+ ksort($headers);
118
+ return implode("\n", $headers) . "\n";
119
+ }
120
+ /**
121
+ * Create a canonicalized resource for a request
122
+ *
123
+ * @param RequestInterface $request Request for the resource
124
+ *
125
+ * @return string
126
+ */
127
+ private function createCanonicalizedResource(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request)
128
+ {
129
+ $buffer = $request->getParams()->get('s3.resource');
130
+ // When sending a raw HTTP request (e.g. $client->get())
131
+ if (null === $buffer) {
132
+ $bucket = $request->getParams()->get('bucket') ?: $this->parseBucketName($request);
133
+ // Use any specified bucket name, the parsed bucket name, or no bucket name when interacting with GetService
134
+ $buffer = $bucket ? "/{$bucket}" : '';
135
+ // Remove encoding from the path and use the S3 specific encoding
136
+ $path = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\S3Client::encodeKey(rawurldecode($request->getPath()));
137
+ // if the bucket was path style, then ensure that the bucket wasn't duplicated in the resource
138
+ $buffer .= preg_replace("#^/{$bucket}/{$bucket}#", "/{$bucket}", $path);
139
+ }
140
+ // Remove double slashes
141
+ $buffer = str_replace('//', '/', $buffer);
142
+ // Add sub resource parameters
143
+ $query = $request->getQuery();
144
+ $first = true;
145
+ foreach ($this->signableQueryString as $key) {
146
+ if ($query->hasKey($key)) {
147
+ $value = $query[$key];
148
+ $buffer .= $first ? '?' : '&';
149
+ $first = false;
150
+ $buffer .= $key;
151
+ // Don't add values for empty sub-resources
152
+ if ($value !== '' && $value !== false && $value !== null && $value !== \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\QueryString::BLANK) {
153
+ $buffer .= "={$value}";
154
+ }
155
+ }
156
+ }
157
+ return $buffer;
158
+ }
159
+ /**
160
+ * Parse the bucket name from a request object
161
+ *
162
+ * @param RequestInterface $request Request to parse
163
+ *
164
+ * @return string
165
+ */
166
+ private function parseBucketName(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request)
167
+ {
168
+ $baseUrl = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Url::factory($request->getClient()->getBaseUrl());
169
+ $baseHost = $baseUrl->getHost();
170
+ $host = $request->getHost();
171
+ if (strpos($host, $baseHost) === false) {
172
+ // Does not contain the base URL, so it's either a redirect, CNAME, or using a different region
173
+ $baseHost = '';
174
+ // For every known S3 host, check if that host is present on the request
175
+ $regions = $request->getClient()->getDescription()->getData('regions');
176
+ foreach ($regions as $region) {
177
+ if (strpos($host, $region['hostname']) !== false) {
178
+ // This host matches the request host. Tells use the region and endpoint-- we can derive the bucket
179
+ $baseHost = $region['hostname'];
180
+ break;
181
+ }
182
+ }
183
+ // If no matching base URL was found, then assume that this is a CNAME, and the CNAME is the bucket
184
+ if (!$baseHost) {
185
+ return $host;
186
+ }
187
+ }
188
+ // Remove the baseURL from the host of the request to attempt to determine the bucket name
189
+ return trim(str_replace($baseHost, '', $request->getHost()), ' .');
190
+ }
191
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/S3SignatureInterface.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureInterface;
20
+ /**
21
+ * @deprecated
22
+ */
23
+ interface S3SignatureInterface extends SignatureInterface
24
+ {
25
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/S3SignatureV4.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureV4;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\EntityEnclosingRequestInterface;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
23
+ /**
24
+ * Amazon S3 signature version 4 overrides.
25
+ */
26
+ class S3SignatureV4 extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Signature\SignatureV4 implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\S3SignatureInterface
27
+ {
28
+ /**
29
+ * Always add a x-amz-content-sha-256 for data integrity.
30
+ */
31
+ public function signRequest(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Credentials\CredentialsInterface $credentials)
32
+ {
33
+ if (!$request->hasHeader('x-amz-content-sha256')) {
34
+ $request->setHeader('x-amz-content-sha256', $this->getPayload($request));
35
+ }
36
+ parent::signRequest($request, $credentials);
37
+ }
38
+ /**
39
+ * Override used to allow pre-signed URLs to be created for an
40
+ * in-determinate request payload.
41
+ */
42
+ protected function getPresignedPayload(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request)
43
+ {
44
+ return 'UNSIGNED-PAYLOAD';
45
+ }
46
+ /**
47
+ * Amazon S3 does not double-encode the path component in the canonical req
48
+ */
49
+ protected function createCanonicalizedPath(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request)
50
+ {
51
+ return '/' . ltrim($request->getPath(), '/');
52
+ }
53
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/SocketTimeoutChecker.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Exception\HttpException;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\EntityEnclosingRequestInterface;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffStrategyInterface;
24
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\AbstractBackoffStrategy;
25
+ /**
26
+ * Custom S3 exponential backoff checking use to retry 400 responses containing the following reason phrase:
27
+ * "Your socket connection to the server was not read from or written to within the timeout period.".
28
+ * This error has been reported as intermittent/random, and in most cases, seems to occur during the middle of a
29
+ * transfer. This plugin will attempt to retry these failed requests, and if using a local file, will clear the
30
+ * stat cache of the file and set a new content-length header on the upload.
31
+ */
32
+ class SocketTimeoutChecker extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\AbstractBackoffStrategy
33
+ {
34
+ const ERR = 'Your socket connection to the server was not read from or written to within the timeout period';
35
+ /**
36
+ * {@inheridoc}
37
+ */
38
+ public function __construct(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Plugin\Backoff\BackoffStrategyInterface $next = null)
39
+ {
40
+ if ($next) {
41
+ $this->setNext($next);
42
+ }
43
+ }
44
+ /**
45
+ * {@inheridoc}
46
+ */
47
+ public function makesDecision()
48
+ {
49
+ return true;
50
+ }
51
+ /**
52
+ * {@inheritdoc}
53
+ */
54
+ protected function getDelay($retries, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\RequestInterface $request, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Message\Response $response = null, \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Exception\HttpException $e = null)
55
+ {
56
+ if ($response && $response->getStatusCode() == 400 && strpos($response->getBody(), self::ERR)) {
57
+ return true;
58
+ }
59
+ }
60
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/SseCpkListener.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3;
4
+
5
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException;
6
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event;
7
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface;
8
+ use DeliciousBrains\WP_Offload_S3\Aws2\Symfony\Component\EventDispatcher\EventSubscriberInterface;
9
+ /**
10
+ * This listener simplifies the SSE-C process by encoding and hashing the key.
11
+ */
12
+ class SseCpkListener implements \DeliciousBrains\WP_Offload_S3\Aws2\Symfony\Component\EventDispatcher\EventSubscriberInterface
13
+ {
14
+ public static function getSubscribedEvents()
15
+ {
16
+ return array('command.before_prepare' => 'onCommandBeforePrepare');
17
+ }
18
+ public function onCommandBeforePrepare(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event $event)
19
+ {
20
+ /** @var CommandInterface $command */
21
+ $command = $event['command'];
22
+ // Allows only HTTPS connections when using SSE-C
23
+ if ($command['SSECustomerKey'] || $command['CopySourceSSECustomerKey']) {
24
+ $this->validateScheme($command);
25
+ }
26
+ // Prepare the normal SSE-CPK headers
27
+ if ($command['SSECustomerKey']) {
28
+ $this->prepareSseParams($command);
29
+ }
30
+ // If it's a copy operation, prepare the SSE-CPK headers for the source.
31
+ if ($command['CopySourceSSECustomerKey']) {
32
+ $this->prepareSseParams($command, true);
33
+ }
34
+ }
35
+ private function validateScheme(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface $command)
36
+ {
37
+ if ($command->getClient()->getConfig('scheme') !== 'https') {
38
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException('You must configure your S3 client to ' . 'use HTTPS in order to use the SSE-C features.');
39
+ }
40
+ }
41
+ private function prepareSseParams(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface $command, $isCopy = false)
42
+ {
43
+ $prefix = $isCopy ? 'CopySource' : '';
44
+ // Base64 encode the provided key
45
+ $key = $command[$prefix . 'SSECustomerKey'];
46
+ $command[$prefix . 'SSECustomerKey'] = base64_encode($key);
47
+ // Base64 the provided MD5 or, generate an MD5 if not provided
48
+ if ($md5 = $command[$prefix . 'SSECustomerKeyMD5']) {
49
+ $command[$prefix . 'SSECustomerKeyMD5'] = base64_encode($md5);
50
+ } else {
51
+ $command[$prefix . 'SSECustomerKeyMD5'] = base64_encode(md5($key, true));
52
+ }
53
+ }
54
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/StreamWrapper.php ADDED
@@ -0,0 +1,757 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\S3Exception;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Exception\NoSuchKeyException;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Iterator\ListObjectsIterator;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBody;
24
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\CachingEntityBody;
25
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Mimetypes;
26
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Iterator\FilterIterator;
27
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Stream\PhpStreamRequestFactory;
28
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface;
29
+ /**
30
+ * Amazon S3 stream wrapper to use "s3://<bucket>/<key>" files with PHP streams, supporting "r", "w", "a", "x".
31
+ *
32
+ * # Supported stream related PHP functions:
33
+ * - fopen, fclose, fread, fwrite, fseek, ftell, feof, fflush
34
+ * - opendir, closedir, readdir, rewinddir
35
+ * - copy, rename, unlink
36
+ * - mkdir, rmdir, rmdir (recursive)
37
+ * - file_get_contents, file_put_contents
38
+ * - file_exists, filesize, is_file, is_dir
39
+ *
40
+ * # Opening "r" (read only) streams:
41
+ *
42
+ * Read only streams are truly streaming by default and will not allow you to seek. This is because data
43
+ * read from the stream is not kept in memory or on the local filesystem. You can force a "r" stream to be seekable
44
+ * by setting the "seekable" stream context option true. This will allow true streaming of data from Amazon S3, but
45
+ * will maintain a buffer of previously read bytes in a 'php://temp' stream to allow seeking to previously read bytes
46
+ * from the stream.
47
+ *
48
+ * You may pass any GetObject parameters as 's3' stream context options. These options will affect how the data is
49
+ * downloaded from Amazon S3.
50
+ *
51
+ * # Opening "w" and "x" (write only) streams:
52
+ *
53
+ * Because Amazon S3 requires a Content-Length header, write only streams will maintain a 'php://temp' stream to buffer
54
+ * data written to the stream until the stream is flushed (usually by closing the stream with fclose).
55
+ *
56
+ * You may pass any PutObject parameters as 's3' stream context options. These options will affect how the data is
57
+ * uploaded to Amazon S3.
58
+ *
59
+ * When opening an "x" stream, the file must exist on Amazon S3 for the stream to open successfully.
60
+ *
61
+ * # Opening "a" (write only append) streams:
62
+ *
63
+ * Similar to "w" streams, opening append streams requires that the data be buffered in a "php://temp" stream. Append
64
+ * streams will attempt to download the contents of an object in Amazon S3, seek to the end of the object, then allow
65
+ * you to append to the contents of the object. The data will then be uploaded using a PutObject operation when the
66
+ * stream is flushed (usually with fclose).
67
+ *
68
+ * You may pass any GetObject and/or PutObject parameters as 's3' stream context options. These options will affect how
69
+ * the data is downloaded and uploaded from Amazon S3.
70
+ *
71
+ * Stream context options:
72
+ *
73
+ * - "seekable": Set to true to create a seekable "r" (read only) stream by using a php://temp stream buffer
74
+ * - For "unlink" only: Any option that can be passed to the DeleteObject operation
75
+ */
76
+ class StreamWrapper
77
+ {
78
+ /**
79
+ * @var resource|null Stream context (this is set by PHP when a context is used)
80
+ */
81
+ public $context;
82
+ /**
83
+ * @var S3Client Client used to send requests
84
+ */
85
+ protected static $client;
86
+ /**
87
+ * @var string Mode the stream was opened with
88
+ */
89
+ protected $mode;
90
+ /**
91
+ * @var EntityBody Underlying stream resource
92
+ */
93
+ protected $body;
94
+ /**
95
+ * @var array Current parameters to use with the flush operation
96
+ */
97
+ protected $params;
98
+ /**
99
+ * @var ListObjectsIterator Iterator used with opendir() and subsequent readdir() calls
100
+ */
101
+ protected $objectIterator;
102
+ /**
103
+ * @var string The bucket that was opened when opendir() was called
104
+ */
105
+ protected $openedBucket;
106
+ /**
107
+ * @var string The prefix of the bucket that was opened with opendir()
108
+ */
109
+ protected $openedBucketPrefix;
110
+ /**
111
+ * @var array The next key to retrieve when using a directory iterator. Helps for fast directory traversal.
112
+ */
113
+ protected static $nextStat = array();
114
+ /**
115
+ * Register the 's3://' stream wrapper
116
+ *
117
+ * @param S3Client $client Client to use with the stream wrapper
118
+ */
119
+ public static function register(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\S3Client $client)
120
+ {
121
+ if (in_array('s3', stream_get_wrappers())) {
122
+ stream_wrapper_unregister('s3');
123
+ }
124
+ stream_wrapper_register('s3', get_called_class(), STREAM_IS_URL);
125
+ static::$client = $client;
126
+ }
127
+ /**
128
+ * Close the stream
129
+ */
130
+ public function stream_close()
131
+ {
132
+ $this->body = null;
133
+ }
134
+ /**
135
+ * @param string $path
136
+ * @param string $mode
137
+ * @param int $options
138
+ * @param string $opened_path
139
+ *
140
+ * @return bool
141
+ */
142
+ public function stream_open($path, $mode, $options, &$opened_path)
143
+ {
144
+ // We don't care about the binary flag
145
+ $this->mode = $mode = rtrim($mode, 'bt');
146
+ $this->params = $params = $this->getParams($path);
147
+ $errors = array();
148
+ if (!$params['Key']) {
149
+ $errors[] = 'Cannot open a bucket. You must specify a path in the form of s3://bucket/key';
150
+ }
151
+ if (strpos($mode, '+')) {
152
+ $errors[] = 'The Amazon S3 stream wrapper does not allow simultaneous reading and writing.';
153
+ }
154
+ if (!in_array($mode, array('r', 'w', 'a', 'x'))) {
155
+ $errors[] = "Mode not supported: {$mode}. Use one 'r', 'w', 'a', or 'x'.";
156
+ }
157
+ // When using mode "x" validate if the file exists before attempting to read
158
+ if ($mode == 'x' && static::$client->doesObjectExist($params['Bucket'], $params['Key'], $this->getOptions())) {
159
+ $errors[] = "{$path} already exists on Amazon S3";
160
+ }
161
+ if (!$errors) {
162
+ if ($mode == 'r') {
163
+ return $this->openReadStream($params, $errors);
164
+ } elseif ($mode == 'a') {
165
+ return $this->openAppendStream($params, $errors);
166
+ } else {
167
+ return $this->openWriteStream($params, $errors);
168
+ }
169
+ }
170
+ return $this->triggerError($errors);
171
+ }
172
+ /**
173
+ * @return bool
174
+ */
175
+ public function stream_eof()
176
+ {
177
+ return $this->body->feof();
178
+ }
179
+ /**
180
+ * @return bool
181
+ */
182
+ public function stream_flush()
183
+ {
184
+ if ($this->mode == 'r') {
185
+ return false;
186
+ }
187
+ $this->body->rewind();
188
+ $params = $this->params;
189
+ $params['Body'] = $this->body;
190
+ // Attempt to guess the ContentType of the upload based on the
191
+ // file extension of the key
192
+ if (!isset($params['ContentType']) && ($type = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\Mimetypes::getInstance()->fromFilename($params['Key']))) {
193
+ $params['ContentType'] = $type;
194
+ }
195
+ try {
196
+ static::$client->putObject($params);
197
+ return true;
198
+ } catch (\Exception $e) {
199
+ return $this->triggerError($e->getMessage());
200
+ }
201
+ }
202
+ /**
203
+ * Read data from the underlying stream
204
+ *
205
+ * @param int $count Amount of bytes to read
206
+ *
207
+ * @return string
208
+ */
209
+ public function stream_read($count)
210
+ {
211
+ return $this->body->read($count);
212
+ }
213
+ /**
214
+ * Seek to a specific byte in the stream
215
+ *
216
+ * @param int $offset Seek offset
217
+ * @param int $whence Whence (SEEK_SET, SEEK_CUR, SEEK_END)
218
+ *
219
+ * @return bool
220
+ */
221
+ public function stream_seek($offset, $whence = SEEK_SET)
222
+ {
223
+ return $this->body->seek($offset, $whence);
224
+ }
225
+ /**
226
+ * Get the current position of the stream
227
+ *
228
+ * @return int Returns the current position in the stream
229
+ */
230
+ public function stream_tell()
231
+ {
232
+ return $this->body->ftell();
233
+ }
234
+ /**
235
+ * Write data the to the stream
236
+ *
237
+ * @param string $data
238
+ *
239
+ * @return int Returns the number of bytes written to the stream
240
+ */
241
+ public function stream_write($data)
242
+ {
243
+ return $this->body->write($data);
244
+ }
245
+ /**
246
+ * Delete a specific object
247
+ *
248
+ * @param string $path
249
+ * @return bool
250
+ */
251
+ public function unlink($path)
252
+ {
253
+ try {
254
+ $this->clearStatInfo($path);
255
+ static::$client->deleteObject($this->getParams($path));
256
+ return true;
257
+ } catch (\Exception $e) {
258
+ return $this->triggerError($e->getMessage());
259
+ }
260
+ }
261
+ /**
262
+ * @return array
263
+ */
264
+ public function stream_stat()
265
+ {
266
+ $stat = fstat($this->body->getStream());
267
+ // Add the size of the underlying stream if it is known
268
+ if ($this->mode == 'r' && $this->body->getSize()) {
269
+ $stat[7] = $stat['size'] = $this->body->getSize();
270
+ }
271
+ return $stat;
272
+ }
273
+ /**
274
+ * Provides information for is_dir, is_file, filesize, etc. Works on buckets, keys, and prefixes
275
+ *
276
+ * @param string $path
277
+ * @param int $flags
278
+ *
279
+ * @return array Returns an array of stat data
280
+ * @link http://www.php.net/manual/en/streamwrapper.url-stat.php
281
+ */
282
+ public function url_stat($path, $flags)
283
+ {
284
+ // Check if this path is in the url_stat cache
285
+ if (isset(static::$nextStat[$path])) {
286
+ return static::$nextStat[$path];
287
+ }
288
+ $parts = $this->getParams($path);
289
+ if (!$parts['Key']) {
290
+ // Stat "directories": buckets, or "s3://"
291
+ if (!$parts['Bucket'] || static::$client->doesBucketExist($parts['Bucket'])) {
292
+ return $this->formatUrlStat($path);
293
+ } else {
294
+ return $this->triggerError("File or directory not found: {$path}", $flags);
295
+ }
296
+ }
297
+ try {
298
+ try {
299
+ $result = static::$client->headObject($parts)->toArray();
300
+ if (substr($parts['Key'], -1, 1) == '/' && $result['ContentLength'] == 0) {
301
+ // Return as if it is a bucket to account for console bucket objects (e.g., zero-byte object "foo/")
302
+ return $this->formatUrlStat($path);
303
+ } else {
304
+ // Attempt to stat and cache regular object
305
+ return $this->formatUrlStat($result);
306
+ }
307
+ } catch (NoSuchKeyException $e) {
308
+ // Maybe this isn't an actual key, but a prefix. Do a prefix listing of objects to determine.
309
+ $result = static::$client->listObjects(array('Bucket' => $parts['Bucket'], 'Prefix' => rtrim($parts['Key'], '/') . '/', 'MaxKeys' => 1));
310
+ if (!$result['Contents'] && !$result['CommonPrefixes']) {
311
+ return $this->triggerError("File or directory not found: {$path}", $flags);
312
+ }
313
+ // This is a directory prefix
314
+ return $this->formatUrlStat($path);
315
+ }
316
+ } catch (\Exception $e) {
317
+ return $this->triggerError($e->getMessage(), $flags);
318
+ }
319
+ }
320
+ /**
321
+ * Support for mkdir().
322
+ *
323
+ * @param string $path Directory which should be created.
324
+ * @param int $mode Permissions. 700-range permissions map to ACL_PUBLIC. 600-range permissions map to
325
+ * ACL_AUTH_READ. All other permissions map to ACL_PRIVATE. Expects octal form.
326
+ * @param int $options A bitwise mask of values, such as STREAM_MKDIR_RECURSIVE.
327
+ *
328
+ * @return bool
329
+ * @link http://www.php.net/manual/en/streamwrapper.mkdir.php
330
+ */
331
+ public function mkdir($path, $mode, $options)
332
+ {
333
+ $params = $this->getParams($path);
334
+ if (!$params['Bucket']) {
335
+ return false;
336
+ }
337
+ if (!isset($params['ACL'])) {
338
+ $params['ACL'] = $this->determineAcl($mode);
339
+ }
340
+ return !isset($params['Key']) || $params['Key'] === '/' ? $this->createBucket($path, $params) : $this->createPseudoDirectory($path, $params);
341
+ }
342
+ /**
343
+ * Remove a bucket from Amazon S3
344
+ *
345
+ * @param string $path the directory path
346
+ * @param int $options A bitwise mask of values
347
+ *
348
+ * @return bool true if directory was successfully removed
349
+ * @link http://www.php.net/manual/en/streamwrapper.rmdir.php
350
+ */
351
+ public function rmdir($path, $options)
352
+ {
353
+ $params = $this->getParams($path);
354
+ if (!$params['Bucket']) {
355
+ return $this->triggerError('You cannot delete s3://. Please specify a bucket.');
356
+ }
357
+ try {
358
+ if (!$params['Key']) {
359
+ static::$client->deleteBucket(array('Bucket' => $params['Bucket']));
360
+ $this->clearStatInfo($path);
361
+ return true;
362
+ }
363
+ // Use a key that adds a trailing slash if needed.
364
+ $prefix = rtrim($params['Key'], '/') . '/';
365
+ $result = static::$client->listObjects(array('Bucket' => $params['Bucket'], 'Prefix' => $prefix, 'MaxKeys' => 1));
366
+ // Check if the bucket contains keys other than the placeholder
367
+ if ($result['Contents']) {
368
+ foreach ($result['Contents'] as $key) {
369
+ if ($key['Key'] == $prefix) {
370
+ continue;
371
+ }
372
+ return $this->triggerError('Psuedo folder is not empty');
373
+ }
374
+ return $this->unlink(rtrim($path, '/') . '/');
375
+ }
376
+ return $result['CommonPrefixes'] ? $this->triggerError('Pseudo folder contains nested folders') : true;
377
+ } catch (\Exception $e) {
378
+ return $this->triggerError($e->getMessage());
379
+ }
380
+ }
381
+ /**
382
+ * Support for opendir().
383
+ *
384
+ * The opendir() method of the Amazon S3 stream wrapper supports a stream
385
+ * context option of "listFilter". listFilter must be a callable that
386
+ * accepts an associative array of object data and returns true if the
387
+ * object should be yielded when iterating the keys in a bucket.
388
+ *
389
+ * @param string $path The path to the directory (e.g. "s3://dir[</prefix>]")
390
+ * @param string $options Whether or not to enforce safe_mode (0x04). Unused.
391
+ *
392
+ * @return bool true on success
393
+ * @see http://www.php.net/manual/en/function.opendir.php
394
+ */
395
+ public function dir_opendir($path, $options)
396
+ {
397
+ // Reset the cache
398
+ $this->clearStatInfo();
399
+ $params = $this->getParams($path);
400
+ $delimiter = $this->getOption('delimiter');
401
+ $filterFn = $this->getOption('listFilter');
402
+ if ($delimiter === null) {
403
+ $delimiter = '/';
404
+ }
405
+ if ($params['Key']) {
406
+ $params['Key'] = rtrim($params['Key'], $delimiter) . $delimiter;
407
+ }
408
+ $this->openedBucket = $params['Bucket'];
409
+ $this->openedBucketPrefix = $params['Key'];
410
+ $operationParams = array('Bucket' => $params['Bucket'], 'Prefix' => $params['Key']);
411
+ if ($delimiter) {
412
+ $operationParams['Delimiter'] = $delimiter;
413
+ }
414
+ $objectIterator = static::$client->getIterator('ListObjects', $operationParams, array('return_prefixes' => true, 'sort_results' => true));
415
+ // Filter our "/" keys added by the console as directories, and ensure
416
+ // that if a filter function is provided that it passes the filter.
417
+ $this->objectIterator = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Iterator\FilterIterator($objectIterator, function ($key) use($filterFn) {
418
+ // Each yielded results can contain a "Key" or "Prefix"
419
+ return (!$filterFn || call_user_func($filterFn, $key)) && (!isset($key['Key']) || substr($key['Key'], -1, 1) !== '/');
420
+ });
421
+ $this->objectIterator->next();
422
+ return true;
423
+ }
424
+ /**
425
+ * Close the directory listing handles
426
+ *
427
+ * @return bool true on success
428
+ */
429
+ public function dir_closedir()
430
+ {
431
+ $this->objectIterator = null;
432
+ return true;
433
+ }
434
+ /**
435
+ * This method is called in response to rewinddir()
436
+ *
437
+ * @return boolean true on success
438
+ */
439
+ public function dir_rewinddir()
440
+ {
441
+ $this->clearStatInfo();
442
+ $this->objectIterator->rewind();
443
+ return true;
444
+ }
445
+ /**
446
+ * This method is called in response to readdir()
447
+ *
448
+ * @return string Should return a string representing the next filename, or false if there is no next file.
449
+ *
450
+ * @link http://www.php.net/manual/en/function.readdir.php
451
+ */
452
+ public function dir_readdir()
453
+ {
454
+ // Skip empty result keys
455
+ if (!$this->objectIterator->valid()) {
456
+ return false;
457
+ }
458
+ $current = $this->objectIterator->current();
459
+ if (isset($current['Prefix'])) {
460
+ // Include "directories". Be sure to strip a trailing "/"
461
+ // on prefixes.
462
+ $prefix = rtrim($current['Prefix'], '/');
463
+ $result = str_replace($this->openedBucketPrefix, '', $prefix);
464
+ $key = "s3://{$this->openedBucket}/{$prefix}";
465
+ $stat = $this->formatUrlStat($prefix);
466
+ } else {
467
+ // Remove the prefix from the result to emulate other
468
+ // stream wrappers.
469
+ $result = str_replace($this->openedBucketPrefix, '', $current['Key']);
470
+ $key = "s3://{$this->openedBucket}/{$current['Key']}";
471
+ $stat = $this->formatUrlStat($current);
472
+ }
473
+ // Cache the object data for quick url_stat lookups used with
474
+ // RecursiveDirectoryIterator.
475
+ static::$nextStat = array($key => $stat);
476
+ $this->objectIterator->next();
477
+ return $result;
478
+ }
479
+ /**
480
+ * Called in response to rename() to rename a file or directory. Currently only supports renaming objects.
481
+ *
482
+ * @param string $path_from the path to the file to rename
483
+ * @param string $path_to the new path to the file
484
+ *
485
+ * @return bool true if file was successfully renamed
486
+ * @link http://www.php.net/manual/en/function.rename.php
487
+ */
488
+ public function rename($path_from, $path_to)
489
+ {
490
+ $partsFrom = $this->getParams($path_from);
491
+ $partsTo = $this->getParams($path_to);
492
+ $this->clearStatInfo($path_from);
493
+ $this->clearStatInfo($path_to);
494
+ if (!$partsFrom['Key'] || !$partsTo['Key']) {
495
+ return $this->triggerError('The Amazon S3 stream wrapper only supports copying objects');
496
+ }
497
+ try {
498
+ // Copy the object and allow overriding default parameters if desired, but by default copy metadata
499
+ static::$client->copyObject($this->getOptions() + array('Bucket' => $partsTo['Bucket'], 'Key' => $partsTo['Key'], 'CopySource' => '/' . $partsFrom['Bucket'] . '/' . rawurlencode($partsFrom['Key']), 'MetadataDirective' => 'COPY'));
500
+ // Delete the original object
501
+ static::$client->deleteObject(array('Bucket' => $partsFrom['Bucket'], 'Key' => $partsFrom['Key']) + $this->getOptions());
502
+ } catch (\Exception $e) {
503
+ return $this->triggerError($e->getMessage());
504
+ }
505
+ return true;
506
+ }
507
+ /**
508
+ * Cast the stream to return the underlying file resource
509
+ *
510
+ * @param int $cast_as STREAM_CAST_FOR_SELECT or STREAM_CAST_AS_STREAM
511
+ *
512
+ * @return resource
513
+ */
514
+ public function stream_cast($cast_as)
515
+ {
516
+ return $this->body->getStream();
517
+ }
518
+ /**
519
+ * Get the stream context options available to the current stream
520
+ *
521
+ * @return array
522
+ */
523
+ protected function getOptions()
524
+ {
525
+ $context = $this->context ?: stream_context_get_default();
526
+ $options = stream_context_get_options($context);
527
+ return isset($options['s3']) ? $options['s3'] : array();
528
+ }
529
+ /**
530
+ * Get a specific stream context option
531
+ *
532
+ * @param string $name Name of the option to retrieve
533
+ *
534
+ * @return mixed|null
535
+ */
536
+ protected function getOption($name)
537
+ {
538
+ $options = $this->getOptions();
539
+ return isset($options[$name]) ? $options[$name] : null;
540
+ }
541
+ /**
542
+ * Get the bucket and key from the passed path (e.g. s3://bucket/key)
543
+ *
544
+ * @param string $path Path passed to the stream wrapper
545
+ *
546
+ * @return array Hash of 'Bucket', 'Key', and custom params
547
+ */
548
+ protected function getParams($path)
549
+ {
550
+ $parts = explode('/', substr($path, 5), 2);
551
+ $params = $this->getOptions();
552
+ unset($params['seekable']);
553
+ return array('Bucket' => $parts[0], 'Key' => isset($parts[1]) ? $parts[1] : null) + $params;
554
+ }
555
+ /**
556
+ * Serialize and sign a command, returning a request object
557
+ *
558
+ * @param CommandInterface $command Command to sign
559
+ *
560
+ * @return RequestInterface
561
+ */
562
+ protected function getSignedRequest($command)
563
+ {
564
+ $request = $command->prepare();
565
+ $request->dispatch('request.before_send', array('request' => $request));
566
+ return $request;
567
+ }
568
+ /**
569
+ * Initialize the stream wrapper for a read only stream
570
+ *
571
+ * @param array $params Operation parameters
572
+ * @param array $errors Any encountered errors to append to
573
+ *
574
+ * @return bool
575
+ */
576
+ protected function openReadStream(array $params, array &$errors)
577
+ {
578
+ // Create the command and serialize the request
579
+ $request = $this->getSignedRequest(static::$client->getCommand('GetObject', $params));
580
+ // Create a stream that uses the EntityBody object
581
+ $factory = $this->getOption('stream_factory') ?: new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Stream\PhpStreamRequestFactory();
582
+ $this->body = $factory->fromRequest($request, array(), array('stream_class' => 'DeliciousBrains\\WP_Offload_S3\\Aws2\\Guzzle\\Http\\EntityBody'));
583
+ // Headers are placed in the "wrapper_data" array. The array of headers
584
+ // is simply an array of header lines of which the first line is the
585
+ // status line of the HTTP response.
586
+ $headers = $this->body->getMetaData('wrapper_data');
587
+ if ($headers && isset($headers[0])) {
588
+ $statusParts = explode(' ', $headers[0]);
589
+ $status = $statusParts[1];
590
+ if ($status != 200) {
591
+ return $this->triggerError('Cannot open file: ' . $this->body);
592
+ }
593
+ }
594
+ // Wrap the body in a caching entity body if seeking is allowed
595
+ if ($this->getOption('seekable')) {
596
+ $this->body = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\CachingEntityBody($this->body);
597
+ }
598
+ return true;
599
+ }
600
+ /**
601
+ * Initialize the stream wrapper for a write only stream
602
+ *
603
+ * @param array $params Operation parameters
604
+ * @param array $errors Any encountered errors to append to
605
+ *
606
+ * @return bool
607
+ */
608
+ protected function openWriteStream(array $params, array &$errors)
609
+ {
610
+ $this->body = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBody(fopen('php://temp', 'r+'));
611
+ return true;
612
+ }
613
+ /**
614
+ * Initialize the stream wrapper for an append stream
615
+ *
616
+ * @param array $params Operation parameters
617
+ * @param array $errors Any encountered errors to append to
618
+ *
619
+ * @return bool
620
+ */
621
+ protected function openAppendStream(array $params, array &$errors)
622
+ {
623
+ try {
624
+ // Get the body of the object
625
+ $this->body = static::$client->getObject($params)->get('Body');
626
+ $this->body->seek(0, SEEK_END);
627
+ } catch (S3Exception $e) {
628
+ // The object does not exist, so use a simple write stream
629
+ $this->openWriteStream($params, $errors);
630
+ }
631
+ return true;
632
+ }
633
+ /**
634
+ * Trigger one or more errors
635
+ *
636
+ * @param string|array $errors Errors to trigger
637
+ * @param mixed $flags If set to STREAM_URL_STAT_QUIET, then no error or exception occurs
638
+ *
639
+ * @return bool Returns false
640
+ * @throws RuntimeException if throw_errors is true
641
+ */
642
+ protected function triggerError($errors, $flags = null)
643
+ {
644
+ if ($flags & STREAM_URL_STAT_QUIET) {
645
+ // This is triggered with things like file_exists()
646
+ if ($flags & STREAM_URL_STAT_LINK) {
647
+ // This is triggered for things like is_link()
648
+ return $this->formatUrlStat(false);
649
+ }
650
+ return false;
651
+ }
652
+ // This is triggered when doing things like lstat() or stat()
653
+ trigger_error(implode("\n", (array) $errors), E_USER_WARNING);
654
+ return false;
655
+ }
656
+ /**
657
+ * Prepare a url_stat result array
658
+ *
659
+ * @param string|array $result Data to add
660
+ *
661
+ * @return array Returns the modified url_stat result
662
+ */
663
+ protected function formatUrlStat($result = null)
664
+ {
665
+ static $statTemplate = array(0 => 0, 'dev' => 0, 1 => 0, 'ino' => 0, 2 => 0, 'mode' => 0, 3 => 0, 'nlink' => 0, 4 => 0, 'uid' => 0, 5 => 0, 'gid' => 0, 6 => -1, 'rdev' => -1, 7 => 0, 'size' => 0, 8 => 0, 'atime' => 0, 9 => 0, 'mtime' => 0, 10 => 0, 'ctime' => 0, 11 => -1, 'blksize' => -1, 12 => -1, 'blocks' => -1);
666
+ $stat = $statTemplate;
667
+ $type = gettype($result);
668
+ // Determine what type of data is being cached
669
+ if ($type == 'NULL' || $type == 'string') {
670
+ // Directory with 0777 access - see "man 2 stat".
671
+ $stat['mode'] = $stat[2] = 040777;
672
+ } elseif ($type == 'array' && isset($result['LastModified'])) {
673
+ // ListObjects or HeadObject result
674
+ $stat['mtime'] = $stat[9] = $stat['ctime'] = $stat[10] = strtotime($result['LastModified']);
675
+ $stat['size'] = $stat[7] = isset($result['ContentLength']) ? $result['ContentLength'] : $result['Size'];
676
+ // Regular file with 0777 access - see "man 2 stat".
677
+ $stat['mode'] = $stat[2] = 0100777;
678
+ }
679
+ return $stat;
680
+ }
681
+ /**
682
+ * Clear the next stat result from the cache
683
+ *
684
+ * @param string $path If a path is specific, clearstatcache() will be called
685
+ */
686
+ protected function clearStatInfo($path = null)
687
+ {
688
+ static::$nextStat = array();
689
+ if ($path) {
690
+ clearstatcache(true, $path);
691
+ }
692
+ }
693
+ /**
694
+ * Creates a bucket for the given parameters.
695
+ *
696
+ * @param string $path Stream wrapper path
697
+ * @param array $params A result of StreamWrapper::getParams()
698
+ *
699
+ * @return bool Returns true on success or false on failure
700
+ */
701
+ private function createBucket($path, array $params)
702
+ {
703
+ if (static::$client->doesBucketExist($params['Bucket'])) {
704
+ return $this->triggerError("Directory already exists: {$path}");
705
+ }
706
+ try {
707
+ static::$client->createBucket($params);
708
+ $this->clearStatInfo($path);
709
+ return true;
710
+ } catch (\Exception $e) {
711
+ return $this->triggerError($e->getMessage());
712
+ }
713
+ }
714
+ /**
715
+ * Creates a pseudo-folder by creating an empty "/" suffixed key
716
+ *
717
+ * @param string $path Stream wrapper path
718
+ * @param array $params A result of StreamWrapper::getParams()
719
+ *
720
+ * @return bool
721
+ */
722
+ private function createPseudoDirectory($path, array $params)
723
+ {
724
+ // Ensure the path ends in "/" and the body is empty.
725
+ $params['Key'] = rtrim($params['Key'], '/') . '/';
726
+ $params['Body'] = '';
727
+ // Fail if this pseudo directory key already exists
728
+ if (static::$client->doesObjectExist($params['Bucket'], $params['Key'])) {
729
+ return $this->triggerError("Directory already exists: {$path}");
730
+ }
731
+ try {
732
+ static::$client->putObject($params);
733
+ $this->clearStatInfo($path);
734
+ return true;
735
+ } catch (\Exception $e) {
736
+ return $this->triggerError($e->getMessage());
737
+ }
738
+ }
739
+ /**
740
+ * Determine the most appropriate ACL based on a file mode.
741
+ *
742
+ * @param int $mode File mode
743
+ *
744
+ * @return string
745
+ */
746
+ private function determineAcl($mode)
747
+ {
748
+ $mode = decoct($mode);
749
+ if ($mode >= 700 && $mode <= 799) {
750
+ return 'public-read';
751
+ }
752
+ if ($mode >= 600 && $mode <= 699) {
753
+ return 'authenticated-read';
754
+ }
755
+ return 'private';
756
+ }
757
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/AbstractSync.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\S3Client;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\AbstractHasDispatcher;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Iterator\ChunkedIterator;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface;
24
+ abstract class AbstractSync extends \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\AbstractHasDispatcher
25
+ {
26
+ const BEFORE_TRANSFER = 's3.sync.before_transfer';
27
+ const AFTER_TRANSFER = 's3.sync.after_transfer';
28
+ /** @var Collection */
29
+ protected $options;
30
+ /**
31
+ * @param array $options Associative array of options:
32
+ * - client: (S3Client) used to transfer requests
33
+ * - bucket: (string) Amazon S3 bucket
34
+ * - iterator: (\Iterator) Iterator that yields SplFileInfo objects to transfer
35
+ * - source_converter: (FilenameConverterInterface) Converter used to convert filenames
36
+ * - *: Any other options required by subclasses
37
+ */
38
+ public function __construct(array $options)
39
+ {
40
+ $this->options = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Collection::fromConfig($options, array('concurrency' => 10), array('client', 'bucket', 'iterator', 'source_converter'));
41
+ $this->init();
42
+ }
43
+ public static function getAllEvents()
44
+ {
45
+ return array(self::BEFORE_TRANSFER, self::AFTER_TRANSFER);
46
+ }
47
+ /**
48
+ * Begin transferring files
49
+ */
50
+ public function transfer()
51
+ {
52
+ // Pull out chunks of uploads to upload in parallel
53
+ $iterator = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Iterator\ChunkedIterator($this->options['iterator'], $this->options['concurrency']);
54
+ foreach ($iterator as $files) {
55
+ $this->transferFiles($files);
56
+ }
57
+ }
58
+ /**
59
+ * Create a command or special transfer action for the
60
+ *
61
+ * @param \SplFileInfo $file File used to build the transfer
62
+ *
63
+ * @return CommandInterface|callable
64
+ */
65
+ protected abstract function createTransferAction(\SplFileInfo $file);
66
+ /**
67
+ * Hook to initialize subclasses
68
+ * @codeCoverageIgnore
69
+ */
70
+ protected function init()
71
+ {
72
+ }
73
+ /**
74
+ * Process and transfer a group of files
75
+ *
76
+ * @param array $files Files to transfer
77
+ */
78
+ protected function transferFiles(array $files)
79
+ {
80
+ // Create the base event data object
81
+ $event = array('sync' => $this, 'client' => $this->options['client']);
82
+ $commands = array();
83
+ foreach ($files as $file) {
84
+ if ($action = $this->createTransferAction($file)) {
85
+ $event = array('command' => $action, 'file' => $file) + $event;
86
+ $this->dispatch(self::BEFORE_TRANSFER, $event);
87
+ if ($action instanceof CommandInterface) {
88
+ $commands[] = $action;
89
+ } elseif (is_callable($action)) {
90
+ $action();
91
+ $this->dispatch(self::AFTER_TRANSFER, $event);
92
+ }
93
+ }
94
+ }
95
+ $this->transferCommands($commands);
96
+ }
97
+ /**
98
+ * Transfer an array of commands in parallel
99
+ *
100
+ * @param array $commands Commands to transfer
101
+ */
102
+ protected function transferCommands(array $commands)
103
+ {
104
+ if ($commands) {
105
+ $this->options['client']->execute($commands);
106
+ // Notify listeners that each command finished
107
+ $event = array('sync' => $this, 'client' => $this->options['client']);
108
+ foreach ($commands as $command) {
109
+ $event['command'] = $command;
110
+ $this->dispatch(self::AFTER_TRANSFER, $event);
111
+ }
112
+ }
113
+ }
114
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/AbstractSyncBuilder.php ADDED
@@ -0,0 +1,359 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\UnexpectedValueException;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\S3Client;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Iterator\OpendirIterator;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event;
24
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\HasDispatcherInterface;
25
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Iterator\FilterIterator;
26
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface;
27
+ abstract class AbstractSyncBuilder
28
+ {
29
+ /** @var \Iterator Iterator that returns SplFileInfo objects to upload */
30
+ protected $sourceIterator;
31
+ /** @var S3Client Amazon S3 client used to send requests */
32
+ protected $client;
33
+ /** @var string Bucket used with the transfer */
34
+ protected $bucket;
35
+ /** @var int Number of files that can be transferred concurrently */
36
+ protected $concurrency = 10;
37
+ /** @var array Custom parameters to add to each operation sent while transferring */
38
+ protected $params = array();
39
+ /** @var FilenameConverterInterface */
40
+ protected $sourceConverter;
41
+ /** @var FilenameConverterInterface */
42
+ protected $targetConverter;
43
+ /** @var string Prefix at prepend to each Amazon S3 object key */
44
+ protected $keyPrefix = '';
45
+ /** @var string Directory separator for Amazon S3 keys */
46
+ protected $delimiter = '/';
47
+ /** @var string Base directory to remove from each file path before converting to an object name or file name */
48
+ protected $baseDir;
49
+ /** @var bool Whether or not to only transfer modified or new files */
50
+ protected $forcing = false;
51
+ /** @var bool Whether or not debug output is enable */
52
+ protected $debug;
53
+ /**
54
+ * @return static
55
+ */
56
+ public static function getInstance()
57
+ {
58
+ return new static();
59
+ }
60
+ /**
61
+ * Set the bucket to use with the sync
62
+ *
63
+ * @param string $bucket Amazon S3 bucket name
64
+ *
65
+ * @return $this
66
+ */
67
+ public function setBucket($bucket)
68
+ {
69
+ $this->bucket = $bucket;
70
+ return $this;
71
+ }
72
+ /**
73
+ * Set the Amazon S3 client object that will send requests
74
+ *
75
+ * @param S3Client $client Amazon S3 client
76
+ *
77
+ * @return $this
78
+ */
79
+ public function setClient(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\S3Client $client)
80
+ {
81
+ $this->client = $client;
82
+ return $this;
83
+ }
84
+ /**
85
+ * Set a custom iterator that returns \SplFileInfo objects for the source data
86
+ *
87
+ * @param \Iterator $iterator
88
+ *
89
+ * @return $this
90
+ */
91
+ public function setSourceIterator(\Iterator $iterator)
92
+ {
93
+ $this->sourceIterator = $iterator;
94
+ return $this;
95
+ }
96
+ /**
97
+ * Set a custom object key provider instead of building one internally
98
+ *
99
+ * @param FileNameConverterInterface $converter Filename to object key provider
100
+ *
101
+ * @return $this
102
+ */
103
+ public function setSourceFilenameConverter(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\FilenameConverterInterface $converter)
104
+ {
105
+ $this->sourceConverter = $converter;
106
+ return $this;
107
+ }
108
+ /**
109
+ * Set a custom object key provider instead of building one internally
110
+ *
111
+ * @param FileNameConverterInterface $converter Filename to object key provider
112
+ *
113
+ * @return $this
114
+ */
115
+ public function setTargetFilenameConverter(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\FilenameConverterInterface $converter)
116
+ {
117
+ $this->targetConverter = $converter;
118
+ return $this;
119
+ }
120
+ /**
121
+ * Set the base directory of the files being transferred. The base directory is removed from each file path before
122
+ * converting the file path to an object key or vice versa.
123
+ *
124
+ * @param string $baseDir Base directory, which will be deleted from each uploaded object key
125
+ *
126
+ * @return $this
127
+ */
128
+ public function setBaseDir($baseDir)
129
+ {
130
+ $this->baseDir = $baseDir;
131
+ return $this;
132
+ }
133
+ /**
134
+ * Specify a prefix to prepend to each Amazon S3 object key or the prefix where object are stored in a bucket
135
+ *
136
+ * Can be used to upload files to a pseudo sub-folder key or only download files from a pseudo sub-folder
137
+ *
138
+ * @param string $keyPrefix Prefix for each uploaded key
139
+ *
140
+ * @return $this
141
+ */
142
+ public function setKeyPrefix($keyPrefix)
143
+ {
144
+ // Removing leading slash
145
+ $this->keyPrefix = ltrim($keyPrefix, '/');
146
+ return $this;
147
+ }
148
+ /**
149
+ * Specify the delimiter used for the targeted filesystem (default delimiter is "/")
150
+ *
151
+ * @param string $delimiter Delimiter to use to separate paths
152
+ *
153
+ * @return $this
154
+ */
155
+ public function setDelimiter($delimiter)
156
+ {
157
+ $this->delimiter = $delimiter;
158
+ return $this;
159
+ }
160
+ /**
161
+ * Specify an array of operation parameters to apply to each operation executed by the sync object
162
+ *
163
+ * @param array $params Associative array of PutObject (upload) GetObject (download) parameters
164
+ *
165
+ * @return $this
166
+ */
167
+ public function setOperationParams(array $params)
168
+ {
169
+ $this->params = $params;
170
+ return $this;
171
+ }
172
+ /**
173
+ * Set the number of files that can be transferred concurrently
174
+ *
175
+ * @param int $concurrency Number of concurrent transfers
176
+ *
177
+ * @return $this
178
+ */
179
+ public function setConcurrency($concurrency)
180
+ {
181
+ $this->concurrency = $concurrency;
182
+ return $this;
183
+ }
184
+ /**
185
+ * Set to true to force transfers even if a file already exists and has not changed
186
+ *
187
+ * @param bool $force Set to true to force transfers without checking if it has changed
188
+ *
189
+ * @return $this
190
+ */
191
+ public function force($force = false)
192
+ {
193
+ $this->forcing = (bool) $force;
194
+ return $this;
195
+ }
196
+ /**
197
+ * Enable debug mode
198
+ *
199
+ * @param bool|resource $enabledOrResource Set to true or false to enable or disable debug output. Pass an opened
200
+ * fopen resource to write to instead of writing to standard out.
201
+ * @return $this
202
+ */
203
+ public function enableDebugOutput($enabledOrResource = true)
204
+ {
205
+ $this->debug = $enabledOrResource;
206
+ return $this;
207
+ }
208
+ /**
209
+ * Add a filename filter that uses a regular expression to filter out files that you do not wish to transfer.
210
+ *
211
+ * @param string $search Regular expression search (in preg_match format). Any filename that matches this regex
212
+ * will not be transferred.
213
+ * @return $this
214
+ */
215
+ public function addRegexFilter($search)
216
+ {
217
+ $this->assertFileIteratorSet();
218
+ $this->sourceIterator = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Iterator\FilterIterator($this->sourceIterator, function ($i) use($search) {
219
+ return !preg_match($search, (string) $i);
220
+ });
221
+ $this->sourceIterator->rewind();
222
+ return $this;
223
+ }
224
+ /**
225
+ * Builds a UploadSync or DownloadSync object
226
+ *
227
+ * @return AbstractSync
228
+ */
229
+ public function build()
230
+ {
231
+ $this->validateRequirements();
232
+ $this->sourceConverter = $this->sourceConverter ?: $this->getDefaultSourceConverter();
233
+ $this->targetConverter = $this->targetConverter ?: $this->getDefaultTargetConverter();
234
+ // Only wrap the source iterator in a changed files iterator if we are not forcing the transfers
235
+ if (!$this->forcing) {
236
+ $this->sourceIterator->rewind();
237
+ $this->sourceIterator = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\ChangedFilesIterator(new \NoRewindIterator($this->sourceIterator), $this->getTargetIterator(), $this->sourceConverter, $this->targetConverter);
238
+ $this->sourceIterator->rewind();
239
+ }
240
+ $sync = $this->specificBuild();
241
+ if ($this->params) {
242
+ $this->addCustomParamListener($sync);
243
+ }
244
+ if ($this->debug) {
245
+ $this->addDebugListener($sync, is_bool($this->debug) ? STDOUT : $this->debug);
246
+ }
247
+ return $sync;
248
+ }
249
+ /**
250
+ * Hook to implement in subclasses
251
+ *
252
+ * @return AbstractSync
253
+ */
254
+ protected abstract function specificBuild();
255
+ /**
256
+ * @return \Iterator
257
+ */
258
+ protected abstract function getTargetIterator();
259
+ /**
260
+ * @return FilenameConverterInterface
261
+ */
262
+ protected abstract function getDefaultSourceConverter();
263
+ /**
264
+ * @return FilenameConverterInterface
265
+ */
266
+ protected abstract function getDefaultTargetConverter();
267
+ /**
268
+ * Add a listener to the sync object to output debug information while transferring
269
+ *
270
+ * @param AbstractSync $sync Sync object to listen to
271
+ * @param resource $resource Where to write debug messages
272
+ */
273
+ protected abstract function addDebugListener(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\AbstractSync $sync, $resource);
274
+ /**
275
+ * Validate that the builder has the minimal requirements
276
+ *
277
+ * @throws RuntimeException if the builder is not configured completely
278
+ */
279
+ protected function validateRequirements()
280
+ {
281
+ if (!$this->client) {
282
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException('No client was provided');
283
+ }
284
+ if (!$this->bucket) {
285
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException('No bucket was provided');
286
+ }
287
+ $this->assertFileIteratorSet();
288
+ }
289
+ /**
290
+ * Ensure that the base file iterator has been provided
291
+ *
292
+ * @throws RuntimeException
293
+ */
294
+ protected function assertFileIteratorSet()
295
+ {
296
+ // Interesting... Need to use isset because: Object of class GlobIterator could not be converted to boolean
297
+ if (!isset($this->sourceIterator)) {
298
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException('A source file iterator must be specified');
299
+ }
300
+ }
301
+ /**
302
+ * Wraps a generated iterator in a filter iterator that removes directories
303
+ *
304
+ * @param \Iterator $iterator Iterator to wrap
305
+ *
306
+ * @return \Iterator
307
+ * @throws UnexpectedValueException
308
+ */
309
+ protected function filterIterator(\Iterator $iterator)
310
+ {
311
+ $f = new \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Iterator\FilterIterator($iterator, function ($i) {
312
+ if (!$i instanceof \SplFileInfo) {
313
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\UnexpectedValueException('All iterators for UploadSync must return SplFileInfo objects');
314
+ }
315
+ return $i->isFile();
316
+ });
317
+ $f->rewind();
318
+ return $f;
319
+ }
320
+ /**
321
+ * Add the custom param listener to a transfer object
322
+ *
323
+ * @param HasDispatcherInterface $sync
324
+ */
325
+ protected function addCustomParamListener(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\HasDispatcherInterface $sync)
326
+ {
327
+ $params = $this->params;
328
+ $sync->getEventDispatcher()->addListener(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\UploadSync::BEFORE_TRANSFER, function (\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event $e) use($params) {
329
+ if ($e['command'] instanceof CommandInterface) {
330
+ $e['command']->overwriteWith($params);
331
+ }
332
+ });
333
+ }
334
+ /**
335
+ * Create an Amazon S3 file iterator based on the given builder settings
336
+ *
337
+ * @return OpendirIterator
338
+ */
339
+ protected function createS3Iterator()
340
+ {
341
+ // Ensure that the stream wrapper is registered
342
+ $this->client->registerStreamWrapper();
343
+ // Calculate the opendir() bucket and optional key prefix location
344
+ $dir = "s3://{$this->bucket}";
345
+ if ($this->keyPrefix) {
346
+ $dir .= '/' . ltrim($this->keyPrefix, '/ ');
347
+ }
348
+ // Use opendir so that we can pass stream context to the iterator
349
+ $dh = opendir($dir, stream_context_create(array('s3' => array('delimiter' => '', 'listFilter' => function ($obj) {
350
+ // Ensure that we do not try to download a glacier object.
351
+ return !isset($obj['StorageClass']) || $obj['StorageClass'] != 'GLACIER';
352
+ }))));
353
+ // Add the trailing slash for the OpendirIterator concatenation
354
+ if (!$this->keyPrefix) {
355
+ $dir .= '/';
356
+ }
357
+ return $this->filterIterator(new \NoRewindIterator(new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Iterator\OpendirIterator($dh, $dir)));
358
+ }
359
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/ChangedFilesIterator.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync;
18
+
19
+ /**
20
+ * Iterator used to filter an internal iterator to only yield files that do not exist in the target iterator or files
21
+ * that have changed
22
+ */
23
+ class ChangedFilesIterator extends \FilterIterator
24
+ {
25
+ /** @var \Iterator */
26
+ protected $sourceIterator;
27
+ /** @var \Iterator */
28
+ protected $targetIterator;
29
+ /** @var FilenameConverterInterface */
30
+ protected $sourceConverter;
31
+ /** @var FilenameConverterInterface */
32
+ protected $targetConverter;
33
+ /** @var array Previously loaded data */
34
+ protected $cache = array();
35
+ /**
36
+ * @param \Iterator $sourceIterator Iterator to wrap and filter
37
+ * @param \Iterator $targetIterator Iterator used to compare against the source iterator
38
+ * @param FilenameConverterInterface $sourceConverter Key converter to convert source to target keys
39
+ * @param FilenameConverterInterface $targetConverter Key converter to convert target to source keys
40
+ */
41
+ public function __construct(\Iterator $sourceIterator, \Iterator $targetIterator, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\FilenameConverterInterface $sourceConverter, \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\FilenameConverterInterface $targetConverter)
42
+ {
43
+ $this->targetIterator = $targetIterator;
44
+ $this->sourceConverter = $sourceConverter;
45
+ $this->targetConverter = $targetConverter;
46
+ parent::__construct($sourceIterator);
47
+ }
48
+ public function accept()
49
+ {
50
+ $current = $this->current();
51
+ $key = $this->sourceConverter->convert($this->normalize($current));
52
+ if (!($data = $this->getTargetData($key))) {
53
+ return true;
54
+ }
55
+ // Ensure the Content-Length matches and it hasn't been modified since the mtime
56
+ return $current->getSize() != $data[0] || $current->getMTime() > $data[1];
57
+ }
58
+ /**
59
+ * Returns an array of the files from the target iterator that were not found in the source iterator
60
+ *
61
+ * @return array
62
+ */
63
+ public function getUnmatched()
64
+ {
65
+ return array_keys($this->cache);
66
+ }
67
+ /**
68
+ * Get key information from the target iterator for a particular filename
69
+ *
70
+ * @param string $key Target iterator filename
71
+ *
72
+ * @return array|bool Returns an array of data, or false if the key is not in the iterator
73
+ */
74
+ protected function getTargetData($key)
75
+ {
76
+ $key = $this->cleanKey($key);
77
+ if (isset($this->cache[$key])) {
78
+ $result = $this->cache[$key];
79
+ unset($this->cache[$key]);
80
+ return $result;
81
+ }
82
+ $it = $this->targetIterator;
83
+ while ($it->valid()) {
84
+ $value = $it->current();
85
+ $data = array($value->getSize(), $value->getMTime());
86
+ $filename = $this->targetConverter->convert($this->normalize($value));
87
+ $filename = $this->cleanKey($filename);
88
+ if ($filename == $key) {
89
+ return $data;
90
+ }
91
+ $this->cache[$filename] = $data;
92
+ $it->next();
93
+ }
94
+ return false;
95
+ }
96
+ private function normalize($current)
97
+ {
98
+ $asString = (string) $current;
99
+ return strpos($asString, 's3://') === 0 ? $asString : $current->getRealPath();
100
+ }
101
+ private function cleanKey($key)
102
+ {
103
+ return ltrim($key, '/');
104
+ }
105
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/DownloadSync.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\ResumableDownload;
21
+ /**
22
+ * Downloads and Amazon S3 bucket to a local directory
23
+ */
24
+ class DownloadSync extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\AbstractSync
25
+ {
26
+ protected function createTransferAction(\SplFileInfo $file)
27
+ {
28
+ $sourceFilename = $file->getPathname();
29
+ list($bucket, $key) = explode('/', substr($sourceFilename, 5), 2);
30
+ $filename = $this->options['source_converter']->convert($sourceFilename);
31
+ $this->createDirectory($filename);
32
+ // Some S3 buckets contains nested files under the same name as a directory
33
+ if (is_dir($filename)) {
34
+ return false;
35
+ }
36
+ // Allow a previously interrupted download to resume
37
+ if (file_exists($filename) && $this->options['resumable']) {
38
+ return new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\ResumableDownload($this->options['client'], $bucket, $key, $filename);
39
+ }
40
+ return $this->options['client']->getCommand('GetObject', array('Bucket' => $bucket, 'Key' => $key, 'SaveAs' => $filename));
41
+ }
42
+ /**
43
+ * @codeCoverageIgnore
44
+ */
45
+ protected function createDirectory($filename)
46
+ {
47
+ $directory = dirname($filename);
48
+ // Some S3 clients create empty files to denote directories. Remove these so that we can create the directory.
49
+ if (is_file($directory) && filesize($directory) == 0) {
50
+ unlink($directory);
51
+ }
52
+ // Create the directory if it does not exist
53
+ if (!is_dir($directory) && !mkdir($directory, 0777, true)) {
54
+ $errors = error_get_last();
55
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException('Could not create directory: ' . $directory . ' - ' . $errors['message']);
56
+ }
57
+ }
58
+ protected function filterCommands(array $commands)
59
+ {
60
+ // Build a list of all of the directories in each command so that we don't attempt to create an empty dir in
61
+ // the same parallel transfer as attempting to create a file in that dir
62
+ $dirs = array();
63
+ foreach ($commands as $command) {
64
+ $parts = array_values(array_filter(explode('/', $command['SaveAs'])));
65
+ for ($i = 0, $total = count($parts); $i < $total; $i++) {
66
+ $dir = '';
67
+ for ($j = 0; $j < $i; $j++) {
68
+ $dir .= '/' . $parts[$j];
69
+ }
70
+ if ($dir && !in_array($dir, $dirs)) {
71
+ $dirs[] = $dir;
72
+ }
73
+ }
74
+ }
75
+ return array_filter($commands, function ($command) use($dirs) {
76
+ return !in_array($command['SaveAs'], $dirs);
77
+ });
78
+ }
79
+ protected function transferCommands(array $commands)
80
+ {
81
+ parent::transferCommands($this->filterCommands($commands));
82
+ }
83
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/DownloadSyncBuilder.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\ResumableDownload;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBodyInterface;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface;
24
+ class DownloadSyncBuilder extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\AbstractSyncBuilder
25
+ {
26
+ /** @var bool */
27
+ protected $resumable = false;
28
+ /** @var string */
29
+ protected $directory;
30
+ /** @var int Number of files that can be transferred concurrently */
31
+ protected $concurrency = 5;
32
+ /**
33
+ * Set the directory where the objects from be downloaded to
34
+ *
35
+ * @param string $directory Directory
36
+ *
37
+ * @return $this
38
+ */
39
+ public function setDirectory($directory)
40
+ {
41
+ $this->directory = $directory;
42
+ return $this;
43
+ }
44
+ /**
45
+ * Call this function to allow partial downloads to be resumed if the download was previously interrupted
46
+ *
47
+ * @return self
48
+ */
49
+ public function allowResumableDownloads()
50
+ {
51
+ $this->resumable = true;
52
+ return $this;
53
+ }
54
+ protected function specificBuild()
55
+ {
56
+ $sync = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\DownloadSync(array('client' => $this->client, 'bucket' => $this->bucket, 'iterator' => $this->sourceIterator, 'source_converter' => $this->sourceConverter, 'target_converter' => $this->targetConverter, 'concurrency' => $this->concurrency, 'resumable' => $this->resumable, 'directory' => $this->directory));
57
+ return $sync;
58
+ }
59
+ protected function getTargetIterator()
60
+ {
61
+ if (!$this->directory) {
62
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException('A directory is required');
63
+ }
64
+ if (!is_dir($this->directory) && !mkdir($this->directory, 0777, true)) {
65
+ // @codeCoverageIgnoreStart
66
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException('Unable to create root download directory: ' . $this->directory);
67
+ // @codeCoverageIgnoreEnd
68
+ }
69
+ return $this->filterIterator(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->directory)));
70
+ }
71
+ protected function getDefaultSourceConverter()
72
+ {
73
+ return new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\KeyConverter("s3://{$this->bucket}/{$this->baseDir}", $this->directory . DIRECTORY_SEPARATOR, $this->delimiter);
74
+ }
75
+ protected function getDefaultTargetConverter()
76
+ {
77
+ return new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\KeyConverter("s3://{$this->bucket}/{$this->baseDir}", '', $this->delimiter);
78
+ }
79
+ protected function assertFileIteratorSet()
80
+ {
81
+ $this->sourceIterator = $this->sourceIterator ?: $this->createS3Iterator();
82
+ }
83
+ protected function addDebugListener(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\AbstractSync $sync, $resource)
84
+ {
85
+ $sync->getEventDispatcher()->addListener(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\UploadSync::BEFORE_TRANSFER, function (\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event $e) use($resource) {
86
+ if ($e['command'] instanceof CommandInterface) {
87
+ $from = $e['command']['Bucket'] . '/' . $e['command']['Key'];
88
+ $to = $e['command']['SaveAs'] instanceof EntityBodyInterface ? $e['command']['SaveAs']->getUri() : $e['command']['SaveAs'];
89
+ fwrite($resource, "Downloading {$from} -> {$to}\n");
90
+ } elseif ($e['command'] instanceof ResumableDownload) {
91
+ $from = $e['command']->getBucket() . '/' . $e['command']->getKey();
92
+ $to = $e['command']->getFilename();
93
+ fwrite($resource, "Resuming {$from} -> {$to}\n");
94
+ }
95
+ });
96
+ }
97
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/FilenameConverterInterface.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync;
18
+
19
+ /**
20
+ * Converts filenames from one system to another (e.g. local to Amazon S3)
21
+ */
22
+ interface FilenameConverterInterface
23
+ {
24
+ /**
25
+ * Convert a filename
26
+ *
27
+ * @param string $filename Name of the file to convert
28
+ *
29
+ * @return string
30
+ */
31
+ public function convert($filename);
32
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/KeyConverter.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync;
18
+
19
+ /**
20
+ * Converts filenames from one system to another
21
+ */
22
+ class KeyConverter implements \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\FilenameConverterInterface
23
+ {
24
+ /** @var string Directory separator for Amazon S3 keys */
25
+ protected $delimiter;
26
+ /** @var string Prefix to prepend to each Amazon S3 object key */
27
+ protected $prefix;
28
+ /** @var string Base directory to remove from each file path before converting to an object key */
29
+ protected $baseDir;
30
+ /**
31
+ * @param string $baseDir Base directory to remove from each converted name
32
+ * @param string $prefix Amazon S3 prefix
33
+ * @param string $delimiter Directory separator used with generated names
34
+ */
35
+ public function __construct($baseDir = '', $prefix = '', $delimiter = '/')
36
+ {
37
+ $this->baseDir = (string) $baseDir;
38
+ $this->prefix = $prefix;
39
+ $this->delimiter = $delimiter;
40
+ }
41
+ public function convert($filename)
42
+ {
43
+ $key = $filename;
44
+ // Remove base directory from the key (only the first occurrence)
45
+ if ($this->baseDir && false !== ($pos = strpos($filename, $this->baseDir))) {
46
+ $key = substr_replace($key, '', $pos, strlen($this->baseDir));
47
+ }
48
+ // Replace Windows directory separators to become Unix style, and convert that to the custom dir separator
49
+ $key = str_replace('/', $this->delimiter, str_replace('\\', '/', $key));
50
+ // Add the key prefix and remove double slashes that are not in the protocol (e.g. prefixed with ":")
51
+ $delim = preg_quote($this->delimiter);
52
+ $key = preg_replace("#(?<!:){$delim}{$delim}#", $this->delimiter, $this->prefix . $key);
53
+ return $key;
54
+ }
55
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/UploadSync.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync;
18
+
19
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload\UploadBuilder;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload\AbstractTransfer;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBody;
23
+ /**
24
+ * Uploads a local directory tree to Amazon S3
25
+ */
26
+ class UploadSync extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\AbstractSync
27
+ {
28
+ const BEFORE_MULTIPART_BUILD = 's3.sync.before_multipart_build';
29
+ protected function init()
30
+ {
31
+ if (null == $this->options['multipart_upload_size']) {
32
+ $this->options['multipart_upload_size'] = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload\AbstractTransfer::MIN_PART_SIZE;
33
+ }
34
+ }
35
+ protected function createTransferAction(\SplFileInfo $file)
36
+ {
37
+ // Open the file for reading
38
+ $filename = $file->getRealPath() ?: $file->getPathName();
39
+ if (!($resource = fopen($filename, 'r'))) {
40
+ // @codeCoverageIgnoreStart
41
+ throw new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Exception\RuntimeException('Could not open ' . $file->getPathname() . ' for reading');
42
+ // @codeCoverageIgnoreEnd
43
+ }
44
+ $key = $this->options['source_converter']->convert($filename);
45
+ $body = \DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Http\EntityBody::factory($resource);
46
+ // Determine how the ACL should be applied
47
+ if ($acl = $this->options['acl']) {
48
+ $aclType = is_string($this->options['acl']) ? 'ACL' : 'ACP';
49
+ } else {
50
+ $acl = 'private';
51
+ $aclType = 'ACL';
52
+ }
53
+ // Use a multi-part upload if the file is larger than the cutoff size and is a regular file
54
+ if ($body->getWrapper() == 'plainfile' && $file->getSize() >= $this->options['multipart_upload_size']) {
55
+ $builder = \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\MultipartUpload\UploadBuilder::newInstance()->setBucket($this->options['bucket'])->setKey($key)->setMinPartSize($this->options['multipart_upload_size'])->setOption($aclType, $acl)->setClient($this->options['client'])->setSource($body)->setConcurrency($this->options['concurrency']);
56
+ $this->dispatch(self::BEFORE_MULTIPART_BUILD, array('builder' => $builder, 'file' => $file));
57
+ return $builder->build();
58
+ }
59
+ return $this->options['client']->getCommand('PutObject', array('Bucket' => $this->options['bucket'], 'Key' => $key, 'Body' => $body, $aclType => $acl));
60
+ }
61
+ }
vendor/Aws2/aws/aws-sdk-php/src/Aws/S3/Sync/UploadSyncBuilder.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License").
7
+ * You may not use this file except in compliance with the License.
8
+ * A copy of the License is located at
9
+ *
10
+ * http://aws.amazon.com/apache2.0
11
+ *
12
+ * or in the "license" file accompanying this file. This file is distributed
13
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ * express or implied. See the License for the specific language governing
15
+ * permissions and limitations under the License.
16
+ */
17
+ namespace DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync;
18
+
19
+ use FilesystemIterator as FI;
20
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\AbstractTransfer;
21
+ use DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\Acp;
22
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\HasDispatcherInterface;
23
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event;
24
+ use DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Service\Command\CommandInterface;
25
+ class UploadSyncBuilder extends \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\AbstractSyncBuilder
26
+ {
27
+ /** @var string|Acp Access control policy to set on each object */
28
+ protected $acp = 'private';
29
+ /** @var int */
30
+ protected $multipartUploadSize;
31
+ /**
32
+ * Set the path that contains files to recursively upload to Amazon S3
33
+ *
34
+ * @param string $path Path that contains files to upload
35
+ *
36
+ * @return $this
37
+ */
38
+ public function uploadFromDirectory($path)
39
+ {
40
+ $this->baseDir = realpath($path);
41
+ $this->sourceIterator = $this->filterIterator(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS | \FilesystemIterator::FOLLOW_SYMLINKS)));
42
+ return $this;
43
+ }
44
+ /**
45
+ * Set a glob expression that will match files to upload to Amazon S3
46
+ *
47
+ * @param string $glob Glob expression
48
+ *
49
+ * @return $this
50
+ * @link http://www.php.net/manual/en/function.glob.php
51
+ */
52
+ public function uploadFromGlob($glob)
53
+ {
54
+ $this->sourceIterator = $this->filterIterator(new \GlobIterator($glob, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS | \FilesystemIterator::FOLLOW_SYMLINKS));
55
+ return $this;
56
+ }
57
+ /**
58
+ * Set a canned ACL to apply to each uploaded object
59
+ *
60
+ * @param string $acl Canned ACL for each upload
61
+ *
62
+ * @return $this
63
+ */
64
+ public function setAcl($acl)
65
+ {
66
+ $this->acp = $acl;
67
+ return $this;
68
+ }
69
+ /**
70
+ * Set an Access Control Policy to apply to each uploaded object
71
+ *
72
+ * @param Acp $acp Access control policy
73
+ *
74
+ * @return $this
75
+ */
76
+ public function setAcp(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Model\Acp $acp)
77
+ {
78
+ $this->acp = $acp;
79
+ return $this;
80
+ }
81
+ /**
82
+ * Set the multipart upload size threshold. When the size of a file exceeds this value, the file will be uploaded
83
+ * using a multipart upload.
84
+ *
85
+ * @param int $size Size threshold
86
+ *
87
+ * @return $this
88
+ */
89
+ public function setMultipartUploadSize($size)
90
+ {
91
+ $this->multipartUploadSize = $size;
92
+ return $this;
93
+ }
94
+ protected function specificBuild()
95
+ {
96
+ $sync = new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\UploadSync(array('client' => $this->client, 'bucket' => $this->bucket, 'iterator' => $this->sourceIterator, 'source_converter' => $this->sourceConverter, 'target_converter' => $this->targetConverter, 'concurrency' => $this->concurrency, 'multipart_upload_size' => $this->multipartUploadSize, 'acl' => $this->acp));
97
+ return $sync;
98
+ }
99
+ protected function addCustomParamListener(\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\HasDispatcherInterface $sync)
100
+ {
101
+ // Handle the special multi-part upload event
102
+ parent::addCustomParamListener($sync);
103
+ $params = $this->params;
104
+ $sync->getEventDispatcher()->addListener(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\UploadSync::BEFORE_MULTIPART_BUILD, function (\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event $e) use($params) {
105
+ foreach ($params as $k => $v) {
106
+ $e['builder']->setOption($k, $v);
107
+ }
108
+ });
109
+ }
110
+ protected function getTargetIterator()
111
+ {
112
+ return $this->createS3Iterator();
113
+ }
114
+ protected function getDefaultSourceConverter()
115
+ {
116
+ return new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\KeyConverter($this->baseDir, $this->keyPrefix . $this->delimiter, $this->delimiter);
117
+ }
118
+ protected function getDefaultTargetConverter()
119
+ {
120
+ return new \DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\KeyConverter('s3://' . $this->bucket . '/', '', DIRECTORY_SEPARATOR);
121
+ }
122
+ protected function addDebugListener(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\AbstractSync $sync, $resource)
123
+ {
124
+ $sync->getEventDispatcher()->addListener(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\S3\Sync\UploadSync::BEFORE_TRANSFER, function (\DeliciousBrains\WP_Offload_S3\Aws2\Guzzle\Common\Event $e) use($resource) {
125
+ $c = $e['command'];
126
+ if ($c instanceof CommandInterface) {
127
+ $uri = $c['Body']->getUri();
128
+ $size = $c['Body']->getSize();
129
+ fwrite($resource, "Uploading {$uri} -> {$c['Key']} ({$size} bytes)\n");
130
+ return;
131
+ }
132
+ // Multipart upload
133
+ $body = $c->getSource();
134
+ $totalSize = $body->getSize();
135
+ $progress = 0;
136
+ fwrite($resource, "Beginning multipart upload: " . $body->getUri() . ' -> ');
137
+ fwrite($resource, $c->getState()->getFromId('Key') . " ({$totalSize} bytes)\n");
138
+ $c->getEventDispatcher()->addListener(\DeliciousBrains\WP_Offload_S3\Aws2\Aws\Common\Model\MultipartUpload\AbstractTransfer::BEFORE_PART_UPLOAD, function ($e) use(&$progress, $totalSize, $resource) {
139
+ $command = $e['command'];
140
+ $size = $command['Body']->getContentLength();
141
+ $percentage = number_format($progress / $totalSize * 100, 2);
142
+ fwrite($resource, "- Part {$command['PartNumber']} ({$size} bytes, {$percentage}%)\n");
143
+ $progress += $size;
144
+ });
145
+ });
146
+ }
147
+ }
vendor/Aws2/guzzle/guzzle/CHANGELOG.md ADDED
@@ -0,0 +1,751 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CHANGELOG
2
+
3
+ ## 3.9.3 - 2015-03-18
4
+
5
+ * Ensuring Content-Length is not stripped from a request when it is `0`.
6
+ * Added more information to stream wrapper exceptions.
7
+ * Message parser will no longer throw warnings for malformed messages.
8
+ * Giving a valid cache TTL when max-age is 0.
9
+
10
+ ## 3.9.2 - 2014-09-10
11
+
12
+ * Retrying "Connection died, retrying a fresh connect" curl errors.
13
+ * Automatically extracting the cacert from the phar in client constructor.
14
+ * Added EntityBody support for OPTIONS requests.
15
+
16
+ ## 3.9.1 - 2014-05-07
17
+
18
+ * Added a fix to ReadLimitEntityBody to ensure it doesn't infinitely loop.
19
+ * Added a fix to the stream checksum function so that when the first read
20
+ returns a falsey value, it still continues to consume the stream until EOF.
21
+
22
+ ## 3.9.0 - 2014-04-23
23
+
24
+ * `null`, `false`, and `"_guzzle_blank_"` all now serialize as an empty value
25
+ with no trailing "=". See dc1d824277.
26
+ * No longer performing an MD5 check on the cacert each time the phar is used,
27
+ but rather copying the cacert to the temp directory.
28
+ * `"0"` can now be added as a URL path
29
+ * Deleting cookies that are set to empty
30
+ * If-Modified-Since is no longer unnecessarily added to the CachePlugin
31
+ * Cookie path matching now follows RFC 6265 s5.1.4
32
+ * Updated service descriptions are now added to a service client's composite
33
+ factory.
34
+ * MockPlugin now throws an exception if the queue is empty.
35
+ * Properly parsing URLs that start with "http" but are not absolute
36
+ * Added the ability to configure the curl_multi_select timeout setting
37
+ * OAuth parameters are now sorted using lexicographical byte value ordering
38
+ * Fixing invalid usage of an out of range PHP feature in the ErrorResponsePlugin
39
+
40
+ ## 3.8.1 -2014-01-28
41
+
42
+ * Bug: Always using GET requests when redirecting from a 303 response
43
+ * Bug: CURLOPT_SSL_VERIFYHOST is now correctly set to false when setting `$certificateAuthority` to false in
44
+ `Guzzle\Http\ClientInterface::setSslVerification()`
45
+ * Bug: RedirectPlugin now uses strict RFC 3986 compliance when combining a base URL with a relative URL
46
+ * Bug: The body of a request can now be set to `"0"`
47
+ * Sending PHP stream requests no longer forces `HTTP/1.0`
48
+ * Adding more information to ExceptionCollection exceptions so that users have more context, including a stack trace of
49
+ each sub-exception
50
+ * Updated the `$ref` attribute in service descriptions to merge over any existing parameters of a schema (rather than
51
+ clobbering everything).
52
+ * Merging URLs will now use the query string object from the relative URL (thus allowing custom query aggregators)
53
+ * Query strings are now parsed in a way that they do no convert empty keys with no value to have a dangling `=`.
54
+ For example `foo&bar=baz` is now correctly parsed and recognized as `foo&bar=baz` rather than `foo=&bar=baz`.
55
+ * Now properly escaping the regular expression delimiter when matching Cookie domains.
56
+ * Network access is now disabled when loading XML documents
57
+
58
+ ## 3.8.0 - 2013-12-05
59
+
60
+ * Added the ability to define a POST name for a file
61
+ * JSON response parsing now properly walks additionalProperties
62
+ * cURL error code 18 is now retried automatically in the BackoffPlugin
63
+ * Fixed a cURL error when URLs contain fragments
64
+ * Fixed an issue in the BackoffPlugin retry event where it was trying to access all exceptions as if they were
65
+ CurlExceptions
66
+ * CURLOPT_PROGRESS function fix for PHP 5.5 (69fcc1e)
67
+ * Added the ability for Guzzle to work with older versions of cURL that do not support `CURLOPT_TIMEOUT_MS`
68
+ * Fixed a bug that was encountered when parsing empty header parameters
69
+ * UriTemplate now has a `setRegex()` method to match the docs
70
+ * The `debug` request parameter now checks if it is truthy rather than if it exists
71
+ * Setting the `debug` request parameter to true shows verbose cURL output instead of using the LogPlugin
72
+ * Added the ability to combine URLs using strict RFC 3986 compliance
73
+ * Command objects can now return the validation errors encountered by the command
74
+ * Various fixes to cache revalidation (#437 and 29797e5)
75
+ * Various fixes to the AsyncPlugin
76
+ * Cleaned up build scripts
77
+
78
+ ## 3.7.4 - 2013-10-02
79
+
80
+ * Bug fix: 0 is now an allowed value in a description parameter that has a default value (#430)
81
+ * Bug fix: SchemaFormatter now returns an integer when formatting to a Unix timestamp
82
+ (see https://github.com/aws/aws-sdk-php/issues/147)
83
+ * Bug fix: Cleaned up and fixed URL dot segment removal to properly resolve internal dots
84
+ * Minimum PHP version is now properly specified as 5.3.3 (up from 5.3.2) (#420)
85
+ * Updated the bundled cacert.pem (#419)
86
+ * OauthPlugin now supports adding authentication to headers or query string (#425)
87
+
88
+ ## 3.7.3 - 2013-09-08
89
+
90
+ * Added the ability to get the exception associated with a request/command when using `MultiTransferException` and
91
+ `CommandTransferException`.
92
+ * Setting `additionalParameters` of a response to false is now honored when parsing responses with a service description
93
+ * Schemas are only injected into response models when explicitly configured.
94
+ * No longer guessing Content-Type based on the path of a request. Content-Type is now only guessed based on the path of
95
+ an EntityBody.
96
+ * Bug fix: ChunkedIterator can now properly chunk a \Traversable as well as an \Iterator.
97
+ * Bug fix: FilterIterator now relies on `\Iterator` instead of `\Traversable`.
98
+ * Bug fix: Gracefully handling malformed responses in RequestMediator::writeResponseBody()
99
+ * Bug fix: Replaced call to canCache with canCacheRequest in the CallbackCanCacheStrategy of the CachePlugin
100
+ * Bug fix: Visiting XML attributes first before visting XML children when serializing requests
101
+ * Bug fix: Properly parsing headers that contain commas contained in quotes
102
+ * Bug fix: mimetype guessing based on a filename is now case-insensitive
103
+
104
+ ## 3.7.2 - 2013-08-02
105
+
106
+ * Bug fix: Properly URL encoding paths when using the PHP-only version of the UriTemplate expander
107
+ See https://github.com/guzzle/guzzle/issues/371
108
+ * Bug fix: Cookie domains are now matched correctly according to RFC 6265
109
+ See https://github.com/guzzle/guzzle/issues/377
110
+ * Bug fix: GET parameters are now used when calculating an OAuth signature
111
+ * Bug fix: Fixed an issue with cache revalidation where the If-None-Match header was being double quoted
112
+ * `Guzzle\Common\AbstractHasDispatcher::dispatch()` now returns the event that was dispatched
113
+ * `Guzzle\Http\QueryString::factory()` now guesses the most appropriate query aggregator to used based on the input.
114
+ See https://github.com/guzzle/guzzle/issues/379
115
+ * Added a way to add custom domain objects to service description parsing using the `operation.parse_class` event. See
116
+ https://github.com/guzzle/guzzle/pull/380
117
+ * cURL multi cleanup and optimizations
118
+
119
+ ## 3.7.1 - 2013-07-05
120
+
121
+ * Bug fix: Setting default options on a client now works
122
+ * Bug fix: Setting options on HEAD requests now works. See #352
123
+ * Bug fix: Moving stream factory before send event to before building the stream. See #353
124
+ * Bug fix: Cookies no longer match on IP addresses per RFC 6265
125
+ * Bug fix: Correctly parsing header parameters that are in `<>` and quotes
126
+ * Added `cert` and `ssl_key` as request options
127
+ * `Host` header can now diverge from the host part of a URL if the header is set manually
128
+ * `Guzzle\Service\Command\LocationVisitor\Request\XmlVisitor` was rewritten to change from using SimpleXML to XMLWriter
129
+ * OAuth parameters are only added via the plugin if they aren't already set
130
+ * Exceptions are now thrown when a URL cannot be parsed
131
+ * Returning `false` if `Guzzle\Http\EntityBody::getContentMd5()` fails
132
+ * Not setting a `Content-MD5` on a command if calculating the Content-MD5 fails via the CommandContentMd5Plugin
133
+
134
+ ## 3.7.0 - 2013-06-10
135
+
136
+ * See UPGRADING.md for more information on how to upgrade.
137
+ * Requests now support the ability to specify an array of $options when creating a request to more easily modify a
138
+ request. You can pass a 'request.options' configuration setting to a client to apply default request options to
139
+ every request created by a client (e.g. default query string variables, headers, curl options, etc).
140
+ * Added a static facade class that allows you to use Guzzle with static methods and mount the class to `\Guzzle`.
141
+ See `Guzzle\Http\StaticClient::mount`.
142
+ * Added `command.request_options` to `Guzzle\Service\Command\AbstractCommand` to pass request options to requests
143
+ created by a command (e.g. custom headers, query string variables, timeout settings, etc).
144
+ * Stream size in `Guzzle\Stream\PhpStreamRequestFactory` will now be set if Content-Length is returned in the
145
+ headers of a response
146
+ * Added `Guzzle\Common\Collection::setPath($path, $value)` to set a value into an array using a nested key
147
+ (e.g. `$collection->setPath('foo/baz/bar', 'test'); echo $collection['foo']['bar']['bar'];`)
148
+ * ServiceBuilders now support storing and retrieving arbitrary data
149
+ * CachePlugin can now purge all resources for a given URI
150
+ * CachePlugin can automatically purge matching cached items when a non-idempotent request is sent to a resource
151
+ * CachePlugin now uses the Vary header to determine if a resource is a cache hit
152
+ * `Guzzle\Http\Message\Response` now implements `\Serializable`
153
+ * Added `Guzzle\Cache\CacheAdapterFactory::fromCache()` to more easily create cache adapters
154
+ * `Guzzle\Service\ClientInterface::execute()` now accepts an array, single command, or Traversable
155
+ * Fixed a bug in `Guzzle\Http\Message\Header\Link::addLink()`
156
+ * Better handling of calculating the size of a stream in `Guzzle\Stream\Stream` using fstat() and caching the size
157
+ * `Guzzle\Common\Exception\ExceptionCollection` now creates a more readable exception message
158
+ * Fixing BC break: Added back the MonologLogAdapter implementation rather than extending from PsrLog so that older
159
+ Symfony users can still use the old version of Monolog.
160
+ * Fixing BC break: Added the implementation back in for `Guzzle\Http\Message\AbstractMessage::getTokenizedHeader()`.
161
+ Now triggering an E_USER_DEPRECATED warning when used. Use `$message->getHeader()->parseParams()`.
162
+ * Several performance improvements to `Guzzle\Common\Collection`
163
+ * Added an `$options` argument to the end of the following methods of `Guzzle\Http\ClientInterface`:
164
+ createRequest, head, delete, put, patch, post, options, prepareRequest
165
+ * Added an `$options` argument to the end of `Guzzle\Http\Message\Request\RequestFactoryInterface::createRequest()`
166
+ * Added an `applyOptions()` method to `Guzzle\Http\Message\Request\RequestFactoryInterface`
167
+ * Changed `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $body = null)` to
168
+ `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $options = array())`. You can still pass in a
169
+ resource, string, or EntityBody into the $options parameter to specify the download location of the response.
170
+ * Changed `Guzzle\Common\Collection::__construct($data)` to no longer accepts a null value for `$data` but a
171
+ default `array()`
172
+ * Added `Guzzle\Stream\StreamInterface::isRepeatable`
173
+ * Removed `Guzzle\Http\ClientInterface::setDefaultHeaders(). Use
174
+ $client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. or
175
+ $client->getConfig()->setPath('request.options/headers', array('header_name' => 'value'))`.
176
+ * Removed `Guzzle\Http\ClientInterface::getDefaultHeaders(). Use $client->getConfig()->getPath('request.options/headers')`.
177
+ * Removed `Guzzle\Http\ClientInterface::expandTemplate()`
178
+ * Removed `Guzzle\Http\ClientInterface::setRequestFactory()`
179
+ * Removed `Guzzle\Http\ClientInterface::getCurlMulti()`
180
+ * Removed `Guzzle\Http\Message\RequestInterface::canCache`
181
+ * Removed `Guzzle\Http\Message\RequestInterface::setIsRedirect`
182
+ * Removed `Guzzle\Http\Message\RequestInterface::isRedirect`
183
+ * Made `Guzzle\Http\Client::expandTemplate` and `getUriTemplate` protected methods.
184
+ * You can now enable E_USER_DEPRECATED warnings to see if you are using a deprecated method by setting
185
+ `Guzzle\Common\Version::$emitWarnings` to true.
186
+ * Marked `Guzzle\Http\Message\Request::isResponseBodyRepeatable()` as deprecated. Use
187
+ `$request->getResponseBody()->isRepeatable()` instead.
188
+ * Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use
189
+ `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead.
190
+ * Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use
191
+ `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead.
192
+ * Marked `Guzzle\Http\Message\Request::setIsRedirect()` as deprecated. Use the HistoryPlugin instead.
193
+ * Marked `Guzzle\Http\Message\Request::isRedirect()` as deprecated. Use the HistoryPlugin instead.
194
+ * Marked `Guzzle\Cache\CacheAdapterFactory::factory()` as deprecated
195
+ * Marked 'command.headers', 'command.response_body' and 'command.on_complete' as deprecated for AbstractCommand.
196
+ These will work through Guzzle 4.0
197
+ * Marked 'request.params' for `Guzzle\Http\Client` as deprecated. Use [request.options][params].
198
+ * Marked `Guzzle\Service\Client::enableMagicMethods()` as deprecated. Magic methods can no longer be disabled on a Guzzle\Service\Client.
199
+ * Marked `Guzzle\Service\Client::getDefaultHeaders()` as deprecated. Use $client->getConfig()->getPath('request.options/headers')`.
200
+ * Marked `Guzzle\Service\Client::setDefaultHeaders()` as deprecated. Use $client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`.
201
+ * Marked `Guzzle\Parser\Url\UrlParser` as deprecated. Just use PHP's `parse_url()` and percent encode your UTF-8.
202
+ * Marked `Guzzle\Common\Collection::inject()` as deprecated.
203
+ * Marked `Guzzle\Plugin\CurlAuth\CurlAuthPlugin` as deprecated. Use `$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest');`
204
+ * CacheKeyProviderInterface and DefaultCacheKeyProvider are no longer used. All of this logic is handled in a
205
+ CacheStorageInterface. These two objects and interface will be removed in a future version.
206
+ * Always setting X-cache headers on cached responses
207
+ * Default cache TTLs are now handled by the CacheStorageInterface of a CachePlugin
208
+ * `CacheStorageInterface::cache($key, Response $response, $ttl = null)` has changed to `cache(RequestInterface
209
+ $request, Response $response);`
210
+ * `CacheStorageInterface::fetch($key)` has changed to `fetch(RequestInterface $request);`
211
+ * `CacheStorageInterface::delete($key)` has changed to `delete(RequestInterface $request);`
212
+ * Added `CacheStorageInterface::purge($url)`
213
+ * `DefaultRevalidation::__construct(CacheKeyProviderInterface $cacheKey, CacheStorageInterface $cache, CachePlugin
214
+ $plugin)` has changed to `DefaultRevalidation::__construct(CacheStorageInterface $cache,
215
+ CanCacheStrategyInterface $canCache = null)`
216
+ * Added `RevalidationInterface::shouldRevalidate(RequestInterface $request, Response $response)`
217
+
218
+ ## 3.6.0 - 2013-05-29
219
+
220
+ * ServiceDescription now implements ToArrayInterface
221
+ * Added command.hidden_params to blacklist certain headers from being treated as additionalParameters
222
+ * Guzzle can now correctly parse incomplete URLs
223
+ * Mixed casing of headers are now forced to be a single consistent casing across all values for that header.
224
+ * Messages internally use a HeaderCollection object to delegate handling case-insensitive header resolution
225
+ * Removed the whole changedHeader() function system of messages because all header changes now go through addHeader().
226
+ * Specific header implementations can be created for complex headers. When a message creates a header, it uses a
227
+ HeaderFactory which can map specific headers to specific header classes. There is now a Link header and
228
+ CacheControl header implementation.
229
+ * Removed from interface: Guzzle\Http\ClientInterface::setUriTemplate
230
+ * Removed from interface: Guzzle\Http\ClientInterface::setCurlMulti()
231
+ * Removed Guzzle\Http\Message\Request::receivedRequestHeader() and implemented this functionality in
232
+ Guzzle\Http\Curl\RequestMediator
233
+ * Removed the optional $asString parameter from MessageInterface::getHeader(). Just cast the header to a string.
234
+ * Removed the optional $tryChunkedTransfer option from Guzzle\Http\Message\EntityEnclosingRequestInterface
235
+ * Removed the $asObjects argument from Guzzle\Http\Message\MessageInterface::getHeaders()
236
+ * Removed Guzzle\Parser\ParserRegister::get(). Use getParser()
237
+ * Removed Guzzle\Parser\ParserRegister::set(). Use registerParser().
238
+ * All response header helper functions return a string rather than mixing Header objects and strings inconsistently
239
+ * Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc are managed by Guzzle
240
+ directly via interfaces
241
+ * Removed the injecting of a request object onto a response object. The methods to get and set a request still exist
242
+ but are a no-op until removed.
243
+ * Most classes that used to require a ``Guzzle\Service\Command\CommandInterface` typehint now request a
244
+ `Guzzle\Service\Command\ArrayCommandInterface`.
245
+ * Added `Guzzle\Http\Message\RequestInterface::startResponse()` to the RequestInterface to handle injecting a response
246
+ on a request while the request is still being transferred
247
+ * The ability to case-insensitively search for header values
248
+ * Guzzle\Http\Message\Header::hasExactHeader
249
+ * Guzzle\Http\Message\Header::raw. Use getAll()
250
+ * Deprecated cache control specific methods on Guzzle\Http\Message\AbstractMessage. Use the CacheControl header object
251
+ instead.
252
+ * `Guzzle\Service\Command\CommandInterface` now extends from ToArrayInterface and ArrayAccess
253
+ * Added the ability to cast Model objects to a string to view debug information.
254
+
255
+ ## 3.5.0 - 2013-05-13
256
+
257
+ * Bug: Fixed a regression so that request responses are parsed only once per oncomplete event rather than multiple times
258
+ * Bug: Better cleanup of one-time events accross the board (when an event is meant to fire once, it will now remove
259
+ itself from the EventDispatcher)
260
+ * Bug: `Guzzle\Log\MessageFormatter` now properly writes "total_time" and "connect_time" values
261
+ * Bug: Cloning an EntityEnclosingRequest now clones the EntityBody too
262
+ * Bug: Fixed an undefined index error when parsing nested JSON responses with a sentAs parameter that reference a
263
+ non-existent key
264
+ * Bug: All __call() method arguments are now required (helps with mocking frameworks)
265
+ * Deprecating Response::getRequest() and now using a shallow clone of a request object to remove a circular reference
266
+ to help with refcount based garbage collection of resources created by sending a request
267
+ * Deprecating ZF1 cache and log adapters. These will be removed in the next major version.
268
+ * Deprecating `Response::getPreviousResponse()` (method signature still exists, but it'sdeprecated). Use the
269
+ HistoryPlugin for a history.
270
+ * Added a `responseBody` alias for the `response_body` location
271
+ * Refactored internals to no longer rely on Response::getRequest()
272
+ * HistoryPlugin can now be cast to a string
273
+ * HistoryPlugin now logs transactions rather than requests and responses to more accurately keep track of the requests
274
+ and responses that are sent over the wire
275
+ * Added `getEffectiveUrl()` and `getRedirectCount()` to Response objects
276
+
277
+ ## 3.4.3 - 2013-04-30
278
+
279
+ * Bug fix: Fixing bug introduced in 3.4.2 where redirect responses are duplicated on the final redirected response
280
+ * Added a check to re-extract the temp cacert bundle from the phar before sending each request
281
+
282
+ ## 3.4.2 - 2013-04-29
283
+
284
+ * Bug fix: Stream objects now work correctly with "a" and "a+" modes
285
+ * Bug fix: Removing `Transfer-Encoding: chunked` header when a Content-Length is present
286
+ * Bug fix: AsyncPlugin no longer forces HEAD requests
287
+ * Bug fix: DateTime timezones are now properly handled when using the service description schema formatter
288
+ * Bug fix: CachePlugin now properly handles stale-if-error directives when a request to the origin server fails
289
+ * Setting a response on a request will write to the custom request body from the response body if one is specified
290
+ * LogPlugin now writes to php://output when STDERR is undefined
291
+ * Added the ability to set multiple POST files for the same key in a single call
292
+ * application/x-www-form-urlencoded POSTs now use the utf-8 charset by default
293
+ * Added the ability to queue CurlExceptions to the MockPlugin
294
+ * Cleaned up how manual responses are queued on requests (removed "queued_response" and now using request.before_send)
295
+ * Configuration loading now allows remote files
296
+
297
+ ## 3.4.1 - 2013-04-16
298
+
299
+ * Large refactoring to how CurlMulti handles work. There is now a proxy that sits in front of a pool of CurlMulti
300
+ handles. This greatly simplifies the implementation, fixes a couple bugs, and provides a small performance boost.
301
+ * Exceptions are now properly grouped when sending requests in parallel
302
+ * Redirects are now properly aggregated when a multi transaction fails
303
+ * Redirects now set the response on the original object even in the event of a failure
304
+ * Bug fix: Model names are now properly set even when using $refs
305
+ * Added support for PHP 5.5's CurlFile to prevent warnings with the deprecated @ syntax
306
+ * Added support for oauth_callback in OAuth signatures
307
+ * Added support for oauth_verifier in OAuth signatures
308
+ * Added support to attempt to retrieve a command first literally, then ucfirst, the with inflection
309
+
310
+ ## 3.4.0 - 2013-04-11
311
+
312
+ * Bug fix: URLs are now resolved correctly based on http://tools.ietf.org/html/rfc3986#section-5.2. #289
313
+ * Bug fix: Absolute URLs with a path in a service description will now properly override the base URL. #289
314
+ * Bug fix: Parsing a query string with a single PHP array value will now result in an array. #263
315
+ * Bug fix: Better normalization of the User-Agent header to prevent duplicate headers. #264.
316
+ * Bug fix: Added `number` type to service descriptions.
317
+ * Bug fix: empty parameters are removed from an OAuth signature
318
+ * Bug fix: Revalidating a cache entry prefers the Last-Modified over the Date header
319
+ * Bug fix: Fixed "array to string" error when validating a union of types in a service description
320
+ * Bug fix: Removed code that attempted to determine the size of a stream when data is written to the stream
321
+ * Bug fix: Not including an `oauth_token` if the value is null in the OauthPlugin.
322
+ * Bug fix: Now correctly aggregating successful requests and failed requests in CurlMulti when a redirect occurs.
323
+ * The new default CURLOPT_TIMEOUT setting has been increased to 150 seconds so that Guzzle works on poor connections.
324
+ * Added a feature to EntityEnclosingRequest::setBody() that will automatically set the Content-Type of the request if
325
+ the Content-Type can be determined based on the entity body or the path of the request.
326
+ * Added the ability to overwrite configuration settings in a client when grabbing a throwaway client from a builder.
327
+ * Added support for a PSR-3 LogAdapter.
328
+ * Added a `command.after_prepare` event
329
+ * Added `oauth_callback` parameter to the OauthPlugin
330
+ * Added the ability to create a custom stream class when using a stream factory
331
+ * Added a CachingEntityBody decorator
332
+ * Added support for `additionalParameters` in service descriptions to define how custom parameters are serialized.
333
+ * The bundled SSL certificate is now provided in the phar file and extracted when running Guzzle from a phar.
334
+ * You can now send any EntityEnclosingRequest with POST fields or POST files and cURL will handle creating bodies
335
+ * POST requests using a custom entity body are now treated exactly like PUT requests but with a custom cURL method. This
336
+ means that the redirect behavior of POST requests with custom bodies will not be the same as POST requests that use
337
+ POST fields or files (the latter is only used when emulating a form POST in the browser).
338
+ * Lots of cleanup to CurlHandle::factory and RequestFactory::createRequest
339
+
340
+ ## 3.3.1 - 2013-03-10
341
+
342
+ * Added the ability to create PHP streaming responses from HTTP requests
343
+ * Bug fix: Running any filters when parsing response headers with service descriptions
344
+ * Bug fix: OauthPlugin fixes to allow for multi-dimensional array signing, and sorting parameters before signing
345
+ * Bug fix: Removed the adding of default empty arrays and false Booleans to responses in order to be consistent across
346
+ response location visitors.
347
+ * Bug fix: Removed the possibility of creating configuration files with circular dependencies
348
+ * RequestFactory::create() now uses the key of a POST file when setting the POST file name
349
+ * Added xmlAllowEmpty to serialize an XML body even if no XML specific parameters are set
350
+
351
+ ## 3.3.0 - 2013-03-03
352
+
353
+ * A large number of performance optimizations have been made
354
+ * Bug fix: Added 'wb' as a valid write mode for streams
355
+ * Bug fix: `Guzzle\Http\Message\Response::json()` now allows scalar values to be returned
356
+ * Bug fix: Fixed bug in `Guzzle\Http\Message\Response` where wrapping quotes were stripped from `getEtag()`
357
+ * BC: Removed `Guzzle\Http\Utils` class
358
+ * BC: Setting a service description on a client will no longer modify the client's command factories.
359
+ * BC: Emitting IO events from a RequestMediator is now a parameter that must be set in a request's curl options using
360
+ the 'emit_io' key. This was previously set under a request's parameters using 'curl.emit_io'
361
+ * BC: `Guzzle\Stream\Stream::getWrapper()` and `Guzzle\Stream\Stream::getSteamType()` are no longer converted to
362
+ lowercase
363
+ * Operation parameter objects are now lazy loaded internally
364
+ * Added ErrorResponsePlugin that can throw errors for responses defined in service description operations' errorResponses
365
+ * Added support for instantiating responseType=class responseClass classes. Classes must implement
366
+ `Guzzle\Service\Command\ResponseClassInterface`
367
+ * Added support for additionalProperties for top-level parameters in responseType=model responseClasses. These
368
+ additional properties also support locations and can be used to parse JSON responses where the outermost part of the
369
+ JSON is an array
370
+ * Added support for nested renaming of JSON models (rename sentAs to name)
371
+ * CachePlugin
372
+ * Added support for stale-if-error so that the CachePlugin can now serve stale content from the cache on error
373
+ * Debug headers can now added to cached response in the CachePlugin
374
+
375
+ ## 3.2.0 - 2013-02-14
376
+
377
+ * CurlMulti is no longer reused globally. A new multi object is created per-client. This helps to isolate clients.
378
+ * URLs with no path no longer contain a "/" by default
379
+ * Guzzle\Http\QueryString does no longer manages the leading "?". This is now handled in Guzzle\Http\Url.
380
+ * BadResponseException no longer includes the full request and response message
381
+ * Adding setData() to Guzzle\Service\Description\ServiceDescriptionInterface
382
+ * Adding getResponseBody() to Guzzle\Http\Message\RequestInterface
383
+ * Various updates to classes to use ServiceDescriptionInterface type hints rather than ServiceDescription
384
+ * Header values can now be normalized into distinct values when multiple headers are combined with a comma separated list
385
+ * xmlEncoding can now be customized for the XML declaration of a XML service description operation
386
+ * Guzzle\Http\QueryString now uses Guzzle\Http\QueryAggregator\QueryAggregatorInterface objects to add custom value
387
+ aggregation and no longer uses callbacks
388
+ * The URL encoding implementation of Guzzle\Http\QueryString can now be customized
389
+ * Bug fix: Filters were not always invoked for array service description parameters
390
+ * Bug fix: Redirects now use a target response body rather than a temporary response body
391
+ * Bug fix: The default exponential backoff BackoffPlugin was not giving when the request threshold was exceeded
392
+ * Bug fix: Guzzle now takes the first found value when grabbing Cache-Control directives
393
+
394
+ ## 3.1.2 - 2013-01-27
395
+
396
+ * Refactored how operation responses are parsed. Visitors now include a before() method responsible for parsing the
397
+ response body. For example, the XmlVisitor now parses the XML response into an array in the before() method.
398
+ * Fixed an issue where cURL would not automatically decompress responses when the Accept-Encoding header was sent
399
+ * CURLOPT_SSL_VERIFYHOST is never set to 1 because it is deprecated (see 5e0ff2ef20f839e19d1eeb298f90ba3598784444)
400
+ * Fixed a bug where redirect responses were not chained correctly using getPreviousResponse()
401
+ * Setting default headers on a client after setting the user-agent will not erase the user-agent setting
402
+
403
+ ## 3.1.1 - 2013-01-20
404
+
405
+ * Adding wildcard support to Guzzle\Common\Collection::getPath()
406
+ * Adding alias support to ServiceBuilder configs
407
+ * Adding Guzzle\Service\Resource\CompositeResourceIteratorFactory and cleaning up factory interface
408
+
409
+ ## 3.1.0 - 2013-01-12
410
+
411
+ * BC: CurlException now extends from RequestException rather than BadResponseException
412
+ * BC: Renamed Guzzle\Plugin\Cache\CanCacheStrategyInterface::canCache() to canCacheRequest() and added CanCacheResponse()
413
+ * Added getData to ServiceDescriptionInterface
414
+ * Added context array to RequestInterface::setState()
415
+ * Bug: Removing hard dependency on the BackoffPlugin from Guzzle\Http
416
+ * Bug: Adding required content-type when JSON request visitor adds JSON to a command
417
+ * Bug: Fixing the serialization of a service description with custom data
418
+ * Made it easier to deal with exceptions thrown when transferring commands or requests in parallel by providing
419
+ an array of successful and failed responses
420
+ * Moved getPath from Guzzle\Service\Resource\Model to Guzzle\Common\Collection
421
+ * Added Guzzle\Http\IoEmittingEntityBody
422
+ * Moved command filtration from validators to location visitors
423
+ * Added `extends` attributes to service description parameters
424
+ * Added getModels to ServiceDescriptionInterface
425
+
426
+ ## 3.0.7 - 2012-12-19
427
+
428
+ * Fixing phar detection when forcing a cacert to system if null or true
429
+ * Allowing filename to be passed to `Guzzle\Http\Message\Request::setResponseBody()`
430
+ * Cleaning up `Guzzle\Common\Collection::inject` method
431
+ * Adding a response_body location to service descriptions
432
+
433
+ ## 3.0.6 - 2012-12-09
434
+
435
+ * CurlMulti performance improvements
436
+ * Adding setErrorResponses() to Operation
437
+ * composer.json tweaks
438
+
439
+ ## 3.0.5 - 2012-11-18
440
+
441
+ * Bug: Fixing an infinite recursion bug caused from revalidating with the CachePlugin
442
+ * Bug: Response body can now be a string containing "0"
443
+ * Bug: Using Guzzle inside of a phar uses system by default but now allows for a custom cacert
444
+ * Bug: QueryString::fromString now properly parses query string parameters that contain equal signs
445
+ * Added support for XML attributes in service description responses
446
+ * DefaultRequestSerializer now supports array URI parameter values for URI template expansion
447
+ * Added better mimetype guessing to requests and post files
448
+
449
+ ## 3.0.4 - 2012-11-11
450
+
451
+ * Bug: Fixed a bug when adding multiple cookies to a request to use the correct glue value
452
+ * Bug: Cookies can now be added that have a name, domain, or value set to "0"
453
+ * Bug: Using the system cacert bundle when using the Phar
454
+ * Added json and xml methods to Response to make it easier to parse JSON and XML response data into data structures
455
+ * Enhanced cookie jar de-duplication
456
+ * Added the ability to enable strict cookie jars that throw exceptions when invalid cookies are added
457
+ * Added setStream to StreamInterface to actually make it possible to implement custom rewind behavior for entity bodies
458
+ * Added the ability to create any sort of hash for a stream rather than just an MD5 hash
459
+
460
+ ## 3.0.3 - 2012-11-04
461
+
462
+ * Implementing redirects in PHP rather than cURL
463
+ * Added PECL URI template extension and using as default parser if available
464
+ * Bug: Fixed Content-Length parsing of Response factory
465
+ * Adding rewind() method to entity bodies and streams. Allows for custom rewinding of non-repeatable streams.
466
+ * Adding ToArrayInterface throughout library
467
+ * Fixing OauthPlugin to create unique nonce values per request
468
+
469
+ ## 3.0.2 - 2012-10-25
470
+
471
+ * Magic methods are enabled by default on clients
472
+ * Magic methods return the result of a command
473
+ * Service clients no longer require a base_url option in the factory
474
+ * Bug: Fixed an issue with URI templates where null template variables were being expanded
475
+
476
+ ## 3.0.1 - 2012-10-22
477
+
478
+ * Models can now be used like regular collection objects by calling filter, map, etc
479
+ * Models no longer require a Parameter structure or initial data in the constructor
480
+ * Added a custom AppendIterator to get around a PHP bug with the `\AppendIterator`
481
+
482
+ ## 3.0.0 - 2012-10-15
483
+
484
+ * Rewrote service description format to be based on Swagger
485
+ * Now based on JSON schema
486
+ * Added nested input structures and nested response models
487
+ * Support for JSON and XML input and output models
488
+ * Renamed `commands` to `operations`
489
+ * Removed dot class notation
490
+ * Removed custom types
491
+ * Broke the project into smaller top-level namespaces to be more component friendly
492
+ * Removed support for XML configs and descriptions. Use arrays or JSON files.
493
+ * Removed the Validation component and Inspector
494
+ * Moved all cookie code to Guzzle\Plugin\Cookie
495
+ * Magic methods on a Guzzle\Service\Client now return the command un-executed.
496
+ * Calling getResult() or getResponse() on a command will lazily execute the command if needed.
497
+ * Now shipping with cURL's CA certs and using it by default
498
+ * Added previousResponse() method to response objects
499
+ * No longer sending Accept and Accept-Encoding headers on every request
500
+ * Only sending an Expect header by default when a payload is greater than 1MB
501
+ * Added/moved client options:
502
+ * curl.blacklist to curl.option.blacklist
503
+ * Added ssl.certificate_authority
504
+ * Added a Guzzle\Iterator component
505
+ * Moved plugins from Guzzle\Http\Plugin to Guzzle\Plugin
506
+ * Added a more robust backoff retry strategy (replaced the ExponentialBackoffPlugin)
507
+ * Added a more robust caching plugin
508
+ * Added setBody to response objects
509
+ * Updating LogPlugin to use a more flexible MessageFormatter
510
+ * Added a completely revamped build process
511
+ * Cleaning up Collection class and removing default values from the get method
512
+ * Fixed ZF2 cache adapters
513
+
514
+ ## 2.8.8 - 2012-10-15
515
+
516
+ * Bug: Fixed a cookie issue that caused dot prefixed domains to not match where popular browsers did
517
+
518
+ ## 2.8.7 - 2012-09-30
519
+
520
+ * Bug: Fixed config file aliases for JSON includes
521
+ * Bug: Fixed cookie bug on a request object by using CookieParser to parse cookies on requests
522
+ * Bug: Removing the path to a file when sending a Content-Disposition header on a POST upload
523
+ * Bug: Hardening request and response parsing to account for missing parts
524
+ * Bug: Fixed PEAR packaging
525
+ * Bug: Fixed Request::getInfo
526
+ * Bug: Fixed cases where CURLM_CALL_MULTI_PERFORM return codes were causing curl transactions to fail
527
+ * Adding the ability for the namespace Iterator factory to look in multiple directories
528
+ * Added more getters/setters/removers from service descriptions
529
+ * Added the ability to remove POST fields from OAuth signatures
530
+ * OAuth plugin now supports 2-legged OAuth
531
+
532
+ ## 2.8.6 - 2012-09-05
533
+
534
+ * Added the ability to modify and build service descriptions
535
+ * Added the use of visitors to apply parameters to locations in service descriptions using the dynamic command
536
+ * Added a `json` parameter location
537
+ * Now allowing dot notation for classes in the CacheAdapterFactory
538
+ * Using the union of two arrays rather than an array_merge when extending service builder services and service params
539
+ * Ensuring that a service is a string before doing strpos() checks on it when substituting services for references
540
+ in service builder config files.
541
+ * Services defined in two different config files that include one another will by default replace the previously
542
+ defined service, but you can now create services that extend themselves and merge their settings over the previous
543
+ * The JsonLoader now supports aliasing filenames with different filenames. This allows you to alias something like
544
+ '_default' with a default JSON configuration file.
545
+
546
+ ## 2.8.5 - 2012-08-29
547
+
548
+ * Bug: Suppressed empty arrays from URI templates
549
+ * Bug: Added the missing $options argument from ServiceDescription::factory to enable caching
550
+ * Added support for HTTP responses that do not contain a reason phrase in the start-line
551
+ * AbstractCommand commands are now invokable
552
+ * Added a way to get the data used when signing an Oauth request before a request is sent
553
+
554
+ ## 2.8.4 - 2012-08-15
555
+
556
+ * Bug: Custom delay time calculations are no longer ignored in the ExponentialBackoffPlugin
557
+ * Added the ability to transfer entity bodies as a string rather than streamed. This gets around curl error 65. Set `body_as_string` in a request's curl options to enable.
558
+ * Added a StreamInterface, EntityBodyInterface, and added ftell() to Guzzle\Common\Stream
559
+ * Added an AbstractEntityBodyDecorator and a ReadLimitEntityBody decorator to transfer only a subset of a decorated stream
560
+ * Stream and EntityBody objects will now return the file position to the previous position after a read required operation (e.g. getContentMd5())
561
+ * Added additional response status codes
562
+ * Removed SSL information from the default User-Agent header
563
+ * DELETE requests can now send an entity body
564
+ * Added an EventDispatcher to the ExponentialBackoffPlugin and added an ExponentialBackoffLogger to log backoff retries
565
+ * Added the ability of the MockPlugin to consume mocked request bodies
566
+ * LogPlugin now exposes request and response objects in the extras array
567
+
568
+ ## 2.8.3 - 2012-07-30
569
+
570
+ * Bug: Fixed a case where empty POST requests were sent as GET requests
571
+ * Bug: Fixed a bug in ExponentialBackoffPlugin that caused fatal errors when retrying an EntityEnclosingRequest that does not have a body
572
+ * Bug: Setting the response body of a request to null after completing a request, not when setting the state of a request to new
573
+ * Added multiple inheritance to service description commands
574
+ * Added an ApiCommandInterface and added ``getParamNames()`` and ``hasParam()``
575
+ * Removed the default 2mb size cutoff from the Md5ValidatorPlugin so that it now defaults to validating everything
576
+ * Changed CurlMulti::perform to pass a smaller timeout to CurlMulti::executeHandles
577
+
578
+ ## 2.8.2 - 2012-07-24
579
+
580
+ * Bug: Query string values set to 0 are no longer dropped from the query string
581
+ * Bug: A Collection object is no longer created each time a call is made to ``Guzzle\Service\Command\AbstractCommand::getRequestHeaders()``
582
+ * Bug: ``+`` is now treated as an encoded space when parsing query strings
583
+ * QueryString and Collection performance improvements
584
+ * Allowing dot notation for class paths in filters attribute of a service descriptions
585
+
586
+ ## 2.8.1 - 2012-07-16
587
+
588
+ * Loosening Event Dispatcher dependency
589
+ * POST redirects can now be customized using CURLOPT_POSTREDIR
590
+
591
+ ## 2.8.0 - 2012-07-15
592
+
593
+ * BC: Guzzle\Http\Query
594
+ * Query strings with empty variables will always show an equal sign unless the variable is set to QueryString::BLANK (e.g. ?acl= vs ?acl)
595
+ * Changed isEncodingValues() and isEncodingFields() to isUrlEncoding()
596
+ * Changed setEncodeValues(bool) and setEncodeFields(bool) to useUrlEncoding(bool)
597
+ * Changed the aggregation functions of QueryString to be static methods
598
+ * Can now use fromString() with querystrings that have a leading ?
599
+ * cURL configuration values can be specified in service descriptions using ``curl.`` prefixed parameters
600
+ * Content-Length is set to 0 before emitting the request.before_send event when sending an empty request body
601
+ * Cookies are no longer URL decoded by default
602
+ * Bug: URI template variables set to null are no longer expanded
603
+
604
+ ## 2.7.2 - 2012-07-02
605
+
606
+ * BC: Moving things to get ready for subtree splits. Moving Inflection into Common. Moving Guzzle\Http\Parser to Guzzle\Parser.
607
+ * BC: Removing Guzzle\Common\Batch\Batch::count() and replacing it with isEmpty()
608
+ * CachePlugin now allows for a custom request parameter function to check if a request can be cached
609
+ * Bug fix: CachePlugin now only caches GET and HEAD requests by default
610
+ * Bug fix: Using header glue when transferring headers over the wire
611
+ * Allowing deeply nested arrays for composite variables in URI templates
612
+ * Batch divisors can now return iterators or arrays
613
+
614
+ ## 2.7.1 - 2012-06-26
615
+
616
+ * Minor patch to update version number in UA string
617
+ * Updating build process
618
+
619
+ ## 2.7.0 - 2012-06-25
620
+
621
+ * BC: Inflection classes moved to Guzzle\Inflection. No longer static methods. Can now inject custom inflectors into classes.
622
+ * BC: Removed magic setX methods from commands
623
+ * BC: Magic methods mapped to service description commands are now inflected in the command factory rather than the client __call() method
624
+ * Verbose cURL options are no longer enabled by default. Set curl.debug to true on a client to enable.
625
+ * Bug: Now allowing colons in a response start-line (e.g. HTTP/1.1 503 Service Unavailable: Back-end server is at capacity)
626
+ * Guzzle\Service\Resource\ResourceIteratorApplyBatched now internally uses the Guzzle\Common\Batch namespace
627
+ * Added Guzzle\Service\Plugin namespace and a PluginCollectionPlugin
628
+ * Added the ability to set POST fields and files in a service description
629
+ * Guzzle\Http\EntityBody::factory() now accepts objects with a __toString() method
630
+ * Adding a command.before_prepare event to clients
631
+ * Added BatchClosureTransfer and BatchClosureDivisor
632
+ * BatchTransferException now includes references to the batch divisor and transfer strategies
633
+ * Fixed some tests so that they pass more reliably
634
+ * Added Guzzle\Common\Log\ArrayLogAdapter
635
+
636
+ ## 2.6.6 - 2012-06-10
637
+
638
+ * BC: Removing Guzzle\Http\Plugin\BatchQueuePlugin
639
+ * BC: Removing Guzzle\Service\Command\CommandSet
640
+ * Adding generic batching system (replaces the batch queue plugin and command set)
641
+ * Updating ZF cache and log adapters and now using ZF's composer repository
642
+ * Bug: Setting the name of each ApiParam when creating through an ApiCommand
643
+ * Adding result_type, result_doc, deprecated, and doc_url to service descriptions
644
+ * Bug: Changed the default cookie header casing back to 'Cookie'
645
+
646
+ ## 2.6.5 - 2012-06-03
647
+
648
+ * BC: Renaming Guzzle\Http\Message\RequestInterface::getResourceUri() to getResource()
649
+ * BC: Removing unused AUTH_BASIC and AUTH_DIGEST constants from
650
+ * BC: Guzzle\Http\Cookie is now used to manage Set-Cookie data, not Cookie data
651
+ * BC: Renaming methods in the CookieJarInterface
652
+ * Moving almost all cookie logic out of the CookiePlugin and into the Cookie or CookieJar implementations
653
+ * Making the default glue for HTTP headers ';' instead of ','
654
+ * Adding a removeValue to Guzzle\Http\Message\Header
655
+ * Adding getCookies() to request interface.
656
+ * Making it easier to add event subscribers to HasDispatcherInterface classes. Can now directly call addSubscriber()
657
+
658
+ ## 2.6.4 - 2012-05-30
659
+
660
+ * BC: Cleaning up how POST files are stored in EntityEnclosingRequest objects. Adding PostFile class.
661
+ * BC: Moving ApiCommand specific functionality from the Inspector and on to the ApiCommand
662
+ * Bug: Fixing magic method command calls on clients
663
+ * Bug: Email constraint only validates strings
664
+ * Bug: Aggregate POST fields when POST files are present in curl handle
665
+ * Bug: Fixing default User-Agent header
666
+ * Bug: Only appending or prepending parameters in commands if they are specified
667
+ * Bug: Not requiring response reason phrases or status codes to match a predefined list of codes
668
+ * Allowing the use of dot notation for class namespaces when using instance_of constraint
669
+ * Added any_match validation constraint
670
+ * Added an AsyncPlugin
671
+ * Passing request object to the calculateWait method of the ExponentialBackoffPlugin
672
+ * Allowing the result of a command object to be changed
673
+ * Parsing location and type sub values when instantiating a service description rather than over and over at runtime
674
+
675
+ ## 2.6.3 - 2012-05-23
676
+
677
+ * [BC] Guzzle\Common\FromConfigInterface no longer requires any config options.
678
+ * [BC] Refactoring how POST files are stored on an EntityEnclosingRequest. They are now separate from POST fields.
679
+ * You can now use an array of data when creating PUT request bodies in the request factory.
680
+ * Removing the requirement that HTTPS requests needed a Cache-Control: public directive to be cacheable.
681
+ * [Http] Adding support for Content-Type in multipart POST uploads per upload
682
+ * [Http] Added support for uploading multiple files using the same name (foo[0], foo[1])
683
+ * Adding more POST data operations for easier manipulation of POST data.
684
+ * You can now set empty POST fields.
685
+ * The body of a request is only shown on EntityEnclosingRequest objects that do not use POST files.
686
+ * Split the Guzzle\Service\Inspector::validateConfig method into two methods. One to initialize when a command is created, and one to validate.
687
+ * CS updates
688
+
689
+ ## 2.6.2 - 2012-05-19
690
+
691
+ * [Http] Better handling of nested scope requests in CurlMulti. Requests are now always prepares in the send() method rather than the addRequest() method.
692
+
693
+ ## 2.6.1 - 2012-05-19
694
+
695
+ * [BC] Removing 'path' support in service descriptions. Use 'uri'.
696
+ * [BC] Guzzle\Service\Inspector::parseDocBlock is now protected. Adding getApiParamsForClass() with cache.
697
+ * [BC] Removing Guzzle\Common\NullObject. Use https://github.com/mtdowling/NullObject if you need it.
698
+ * [BC] Removing Guzzle\Common\XmlElement.
699
+ * All commands, both dynamic and concrete, have ApiCommand objects.
700
+ * Adding a fix for CurlMulti so that if all of the connections encounter some sort of curl error, then the loop exits.
701
+ * Adding checks to EntityEnclosingRequest so that empty POST files and fields are ignored.
702
+ * Making the method signature of Guzzle\Service\Builder\ServiceBuilder::factory more flexible.
703
+
704
+ ## 2.6.0 - 2012-05-15
705
+
706
+ * [BC] Moving Guzzle\Service\Builder to Guzzle\Service\Builder\ServiceBuilder
707
+ * [BC] Executing a Command returns the result of the command rather than the command
708
+ * [BC] Moving all HTTP parsing logic to Guzzle\Http\Parsers. Allows for faster C implementations if needed.
709
+ * [BC] Changing the Guzzle\Http\Message\Response::setProtocol() method to accept a protocol and version in separate args.
710
+ * [BC] Moving ResourceIterator* to Guzzle\Service\Resource
711
+ * [BC] Completely refactored ResourceIterators to iterate over a cloned command object
712
+ * [BC] Moved Guzzle\Http\UriTemplate to Guzzle\Http\Parser\UriTemplate\UriTemplate
713
+ * [BC] Guzzle\Guzzle is now deprecated
714
+ * Moving Guzzle\Common\Guzzle::inject to Guzzle\Common\Collection::inject
715
+ * Adding Guzzle\Version class to give version information about Guzzle
716
+ * Adding Guzzle\Http\Utils class to provide getDefaultUserAgent() and getHttpDate()
717
+ * Adding Guzzle\Curl\CurlVersion to manage caching curl_version() data
718
+ * ServiceDescription and ServiceBuilder are now cacheable using similar configs
719
+ * Changing the format of XML and JSON service builder configs. Backwards compatible.
720
+ * Cleaned up Cookie parsing
721
+ * Trimming the default Guzzle User-Agent header
722
+ * Adding a setOnComplete() method to Commands that is called when a command completes
723
+ * Keeping track of requests that were mocked in the MockPlugin
724
+ * Fixed a caching bug in the CacheAdapterFactory
725
+ * Inspector objects can be injected into a Command object
726
+ * Refactoring a lot of code and tests to be case insensitive when dealing with headers
727
+ * Adding Guzzle\Http\Message\HeaderComparison for easy comparison of HTTP headers using a DSL
728
+ * Adding the ability to set global option overrides to service builder configs
729
+ * Adding the ability to include other service